This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
move some more variables into the PL_parser struct:
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Fri Apr 27 08:02:41 CEST 2007 [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 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 charsize=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         -h) shift; error=true;;
1570         -r) shift; reuseval=true;;
1571         -s) shift; silent=true; realsilent=true;;
1572         -E) shift; alldone=exit;;
1573         -K) shift; knowitall=true;;
1574         -O) shift; override=true;;
1575         -S) shift; silent=true; extractsh=true;;
1576         -D)
1577                 shift
1578                 case "$1" in
1579                 *=)
1580                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1581                         echo "$me: ignoring -D $1" >&2
1582                         ;;
1583                 *=*) echo "$1" | \
1584                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1585                 *) echo "$1='define'" >> optdef.sh;;
1586                 esac
1587                 shift
1588                 ;;
1589         -U)
1590                 shift
1591                 case "$1" in
1592                 *=) echo "$1" >> optdef.sh;;
1593                 *=*)
1594                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1595                         echo "$me: ignoring -U $1" >&2
1596                         ;;
1597                 *) echo "$1='undef'" >> optdef.sh;;
1598                 esac
1599                 shift
1600                 ;;
1601         -A)
1602             shift
1603             xxx=''
1604             yyy="$1"
1605             zzz=''
1606             uuu=undef
1607             case "$yyy" in
1608             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1609                  case "$zzz" in
1610                  *:*) zzz='' ;;
1611                  *)   xxx=append
1612                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1613                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1614                  esac
1615                  ;;
1616             esac
1617             case "$xxx" in
1618             '')  case "$yyy" in
1619                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1621                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1622                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1623                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1624                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1625                  esac
1626                  ;;       
1627             esac
1628             case "$xxx" in
1629             append)
1630                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1631             clear)
1632                 echo "$yyy=''"                  >> posthint.sh ;;
1633             define)
1634                 case "$zzz" in
1635                 '') zzz=define ;;
1636                 esac
1637                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1638             eval)
1639                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1640             prepend)
1641                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1642             undef)
1643                 case "$zzz" in
1644                 '') zzz="$uuu" ;;
1645                 esac
1646                 echo "$yyy=$zzz"                >> posthint.sh ;;
1647             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1648             esac
1649             shift
1650             ;;
1651         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1652             exit 0;;
1653         --) break;;
1654         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1655         *) break;;
1656         esac
1657 done
1658
1659 case "$error" in
1660 true)
1661         cat >&2 <<EOM
1662 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1663                  [-U symbol] [-U symbol=] [-A command:symbol...]
1664   -d : use defaults for all answers.
1665   -e : go on without questioning past the production of config.sh.
1666   -f : specify an alternate default configuration file.
1667   -h : print this help message and exit (with an error status).
1668   -r : reuse C symbols value if possible (skips costly nm extraction).
1669   -s : silent mode, only echoes questions and essential information.
1670   -D : define symbol to have some value:
1671          -D symbol         symbol gets the value 'define'
1672          -D symbol=value   symbol gets the value 'value'
1673   -E : stop at the end of questions, after having produced config.sh.
1674   -K : do not use unless you know what you are doing.
1675   -O : let -D and -U override definitions from loaded configuration file.
1676   -S : perform variable substitutions on all .SH files (can mix with -f)
1677   -U : undefine symbol:
1678          -U symbol    symbol gets the value 'undef'
1679          -U symbol=   symbol gets completely empty
1680   -A : manipulate symbol after the platform specific hints have been applied:
1681          -A symbol=value                append " "value to symbol
1682          -A append:symbol=value         append value to symbol
1683          -A define:symbol=value         define symbol to have value
1684          -A clear:symbol                define symbol to be ''
1685          -A define:symbol               define symbol to be 'define'
1686          -A eval:symbol=value           define symbol to be eval of value
1687          -A prepend:symbol=value        prepend value to symbol
1688          -A undef:symbol                define symbol to be 'undef'
1689          -A undef:symbol=               define symbol to be ''
1690   -V : print version number and exit (with a zero status).
1691 EOM
1692         exit 1
1693         ;;
1694 esac
1695
1696 : Sanity checks
1697 case "$fastread$alldone" in
1698 yescont|yesexit) ;;
1699 *)
1700         case "$extractsh" in
1701         true) ;;
1702         *)
1703                 if test ! -t 0; then
1704                         echo "Say 'sh Configure', not 'sh <Configure'"
1705                         exit 1
1706                 fi
1707                 ;;
1708         esac
1709         ;;
1710 esac
1711
1712 exec 4>&1
1713 case "$silent" in
1714 true) exec 1>/dev/null;;
1715 esac
1716
1717 : run the defines and the undefines, if any, but leave the file out there...
1718 touch optdef.sh
1719 . ./optdef.sh
1720 : create the posthint manipulation script and leave the file out there...
1721 touch posthint.sh
1722
1723 : set package name
1724 package=perl5
1725 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1726 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1727 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1728 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1729 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1730 esac
1731
1732 : Some greps do not return status, grrr.
1733 echo "grimblepritz" >grimble
1734 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1735         contains=contains
1736 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1737         contains=grep
1738 else
1739         contains=contains
1740 fi
1741 rm -f grimble
1742 : the following should work in any shell
1743 case "$contains" in
1744 contains*)
1745         echo " "
1746         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1747         cat >contains <<'EOSS'
1748 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1749 EOSS
1750 chmod +x contains
1751 esac
1752
1753 : Find the path to the source tree
1754 case "$src" in
1755 '') case "$0" in
1756     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1757          case "$src" in
1758          /*)    ;;
1759          .)     ;;
1760          *)     src=`cd ../$src && pwd` ;;
1761          esac
1762          ;;
1763     *)   src='.';;
1764     esac;;
1765 esac
1766 case "$src" in
1767 '')     src=/
1768         rsrc=/
1769         ;;
1770 /*) rsrc="$src";;
1771 *) rsrc="../$src";;
1772 esac
1773 if test -f $rsrc/Configure && \
1774         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1775 then
1776    : found it, so we are ok.
1777 else
1778         rsrc=''
1779         for src in . .. ../.. ../../.. ../../../..; do
1780                 if test -f ../$src/Configure && \
1781                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1782                 then
1783                         rsrc=../$src
1784                         break
1785                 fi
1786         done
1787 fi
1788 case "$rsrc" in
1789 '')
1790         cat <<EOM >&4
1791
1792 Sorry, I can't seem to locate the source dir for $package.  Please start
1793 Configure with an explicit path -- i.e. /some/path/Configure.
1794
1795 EOM
1796         exit 1
1797         ;;
1798 ../.)   rsrc='..';;
1799 *)
1800         echo " "
1801         echo "Sources for $package found in \"$src\"." >&4
1802         ;;
1803 esac
1804
1805 : script used to extract .SH files with variable substitutions
1806 cat >extract <<'EOS'
1807 PERL_CONFIG_SH=true
1808 echo "Doing variable substitutions on .SH files..."
1809 if test -f MANIFEST; then
1810         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1811 else
1812         echo "(Looking for .SH files under the source directory.)"
1813         set x `(cd "$src"; find . -name "*.SH" -print)`
1814 fi
1815 shift
1816 case $# in
1817 0) set x `(cd "$src"; echo *.SH)`; shift;;
1818 esac
1819 if test ! -f "$src/$1"; then
1820         shift
1821 fi
1822 mkdir_p='
1823 name=$1;
1824 create="";
1825 while test $name; do
1826         if test ! -d "$name"; then
1827                 create="$name $create";
1828                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1829                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1830         else
1831                 name="";
1832         fi;
1833 done;
1834 for file in $create; do
1835         mkdir $file;
1836 done
1837 '
1838 for file in $*; do
1839         case "$src" in
1840         ".")
1841                 case "$file" in
1842                 */*)
1843                         dir=`expr X$file : 'X\(.*\)/'`
1844                         file=`expr X$file : 'X.*/\(.*\)'`
1845                         (cd "$dir" && . ./$file)
1846                         ;;
1847                 *)
1848                         . ./$file
1849                         ;;
1850                 esac
1851                 ;;
1852         *)
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (set x $dir; shift; eval $mkdir_p)
1858                         sh <"$src/$dir/$file"
1859                         ;;
1860                 *)
1861                         sh <"$src/$file"
1862                         ;;
1863                 esac
1864                 ;;
1865         esac
1866 done
1867 if test -f "$src/config_h.SH"; then
1868         if test ! -f config.h; then
1869         : oops, they left it out of MANIFEST, probably, so do it anyway.
1870         . "$src/config_h.SH"
1871         fi
1872 fi
1873 EOS
1874
1875 : extract files and exit if asked to do so
1876 case "$extractsh" in
1877 true)
1878         case "$realsilent" in
1879         true) ;;
1880         *) exec 1>&4;;
1881         esac
1882         case "$config_sh" in
1883         '') config_sh='config.sh';;
1884         esac
1885         echo " "
1886         echo "Fetching answers from $config_sh..."
1887         cd ..
1888         . $config_sh
1889         test "$override" && . ./optdef.sh
1890         echo " "
1891         . UU/extract
1892         rm -rf UU
1893         echo "Extraction done."
1894         exit 0
1895         ;;
1896 esac
1897
1898 : Eunice requires " " instead of "", can you believe it
1899 echo " "
1900 : Here we go...
1901 echo "Beginning of configuration questions for $package."
1902
1903 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1904
1905 : first determine how to suppress newline on echo command
1906 echo " "
1907 echo "Checking echo to see how to suppress newlines..."
1908 (echo "hi there\c" ; echo " ") >.echotmp
1909 if $contains c .echotmp >/dev/null 2>&1 ; then
1910         echo "...using -n."
1911         n='-n'
1912         c=''
1913 else
1914         cat <<'EOM'
1915 ...using \c
1916 EOM
1917         n=''
1918         c='\c'
1919 fi
1920 echo $n "The star should be here-->$c"
1921 echo '*'
1922 rm -f .echotmp
1923
1924 : Now test for existence of everything in MANIFEST
1925 echo " "
1926 if test -f "$rsrc/MANIFEST"; then
1927         echo "First let's make sure your kit is complete.  Checking..." >&4
1928         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1929         rm -f missing
1930         tmppwd=`pwd`
1931         for filelist in x??; do
1932                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1933         done
1934         if test -s missing; then
1935                 cat missing >&4
1936                 cat >&4 <<'EOM'
1937
1938 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1939
1940 You have the option of continuing the configuration process, despite the
1941 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1942 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1943 and contact the author (perlbug@perl.org).
1944
1945 EOM
1946                 echo $n "Continue? [n] $c" >&4
1947                 read ans
1948                 case "$ans" in
1949                 y*)
1950                         echo "Continuing..." >&4
1951                         rm -f missing
1952                         ;;
1953                 *)
1954                         echo "ABORTING..." >&4
1955                         kill $$
1956                         ;;
1957                 esac
1958         else
1959                 echo "Looks good..."
1960         fi
1961 else
1962         echo "There is no MANIFEST file.  I hope your kit is complete !"
1963 fi
1964 rm -f missing x??
1965
1966 echo " "
1967 : Find the appropriate value for a newline for tr
1968 if test -n "$DJGPP"; then
1969        trnl='\012'
1970 fi
1971 if test X"$trnl" = X; then
1972         case "`echo foo|tr '\n' x 2>/dev/null`" in
1973         foox) trnl='\n' ;;
1974         esac
1975 fi
1976 if test X"$trnl" = X; then
1977         case "`echo foo|tr '\012' x 2>/dev/null`" in
1978         foox) trnl='\012' ;;
1979         esac
1980 fi
1981 if test X"$trnl" = X; then
1982        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1983        fooxy) trnl='\n\r' ;;
1984        esac
1985 fi
1986 if test X"$trnl" = X; then
1987         cat <<EOM >&2
1988
1989 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1990
1991 EOM
1992         exit 1
1993 fi
1994
1995 : compute the number of columns on the terminal for proper question formatting
1996 case "$COLUMNS" in
1997 '') COLUMNS='80';;
1998 esac
1999
2000 : set up the echo used in my read
2001 myecho="case \"\$xxxm\" in
2002 '') echo $n \"\$rp $c\" >&4;;
2003 *) case \"\$rp\" in
2004         '') echo $n \"[\$xxxm] $c\";;
2005         *)
2006                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2007                         echo \"\$rp\" >&4
2008                         echo $n \"[\$xxxm] $c\" >&4
2009                 else
2010                         echo $n \"\$rp [\$xxxm] $c\" >&4
2011                 fi
2012                 ;;
2013         esac;;
2014 esac"
2015
2016 : now set up to do reads with possible shell escape and default assignment
2017 cat <<EOSC >myread
2018 $startsh
2019 xxxm=\$dflt
2020 $myecho
2021 ans='!'
2022 case "\$fastread" in
2023 yes) case "\$dflt" in
2024         '') ;;
2025         *) ans='';
2026                 case "\$silent-\$rp" in
2027                 true-) ;;
2028                 *) echo " " >&4;;
2029                 esac;;
2030         esac;;
2031 *) case "\$silent" in
2032         true) case "\$rp" in
2033                 '') ans='';;
2034                 esac;;
2035         esac;;
2036 esac
2037 while expr "X\$ans" : "X!" >/dev/null; do
2038         read answ
2039         set x \$xxxm
2040         shift
2041         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2042         case  "\$answ" in
2043         "!")
2044                 sh 1>&4
2045                 echo " "
2046                 $myecho
2047                 ;;
2048         !*)
2049                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2050                 shift
2051                 sh 1>&4 -c "\$*"
2052                 echo " "
2053                 $myecho
2054                 ;;
2055         "\$ans")
2056                 case "\$ans" in
2057                 \\&*)
2058                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2059                         shift
2060                         case "\$1" in
2061                         -d)
2062                                 fastread=yes
2063                                 echo "(OK, I'll run with -d after this question.)" >&4
2064                                 ;;
2065                         -*)
2066                                 echo "*** Sorry, \$1 not supported yet." >&4
2067                                 ;;
2068                         esac
2069                         $myecho
2070                         ans=!
2071                         ;;
2072                 esac;;
2073         *)
2074                 case "\$aok" in
2075                 y)
2076                         echo "*** Substitution done -- please confirm."
2077                         xxxm="\$ans"
2078                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2079                         xxxm="\$ans"
2080                         ans=!
2081                         ;;
2082                 *)
2083                         echo "*** Error -- try again."
2084                         ans=!
2085                         ;;
2086                 esac
2087                 $myecho
2088                 ;;
2089         esac
2090         case "\$ans\$xxxm\$nostick" in
2091         '')
2092                 ans=!
2093                 $myecho
2094                 ;;
2095         esac
2096 done
2097 case "\$ans" in
2098 '') ans="\$xxxm";;
2099 esac
2100 EOSC
2101
2102 : create .config dir to save info across Configure sessions
2103 test -d ../.config || mkdir ../.config
2104 cat >../.config/README <<EOF
2105 This directory created by Configure to save information that should
2106 persist across sessions for $package.
2107
2108 You may safely delete it if you wish.
2109 EOF
2110
2111 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2112 case "$usedevel" in
2113 $define|true|[yY]*) ;;
2114 *) case "$xversion" in
2115    *[13579])
2116         cat >&4 <<EOH
2117 *** WHOA THERE!!! ***
2118
2119     This is an UNSTABLE DEVELOPMENT release.
2120     The version of this $package distribution is $xversion, that is, odd,
2121     (as opposed to even) and that signifies a development release.
2122     If you want a maintenance release, you want an even-numbered version.
2123
2124     Do ***NOT*** install this into production use.
2125     Data corruption and crashes are possible.
2126
2127     It is most seriously suggested that you do not continue any further
2128     unless you want to help in developing and debugging Perl.
2129
2130     If you *still* want to build perl, you can answer 'y' now,
2131     or pass -Dusedevel to Configure.
2132
2133 EOH
2134         rp='Do you really want to continue?'
2135         dflt='n'
2136         . ./myread
2137         case "$ans" in
2138         [yY]) echo >&4 "Okay, continuing."
2139               usedevel="$define" ;;
2140         *) echo >&4 "Okay, bye."
2141            exit 1
2142            ;;
2143         esac
2144         ;;
2145     esac
2146     ;;
2147 esac
2148 case "$usedevel" in
2149 $define|true|[yY]*)
2150         case "$versiononly" in
2151         '') versiononly="$define" ;;
2152         esac
2153         case "$installusrbinperl" in
2154         '') installusrbinperl="$undef" ;;
2155         esac
2156         ;;
2157 esac
2158
2159 : general instructions
2160 needman=true
2161 firsttime=true
2162 user=`(logname) 2>/dev/null`
2163 case "$user" in
2164 '') user=`whoami 2>&1`;;
2165 esac
2166 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2167         firsttime=false
2168         echo " "
2169         rp='Would you like to see the instructions?'
2170         dflt=n
2171         . ./myread
2172         case "$ans" in
2173         [yY]*) ;;
2174         *) needman=false;;
2175         esac
2176 fi
2177 if $needman; then
2178         cat <<EOH
2179
2180 This installation shell script will examine your system and ask you questions
2181 to determine how the perl5 package should be installed. If you get
2182 stuck on a question, you may use a ! shell escape to start a subshell or
2183 execute a command.  Many of the questions will have default answers in square
2184 brackets; typing carriage return will give you the default.
2185
2186 On some of the questions which ask for file or directory names you are allowed
2187 to use the ~name construct to specify the login directory belonging to "name",
2188 even if you don't have a shell which knows about that.  Questions where this is
2189 allowed will be marked "(~name ok)".
2190
2191 EOH
2192         rp=''
2193         dflt='Type carriage return to continue'
2194         . ./myread
2195         cat <<'EOH'
2196
2197 The prompter used in this script allows you to use shell variables and
2198 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2199 in the default answer, as if the default line was a set of arguments given to a
2200 script shell.  This means you may also use $* to repeat the whole default line,
2201 so you do not have to re-type everything to add something to the default.
2202
2203 Everytime there is a substitution, you will have to confirm.  If there is an
2204 error (e.g. an unmatched backtick), the default answer will remain unchanged
2205 and you will be prompted again.
2206
2207 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2208 the questions and use the computed defaults (or the previous answers if there
2209 was already a config.sh file). Type 'Configure -h' for a list of options.
2210 You may also start interactively and then answer '& -d' at any prompt to turn
2211 on the non-interactive behaviour for the remainder of the execution.
2212
2213 EOH
2214         . ./myread
2215         cat <<EOH
2216
2217 Much effort has been expended to ensure that this shell script will run on any
2218 Unix system.  If despite that it blows up on yours, your best bet is to edit
2219 Configure and run it again.  If you can't run Configure for some reason,
2220 you'll have to generate a config.sh file by hand.  Whatever problems you
2221 have, let me (perlbug@perl.org) know how I blew it.
2222
2223 This installation script affects things in two ways:
2224
2225 1) it may do direct variable substitutions on some of the files included
2226    in this kit.
2227 2) it builds a config.h file for inclusion in C programs.  You may edit
2228    any of these files as the need arises after running this script.
2229
2230 If you make a mistake on a question, there is no easy way to back up to it
2231 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2232 files.  Configure will offer to let you do this before it runs the SH files.
2233
2234 EOH
2235         dflt='Type carriage return to continue'
2236         . ./myread
2237         case "$firsttime" in
2238         true) echo $user >>../.config/instruct;;
2239         esac
2240 fi
2241
2242 : find out where common programs are
2243 echo " "
2244 echo "Locating common programs..." >&4
2245 cat <<EOSC >loc
2246 $startsh
2247 case \$# in
2248 0) exit 1;;
2249 esac
2250 thing=\$1
2251 shift
2252 dflt=\$1
2253 shift
2254 for dir in \$*; do
2255         case "\$thing" in
2256         .)
2257         if test -d \$dir/\$thing; then
2258                 echo \$dir
2259                 exit 0
2260         fi
2261         ;;
2262         *)
2263         for thisthing in \$dir/\$thing; do
2264                 : just loop through to pick last item
2265         done
2266         if test -f \$thisthing; then
2267                 echo \$thisthing
2268                 exit 0
2269         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2270                 echo \$thisthing
2271                 exit 0
2272         elif test -f \$dir/\$thing.exe; then
2273                 if test -n "$DJGPP"; then
2274                         echo \$dir/\$thing.exe
2275                 elif test "$eunicefix" != ":"; then
2276                         : on Eunice apparently
2277                         echo \$dir/\$thing
2278                         exit 0
2279                 fi
2280                 exit 0
2281         fi
2282         ;;
2283         esac
2284 done
2285 echo \$dflt
2286 exit 1
2287 EOSC
2288 chmod +x loc
2289 $eunicefix loc
2290 loclist="
2291 awk
2292 cat
2293 chmod
2294 comm
2295 cp
2296 echo
2297 expr
2298 grep
2299 ls
2300 mkdir
2301 rm
2302 sed
2303 sort
2304 touch
2305 tr
2306 uniq
2307 "
2308 trylist="
2309 Mcc
2310 ar
2311 bison
2312 byacc
2313 cpp
2314 csh
2315 date
2316 egrep
2317 gmake
2318 gzip
2319 less
2320 ln
2321 make
2322 more
2323 nm
2324 nroff
2325 pg
2326 test
2327 uname
2328 zip
2329 "
2330 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2331 pth="$pth /lib /usr/lib"
2332 for file in $loclist; do
2333         eval xxx=\$$file
2334         case "$xxx" in
2335         /*|?:[\\/]*)
2336                 if test -f "$xxx"; then
2337                         : ok
2338                 else
2339                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2340                         xxx=`./loc $file $file $pth`
2341                 fi
2342                 ;;
2343         '') xxx=`./loc $file $file $pth`;;
2344         *) xxx=`./loc $xxx $xxx $pth`;;
2345         esac
2346         eval $file=$xxx$_exe
2347         eval _$file=$xxx
2348         case "$xxx" in
2349         /*)
2350                 echo $file is in $xxx.
2351                 ;;
2352         ?:[\\/]*)
2353                 echo $file is in $xxx.
2354                 ;;
2355         *)
2356                 echo "I don't know where '$file' is, and my life depends on it." >&4
2357                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2358                 exit 1
2359                 ;;
2360         esac
2361 done
2362 echo " "
2363 echo "Don't worry if any of the following aren't found..."
2364 say=offhand
2365 for file in $trylist; do
2366         eval xxx=\$$file
2367         case "$xxx" in
2368         /*|?:[\\/]*)
2369                 if test -f "$xxx"; then
2370                         : ok
2371                 else
2372                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2373                         xxx=`./loc $file $file $pth`
2374                 fi
2375                 ;;
2376         '') xxx=`./loc $file $file $pth`;;
2377         *) xxx=`./loc $xxx $xxx $pth`;;
2378         esac
2379         eval $file=$xxx$_exe
2380         eval _$file=$xxx
2381         case "$xxx" in
2382         /*)
2383                 echo $file is in $xxx.
2384                 ;;
2385         ?:[\\/]*)
2386                 echo $file is in $xxx.
2387                 ;;
2388         *)
2389                 echo "I don't see $file out there, $say."
2390                 say=either
2391                 ;;
2392         esac
2393 done
2394 case "$egrep" in
2395 egrep)
2396         echo "Substituting grep for egrep."
2397         egrep=$grep
2398         _egrep=$grep
2399         ;;
2400 esac
2401 case "$ln" in
2402 ln)
2403         echo "Substituting cp for ln."
2404         ln=$cp
2405         _ln=$cp
2406         ;;
2407 esac
2408 case "$make" in
2409 make)   
2410         case "$gmake" in
2411         gmake)
2412         echo "I can't find make or gmake, and my life depends on it." >&4
2413         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2414         exit 1
2415         ;;
2416         esac
2417         ;;
2418 esac    
2419 case "$gmake" in
2420 gmake)  ;;
2421 *)      # We can't have osname yet.
2422         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2423                 # Assume that gmake, if found, is definitely GNU make
2424                 # and prefer it over the system make.
2425                 echo "Substituting gmake for make."
2426                 make=$gmake
2427                 _make=$gmake
2428         fi
2429         ;;
2430 esac
2431 case "$test" in
2432 test)
2433         echo "Hopefully test is built into your sh."
2434         ;;
2435 *)
2436         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2437                 echo "Using the test built into your sh."
2438                 test=test
2439                 _test=test
2440         fi
2441         ;;
2442 esac
2443 case "$echo" in
2444 echo)
2445         echo "Hopefully echo is built into your sh."
2446         ;;
2447 '') ;;
2448 *)
2449         echo " "
2450 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2451         $echo $n "hi there$c" >foo1
2452         echo $n "hi there$c" >foo2
2453         if cmp foo1 foo2 >/dev/null 2>&1; then
2454                 echo "They are compatible.  In fact, they may be identical."
2455         else
2456                 case "$n" in
2457                 '-n') n='' c='\c';;
2458                 *) n='-n' c='';;
2459                 esac
2460                 cat <<FOO
2461 They are not compatible!  You are probably running ksh on a non-USG system.
2462 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2463 have echo built in and we may have to run some Bourne shell scripts.  That
2464 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2465
2466 FOO
2467                 $echo $n "The star should be here-->$c"
2468                 $echo "*"
2469         fi
2470         $rm -f foo1 foo2
2471         ;;
2472 esac
2473
2474 cat <<EOS >trygcc
2475 $startsh
2476 EOS
2477 cat <<'EOSC' >>trygcc
2478 case "$cc" in
2479 '') ;;
2480 *)  $rm -f try try.*
2481     $cat >try.c <<EOM
2482 int main(int argc, char *argv[]) {
2483   return 0;
2484 }
2485 EOM
2486     if $cc -o try $ccflags $ldflags try.c; then
2487        :
2488     else
2489         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2490         despair=yes
2491         trygcc=yes
2492         case "$cc" in
2493         *gcc*) trygcc=no ;;
2494         esac
2495         case "`$cc -v -c try.c 2>&1`" in
2496         *gcc*) trygcc=no ;;
2497         esac
2498         if $test X"$trygcc" = Xyes; then
2499             if gcc -o try -c try.c; then
2500                 echo " "
2501                 echo "You seem to have a working gcc, though." >&4
2502                 rp="Would you like to use it?"
2503                 dflt=y
2504                 if $test -f myread; then
2505                     . ./myread
2506                 else
2507                     if $test -f UU/myread; then
2508                         . ./UU/myread
2509                     else
2510                         echo "Cannot find myread, sorry.  Aborting." >&2
2511                         exit 1
2512                     fi
2513                 fi  
2514                 case "$ans" in
2515                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2516                        if $test -f usethreads.cbu; then
2517                            $cat >&4 <<EOM 
2518
2519 *** However, any setting of the C compiler flags (e.g. for thread support)
2520 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2521 *** (together with e.g. -Dusethreads).
2522
2523 EOM
2524                        fi;;
2525                 esac
2526             fi
2527         fi
2528     fi
2529     $rm -f try try.*
2530     ;;
2531 esac
2532 EOSC
2533
2534 cat <<EOS >checkcc
2535 $startsh
2536 EOS
2537 cat <<'EOSC' >>checkcc
2538 case "$cc" in        
2539 '') ;;
2540 *)  $rm -f try try.*              
2541     $cat >try.c <<EOM
2542 int main(int argc, char *argv[]) {
2543   return 0;
2544 }
2545 EOM
2546     if $cc -o try $ccflags $ldflags try.c; then
2547        :
2548     else
2549         if $test X"$despair" = Xyes; then
2550            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2551         fi
2552         $cat >&4 <<EOM         
2553 You need to find a working C compiler.
2554 Either (purchase and) install the C compiler supplied by your OS vendor,
2555 or for a free C compiler try http://gcc.gnu.org/
2556 I cannot continue any further, aborting.
2557 EOM
2558         exit 1
2559     fi
2560     $rm -f try try.*
2561     ;;
2562 esac
2563 EOSC
2564
2565 : determine whether symbolic links are supported
2566 echo " "
2567 $touch blurfl
2568 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2569         echo "Symbolic links are supported." >&4
2570         lns="$ln -s"
2571 else
2572         echo "Symbolic links are NOT supported." >&4
2573         lns="$ln"
2574 fi
2575 $rm -f blurfl sym
2576
2577 : determine whether symbolic links are supported
2578 echo " "
2579 case "$lns" in
2580 *"ln"*" -s")
2581         echo "Checking how to test for symbolic links..." >&4
2582         $lns blurfl sym
2583         if $test "X$issymlink" = X; then
2584                 case "$newsh" in
2585                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2586                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2587                 esac
2588                 if test $? = 0; then
2589                         issymlink="test -h"
2590                 else
2591                         echo "Your builtin 'test -h' may be broken." >&4
2592                         case "$test" in
2593                         /*)     ;;
2594                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2595                                 for p in $pth
2596                                 do
2597                                         if test -f "$p/$test"; then
2598                                                 test="$p/$test"
2599                                                 break
2600                                         fi
2601                                 done
2602                                 ;;
2603                         esac
2604                         case "$test" in
2605                         /*)
2606                                 echo "Trying external '$test -h'." >&4
2607                                 issymlink="$test -h"
2608                                 if $test ! -h sym >/dev/null 2>&1; then
2609                                         echo "External '$test -h' is broken, too." >&4
2610                                         issymlink=''
2611                                 fi
2612                                 ;;
2613                         *)      issymlink='' ;;
2614                         esac
2615                 fi              
2616         fi
2617         if $test "X$issymlink" = X; then
2618                 if $test -L sym 2>/dev/null; then
2619                         issymlink="$test -L"
2620                         echo "The builtin '$test -L' worked." >&4
2621                 fi
2622         fi
2623         if $test "X$issymlink" != X; then
2624                 echo "You can test for symbolic links with '$issymlink'." >&4
2625         else
2626                 echo "I do not know how you can test for symbolic links." >&4
2627         fi
2628         $rm -f blurfl sym
2629         ;;
2630 *)      echo "No symbolic links, so not testing for their testing..." >&4
2631         ;;
2632 esac
2633 echo " "
2634
2635
2636 case "$mksymlinks" in
2637 $define|true|[yY]*)
2638         case "$src" in
2639         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2640                 exit 1
2641                 ;;
2642         *)      case "$lns:$issymlink" in
2643                 *"ln"*" -s:"*"test -"?)
2644                         echo "Creating the symbolic links..." >&4
2645                         echo "(First creating the subdirectories...)" >&4
2646                         cd ..
2647                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2648                                 read directory
2649                                 test -z "$directory" && break
2650                                 mkdir -p $directory
2651                         done
2652                         # Sanity check 1.
2653                         if test ! -d t/base; then
2654                                 echo "Failed to create the subdirectories.  Aborting." >&4
2655                                 exit 1
2656                         fi
2657                         echo "(Then creating the symlinks...)" >&4
2658                         awk '{print $1}' $src/MANIFEST | while true; do
2659                                 read filename
2660                                 test -z "$filename" && break
2661                                 if test -f $filename; then
2662                                         if $issymlink $filename; then
2663                                                 rm -f $filename
2664                                         fi
2665                                 fi
2666                                 if test -f $filename; then
2667                                         echo "$filename already exists, not symlinking."
2668                                 else
2669                                         ln -s $src/$filename $filename
2670                                 fi
2671                         done
2672                         # Sanity check 2.
2673                         if test ! -f t/base/lex.t; then
2674                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2675                                 exit 1
2676                         fi
2677                         cd UU
2678                         ;;
2679                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2680                         ;;
2681                 esac
2682                 ;;
2683         esac
2684         ;;
2685 esac
2686
2687
2688 case "$usecrosscompile" in
2689 $define|true|[yY]*)
2690         $echo "Cross-compiling..."
2691         croak=''
2692         case "$cc" in
2693         *-*-gcc) # A cross-compiling gcc, probably.
2694             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2695             ar=$targetarch-ar
2696             # leave out ld, choosing it is more complex
2697             nm=$targetarch-nm
2698             ranlib=$targetarch-ranlib
2699             $echo 'extern int foo;' > try.c
2700             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2701             shift
2702             if $test $# -gt 0; then
2703                 incpth="$incpth $*"
2704                 incpth="`$echo $incpth|$sed 's/^ //'`"
2705                 echo "Guessing incpth '$incpth'." >&4
2706                 for i in $*; do
2707                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2708                     if $test -d $j; then
2709                         libpth="$libpth $j"
2710                     fi
2711                 done   
2712                 libpth="`$echo $libpth|$sed 's/^ //'`"
2713                 echo "Guessing libpth '$libpth'." >&4
2714             fi
2715             $rm -f try.c
2716             ;;
2717         esac
2718         case "$targetarch" in
2719         '') echo "Targetarch not defined." >&4; croak=y ;;
2720         *)  echo "Using targetarch $targetarch." >&4 ;;
2721         esac
2722         case "$incpth" in
2723         '') echo "Incpth not defined." >&4; croak=y ;;
2724         *)  echo "Using incpth '$incpth'." >&4 ;;
2725         esac
2726         case "$libpth" in
2727         '') echo "Libpth not defined." >&4; croak=y ;;
2728         *)  echo "Using libpth '$libpth'." >&4 ;;
2729         esac
2730         case "$usrinc" in
2731         '') for i in $incpth; do
2732                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2733                     usrinc=$i
2734                     echo "Guessing usrinc $usrinc." >&4
2735                     break
2736                 fi
2737             done
2738             case "$usrinc" in
2739             '') echo "Usrinc not defined." >&4; croak=y ;;
2740             esac
2741             ;;
2742         *)  echo "Using usrinc $usrinc." >&4 ;;
2743         esac
2744         case "$targethost" in
2745         '') echo "Targethost not defined." >&4; croak=y ;;
2746         *)  echo "Using targethost $targethost." >&4
2747         esac
2748         locincpth=' '
2749         loclibpth=' '
2750         case "$croak" in
2751         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2752         esac
2753         case "$src" in
2754         /*) run=$src/Cross/run
2755             targetmkdir=$src/Cross/mkdir
2756             to=$src/Cross/to
2757             from=$src/Cross/from
2758             ;;
2759         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2760             run=$pwd/Cross/run
2761             targetmkdir=$pwd/Cross/mkdir
2762             to=$pwd/Cross/to
2763             from=$pwd/Cross/from
2764             ;;
2765         esac
2766         case "$targetrun" in
2767         '') targetrun=ssh ;;
2768         esac
2769         case "$targetto" in
2770         '') targetto=scp ;;
2771         esac
2772         case "$targetfrom" in
2773         '') targetfrom=scp ;;
2774         esac
2775         run=$run-$targetrun
2776         to=$to-$targetto
2777         from=$from-$targetfrom
2778         case "$targetdir" in
2779         '')  targetdir=/tmp
2780              echo "Guessing targetdir $targetdir." >&4
2781              ;;
2782         esac
2783         case "$targetuser" in
2784         '')  targetuser=root
2785              echo "Guessing targetuser $targetuser." >&4
2786              ;;
2787         esac
2788         case "$targetfrom" in
2789         scp)    q=-q ;;
2790         *)      q='' ;;
2791         esac
2792         case "$targetrun" in
2793         ssh|rsh)
2794             cat >$run <<EOF
2795 #!/bin/sh
2796 case "\$1" in
2797 -cwd)
2798   shift
2799   cwd=\$1
2800   shift
2801   ;;
2802 esac
2803 case "\$cwd" in
2804 '') cwd=$targetdir ;;
2805 esac
2806 exe=\$1
2807 shift
2808 if $test ! -f \$exe.xok; then
2809   $to \$exe
2810   $touch \$exe.xok
2811 fi
2812 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2813 EOF
2814             ;;
2815         *)  echo "Unknown targetrun '$targetrun'" >&4
2816             exit 1
2817             ;;
2818         esac
2819         case "$targetmkdir" in
2820         */Cross/mkdir)
2821             cat >$targetmkdir <<EOF
2822 #!/bin/sh
2823 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2824 EOF
2825             $chmod a+rx $targetmkdir
2826             ;;
2827         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2828             exit 1
2829             ;;
2830         esac
2831         case "$targetto" in
2832         scp|rcp)
2833             cat >$to <<EOF
2834 #!/bin/sh
2835 for f in \$@
2836 do
2837   case "\$f" in
2838   /*)
2839     $targetmkdir \`dirname \$f\`
2840     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2841     ;;
2842   *)
2843     $targetmkdir $targetdir/\`dirname \$f\`
2844     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2845     ;;
2846   esac
2847 done
2848 exit 0
2849 EOF
2850             ;;
2851         cp) cat >$to <<EOF
2852 #!/bin/sh
2853 for f in \$@
2854 do
2855   case "\$f" in
2856   /*)
2857     $mkdir -p $targetdir/\`dirname \$f\`
2858     $cp \$f $targetdir/\$f || exit 1
2859     ;;
2860   *)
2861     $targetmkdir $targetdir/\`dirname \$f\`
2862     $cp \$f $targetdir/\$f || exit 1
2863     ;;
2864   esac
2865 done
2866 exit 0
2867 EOF
2868             ;;
2869         *)  echo "Unknown targetto '$targetto'" >&4
2870             exit 1
2871             ;;
2872         esac
2873         case "$targetfrom" in
2874         scp|rcp)
2875           cat >$from <<EOF
2876 #!/bin/sh
2877 for f in \$@
2878 do
2879   $rm -f \$f
2880   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2881 done
2882 exit 0
2883 EOF
2884             ;;
2885         cp) cat >$from <<EOF
2886 #!/bin/sh
2887 for f in \$@
2888 do
2889   $rm -f \$f
2890   cp $targetdir/\$f . || exit 1
2891 done
2892 exit 0
2893 EOF
2894             ;;
2895         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2896             exit 1
2897             ;;
2898         esac
2899         if $test ! -f $run; then
2900             echo "Target 'run' script '$run' not found." >&4
2901         else
2902             $chmod a+rx $run
2903         fi
2904         if $test ! -f $to; then
2905             echo "Target 'to' script '$to' not found." >&4
2906         else
2907             $chmod a+rx $to
2908         fi
2909         if $test ! -f $from; then
2910             echo "Target 'from' script '$from' not found." >&4
2911         else
2912             $chmod a+rx $from
2913         fi
2914         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2915             exit 1
2916         fi
2917         cat >&4 <<EOF
2918 Using '$run' for remote execution,
2919 and '$from' and '$to'
2920 for remote file transfer.
2921 EOF
2922         ;;
2923 *)      run=''
2924         to=:
2925         from=:
2926         usecrosscompile='undef'
2927         targetarch=''
2928         ;;
2929 esac
2930
2931 : see whether [:lower:] and [:upper:] are supported character classes
2932 echo " "
2933 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2934 ABYZ)
2935         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2936         up='[:upper:]'
2937         low='[:lower:]'
2938         ;;
2939 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2940         # (0xd9 and 0xe2), therefore that is a nice testing point.
2941         if test "X$up" = X -o "X$low" = X; then
2942             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2943             rs) up='[A-Z]'
2944                 low='[a-z]'
2945                 ;;
2946             esac
2947         fi
2948         if test "X$up" = X -o "X$low" = X; then
2949             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2950             rs) up='A-Z'
2951                 low='a-z'
2952                 ;;
2953             esac
2954         fi
2955         if test "X$up" = X -o "X$low" = X; then
2956             case "`echo RS | od -x 2>/dev/null`" in
2957             *D9E2*|*d9e2*)
2958                 echo "Hey, this might be EBCDIC." >&4
2959                 if test "X$up" = X -o "X$low" = X; then
2960                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2961                     rs) up='[A-IJ-RS-Z]'
2962                         low='[a-ij-rs-z]'
2963                         ;;
2964                     esac
2965                 fi
2966                 if test "X$up" = X -o "X$low" = X; then
2967                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2968                     rs) up='A-IJ-RS-Z'
2969                         low='a-ij-rs-z'
2970                         ;;
2971                     esac
2972                 fi
2973                 ;;
2974             esac
2975         fi
2976 esac
2977 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2978 rs)
2979     echo "Using $up and $low to convert case." >&4
2980     ;;
2981 *)
2982     echo "I don't know how to translate letters from upper to lower case." >&4
2983     echo "Your tr is not acting any way I know of." >&4
2984     exit 1
2985     ;;
2986 esac
2987 : set up the translation script tr, must be called with ./tr of course
2988 cat >tr <<EOSC
2989 $startsh
2990 case "\$1\$2" in
2991 '[A-Z][a-z]') exec $tr '$up' '$low';;
2992 '[a-z][A-Z]') exec $tr '$low' '$up';;
2993 esac
2994 exec $tr "\$@"
2995 EOSC
2996 chmod +x tr
2997 $eunicefix tr
2998
2999 : Try to determine whether config.sh was made on this system
3000 case "$config_sh" in
3001 '')
3002 myuname=`$uname -a 2>/dev/null`
3003 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3004 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3005 # because the A-Z/a-z are not consecutive.
3006 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3007         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3008 newmyuname="$myuname"
3009 dflt=n
3010 case "$knowitall" in
3011 '')
3012         if test -f ../config.sh; then
3013                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3014                         eval "`grep myuname= ../config.sh`"
3015                 fi
3016                 if test "X$myuname" = "X$newmyuname"; then
3017                         dflt=y
3018                 fi
3019         fi
3020         ;;
3021 *) dflt=y;;
3022 esac
3023
3024 : Get old answers from old config file if Configure was run on the
3025 : same system, otherwise use the hints.
3026 hint=default
3027 cd ..
3028 if test -f config.sh; then
3029         echo " "
3030         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3031         . UU/myread
3032         case "$ans" in
3033         n*|N*) echo "OK, I'll ignore it."
3034                 mv config.sh config.sh.old
3035                 myuname="$newmyuname"
3036                 ;;
3037         *)  echo "Fetching default answers from your old config.sh file..." >&4
3038                 tmp_n="$n"
3039                 tmp_c="$c"
3040                 tmp_sh="$sh"
3041                 . ./config.sh
3042                 cp config.sh UU
3043                 n="$tmp_n"
3044                 c="$tmp_c"
3045                 : Older versions did not always set $sh.  Catch re-use of such
3046                 : an old config.sh.
3047                 case "$sh" in
3048                 '') sh="$tmp_sh" ;;
3049                 esac
3050                 hint=previous
3051                 ;;
3052         esac
3053 fi
3054 . ./UU/checkcc
3055 if test ! -f config.sh; then
3056         $cat <<EOM
3057
3058 First time through, eh?  I have some defaults handy for some systems
3059 that need some extra help getting the Configure answers right:
3060
3061 EOM
3062         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3063         dflt=''
3064         : Half the following guesses are probably wrong... If you have better
3065         : tests or hints, please send them to perlbug@perl.org
3066         : The metaconfig authors would also appreciate a copy...
3067         $test -f /irix && osname=irix
3068         $test -f /xenix && osname=sco_xenix
3069         $test -f /dynix && osname=dynix
3070         $test -f /dnix && osname=dnix
3071         $test -f /lynx.os && osname=lynxos
3072         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3073         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3074         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3075         $test -f /bin/mips && /bin/mips && osname=mips
3076         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3077                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3078         $test -d /usr/apollo/bin && osname=apollo
3079         $test -f /etc/saf/_sactab && osname=svr4
3080         $test -d /usr/include/minix && osname=minix
3081         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3082         if $test -d /MachTen -o -d /MachTen_Folder; then
3083                 osname=machten
3084                 if $test -x /sbin/version; then
3085                         osvers=`/sbin/version | $awk '{print $2}' |
3086                         $sed -e 's/[A-Za-z]$//'`
3087                 elif $test -x /usr/etc/version; then
3088                         osvers=`/usr/etc/version | $awk '{print $2}' |
3089                         $sed -e 's/[A-Za-z]$//'`
3090                 else
3091                         osvers="$2.$3"
3092                 fi
3093         fi
3094
3095         $test -f /sys/posix.dll &&
3096                 $test -f /usr/bin/what &&
3097                 set X `/usr/bin/what /sys/posix.dll` &&
3098                 $test "$3" = UWIN &&
3099                 osname=uwin &&
3100                 osvers="$5"
3101
3102         if $test -f $uname; then
3103                 set X $myuname
3104                 shift
3105
3106                 case "$5" in
3107                 fps*) osname=fps ;;
3108                 mips*)
3109                         case "$4" in
3110                         umips) osname=umips ;;
3111                         *) osname=mips ;;
3112                         esac;;
3113                 [23]100) osname=mips ;;
3114                 next*) osname=next ;;
3115                 i386*)
3116                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3117                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3118                                 osname='sco'
3119                                 osvers=$tmp
3120                         elif $test -f /etc/kconfig; then
3121                                 osname=isc
3122                                 if test "$lns" = "$ln -s"; then
3123                                         osvers=4
3124                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3125                                         osvers=3
3126                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3127                                         osvers=2
3128                                 fi
3129                         fi
3130                         tmp=''
3131                         ;;
3132                 pc*)
3133                         if test -n "$DJGPP"; then
3134                                 osname=dos
3135                                 osvers=djgpp
3136                         fi
3137                         ;;
3138                 esac
3139
3140                 case "$1" in
3141                 aix) osname=aix
3142                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3143                         case "$tmp" in
3144                         # oslevel can fail with:
3145                         # oslevel: Unable to acquire lock.
3146                         *not\ found) osvers="$4"."$3" ;;
3147                         '<3240'|'<>3240') osvers=3.2.0 ;;
3148                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3149                         '=3250'|'>3250') osvers=3.2.5 ;;
3150                         *) osvers=$tmp;;
3151                         esac
3152                         ;;
3153                 bsd386) osname=bsd386
3154                         osvers=`$uname -r`
3155                         ;;
3156                 cygwin*) osname=cygwin
3157                         osvers="$3"
3158                         ;;
3159                 *dc.osx) osname=dcosx
3160                         osvers="$3"
3161                         ;;
3162                 dnix) osname=dnix
3163                         osvers="$3"
3164                         ;;
3165                 domainos) osname=apollo
3166                         osvers="$3"
3167                         ;;
3168                 dgux)   osname=dgux
3169                         osvers="$3"
3170                         ;;
3171                 dragonfly) osname=dragonfly
3172                         osvers="$3"
3173                         ;;
3174                 dynixptx*) osname=dynixptx
3175                         osvers=`echo "$4"|sed 's/^v//'`
3176                         ;;
3177                 freebsd) osname=freebsd
3178                         osvers="$3" ;;
3179                 genix)  osname=genix ;;
3180                 gnu)    osname=gnu
3181                         osvers="$3" ;;
3182                 hp*)    osname=hpux
3183                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3184                         ;;
3185                 irix*)  osname=irix
3186                         case "$3" in
3187                         4*) osvers=4 ;;
3188                         5*) osvers=5 ;;
3189                         *)      osvers="$3" ;;
3190                         esac
3191                         ;;
3192                 linux)  osname=linux
3193                         case "$3" in
3194                         *)      osvers="$3" ;;
3195                         esac
3196                         ;;
3197                 MiNT)   osname=mint
3198                         ;;
3199                 netbsd*) osname=netbsd
3200                         osvers="$3"
3201                         ;;
3202                 news-os) osvers="$3"
3203                         case "$3" in
3204                         4*) osname=newsos4 ;;
3205                         *) osname=newsos ;;
3206                         esac
3207                         ;;
3208                 next*) osname=next ;;
3209                 nonstop-ux) osname=nonstopux ;;
3210                 openbsd) osname=openbsd
3211                         osvers="$3"
3212                         ;;
3213                 os2)    osname=os2
3214                         osvers="$4"
3215                         ;;
3216                 POSIX-BC | posix-bc ) osname=posix-bc
3217                         osvers="$3"
3218                         ;;
3219                 powerux | power_ux | powermax_os | powermaxos | \
3220                 powerunix | power_unix) osname=powerux
3221                         osvers="$3"
3222                         ;;
3223                 qnx) osname=qnx
3224                         osvers="$4"
3225                         ;;
3226                 solaris) osname=solaris
3227                         case "$3" in
3228                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3229                         *)      osvers="$3" ;;
3230                         esac
3231                         ;;
3232                 sunos) osname=sunos
3233                         case "$3" in
3234                         5*) osname=solaris
3235                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3236                         *)      osvers="$3" ;;
3237                         esac
3238                         ;;
3239                 titanos) osname=titanos
3240                         case "$3" in
3241                         1*) osvers=1 ;;
3242                         2*) osvers=2 ;;
3243                         3*) osvers=3 ;;
3244                         4*) osvers=4 ;;
3245                         *)      osvers="$3" ;;
3246                         esac
3247                         ;;
3248                 ultrix) osname=ultrix
3249                         osvers="$3"
3250                         ;;
3251                 osf1|mls+)      case "$5" in
3252                                 alpha)
3253                                         osname=dec_osf
3254                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3255                                         case "$osvers" in
3256                                         [1-9].[0-9]*) ;;
3257                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3258                                         esac
3259                                         ;;
3260                         hp*)    osname=hp_osf1  ;;
3261                         mips)   osname=mips_osf1 ;;
3262                         esac
3263                         ;;
3264                 # UnixWare 7.1.2 is known as Open UNIX 8
3265                 openunix|unixware) osname=svr5
3266                         osvers="$4"
3267                         ;;
3268                 uts)    osname=uts
3269                         osvers="$3"
3270                         ;;
3271                 vos) osvers="$3"
3272                         ;;
3273                 $2) case "$osname" in
3274                         *isc*) ;;
3275                         *freebsd*) ;;
3276                         svr*)
3277                                 : svr4.x or possibly later
3278                                 case "svr$3" in
3279                                 ${osname}*)
3280                                         osname=svr$3
3281                                         osvers=$4
3282                                         ;;
3283                                 esac
3284                                 case "$osname" in
3285                                 svr4.0)
3286                                         : Check for ESIX
3287                                         if test -f /stand/boot ; then
3288                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3289                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3290                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3291                                                         if test -n "$isesix"; then
3292                                                                 osname=esix4
3293                                                         fi
3294                                                 fi
3295                                         fi
3296                                         ;;
3297                                 esac
3298                                 ;;
3299                         *)      if test -f /etc/systemid; then
3300                                         osname=sco
3301                                         set `echo $3 | $sed 's/\./ /g'` $4
3302                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3303                                                 osvers=$1.$2.$3
3304                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3305                                                 osvers=$1.$2
3306                                         elif $test -f $src/hints/sco_$1.sh; then
3307                                                 osvers=$1
3308                                         fi
3309                                 else
3310                                         case "$osname" in
3311                                         '') : Still unknown.  Probably a generic Sys V.
3312                                                 osname="sysv"
3313                                                 osvers="$3"
3314                                                 ;;
3315                                         esac
3316                                 fi
3317                                 ;;
3318                         esac
3319                         ;;
3320                 *)      case "$osname" in
3321                         '') : Still unknown.  Probably a generic BSD.
3322                                 osname="$1"
3323                                 osvers="$3"
3324                                 ;;
3325                         esac
3326                         ;;
3327                 esac
3328         else
3329                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3330                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3331                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3332                                 osname=news_os
3333                         fi
3334                         $rm -f UU/kernel.what
3335                 elif test -d c:/. -o -n "$is_os2" ; then
3336                         set X $myuname
3337                         osname=os2
3338                         osvers="$5"
3339                 fi
3340         fi
3341
3342         case "$targetarch" in
3343         '') ;;
3344         *)  hostarch=$osname
3345             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3346             osvers=''
3347             ;;
3348         esac
3349
3350         : Now look for a hint file osname_osvers, unless one has been
3351         : specified already.
3352         case "$hintfile" in
3353         ''|' ')
3354                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3355                 : Also try without trailing minor version numbers.
3356                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3357                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3358                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3359                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3360                 case "$file" in
3361                 '') dflt=none ;;
3362                 *)  case "$osvers" in
3363                         '') dflt=$file
3364                                 ;;
3365                         *)  if $test -f $src/hints/$file.sh ; then
3366                                         dflt=$file
3367                                 elif $test -f $src/hints/$xfile.sh ; then
3368                                         dflt=$xfile
3369                                 elif $test -f $src/hints/$xxfile.sh ; then
3370                                         dflt=$xxfile
3371                                 elif $test -f $src/hints/$xxxfile.sh ; then
3372                                         dflt=$xxxfile
3373                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3374                                         dflt=$xxxxfile
3375                                 elif $test -f "$src/hints/${osname}.sh" ; then
3376                                         dflt="${osname}"
3377                                 else
3378                                         dflt=none
3379                                 fi
3380                                 ;;
3381                         esac
3382                         ;;
3383                 esac
3384                 if $test -f Policy.sh ; then
3385                         case "$dflt" in
3386                         *Policy*) ;;
3387                         none) dflt="Policy" ;;
3388                         *) dflt="Policy $dflt" ;;
3389                         esac
3390                 fi
3391                 ;;
3392         *)
3393                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3394                 ;;
3395         esac
3396
3397         if $test -f Policy.sh ; then
3398                 $cat <<EOM
3399
3400 There's also a Policy hint file available, which should make the
3401 site-specific (policy) questions easier to answer.
3402 EOM
3403
3404         fi
3405
3406         $cat <<EOM
3407
3408 You may give one or more space-separated answers, or "none" if appropriate.
3409 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3410 previous run of Configure, you may specify it as well as or instead of
3411 OS-specific hints.  If hints are provided for your OS, you should use them:
3412 although Perl can probably be built without hints on many platforms, using
3413 hints often improve performance and may enable features that Configure can't
3414 set up on its own. If there are no hints that match your OS, specify "none";
3415 DO NOT give a wrong version or a wrong OS.
3416
3417 EOM
3418
3419         rp="Which of these apply, if any?"
3420         . UU/myread
3421         tans=$ans
3422         for file in $tans; do
3423                 if $test X$file = XPolicy -a -f Policy.sh; then
3424                         . Policy.sh
3425                         $cat Policy.sh >> UU/config.sh
3426                 elif $test -f $src/hints/$file.sh; then
3427                         . $src/hints/$file.sh
3428                         $cat $src/hints/$file.sh >> UU/config.sh
3429                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3430                         : nothing
3431                 else
3432                         : Give one chance to correct a possible typo.
3433                         echo "$file.sh does not exist"
3434                         dflt=$file
3435                         rp="hint to use instead?"
3436                         . UU/myread
3437                         for file in $ans; do
3438                                 if $test -f "$src/hints/$file.sh"; then
3439                                         . $src/hints/$file.sh
3440                                         $cat $src/hints/$file.sh >> UU/config.sh
3441                                 elif $test X$ans = X -o X$ans = Xnone ; then
3442                                         : nothing
3443                                 else
3444                                         echo "$file.sh does not exist -- ignored."
3445                                 fi
3446                         done
3447                 fi
3448         done
3449
3450         hint=recommended
3451         : Remember our hint file for later.
3452         if $test -f "$src/hints/$file.sh" ; then
3453                 hintfile="$file"
3454         else
3455                 hintfile=''
3456         fi
3457 fi
3458 cd UU
3459 ;;
3460 *)
3461         echo " "
3462         echo "Fetching default answers from $config_sh..." >&4
3463         tmp_n="$n"
3464         tmp_c="$c"
3465         cd ..
3466         cp $config_sh config.sh 2>/dev/null
3467         chmod +w config.sh
3468         . ./config.sh
3469         cd UU
3470         cp ../config.sh .
3471         n="$tmp_n"
3472         c="$tmp_c"
3473         hint=previous
3474         ;;
3475 esac
3476 test "$override" && . ./optdef.sh
3477
3478 : Restore computed paths
3479 for file in $loclist $trylist; do
3480         eval $file="\$_$file"
3481 done
3482
3483 cat << EOM
3484
3485 Configure uses the operating system name and version to set some defaults.
3486 The default value is probably right if the name rings a bell. Otherwise,
3487 since spelling matters for me, either accept the default or answer "none"
3488 to leave it blank.
3489
3490 EOM
3491 case "$osname" in
3492         ''|' ')
3493                 case "$hintfile" in
3494                 ''|' '|none) dflt=none ;;
3495                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3496                 esac
3497                 ;;
3498         *) dflt="$osname" ;;
3499 esac
3500 rp="Operating system name?"
3501 . ./myread
3502 case "$ans" in
3503 none)  osname='' ;;
3504 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3505 esac
3506 echo " "
3507 case "$osvers" in
3508         ''|' ')
3509                 case "$hintfile" in
3510                 ''|' '|none) dflt=none ;;
3511                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3512                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3513                         case "$dflt" in
3514                         ''|' ') dflt=none ;;
3515                         esac
3516                         ;;
3517                 esac
3518                 ;;
3519         *) dflt="$osvers" ;;
3520 esac
3521 rp="Operating system version?"
3522 . ./myread
3523 case "$ans" in
3524 none)  osvers='' ;;
3525 *) osvers="$ans" ;;
3526 esac
3527
3528
3529 . ./posthint.sh
3530
3531 : who configured the system
3532 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3533 case "$cf_by" in
3534 "")
3535         cf_by=`(logname) 2>/dev/null`
3536         case "$cf_by" in
3537         "")
3538                 cf_by=`(whoami) 2>/dev/null`
3539                 case "$cf_by" in
3540                 "") cf_by=unknown ;;
3541                 esac ;;
3542         esac ;;
3543 esac
3544
3545 : decide how portable to be.  Allow command line overrides.
3546 case "$d_portable" in
3547 "$undef") ;;
3548 *)      d_portable="$define" ;;
3549 esac
3550
3551 : set up shell script to do ~ expansion
3552 cat >filexp <<EOSS
3553 $startsh
3554 : expand filename
3555 case "\$1" in
3556  ~/*|~)
3557         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3558         ;;
3559  ~*)
3560         if $test -f /bin/csh; then
3561                 /bin/csh -f -c "glob \$1"
3562                 failed=\$?
3563                 echo ""
3564                 exit \$failed
3565         else
3566                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3567                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3568                 if $test ! -d "\$dir"; then
3569                         me=\`basename \$0\`
3570                         echo "\$me: can't locate home directory for: \$name" >&2
3571                         exit 1
3572                 fi
3573                 case "\$1" in
3574                 */*)
3575                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3576                         ;;
3577                 *)
3578                         echo \$dir
3579                         ;;
3580                 esac
3581         fi
3582         ;;
3583 *)
3584         echo \$1
3585         ;;
3586 esac
3587 EOSS
3588 chmod +x filexp
3589 $eunicefix filexp
3590
3591 : now set up to get a file name
3592 cat <<EOS >getfile
3593 $startsh
3594 EOS
3595 cat <<'EOSC' >>getfile
3596 tilde=''
3597 fullpath=''
3598 already=''
3599 skip=''
3600 none_ok=''
3601 exp_file=''
3602 nopath_ok=''
3603 orig_rp="$rp"
3604 orig_dflt="$dflt"
3605 case "$gfpth" in
3606 '') gfpth='.' ;;
3607 esac
3608
3609 case "$fn" in
3610 *\(*)
3611         : getfile will accept an answer from the comma-separated list
3612         : enclosed in parentheses even if it does not meet other criteria.
3613         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3614         fn=`echo $fn | sed 's/(.*)//'`
3615         ;;
3616 esac
3617
3618 case "$fn" in
3619 *:*)
3620         loc_file=`expr $fn : '.*:\(.*\)'`
3621         fn=`expr $fn : '\(.*\):.*'`
3622         ;;
3623 esac
3624
3625 case "$fn" in
3626 *~*) tilde=true;;
3627 esac
3628 case "$fn" in
3629 */*) fullpath=true;;
3630 esac
3631 case "$fn" in
3632 *+*) skip=true;;
3633 esac
3634 case "$fn" in
3635 *n*) none_ok=true;;
3636 esac
3637 case "$fn" in
3638 *e*) exp_file=true;;
3639 esac
3640 case "$fn" in
3641 *p*) nopath_ok=true;;
3642 esac
3643
3644 case "$fn" in
3645 *f*) type='File';;
3646 *d*) type='Directory';;
3647 *l*) type='Locate';;
3648 esac
3649
3650 what="$type"
3651 case "$what" in
3652 Locate) what='File';;
3653 esac
3654
3655 case "$exp_file" in
3656 '')
3657         case "$d_portable" in
3658         "$define") ;;
3659         *) exp_file=true;;
3660         esac
3661         ;;
3662 esac
3663
3664 cd ..
3665 while test "$type"; do
3666         redo=''
3667         rp="$orig_rp"
3668         dflt="$orig_dflt"
3669         case "$tilde" in
3670         true) rp="$rp (~name ok)";;
3671         esac
3672         . UU/myread
3673         if test -f UU/getfile.ok && \
3674                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3675         then
3676                 value="$ans"
3677                 ansexp="$ans"
3678                 break
3679         fi
3680         case "$ans" in
3681         none)
3682                 value=''
3683                 ansexp=''
3684                 case "$none_ok" in
3685                 true) type='';;
3686                 esac
3687                 ;;
3688         *)
3689                 case "$tilde" in
3690                 '') value="$ans"
3691                         ansexp="$ans";;
3692                 *)
3693                         value=`UU/filexp $ans`
3694                         case $? in
3695                         0)
3696                                 if test "$ans" != "$value"; then
3697                                         echo "(That expands to $value on this system.)"
3698                                 fi
3699                                 ;;
3700                         *) value="$ans";;
3701                         esac
3702                         ansexp="$value"
3703                         case "$exp_file" in
3704                         '') value="$ans";;
3705                         esac
3706                         ;;
3707                 esac
3708                 case "$fullpath" in
3709                 true)
3710                         case "$ansexp" in
3711                         /*) value="$ansexp" ;;
3712                         [a-zA-Z]:/*) value="$ansexp" ;;
3713                         *)
3714                                 redo=true
3715                                 case "$already" in
3716                                 true)
3717                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3718                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3719                                         ;;
3720                                 *)
3721                                 echo "Please give a full path name, starting with slash." >&4
3722                                         case "$tilde" in
3723                                         true)
3724                                 echo "Note that using ~name is ok provided it expands well." >&4
3725                                                 already=true
3726                                                 ;;
3727                                         esac
3728                                 esac
3729                                 ;;
3730                         esac
3731                         ;;
3732                 esac
3733                 case "$redo" in
3734                 '')
3735                         case "$type" in
3736                         File)
3737                                 for fp in $gfpth; do
3738                                         if test "X$fp" = X.; then
3739                                             pf="$ansexp"
3740                                         else    
3741                                             pf="$fp/$ansexp"
3742                                         fi
3743                                         if test -f "$pf"; then
3744                                                 type=''
3745                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3746                                         then
3747                                                 echo "($value is not a plain file, but that's ok.)"
3748                                                 type=''
3749                                         fi
3750                                         if test X"$type" = X; then
3751                                             value="$pf"
3752                                             break
3753                                         fi
3754                                 done
3755                                 ;;
3756                         Directory)
3757                                 for fp in $gfpth; do
3758                                         if test "X$fp" = X.; then
3759                                             dir="$ans"
3760                                             direxp="$ansexp"
3761                                         else    
3762                                             dir="$fp/$ansexp"
3763                                             direxp="$fp/$ansexp"
3764                                         fi
3765                                         if test -d "$direxp"; then
3766                                                 type=''
3767                                                 value="$dir"
3768                                                 break
3769                                         fi
3770                                 done
3771                                 ;;
3772                         Locate)
3773                                 if test -d "$ansexp"; then
3774                                         echo "(Looking for $loc_file in directory $value.)"
3775                                         value="$value/$loc_file"
3776                                         ansexp="$ansexp/$loc_file"
3777                                 fi
3778                                 if test -f "$ansexp"; then
3779                                         type=''
3780                                 fi
3781                                 case "$nopath_ok" in
3782                                 true)   case "$value" in
3783                                         */*) ;;
3784                                         *)      echo "Assuming $value will be in people's path."
3785                                                 type=''
3786                                                 ;;
3787                                         esac
3788                                         ;;
3789                                 esac
3790                                 ;;
3791                         esac
3792
3793                         case "$skip" in
3794                         true) type='';
3795                         esac
3796
3797                         case "$type" in
3798                         '') ;;
3799                         *)
3800                                 if test "$fastread" = yes; then
3801                                         dflt=y
3802                                 else
3803                                         dflt=n
3804                                 fi
3805                                 rp="$what $value doesn't exist.  Use that name anyway?"
3806                                 . UU/myread
3807                                 dflt=''
3808                                 case "$ans" in
3809                                 y*) type='';;
3810                                 *) echo " ";;
3811                                 esac
3812                                 ;;
3813                         esac
3814                         ;;
3815                 esac
3816                 ;;
3817         esac
3818 done
3819 cd UU
3820 ans="$value"
3821 rp="$orig_rp"
3822 dflt="$orig_dflt"
3823 rm -f getfile.ok
3824 test "X$gfpthkeep" != Xy && gfpth=""
3825 EOSC
3826
3827 : determine root of directory hierarchy where package will be installed.
3828 case "$prefix" in
3829 '')
3830         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3831         ;;
3832 *?/)
3833         dflt=`echo "$prefix" | sed 's/.$//'`
3834         ;;
3835 *)
3836         dflt="$prefix"
3837         ;;
3838 esac
3839 $cat <<EOM
3840
3841 By default, $package will be installed in $dflt/bin, manual pages
3842 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3843 installation directories. Typically this is something like /usr/local.
3844 If you wish to have binaries under /usr/bin but other parts of the
3845 installation under /usr/local, that's ok: you will be prompted
3846 separately for each of the installation directories, the prefix being
3847 only used to set the defaults.
3848
3849 EOM
3850 fn=d~
3851 rp='Installation prefix to use?'
3852 . ./getfile
3853 oldprefix=''
3854 case "$prefix" in
3855 '') ;;
3856 *)
3857         case "$ans" in
3858         "$prefix") ;;
3859         *) oldprefix="$prefix";;
3860         esac
3861         ;;
3862 esac
3863 prefix="$ans"
3864 prefixexp="$ansexp"
3865
3866 case "$afsroot" in
3867 '')     afsroot=/afs ;;
3868 *)      afsroot=$afsroot ;;
3869 esac
3870
3871 : is AFS running?
3872 echo " "
3873 case "$afs" in
3874 $define|true)   afs=true ;;
3875 $undef|false)   afs=false ;;
3876 *)      if test -d $afsroot; then
3877                 afs=true
3878         else
3879                 afs=false
3880         fi
3881         ;;
3882 esac
3883 if $afs; then
3884         echo "AFS may be running... I'll be extra cautious then..." >&4
3885 else
3886         echo "AFS does not seem to be running..." >&4
3887 fi
3888
3889 : determine installation prefix for where package is to be installed.
3890 if $afs; then 
3891 $cat <<EOM
3892
3893 Since you are running AFS, I need to distinguish the directory in which
3894 files will reside from the directory in which they are installed (and from
3895 which they are presumably copied to the former directory by occult means).
3896
3897 EOM
3898         case "$installprefix" in
3899         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3900         *) dflt="$installprefix";;
3901         esac
3902 else
3903 $cat <<EOM
3904
3905 In some special cases, particularly when building $package for distribution,
3906 it is convenient to distinguish the directory in which files should be
3907 installed from the directory ($prefix) in which they will
3908 eventually reside.  For most users, these two directories are the same.
3909
3910 EOM
3911         case "$installprefix" in
3912         '') dflt=$prefix ;;
3913         *) dflt=$installprefix;;
3914         esac
3915 fi
3916 fn=d~
3917 rp='What installation prefix should I use for installing files?'
3918 . ./getfile
3919 installprefix="$ans"
3920 installprefixexp="$ansexp"
3921
3922 : Perform the prefixexp/installprefixexp correction if necessary
3923 cat <<EOS >installprefix
3924 $startsh
3925 EOS
3926 cat <<'EOSC' >>installprefix
3927 : Change installation prefix, if necessary.
3928 if $test X"$prefix" != X"$installprefix"; then
3929     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3930 else
3931     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3932 fi
3933 EOSC
3934 chmod +x installprefix
3935 $eunicefix installprefix
3936
3937 : Set variables such as privlib and privlibexp from the output of ./getfile
3938 : performing the prefixexp/installprefixexp correction if necessary.
3939 cat <<EOS >setprefixvar
3940 $startsh
3941 EOS
3942 cat <<'EOSC' >>setprefixvar
3943 eval "${prefixvar}=\"\$ans\""
3944 eval "${prefixvar}exp=\"\$ansexp\""
3945 . ./installprefix
3946 EOSC
3947 chmod +x setprefixvar
3948 $eunicefix setprefixvar
3949
3950 : set up the script used to warn in case of inconsistency
3951 cat <<EOS >whoa
3952 $startsh
3953 EOS
3954 cat <<'EOSC' >>whoa
3955 dflt=y
3956 case "$hint" in
3957     recommended)
3958         case "$hintfile" in
3959         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3960                 ;;
3961         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3962                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3963                 ;;
3964         esac
3965         ;;
3966     *)  echo " "
3967         echo "*** WHOA THERE!!! ***" >&4
3968         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3969         ;;
3970 esac
3971 rp="    Keep the $hint value?"
3972 . ./myread
3973 case "$ans" in
3974 y) td=$was; tu=$was;;
3975 esac
3976 EOSC
3977
3978 : function used to set $1 to $val
3979 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3980 case "$val$was" in
3981 $define$undef) . ./whoa; eval "$var=\$td";;
3982 $undef$define) . ./whoa; eval "$var=\$tu";;
3983 *) eval "$var=$val";;
3984 esac'
3985
3986 case "$usesocks" in
3987 $define|true|[yY]*)     dflt='y';;
3988 *) dflt='n';;
3989 esac
3990 cat <<EOM
3991
3992 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3993 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3994 to use the PerlIO abstraction layer, this will be implicitly selected.
3995
3996 If this doesn't make any sense to you, just accept the default '$dflt'.
3997 EOM
3998 rp='Build Perl for SOCKS?'
3999 . ./myread
4000 case "$ans" in
4001 y|Y)    val="$define" ;;     
4002 *)      val="$undef" ;;
4003 esac
4004 set usesocks
4005 eval $setvar
4006
4007 case "$usesocks" in
4008 $define|true|[yY]*) useperlio="$define";;
4009 esac
4010
4011 case "$useperlio" in
4012 $define|true|[yY]*|'')  dflt='y';;
4013 *) dflt='n';;
4014 esac
4015 cat <<EOM
4016
4017 Previous version of $package used the standard IO mechanisms as
4018 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4019 alternate IO mechanisms via the PerlIO abstraction layer, but the
4020 stdio mechanism is still available if needed.  The abstraction layer
4021 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4022 Using PerlIO with sfio may cause problems with some extension modules.
4023
4024 If this doesn't make any sense to you, just accept the default '$dflt'.
4025 EOM
4026 rp='Use the PerlIO abstraction layer?'
4027 . ./myread
4028 case "$ans" in
4029 y|Y) 
4030         val="$define"
4031         ;;
4032 *)      
4033         echo "Ok, doing things the stdio way."
4034         val="$undef"
4035         ;;
4036 esac
4037 set useperlio
4038 eval $setvar 
4039
4040 case "$usesocks" in
4041 $define|true|[yY]*)
4042         case "$useperlio" in
4043         $define|true|[yY]*) ;;
4044         *)      cat >&4 <<EOM
4045
4046 You are using the SOCKS proxy protocol library which means that you
4047 should also use the PerlIO layer.  You may be headed for trouble.
4048
4049 EOM
4050                 ;;
4051         esac
4052         ;;
4053 esac
4054
4055         
4056 : get the patchlevel
4057 echo " "
4058 echo "Getting the current patchlevel..." >&4
4059 if $test -r $rsrc/patchlevel.h;then
4060         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4061         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4062         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4063         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4064         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4065         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4066         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4067 else
4068         revision=0
4069         patchlevel=0
4070         subversion=0
4071         api_revision=0
4072         api_version=0
4073         api_subversion=0
4074         perl_patchlevel=0
4075         $echo "(You do not have patchlevel.h.  Eek.)"
4076 fi
4077 if $test -r $rsrc/.patch ; then
4078         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4079                 perl_patchlevel=`cat $rsrc/.patch`
4080         fi
4081 fi
4082 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4083 version_patchlevel_string="version $patchlevel subversion $subversion"
4084 case "$perl_patchlevel" in
4085 0|'') ;;
4086 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4087 esac
4088
4089 $echo "(You have $package $version_patchlevel_string.)"
4090
4091 case "$osname" in
4092 dos|vms)
4093         : XXX Should be a Configure test for double-dots in filenames.
4094         version=`echo $revision $patchlevel $subversion | \
4095                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4096         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4097                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4098         ;;
4099 *)
4100         version=`echo $revision $patchlevel $subversion | \
4101                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4102         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4103                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4104         ;;
4105 esac
4106 : Special case the 5.005_xx maintenance series, which used 5.005
4107 : without any subversion label as a subdirectory in $sitelib
4108 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4109         api_versionstring='5.005'
4110 fi
4111
4112 case "$usethreads" in
4113 $define|true|[yY]*)     dflt='y';;
4114 *)     # Catch case where user specified ithreads or 5005threads but
4115        # forgot -Dusethreads (A.D. 4/2002)
4116        case "$useithreads$use5005threads" in
4117        *$define*)      
4118                 case "$useperlio" in
4119                 "$define")      dflt='y' ;;
4120                 *)              dflt='n' ;;
4121                 esac
4122                 ;;
4123        *)       dflt='n';;
4124        esac
4125        ;;
4126 esac
4127 cat <<EOM
4128
4129 Perl can be built to take advantage of threads on some systems.
4130 To do so, Configure can be run with -Dusethreads.
4131
4132 Note that Perl built with threading support runs slightly slower
4133 and uses more memory than plain Perl. The current implementation
4134 is believed to be stable, but it is fairly new, and so should be
4135 treated with caution.
4136
4137 If this doesn't make any sense to you, just accept the default '$dflt'.
4138 EOM
4139 rp='Build a threading Perl?'
4140 . ./myread
4141 case "$ans" in
4142 y|Y)    val="$define" ;;
4143 *)      val="$undef" ;;
4144 esac
4145 set usethreads
4146 eval $setvar
4147
4148 if $test $patchlevel -lt 9; then
4149     case "$usethreads" in
4150     $define)
4151         $cat <<EOM
4152
4153 Since release 5.6, Perl has had two different threading implementations,
4154 the newer interpreter-based version (ithreads) with one interpreter per
4155 thread, and the older 5.005 version (5005threads).
4156 The 5005threads version is effectively unmaintained and will probably be
4157 removed in Perl 5.10, so there should be no need to build a Perl using it
4158 unless needed for backwards compatibility with some existing 5.005threads
4159 code.
4160
4161 EOM
4162         : Default to ithreads unless overridden on command line or with
4163         : old config.sh
4164         dflt='y'
4165         case "$use5005threads" in
4166                 $define|true|[yY]*) dflt='n';;
4167         esac
4168         case "$useithreads" in
4169                 $undef|false|[nN]*) dflt='n';;
4170         esac
4171         rp='Use the newer interpreter-based ithreads?'
4172         . ./myread
4173         case "$ans" in
4174         y|Y)    val="$define" ;;
4175         *)      val="$undef" ;;
4176         esac
4177         set useithreads
4178         eval $setvar
4179         : Now set use5005threads to the opposite value.
4180         case "$useithreads" in
4181         $define) val="$undef" ;;
4182         *) val="$define" ;;
4183         esac
4184         set use5005threads
4185         eval $setvar
4186         ;;
4187     *)
4188         useithreads="$undef"
4189         use5005threads="$undef"
4190         ;;
4191     esac
4192
4193     case "$useithreads$use5005threads" in
4194     "$define$define")
4195         $cat >&4 <<EOM
4196
4197 You cannot have both the ithreads and the 5.005 threads enabled
4198 at the same time.  Disabling the 5.005 threads since they are
4199 much less stable than the ithreads.
4200
4201 EOM
4202         use5005threads="$undef"
4203         ;;
4204     esac
4205
4206 else
4207 : perl-5.9.x and later
4208
4209     if test X"$usethreads" = "X$define"; then
4210         case "$use5005threads" in
4211             $define|true|[yY]*)
4212                 $cat >&4 <<EOM
4213
4214 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4215
4216 EOM
4217             ;;
4218         esac
4219     fi
4220     use5005threads="$undef"
4221     useithreads="$usethreads"
4222 fi
4223
4224 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4225         cat >&4 <<EOF
4226 ***
4227 *** To build with ithreads you must also use the PerlIO layer.
4228 *** Cannot continue, aborting.
4229 ***
4230 EOF
4231         exit 1
4232 fi
4233
4234 case "$d_oldpthreads" in
4235 '')     : Configure tests would be welcome here.  For now, assume undef.
4236         val="$undef" ;;
4237 *)      val="$d_oldpthreads" ;;
4238 esac
4239 set d_oldpthreads
4240 eval $setvar
4241
4242
4243 : Look for a hint-file generated 'call-back-unit'.  If the
4244 : user has specified that a threading perl is to be built,
4245 : we may need to set or change some other defaults.
4246 if $test -f usethreads.cbu; then
4247     echo "Your platform has some specific hints regarding threaded builds, using them..."
4248     . ./usethreads.cbu
4249 else
4250     case "$usethreads" in
4251         "$define"|true|[yY]*)
4252                 $cat <<EOM
4253 (Your platform does not have any specific hints for threaded builds.
4254  Assuming POSIX threads, then.)
4255 EOM
4256         ;;
4257     esac
4258 fi
4259
4260 cat <<EOM
4261
4262 Perl can be built so that multiple Perl interpreters can coexist
4263 within the same Perl executable.
4264 EOM
4265
4266 case "$useithreads" in
4267 $define)
4268         cat <<EOM
4269 This multiple interpreter support is required for interpreter-based threads.
4270 EOM
4271         val="$define"
4272         ;;
4273 *)      case "$usemultiplicity" in
4274         $define|true|[yY]*)     dflt='y';;
4275         *) dflt='n';;
4276         esac
4277         echo " "
4278         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4279         rp='Build Perl for multiplicity?'
4280         . ./myread
4281         case "$ans" in
4282         y|Y)    val="$define" ;;
4283         *)      val="$undef" ;;
4284         esac
4285         ;;
4286 esac
4287 set usemultiplicity
4288 eval $setvar
4289
4290
4291 case "$usemorebits" in
4292 "$define"|true|[yY]*)
4293         use64bitint="$define"
4294         uselongdouble="$define"
4295         usemorebits="$define"
4296         ;;
4297 *)      usemorebits="$undef"
4298         ;;
4299 esac
4300
4301 : make some quick guesses about what we are up against
4302 echo " "
4303 $echo $n "Hmm...  $c"
4304 echo exit 1 >bsd
4305 echo exit 1 >usg
4306 echo exit 1 >v7
4307 echo exit 1 >osf1
4308 echo exit 1 >eunice
4309 echo exit 1 >xenix
4310 echo exit 1 >venix
4311 echo exit 1 >os2
4312 d_bsd="$undef"
4313 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4314 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4315 then
4316         echo "Looks kind of like an OSF/1 system, but we'll see..."
4317         echo exit 0 >osf1
4318 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4319         xxx=`./loc addbib blurfl $pth`
4320         if $test -f $xxx; then
4321         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4322                 echo exit 0 >bsd
4323                 echo exit 0 >usg
4324         else
4325                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4326                         echo "Looks kind of like an extended USG system, but we'll see..."
4327                 else
4328                         echo "Looks kind of like a USG system, but we'll see..."
4329                 fi
4330                 echo exit 0 >usg
4331         fi
4332 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4333         echo "Looks kind of like a BSD system, but we'll see..."
4334         d_bsd="$define"
4335         echo exit 0 >bsd
4336 else
4337         echo "Looks kind of like a Version 7 system, but we'll see..."
4338         echo exit 0 >v7
4339 fi
4340 case "$eunicefix" in
4341 *unixtovms*)
4342         $cat <<'EOI'
4343 There is, however, a strange, musty smell in the air that reminds me of
4344 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4345 EOI
4346         echo exit 0 >eunice
4347         d_eunice="$define"
4348 : it so happens the Eunice I know will not run shell scripts in Unix format
4349         ;;
4350 *)
4351         echo " "
4352         echo "Congratulations.  You aren't running Eunice."
4353         d_eunice="$undef"
4354         ;;
4355 esac
4356 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4357 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4358 : semicolon as a patch separator
4359 case "$p_" in
4360 :) ;;
4361 *)
4362         $cat <<'EOI'
4363 I have the feeling something is not exactly right, however...don't tell me...
4364 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4365 (Or you may be running DOS with DJGPP.)
4366 EOI
4367         echo exit 0 >os2
4368         ;;
4369 esac
4370 if test -f /xenix; then
4371         echo "Actually, this looks more like a XENIX system..."
4372         echo exit 0 >xenix
4373         d_xenix="$define"
4374 else
4375         echo " "
4376         echo "It's not Xenix..."
4377         d_xenix="$undef"
4378 fi
4379 chmod +x xenix
4380 $eunicefix xenix
4381 if test -f /venix; then
4382         echo "Actually, this looks more like a VENIX system..."
4383         echo exit 0 >venix
4384 else
4385         echo " "
4386         if ./xenix; then
4387                 : null
4388         else
4389                 echo "Nor is it Venix..."
4390         fi
4391 fi
4392 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4393 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4394 $rm -f foo
4395
4396 case "$cc" in
4397 '') dflt=cc;;
4398 *) dflt="$cc";;
4399 esac
4400 rp="Use which C compiler?"
4401 . ./myread
4402 cc="$ans"
4403
4404 : See if they have not cc but they do have gcc
4405 . ./trygcc
4406 : Look for a hint-file generated 'call-back-unit'.  Now that the
4407 : user has specified the compiler, we may need to set or change some
4408 : other defaults.
4409 if $test -f cc.cbu; then
4410     . ./cc.cbu
4411 fi
4412 . ./checkcc
4413
4414 echo " "
4415 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4416 $cat >try.c <<EOM
4417 #include <stdio.h>
4418 int main() {
4419 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4420 #ifdef __VERSION__
4421         printf("%s\n", __VERSION__);
4422 #else
4423         printf("%s\n", "1");
4424 #endif
4425 #endif
4426         return(0);
4427 }
4428 EOM
4429 if $cc -o try $ccflags $ldflags try.c; then
4430         gccversion=`$run ./try`
4431         case "$gccversion" in
4432         '') echo "You are not using GNU cc." ;;
4433         *)  echo "You are using GNU cc $gccversion."
4434             ccname=gcc
4435             ;;
4436         esac
4437 else
4438         echo " "
4439         echo "*** WHOA THERE!!! ***" >&4
4440         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4441         case "$knowitall" in
4442         '')
4443         echo "    You'd better start hunting for one and let me know about it." >&4
4444                 exit 1
4445                 ;;
4446         esac
4447 fi
4448 $rm -f try try.*
4449 case "$gccversion" in
4450 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4451 esac
4452 case "$gccversion" in
4453 '') gccosandvers='' ;;
4454 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4455    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4456    gccshortvers=''
4457    case "$gccosandvers" in
4458    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4459    $osname$osvers) ;; # looking good
4460    $osname*) cat <<EOM >&4
4461
4462 *** WHOA THERE!!! ***
4463
4464     Your gcc has not been compiled for the exact release of
4465     your operating system ($gccosandvers versus $osname$osvers).
4466
4467     In general it is a good idea to keep gcc synchronized with
4468     the operating system because otherwise serious problems
4469     may ensue when trying to compile software, like Perl.
4470
4471     I'm trying to be optimistic here, though, and will continue.
4472     If later during the configuration and build icky compilation
4473     problems appear (headerfile conflicts being the most common
4474     manifestation), I suggest reinstalling the gcc to match
4475     your operating system release.
4476
4477 EOM
4478       ;;
4479    *) gccosandvers='' ;; # failed to parse, better be silent
4480    esac
4481    ;;
4482 esac
4483 case "$ccname" in
4484 '') ccname="$cc" ;;
4485 esac
4486
4487 # gcc 3.* complain about adding -Idirectories that they already know about,
4488 # so we will take those off from locincpth.
4489 case "$gccversion" in
4490 3*)
4491     echo "main(){}">try.c
4492     for incdir in $locincpth; do
4493        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4494              grep '^c[cp]p*[01]: warning: changing search order '`
4495        if test "X$warn" != X; then
4496            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4497        fi
4498     done
4499     $rm -f try try.*
4500 esac
4501
4502 : What should the include directory be ?
4503 echo " "
4504 $echo $n "Hmm...  $c"
4505 dflt='/usr/include'
4506 incpath=''
4507 mips_type=''
4508 if $test -f /bin/mips && /bin/mips; then
4509         echo "Looks like a MIPS system..."
4510         $cat >usr.c <<'EOCP'
4511 #ifdef SYSTYPE_BSD43
4512 /bsd43
4513 #endif
4514 EOCP
4515         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4516                 dflt='/bsd43/usr/include'
4517                 incpath='/bsd43'
4518                 mips_type='BSD 4.3'
4519         else
4520                 mips_type='System V'
4521         fi
4522         $rm -f usr.c usr.out
4523         echo "and you're compiling with the $mips_type compiler and libraries."
4524         xxx_prompt=y
4525         echo "exit 0" >mips
4526 else
4527         echo "Doesn't look like a MIPS system."
4528         xxx_prompt=n
4529         echo "exit 1" >mips
4530 fi
4531 chmod +x mips
4532 $eunicefix mips
4533 case "$usrinc" in
4534 '') ;;
4535 *) dflt="$usrinc";;
4536 esac
4537 case "$xxx_prompt" in
4538 y)      fn=d/
4539         echo " "
4540         rp='Where are the include files you want to use?'
4541         . ./getfile
4542         usrinc="$ans"
4543         ;;
4544 *)      usrinc="$dflt"
4545         ;;
4546 esac
4547
4548 : see how we invoke the C preprocessor
4549 echo " "
4550 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4551 cat <<'EOT' >testcpp.c
4552 #define ABC abc
4553 #define XYZ xyz
4554 ABC.XYZ
4555 EOT
4556 cd ..
4557 if test ! -f cppstdin; then
4558         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4559                 # AIX cc -E doesn't show the absolute headerfile
4560                 # locations but we'll cheat by using the -M flag.
4561                 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
4562         else
4563                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4564         fi
4565 else
4566         echo "Keeping your $hint cppstdin wrapper."
4567 fi
4568 chmod 755 cppstdin
4569 wrapper=`pwd`/cppstdin
4570 ok='false'
4571 cd UU
4572
4573 if $test "X$cppstdin" != "X" && \
4574         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4575         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4576 then
4577         echo "You used to use $cppstdin $cppminus so we'll use that again."
4578         case "$cpprun" in
4579         '') echo "But let's see if we can live without a wrapper..." ;;
4580         *)
4581                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4582                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4583                 then
4584                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4585                         ok='true'
4586                 else
4587                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4588                 fi
4589                 ;;
4590         esac
4591 else
4592         case "$cppstdin" in
4593         '') ;;
4594         *)
4595                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4596                 ;;
4597         esac
4598 fi
4599
4600 if $ok; then
4601         : nothing
4602 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4603         $cc -E <testcpp.c >testcpp.out 2>&1; \
4604         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4605         echo "Yup, it does."
4606         x_cpp="$cc -E"
4607         x_minus='';
4608 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4609         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4610         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4611         echo "Yup, it does."
4612         x_cpp="$cc -E"
4613         x_minus='-';
4614 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4615         $cc -P <testcpp.c >testcpp.out 2>&1; \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4617         echo "Yipee, that works!"
4618         x_cpp="$cc -P"
4619         x_minus='';
4620 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4621         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4622         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4623         echo "At long last!"
4624         x_cpp="$cc -P"
4625         x_minus='-';
4626 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4627         $cpp <testcpp.c >testcpp.out 2>&1; \
4628         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629         echo "It works!"
4630         x_cpp="$cpp"
4631         x_minus='';
4632 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4633         $cpp - <testcpp.c >testcpp.out 2>&1; \
4634         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635         echo "Hooray, it works!  I was beginning to wonder."
4636         x_cpp="$cpp"
4637         x_minus='-';
4638 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4639         $wrapper <testcpp.c >testcpp.out 2>&1; \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641         x_cpp="$wrapper"
4642         x_minus=''
4643         echo "Eureka!"
4644 else
4645         dflt=''
4646         rp="No dice.  I can't find a C preprocessor.  Name one:"
4647         . ./myread
4648         x_cpp="$ans"
4649         x_minus=''
4650         $x_cpp <testcpp.c >testcpp.out 2>&1
4651         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652                 echo "OK, that will do." >&4
4653         else
4654 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4655                 exit 1
4656         fi
4657 fi
4658
4659 case "$ok" in
4660 false)
4661         cppstdin="$x_cpp"
4662         cppminus="$x_minus"
4663         cpprun="$x_cpp"
4664         cpplast="$x_minus"
4665         set X $x_cpp
4666         shift
4667         case "$1" in
4668         "$cpp")
4669                 echo "Perhaps can we force $cc -E using a wrapper..."
4670                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4671                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672                 then
4673                         echo "Yup, we can."
4674                         cppstdin="$wrapper"
4675                         cppminus='';
4676                 else
4677                         echo "Nope, we'll have to live without it..."
4678                 fi
4679                 ;;
4680         esac
4681         case "$cpprun" in
4682         "$wrapper")
4683                 cpprun=''
4684                 cpplast=''
4685                 ;;
4686         esac
4687         ;;
4688 esac
4689
4690 case "$cppstdin" in
4691 "$wrapper"|'cppstdin') ;;
4692 *) $rm -f $wrapper;;
4693 esac
4694 $rm -f testcpp.c testcpp.out
4695
4696 : Set private lib path
4697 case "$plibpth" in
4698 '') if ./mips; then
4699                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4700         fi;;
4701 esac
4702 case "$libpth" in
4703 ' ') dlist='';;
4704 '') dlist="$loclibpth $plibpth $glibpth";;
4705 *) dlist="$libpth";;
4706 esac
4707
4708 : Now check and see which directories actually exist, avoiding duplicates
4709 libpth=''
4710 for xxx in $dlist
4711 do
4712     if $test -d $xxx; then
4713                 case " $libpth " in
4714                 *" $xxx "*) ;;
4715                 *) libpth="$libpth $xxx";;
4716                 esac
4717     fi
4718 done
4719 $cat <<'EOM'
4720
4721 Some systems have incompatible or broken versions of libraries.  Among
4722 the directories listed in the question below, please remove any you
4723 know not to be holding relevant libraries, and add any that are needed.
4724 Say "none" for none.
4725
4726 EOM
4727 case "$libpth" in
4728 '') dflt='none';;
4729 *)
4730         set X $libpth
4731         shift
4732         dflt=${1+"$@"}
4733         ;;
4734 esac
4735 rp="Directories to use for library searches?"
4736 . ./myread
4737 case "$ans" in
4738 none) libpth=' ';;
4739 *) libpth="$ans";;
4740 esac
4741
4742 : compute shared library extension
4743 case "$so" in
4744 '')
4745         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4746                 dflt='sl'
4747         else
4748                 dflt='so'
4749         fi
4750         ;;
4751 *) dflt="$so";;
4752 esac
4753 $cat <<EOM
4754
4755 On some systems, shared libraries may be available.  Answer 'none' if
4756 you want to suppress searching of shared libraries for the remainder
4757 of this configuration.
4758
4759 EOM
4760 rp='What is the file extension used for shared libraries?'
4761 . ./myread
4762 so="$ans"
4763
4764 : Define several unixisms.
4765 : Hints files or command line option can be used to override them.
4766 : The convoluted testing is in case hints files set either the old
4767 : or the new name.
4768 case "$_exe" in
4769 '')     case "$exe_ext" in
4770         '')     ;;
4771         *)      _exe="$exe_ext" ;;
4772         esac
4773         ;;
4774 esac
4775 case "$_a" in
4776 '')     case "$lib_ext" in
4777     '') _a='.a';;
4778         *)      _a="$lib_ext" ;;
4779         esac
4780         ;;
4781 esac
4782 case "$_o" in
4783 '') case "$obj_ext" in
4784         '')     _o='.o';;
4785         *)      _o="$obj_ext";;
4786         esac
4787         ;;
4788 esac
4789 case "$p_" in
4790 '') case "$path_sep" in
4791         '')     p_=':';;
4792         *)      p_="$path_sep";;
4793         esac
4794         ;;
4795 esac
4796 exe_ext=$_exe
4797 lib_ext=$_a
4798 obj_ext=$_o
4799 path_sep=$p_
4800
4801 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4802
4803 : Which makefile gets called first.  This is used by make depend.
4804 case "$firstmakefile" in
4805 '') firstmakefile='makefile';;
4806 esac
4807
4808 case "$ccflags" in
4809 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4810 esac
4811
4812 case "$uselongdouble" in
4813 $define|true|[yY]*)     dflt='y';;
4814 *) dflt='n';;
4815 esac
4816 cat <<EOM
4817
4818 Perl can be built to take advantage of long doubles which
4819 (if available) may give more accuracy and range for floating point numbers.
4820
4821 If this doesn't make any sense to you, just accept the default '$dflt'.
4822 EOM
4823 rp='Try to use long doubles if available?'
4824 . ./myread
4825 case "$ans" in
4826 y|Y)    val="$define"   ;;
4827 *)      val="$undef"    ;;
4828 esac
4829 set uselongdouble
4830 eval $setvar
4831
4832 case "$uselongdouble" in
4833 true|[yY]*) uselongdouble="$define" ;;
4834 esac
4835
4836 : Look for a hint-file generated 'call-back-unit'.  If the
4837 : user has specified that long doubles should be used,
4838 : we may need to set or change some other defaults.
4839 if $test -f uselongdouble.cbu; then
4840     echo "Your platform has some specific hints regarding long doubles, using them..."
4841     . ./uselongdouble.cbu
4842 else
4843     case "$uselongdouble" in
4844         $define)
4845                 $cat <<EOM
4846 (Your platform does not have any specific hints for long doubles.)
4847 EOM
4848         ;;
4849     esac
4850 fi
4851
4852 : Looking for optional libraries
4853 echo " "
4854 echo "Checking for optional libraries..." >&4
4855 case "$libs" in
4856 ' '|'') dflt='';;
4857 *) dflt="$libs";;
4858 esac
4859 case "$libswanted" in
4860 '') libswanted='c_s';;
4861 esac
4862 case "$usesocks" in
4863 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4864 esac
4865 libsfound=''
4866 libsfiles=''
4867 libsdirs=''
4868 libspath=''
4869 for thisdir in $libpth $xlibpth; do
4870   test -d $thisdir && libspath="$libspath $thisdir"
4871 done
4872 for thislib in $libswanted; do
4873         for thisdir in $libspath; do
4874             xxx=''
4875             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4876                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4877                 $test -f "$xxx" && eval $libscheck
4878                 $test -f "$xxx" && libstyle=shared
4879             fi
4880             if test ! -f "$xxx"; then
4881                 xxx=$thisdir/lib$thislib.$so
4882                 $test -f "$xxx" && eval $libscheck
4883                 $test -f "$xxx" && libstyle=shared
4884             fi  
4885             if test ! -f "$xxx"; then
4886                 xxx=$thisdir/lib$thislib$_a
4887                 $test -f "$xxx" && eval $libscheck
4888                 $test -f "$xxx" && libstyle=static
4889             fi
4890             if test ! -f "$xxx"; then
4891                 xxx=$thisdir/$thislib$_a
4892                 $test -f "$xxx" && eval $libscheck
4893                 $test -f "$xxx" && libstyle=static
4894             fi
4895             if test ! -f "$xxx"; then
4896                 xxx=$thisdir/lib${thislib}_s$_a
4897                 $test -f "$xxx" && eval $libscheck
4898                 $test -f "$xxx" && libstyle=static
4899                 $test -f "$xxx" && thislib=${thislib}_s
4900             fi
4901             if test ! -f "$xxx"; then
4902                 xxx=$thisdir/Slib$thislib$_a
4903                 $test -f "$xxx" && eval $libscheck
4904                 $test -f "$xxx" && libstyle=static
4905             fi
4906             if $test -f "$xxx"; then
4907                 case "$libstyle" in
4908                 shared) echo "Found -l$thislib (shared)." ;;
4909                 static) echo "Found -l$thislib." ;;
4910                 *)      echo "Found -l$thislib ($libstyle)." ;;
4911                 esac
4912                 case " $dflt " in
4913                 *"-l$thislib "*);;
4914                 *) dflt="$dflt -l$thislib"
4915                    libsfound="$libsfound $xxx"
4916                    yyy=`basename $xxx`
4917                    libsfiles="$libsfiles $yyy"
4918                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4919                    case " $libsdirs " in
4920                    *" $yyy "*) ;;
4921                    *) libsdirs="$libsdirs $yyy" ;;
4922                    esac
4923                    ;;
4924                 esac
4925                 break
4926             fi  
4927         done
4928         if $test ! -f "$xxx"; then
4929             echo "No -l$thislib."
4930         fi
4931 done
4932 set X $dflt
4933 shift
4934 dflt="$*"
4935 case "$libs" in
4936 '') dflt="$dflt";;
4937 *) dflt="$libs";;
4938 esac
4939 case "$dflt" in
4940 ' '|'') dflt='none';;
4941 esac
4942
4943 $cat <<EOM
4944
4945 In order to compile $package on your machine, a number of libraries
4946 are usually needed.  Include any other special libraries here as well.
4947 Say "none" for none.  The default list is almost always right.
4948 EOM
4949
4950 echo " "
4951 rp="What libraries to use?"
4952 . ./myread
4953 case "$ans" in
4954 none) libs=' ';;
4955 *) libs="$ans";;
4956 esac
4957
4958 : determine optimization, if desired, or use for debug flag also
4959 case "$optimize" in
4960 ' '|$undef) dflt='none';;
4961 '') dflt='-O';;
4962 *) dflt="$optimize";;
4963 esac
4964 $cat <<EOH
4965
4966 By default, $package compiles with the -O flag to use the optimizer.
4967 Alternately, you might want to use the symbolic debugger, which uses
4968 the -g flag (on traditional Unix systems).  Either flag can be
4969 specified here.  To use neither flag, specify the word "none".
4970
4971 EOH
4972 rp="What optimizer/debugger flag should be used?"
4973 . ./myread
4974 optimize="$ans"
4975 case "$optimize" in
4976 'none') optimize=" ";;
4977 esac
4978
4979 : Check what DEBUGGING is required from the command line
4980 : -DEBUGGING      or -DDEBUGGING or
4981 : -DEBUGGING=both                       = -g + -DDEBUGGING
4982 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4983 : -DEBUGGING=none or -UDEBUGGING        =
4984 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4985 case "$EBUGGING" in
4986 '')     ;;
4987 *)      DEBUGGING=$EBUGGING ;;
4988 esac
4989
4990 case "$DEBUGGING" in
4991 -g|both|$define)
4992     case "$optimize" in
4993         *-g*) ;;
4994         *)    optimize="$optimize -g" ;;
4995     esac ;;
4996 none|$undef)
4997     case "$optimize" in
4998         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4999                 shift
5000                 optimize="$*"
5001                 ;;
5002     esac ;;
5003 esac
5004
5005 dflt=''
5006 case "$DEBUGGING" in
5007 both|$define) dflt='-DDEBUGGING'
5008 esac
5009
5010 : We will not override a previous value, but we might want to
5011 : augment a hint file
5012 case "$hint" in
5013 default|recommended)
5014         case "$gccversion" in
5015         1*) dflt="$dflt -fpcc-struct-return" ;;
5016         esac
5017         case "$optimize:$DEBUGGING" in
5018         *-g*:old) dflt="$dflt -DDEBUGGING";;
5019         esac
5020         case "$gccversion" in
5021         2*) if test -d /etc/conf/kconfig.d &&
5022                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5023                 then
5024                         # Interactive Systems (ISC) POSIX mode.
5025                         dflt="$dflt -posix"
5026                 fi
5027                 ;;
5028         esac
5029         case "$gccversion" in
5030         1*) ;;
5031         2.[0-8]*) ;;
5032         ?*)     echo " "
5033                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5034                 echo 'int main(void) { return 0; }' > gcctest.c
5035                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5036                         echo "Yes, it does." 2>&1
5037                         case "$ccflags" in
5038                         *strict-aliasing*)
5039                                 echo "Leaving current flags $ccflags alone." 2>&1
5040                                 ;;
5041                         *) dflt="$dflt -fno-strict-aliasing" ;;
5042                         esac
5043                 else
5044                         echo "Nope, it doesn't, but that's ok." 2>&1
5045                 fi
5046                 ;;
5047         esac
5048         # For gcc, adding -pipe speeds up compilations for some, but apparently
5049         # some assemblers can't read from stdin.  (It also slows down compilations
5050         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5051         case "$gccversion" in
5052         ?*)     echo " "
5053                 echo "Checking if your compiler accepts -pipe" 2>&1
5054                 echo 'int main(void) { return 0; }' > gcctest.c
5055                 if $cc -pipe -o gcctest gcctest.c; then
5056                         echo "Yes, it does." 2>&1
5057                         case "$ccflags" in
5058                         *-pipe*)
5059                                 echo "Leaving current flags $ccflags alone." 2>&1
5060                                 ;;
5061                         *) dflt="$dflt -pipe" ;;
5062                         esac
5063                 else
5064                         echo "Nope, it doesn't, but that's ok." 2>&1
5065                 fi
5066                 ;;
5067         esac
5068         ;;
5069 esac
5070
5071 case "$mips_type" in
5072 *BSD*|'') inclwanted="$locincpth $usrinc";;
5073 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5074 esac
5075 for thisincl in $inclwanted; do
5076         if $test -d $thisincl; then
5077                 if $test x$thisincl != x$usrinc; then
5078                         case "$dflt" in
5079                         *" -I$thisincl "*);;
5080                         *) dflt="$dflt -I$thisincl ";;
5081                         esac
5082                 fi
5083         fi
5084 done
5085
5086 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5087         xxx=true;
5088 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5089         xxx=true;
5090 else
5091         xxx=false;
5092 fi;
5093 if $xxx; then
5094         case "$dflt" in
5095         *$2*);;
5096         *) dflt="$dflt -D$2";;
5097         esac;
5098 fi'
5099
5100 set signal.h LANGUAGE_C; eval $inctest
5101
5102 case "$usesocks" in
5103 $define)
5104         ccflags="$ccflags -DSOCKS"
5105         ;;
5106 esac
5107
5108 case "$hint" in
5109 default|recommended) dflt="$ccflags $dflt" ;;
5110 *) dflt="$ccflags";;
5111 esac
5112
5113 case "$dflt" in
5114 ''|' ') dflt=none;;
5115 esac
5116
5117 $cat <<EOH
5118
5119 Your C compiler may want other flags.  For this question you should include
5120 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5121 but you should NOT include libraries or ld flags like -lwhatever.  If you
5122 want $package to honor its debug switch, you should include -DDEBUGGING here.
5123 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5124
5125 To use no flags, specify the word "none".
5126
5127 EOH
5128 set X $dflt
5129 shift
5130 dflt=${1+"$@"}
5131 rp="Any additional cc flags?"
5132 . ./myread
5133 case "$ans" in
5134 none) ccflags='';;
5135 *) ccflags="$ans";;
5136 esac
5137
5138 : the following weeds options from ccflags that are of no interest to cpp
5139 case "$cppflags" in
5140 '') cppflags="$ccflags" ;;
5141 *)  cppflags="$cppflags $ccflags" ;;
5142 esac
5143 case "$gccversion" in
5144 1*) cppflags="$cppflags -D__GNUC__"
5145 esac
5146 case "$mips_type" in
5147 '');;
5148 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5149 esac
5150 case "$cppflags" in
5151 '');;
5152 *)
5153         echo " "
5154         echo "Let me guess what the preprocessor flags are..." >&4
5155         set X $cppflags
5156         shift
5157         cppflags=''
5158         $cat >cpp.c <<'EOM'
5159 #define BLURFL foo
5160
5161 BLURFL xx LFRULB
5162 EOM
5163         previous=''
5164         for flag in $*
5165         do
5166                 case "$flag" in
5167                 -*) ftry="$flag";;
5168                 *) ftry="$previous $flag";;
5169                 esac
5170                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5171                         >cpp1.out 2>/dev/null && \
5172                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5173                         >cpp2.out 2>/dev/null && \
5174                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5175                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5176                 then
5177                         cppflags="$cppflags $ftry"
5178                         previous=''
5179                 else
5180                         previous="$flag"
5181                 fi
5182         done
5183         set X $cppflags
5184         shift
5185         cppflags=${1+"$@"}
5186         case "$cppflags" in
5187         *-*)  echo "They appear to be: $cppflags";;
5188         esac
5189         $rm -f cpp.c cpp?.out
5190         ;;
5191 esac
5192
5193 : flags used in final linking phase
5194 case "$ldflags" in
5195 '') if ./venix; then
5196                 dflt='-i -z'
5197         else
5198                 dflt=''
5199         fi
5200         case "$ccflags" in
5201         *-posix*) dflt="$dflt -posix" ;;
5202         esac
5203         ;;
5204 *) dflt="$ldflags";;
5205 esac
5206
5207 : Try to guess additional flags to pick up local libraries.
5208 for thislibdir in $libpth; do
5209         case " $loclibpth " in
5210         *" $thislibdir "*)
5211                 case "$dflt " in
5212                 *"-L$thislibdir "*) ;;
5213                 *)  dflt="$dflt -L$thislibdir" ;;
5214                 esac
5215                 ;;
5216         esac
5217 done
5218
5219 case "$dflt" in
5220 '') dflt='none' ;;
5221 esac
5222
5223 $cat <<EOH
5224
5225 Your C linker may need flags.  For this question you should
5226 include -L/whatever and any other flags used by the C linker, but you
5227 should NOT include libraries like -lwhatever.
5228
5229 Make sure you include the appropriate -L/path flags if your C linker
5230 does not normally search all of the directories you specified above,
5231 namely
5232         $libpth
5233 To use no flags, specify the word "none".
5234
5235 EOH
5236
5237 rp="Any additional ld flags (NOT including libraries)?"
5238 . ./myread
5239 case "$ans" in
5240 none) ldflags='';;
5241 *) ldflags="$ans";;
5242 esac
5243 rmlist="$rmlist pdp11"
5244
5245 : coherency check
5246 echo " "
5247 echo "Checking your choice of C compiler and flags for coherency..." >&4
5248 $cat > try.c <<'EOF'
5249 #include <stdio.h>
5250 int main() { printf("Ok\n"); return(0); }
5251 EOF
5252 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5253 shift
5254 $cat >try.msg <<'EOM'
5255 I've tried to compile and run the following simple program:
5256
5257 EOM
5258 $cat try.c >> try.msg
5259
5260 $cat >> try.msg <<EOM
5261
5262 I used the command:
5263
5264         $*
5265         $run ./try
5266
5267 and I got the following output:
5268
5269 EOM
5270 dflt=y
5271 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5272         if $sh -c "$run ./try" >>try.msg 2>&1; then
5273                 xxx=`$run ./try`
5274                 case "$xxx" in
5275                 "Ok") dflt=n ;;
5276                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5277                         case " $libs " in
5278                         *" -lsfio "*)
5279                                 cat >> try.msg <<'EOQS'
5280 If $libs contains -lsfio, and sfio is mis-configured, then it
5281 sometimes (apparently) runs and exits with a 0 status, but with no
5282 output!  It may have to do with sfio's use of _exit vs. exit.
5283
5284 EOQS
5285                                 rp="You have a big problem.  Shall I abort Configure"
5286                                 dflt=y
5287                                 ;;
5288                         esac
5289                         ;;
5290                 esac
5291         else
5292                 echo "The program compiled OK, but exited with status $?." >>try.msg
5293                 rp="You have a problem.  Shall I abort Configure"
5294                 dflt=y
5295         fi
5296 else
5297         echo "I can't compile the test program." >>try.msg
5298         rp="You have a BIG problem.  Shall I abort Configure"
5299         dflt=y
5300 fi
5301 case "$dflt" in
5302 y)
5303         $cat try.msg >&4
5304         case "$knowitall" in
5305         '')
5306                 echo "(The supplied flags or libraries might be incorrect.)"
5307                 ;;
5308         *) dflt=n;;
5309         esac
5310         echo " "
5311         . ./myread
5312         case "$ans" in
5313         n*|N*) ;;
5314         *)      echo "Ok.  Stopping Configure." >&4
5315                 exit 1
5316                 ;;
5317         esac
5318         ;;
5319 n) echo "OK, that should do.";;
5320 esac
5321 $rm_try
5322
5323 : define a shorthand compile call
5324 compile='
5325 mc_file=$1;
5326 shift;
5327 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5328 : define a shorthand compile call for compilations that should be ok.
5329 compile_ok='
5330 mc_file=$1;
5331 shift;
5332 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5333
5334 : determine filename position in cpp output
5335 echo " "
5336 echo "Computing filename position in cpp output for #include directives..." >&4
5337 case "$osname" in
5338 vos) testaccess=-e ;;
5339 *)   testaccess=-r ;;
5340 esac
5341 echo '#include <stdio.h>' > foo.c
5342 $cat >fieldn <<EOF
5343 $startsh
5344 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5345 $grep '^[       ]*#.*stdio\.h' | \
5346 while read cline; do
5347         pos=1
5348         set \$cline
5349         while $test \$# -gt 0; do
5350                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5351                         echo "\$pos"
5352                         exit 0
5353                 fi
5354                 shift
5355                 pos=\`expr \$pos + 1\`
5356         done
5357 done
5358 EOF
5359 chmod +x fieldn
5360 fieldn=`./fieldn`
5361 $rm -f foo.c fieldn
5362 case $fieldn in
5363 '') pos='???';;
5364 1) pos=first;;
5365 2) pos=second;;
5366 3) pos=third;;
5367 *) pos="${fieldn}th";;
5368 esac
5369 echo "Your cpp writes the filename in the $pos field of the line."
5370
5371 case "$osname" in
5372 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5373 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5374 *)   cppfilter='' ;;
5375 esac
5376 : locate header file
5377 $cat >findhdr <<EOF
5378 $startsh
5379 wanted=\$1
5380 name=''
5381 for usrincdir in $usrinc
5382 do
5383         if test -f \$usrincdir/\$wanted; then
5384                 echo "\$usrincdir/\$wanted"
5385                 exit 0
5386         fi
5387 done
5388 awkprg='{ print \$$fieldn }'
5389 echo "#include <\$wanted>" > foo\$\$.c
5390 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5391 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5392 while read cline; do
5393         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5394         case "\$name" in
5395         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5396         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5397         *) exit 2;;
5398         esac;
5399 done;
5400 #
5401 # status = 0: grep returned 0 lines, case statement not executed
5402 # status = 1: headerfile found
5403 # status = 2: while loop executed, no headerfile found
5404 #
5405 status=\$?
5406 $rm -f foo\$\$.c;
5407 if test \$status -eq 1; then
5408         exit 0;
5409 fi
5410 exit 1
5411 EOF
5412 chmod +x findhdr
5413
5414 : define an alternate in-header-list? function
5415 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5416 cont=true; xxf="echo \"<\$1> found.\" >&4";
5417 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5418 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5419 esac;
5420 case $# in 4) instead=instead;; *) instead="at last";; esac;
5421 while $test "$cont"; do
5422         xxx=`./findhdr $1`
5423         var=$2; eval "was=\$$2";
5424         if $test "$xxx" && $test -r "$xxx";
5425         then eval $xxf;
5426         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5427                 cont="";
5428         else eval $xxnf;
5429         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5430         set $yyy; shift; shift; yyy=$@;
5431         case $# in 0) cont="";;
5432         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5433                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5434         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5435                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5436         esac;
5437 done;
5438 while $test "$yyy";
5439 do set $yyy; var=$2; eval "was=\$$2";
5440         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5441         set $yyy; shift; shift; yyy=$@;
5442 done'
5443
5444 : see if stdlib is available
5445 set stdlib.h i_stdlib
5446 eval $inhdr
5447
5448 : check for lengths of integral types
5449 echo " "
5450 case "$intsize" in
5451 '')
5452         echo "Checking to see how big your integers are..." >&4
5453         $cat >try.c <<EOCP
5454 #include <stdio.h>
5455 #$i_stdlib I_STDLIB
5456 #ifdef I_STDLIB
5457 #include <stdlib.h>
5458 #endif
5459 int main()
5460 {
5461         printf("intsize=%d;\n", (int)sizeof(int));
5462         printf("longsize=%d;\n", (int)sizeof(long));
5463         printf("shortsize=%d;\n", (int)sizeof(short));
5464         exit(0);
5465 }
5466 EOCP
5467         set try
5468         if eval $compile_ok && $run ./try > /dev/null; then
5469                 eval `$run ./try`
5470                 echo "Your integers are $intsize bytes long."
5471                 echo "Your long integers are $longsize bytes long."
5472                 echo "Your short integers are $shortsize bytes long."
5473         else
5474                 $cat >&4 <<EOM
5475 !
5476 Help! I can't compile and run the intsize test program: please enlighten me!
5477 (This is probably a misconfiguration in your system or libraries, and
5478 you really ought to fix it.  Still, I'll try anyway.)
5479 !
5480 EOM
5481                 dflt=4
5482                 rp="What is the size of an integer (in bytes)?"
5483                 . ./myread
5484                 intsize="$ans"
5485                 dflt=$intsize
5486                 rp="What is the size of a long integer (in bytes)?"
5487                 . ./myread
5488                 longsize="$ans"
5489                 dflt=2
5490                 rp="What is the size of a short integer (in bytes)?"
5491                 . ./myread
5492                 shortsize="$ans"
5493         fi
5494         ;;
5495 esac
5496 $rm_try
5497
5498 : check for long long
5499 echo " "
5500 echo "Checking to see if you have long long..." >&4
5501 echo 'int main() { long long x = 7; return 0; }' > try.c
5502 set try
5503 if eval $compile; then
5504         val="$define"
5505         echo "You have long long."
5506 else
5507         val="$undef"
5508         echo "You do not have long long."
5509 fi
5510 $rm_try
5511 set d_longlong
5512 eval $setvar
5513
5514 : check for length of long long
5515 case "${d_longlong}${longlongsize}" in
5516 $define)
5517         echo " "
5518         echo "Checking to see how big your long longs are..." >&4
5519         $cat >try.c <<'EOCP'
5520 #include <stdio.h>
5521 int main()
5522 {
5523     printf("%d\n", (int)sizeof(long long));
5524     return(0);
5525 }
5526 EOCP
5527         set try
5528         if eval $compile_ok; then
5529                 longlongsize=`$run ./try`
5530                 echo "Your long longs are $longlongsize bytes long."
5531         else
5532                 dflt='8'
5533                 echo " "
5534                 echo "(I can't seem to compile the test program.  Guessing...)"
5535                 rp="What is the size of a long long (in bytes)?"
5536                 . ./myread
5537                 longlongsize="$ans"
5538         fi
5539         if $test "X$longsize" = "X$longlongsize"; then
5540                 echo "(That isn't any different from an ordinary long.)"
5541         fi
5542         ;;
5543 esac
5544 $rm_try
5545
5546 : see if inttypes.h is available
5547 : we want a real compile instead of Inhdr because some systems
5548 : have an inttypes.h which includes non-existent headers
5549 echo " "
5550 $cat >try.c <<EOCP
5551 #include <inttypes.h>
5552 int main() {
5553         static int32_t foo32 = 0x12345678;
5554 }
5555 EOCP
5556 set try
5557 if eval $compile; then
5558         echo "<inttypes.h> found." >&4
5559         val="$define"
5560 else
5561         echo "<inttypes.h> NOT found." >&4
5562         val="$undef"
5563 fi
5564 $rm_try
5565 set i_inttypes
5566 eval $setvar
5567
5568 : check for int64_t
5569 echo " "
5570 echo "Checking to see if you have int64_t..." >&4
5571 $cat >try.c <<EOCP
5572 #include <sys/types.h>
5573 #$i_inttypes I_INTTYPES
5574 #ifdef I_INTTYPES
5575 #include <inttypes.h>
5576 #endif
5577 int main() { int64_t x = 7; }
5578 EOCP
5579 set try
5580 if eval $compile; then
5581         val="$define"
5582         echo "You have int64_t."
5583 else
5584         val="$undef"
5585         echo "You do not have int64_t."
5586 fi
5587 $rm_try
5588 set d_int64_t
5589 eval $setvar
5590
5591
5592 echo " "
5593 echo "Checking which 64-bit integer type we could use..." >&4
5594
5595 case "$intsize" in
5596 8) val=int
5597    set quadtype
5598    eval $setvar
5599    val='"unsigned int"'
5600    set uquadtype
5601    eval $setvar
5602    quadkind=1
5603    ;;
5604 *) case "$longsize" in
5605    8) val=long
5606       set quadtype
5607       eval $setvar
5608       val='"unsigned long"'
5609       set uquadtype
5610       eval $setvar
5611       quadkind=2
5612       ;;
5613    *) case "$d_longlong:$longlongsize" in
5614       define:8)
5615         val='"long long"'
5616         set quadtype
5617         eval $setvar
5618         val='"unsigned long long"'
5619         set uquadtype
5620         eval $setvar
5621         quadkind=3
5622         ;;
5623       *) case "$d_int64_t" in
5624          define)
5625            val=int64_t
5626            set quadtype
5627            eval $setvar
5628            val=uint64_t
5629            set uquadtype
5630            eval $setvar
5631            quadkind=4
5632            ;;
5633          esac
5634          ;;
5635       esac
5636       ;;
5637    esac
5638    ;;
5639 esac
5640
5641 case "$quadtype" in
5642 '')     echo "Alas, no 64-bit integer types in sight." >&4
5643         d_quad="$undef"
5644         ;;
5645 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5646         d_quad="$define"
5647         ;;
5648 esac
5649
5650
5651 case "$uselonglong" in
5652 "$define"|true|[yY]*)
5653         cat <<EOM >&4
5654
5655 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5656 EOM
5657         use64bitint="$define"
5658         ;;
5659 esac                          
5660 case "$use64bits" in
5661 "$define"|true|[yY]*)
5662         cat <<EOM >&4
5663
5664 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5665 EOM
5666         use64bitint="$define"
5667         ;;
5668 esac                          
5669 case "$use64bitints" in
5670 "$define"|true|[yY]*)
5671         cat <<EOM >&4
5672
5673 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5674 EOM
5675         use64bitint="$define"
5676         ;;
5677 esac                          
5678 case "$use64bitsint" in
5679 "$define"|true|[yY]*)
5680         cat <<EOM >&4
5681
5682 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5683 EOM
5684         use64bitint="$define"
5685         ;;
5686 esac                          
5687 case "$uselonglongs" in
5688 "$define"|true|[yY]*)
5689         cat <<EOM >&4
5690
5691 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5692 EOM
5693         use64bitint="$define"
5694         ;;
5695 esac                          
5696 case "$use64bitsall" in
5697 "$define"|true|[yY]*)
5698         cat <<EOM >&4
5699
5700 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5701 EOM
5702         use64bitall="$define"
5703         ;;
5704 esac                          
5705
5706 case "$ccflags" in
5707 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5708 esac
5709 case "$use64bitall" in
5710 "$define"|true|[yY]*) use64bitint="$define" ;;
5711 esac
5712
5713 case "$longsize" in
5714 8) cat <<EOM
5715
5716 You have natively 64-bit long integers.
5717 EOM
5718    val="$define"
5719    ;;
5720 *) case "$use64bitint" in
5721    "$define"|true|[yY]*) dflt='y';;
5722    *) dflt='n';;
5723    esac
5724    case "$d_quad" in
5725    "$define") ;;
5726    *) dflt='n' ;;
5727    esac
5728    cat <<EOM
5729
5730 Perl can be built to take advantage of 64-bit integer types
5731 on some systems.  To do so, Configure can be run with -Duse64bitint.
5732 Choosing this option will most probably introduce binary incompatibilities.
5733
5734 If this doesn't make any sense to you, just accept the default '$dflt'.
5735 (The default has been chosen based on your configuration.)
5736 EOM
5737    rp='Try to use 64-bit integers, if available?'
5738    . ./myread
5739    case "$ans" in
5740    [yY]*) val="$define" ;;
5741    *)     val="$undef"  ;;
5742    esac
5743    ;;
5744 esac
5745 set use64bitint
5746 eval $setvar
5747
5748 case "$use64bitall" in
5749 "$define"|true|[yY]*) dflt='y' ;;
5750 *) case "$longsize" in
5751    8) dflt='y' ;;
5752    *) dflt='n' ;;
5753    esac
5754    ;;
5755 esac    
5756 cat <<EOM
5757
5758 You may also choose to try maximal 64-bitness.  It means using as much
5759 64-bitness as possible on the platform.  This in turn means even more
5760 binary incompatibilities.  On the other hand, your platform may not
5761 have any more 64-bitness available than what you already have chosen.
5762
5763 If this doesn't make any sense to you, just accept the default '$dflt'.
5764 (The default has been chosen based on your configuration.)
5765 EOM
5766 rp='Try to use maximal 64-bit support, if available?'
5767 . ./myread
5768 case "$ans" in
5769 [yY]*) val="$define" ;;
5770 *)     val="$undef"  ;;
5771 esac
5772 set use64bitall
5773 eval $setvar
5774 case "$use64bitall" in
5775 "$define")
5776         case "$use64bitint" in
5777         "$undef")
5778                 cat <<EOM
5779
5780 Since you have chosen a maximally 64-bit build, I'm also turning on
5781 the use of 64-bit integers.
5782 EOM
5783                 use64bitint="$define" ;;
5784         esac
5785         ;;
5786 esac
5787
5788 : Look for a hint-file generated 'call-back-unit'.  If the
5789 : user has specified that a 64-bit perl is to be built,
5790 : we may need to set or change some other defaults.
5791 if $test -f use64bitint.cbu; then
5792         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5793         . ./use64bitint.cbu
5794 fi
5795 case "$use64bitint" in
5796 "$define"|true|[yY]*)
5797         case "$longsize" in
5798         4) case "$archname64" in
5799            '') archname64=64int ;;
5800            esac
5801            ;;
5802         esac
5803         ;;
5804 esac
5805
5806 : Look for a hint-file generated 'call-back-unit'.  If the
5807 : user has specified that a maximally 64-bit perl is to be built,
5808 : we may need to set or change some other defaults.
5809 if $test -f use64bitall.cbu; then
5810         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5811         . ./use64bitall.cbu
5812 fi
5813 case "$use64bitall" in
5814 "$define"|true|[yY]*)
5815         case "$longsize" in
5816         4) case "$archname64" in
5817            ''|64int) archname64=64all ;;
5818            esac
5819            ;;
5820         esac
5821         ;;
5822 esac
5823
5824 case "$d_quad:$use64bitint" in
5825 $undef:$define)
5826         cat >&4 <<EOF
5827
5828 *** You have chosen to use 64-bit integers,
5829 *** but none can be found.
5830 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5831 *** Cannot continue, aborting.
5832
5833 EOF
5834         exit 1
5835         ;;
5836 esac
5837
5838 : check for length of double
5839 echo " "
5840 case "$doublesize" in
5841 '')
5842         echo "Checking to see how big your double precision numbers are..." >&4
5843         $cat >try.c <<EOCP
5844 #include <stdio.h>
5845 #$i_stdlib I_STDLIB
5846 #ifdef I_STDLIB
5847 #include <stdlib.h>
5848 #endif
5849 int main()
5850 {
5851     printf("%d\n", (int)sizeof(double));
5852     exit(0);
5853 }
5854 EOCP
5855         set try
5856         if eval $compile_ok; then
5857                 doublesize=`$run ./try`
5858                 echo "Your double is $doublesize bytes long."
5859         else
5860                 dflt='8'
5861                 echo "(I can't seem to compile the test program.  Guessing...)"
5862                 rp="What is the size of a double precision number (in bytes)?"
5863                 . ./myread
5864                 doublesize="$ans"
5865         fi
5866         ;;
5867 esac
5868 $rm_try
5869
5870 : check for long doubles
5871 echo " "
5872 echo "Checking to see if you have long double..." >&4
5873 echo 'int main() { long double x = 7.0; }' > try.c
5874 set try
5875 if eval $compile; then
5876         val="$define"
5877         echo "You have long double."
5878 else
5879         val="$undef"
5880         echo "You do not have long double."
5881 fi
5882 $rm_try
5883 set d_longdbl
5884 eval $setvar
5885
5886 : check for length of long double
5887 case "${d_longdbl}${longdblsize}" in
5888 $define)
5889         echo " "
5890         echo "Checking to see how big your long doubles are..." >&4
5891         $cat >try.c <<'EOCP'
5892 #include <stdio.h>
5893 int main()
5894 {
5895         printf("%d\n", sizeof(long double));
5896 }
5897 EOCP
5898         set try
5899         set try
5900         if eval $compile; then
5901                 longdblsize=`$run ./try`
5902                 echo "Your long doubles are $longdblsize bytes long."
5903         else
5904                 dflt='8'
5905                 echo " "
5906                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5907                 rp="What is the size of a long double (in bytes)?"
5908                 . ./myread
5909                 longdblsize="$ans"
5910         fi
5911         if $test "X$doublesize" = "X$longdblsize"; then
5912                 echo "That isn't any different from an ordinary double."
5913                 echo "I'll keep your setting anyway, but you may see some"
5914                 echo "harmless compilation warnings."
5915         fi
5916         ;;
5917 esac
5918 $rm_try
5919
5920 : determine the architecture name
5921 echo " "
5922 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5923         tarch=`arch`"-$osname"
5924 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5925         if uname -m > tmparch 2>&1 ; then
5926                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5927                         -e 's/$/'"-$osname/" tmparch`
5928         else
5929                 tarch="$osname"
5930         fi
5931         $rm -f tmparch
5932 else
5933         tarch="$osname"
5934 fi
5935 case "$myarchname" in
5936 ''|"$tarch") ;;
5937 *)
5938         echo "(Your architecture name used to be $myarchname.)"
5939         archname=''
5940         ;;
5941 esac
5942 case "$targetarch" in
5943 '') ;;
5944 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5945 esac
5946 myarchname="$tarch"
5947 case "$archname" in
5948 '') dflt="$tarch";;
5949 *) dflt="$archname";;
5950 esac
5951 rp='What is your architecture name'
5952 . ./myread
5953 archname="$ans"
5954 case "$usethreads" in
5955 $define)
5956         echo "Threads selected." >&4
5957         case "$archname" in
5958         *-thread*) echo "...and architecture name already has -thread." >&4
5959                 ;;
5960         *)      archname="$archname-thread"
5961                 echo "...setting architecture name to $archname." >&4
5962                 ;;
5963         esac
5964         ;;
5965 esac
5966 case "$usemultiplicity" in
5967 $define)
5968         echo "Multiplicity selected." >&4
5969         case "$archname" in
5970         *-multi*) echo "...and architecture name already has -multi." >&4
5971                 ;;
5972         *)      archname="$archname-multi"
5973                 echo "...setting architecture name to $archname." >&4
5974                 ;;
5975         esac
5976         ;;
5977 esac
5978 case "$use64bitint$use64bitall" in
5979 *"$define"*)
5980         case "$archname64" in
5981         '')
5982                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5983                 ;;
5984         *)
5985                 case "$use64bitint" in
5986                 "$define") echo "64 bit integers selected." >&4 ;;
5987                 esac
5988                 case "$use64bitall" in
5989                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5990                 esac
5991                 case "$archname" in
5992                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5993                         ;;
5994                 *)      archname="$archname-$archname64"
5995                         echo "...setting architecture name to $archname." >&4
5996                         ;;
5997                 esac
5998                 ;;
5999         esac
6000 esac
6001 case "$uselongdouble" in
6002 $define)
6003         echo "Long doubles selected." >&4
6004         case "$longdblsize" in
6005         $doublesize)
6006                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6007                 ;;
6008         *)
6009                 case "$archname" in
6010                 *-ld*) echo "...and architecture name already has -ld." >&4
6011                         ;;
6012                 *)      archname="$archname-ld"
6013                         echo "...setting architecture name to $archname." >&4
6014                         ;;
6015                 esac
6016                 ;;
6017         esac
6018         ;;
6019 esac
6020 case "$useperlio" in
6021 $define)
6022         echo "Perlio selected." >&4
6023         ;;
6024 *)
6025         echo "Perlio not selected, using stdio." >&4
6026         case "$archname" in
6027         *-stdio*) echo "...and architecture name already has -stdio." >&4
6028                 ;;
6029         *)      archname="$archname-stdio"
6030                 echo "...setting architecture name to $archname." >&4
6031                 ;;
6032         esac
6033         ;;
6034 esac
6035 if $test -f archname.cbu; then
6036         echo "Your platform has some specific hints for architecture name, using them..."
6037         . ./archname.cbu
6038 fi
6039
6040 : set the prefixit variable, to compute a suitable default value
6041 prefixit='case "$3" in
6042 ""|none)
6043         case "$oldprefix" in
6044         "") eval "$1=\"\$$2\"";;
6045         *)
6046                 case "$3" in
6047                 "") eval "$1=";;
6048                 none)
6049                         eval "tp=\"\$$2\"";
6050                         case "$tp" in
6051                         ""|" ") eval "$1=\"\$$2\"";;
6052                         *) eval "$1=";;
6053                         esac;;
6054                 esac;;
6055         esac;;
6056 *)
6057         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6058         case "$tp" in
6059         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6060         /*-$oldprefix/*|\~*-$oldprefix/*)
6061                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6062         *) eval "$1=\"\$$2\"";;
6063         esac;;
6064 esac'
6065
6066 : determine installation style
6067 : For now, try to deduce it from prefix unless it is already set.
6068 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6069 case "$installstyle" in
6070 '')     case "$prefix" in
6071                 *perl*) dflt='lib';;
6072                 *) dflt='lib/perl5' ;;
6073         esac
6074         ;;
6075 *)      dflt="$installstyle" ;;
6076 esac
6077 : Probably not worth prompting for this since we prompt for all
6078 : the directories individually, and the prompt would be too long and
6079 : confusing anyway.
6080 installstyle=$dflt
6081
6082 : determine where public executables go
6083 echo " "
6084 set dflt bin bin
6085 eval $prefixit
6086 fn=d~
6087 rp='Pathname where the public executables will reside?'
6088 . ./getfile
6089 if $test "X$ansexp" != "X$binexp"; then
6090         installbin=''
6091 fi
6092 prefixvar=bin
6093 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6094 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6095 :     this via initialinstalllocation
6096 . ./setprefixvar
6097
6098 case "$userelocatableinc" in
6099 $define|true|[yY]*)     dflt='y' ;;
6100 *)                      dflt='n' ;;
6101 esac
6102 cat <<EOM
6103
6104 Would you like to build Perl so that the installation is relocatable, so that
6105 library paths in @INC are determined relative to the path of the perl binary?
6106 This is not advised for system Perl installs, or if you need to run setid
6107 scripts or scripts under taint mode.
6108
6109 If this doesn't make any sense to you, just accept the default '$dflt'.
6110 EOM
6111 rp='Use relocatable @INC?'
6112 . ./myread
6113 case "$ans" in
6114 y|Y)    val="$define" ;;
6115 *)      val="$undef"  ;;
6116 esac
6117 set userelocatableinc
6118 eval $setvar
6119
6120 initialinstalllocation="$binexp"
6121 : Default prefix is now "up one level from where the binaries are"
6122 case "$userelocatableinc" in
6123 $define|true|[yY]*)
6124     bin=".../"
6125     binexp=".../"
6126     prefix=".../.."
6127     prefixexp=".../.."
6128     installprefixexp=".../.."
6129     ;;
6130 esac
6131
6132 : determine where private library files go
6133 : Usual default is /usr/local/lib/perl5/$version.
6134 : Also allow things like /opt/perl/lib/$version, since
6135 : /opt/perl/lib/perl5... would be redundant.
6136 : The default "style" setting is made in installstyle.U
6137 case "$installstyle" in
6138 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6139 *)       set dflt privlib lib/$version ;;
6140 esac
6141 eval $prefixit
6142 $cat <<EOM
6143
6144 There are some auxiliary files for $package that need to be put into a
6145 private library directory that is accessible by everyone.
6146
6147 EOM
6148 fn=$binexp
6149 fn=d~+
6150 rp='Pathname where the private library files will reside?'
6151 . ./getfile
6152 prefixvar=privlib
6153 . ./setprefixvar
6154
6155 : set the prefixup variable, to restore leading tilda escape
6156 prefixup='case "$prefixexp" in
6157 "$prefix") ;;
6158 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6159 esac'
6160
6161 : determine where public architecture dependent libraries go
6162 set archlib archlib
6163 eval $prefixit
6164 : privlib default is /usr/local/lib/$package/$version
6165 : archlib default is /usr/local/lib/$package/$version/$archname
6166 : privlib may have an optional trailing /share.
6167 tdflt=`echo $privlib | $sed 's,/share$,,'`
6168 tdflt=$tdflt/$archname
6169 case "$archlib" in
6170 '')     dflt=$tdflt
6171         ;;
6172 *)      dflt="$archlib"
6173     ;;
6174 esac
6175 $cat <<EOM
6176
6177 $spackage contains architecture-dependent library files.  If you are
6178 sharing libraries in a heterogeneous environment, you might store
6179 these files in a separate location.  Otherwise, you can just include
6180 them with the rest of the public library files.
6181
6182 EOM
6183 fn=$binexp
6184 fn=d+~
6185 rp='Where do you want to put the public architecture-dependent libraries?'
6186 . ./getfile
6187 prefixvar=archlib
6188 . ./setprefixvar
6189 if $test X"$archlib" = X"$privlib"; then
6190         d_archlib="$undef"
6191 else
6192         d_archlib="$define"
6193 fi
6194
6195 : see if setuid scripts can be secure
6196 $cat <<EOM
6197
6198 Some kernels have a bug that prevents setuid #! scripts from being
6199 secure.  Some sites have disabled setuid #! scripts because of this.
6200
6201 First let's decide if your kernel supports secure setuid #! scripts.
6202 (If setuid #! scripts would be secure but have been disabled anyway,
6203 don't say that they are secure if asked.)
6204
6205 EOM
6206
6207 val="$undef"
6208 if $test -d /dev/fd; then
6209         echo "#!$ls" >reflect
6210         chmod +x,u+s reflect
6211         ./reflect >flect 2>&1
6212         if $contains "/dev/fd" flect >/dev/null; then
6213                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6214                 val="$define"
6215         else
6216                 $cat <<EOM
6217 If you are not sure if they are secure, I can check but I'll need a
6218 username and password different from the one you are using right now.
6219 If you don't have such a username or don't want me to test, simply
6220 enter 'none'.
6221
6222 EOM
6223                 rp='Other username to test security of setuid scripts with?'
6224                 dflt='none'
6225                 . ./myread
6226                 case "$ans" in
6227                 n|none)
6228                         case "$d_suidsafe" in
6229                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6230                                 dflt=n;;
6231                         "$undef")
6232                                 echo "Well, the $hint value is *not* secure." >&4
6233                                 dflt=n;;
6234                         *)      echo "Well, the $hint value *is* secure." >&4
6235                                 dflt=y;;
6236                         esac
6237                         ;;
6238                 *)
6239                         $rm -f reflect flect
6240                         echo "#!$ls" >reflect
6241                         chmod +x,u+s reflect
6242                         echo >flect
6243                         chmod a+w flect
6244                         echo '"su" will (probably) prompt you for '"$ans's password."
6245                         su $ans -c './reflect >flect'
6246                         if $contains "/dev/fd" flect >/dev/null; then
6247                                 echo "Okay, it looks like setuid scripts are secure." >&4
6248                                 dflt=y
6249                         else
6250                                 echo "I don't think setuid scripts are secure." >&4
6251                                 dflt=n
6252                         fi
6253                         ;;
6254                 esac
6255                 rp='Does your kernel have *secure* setuid scripts?'
6256                 . ./myread
6257                 case "$ans" in
6258                 [yY]*)  val="$define";;
6259                 *)      val="$undef";;
6260                 esac
6261         fi
6262 else
6263         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6264         echo "(That's for file descriptors, not floppy disks.)"
6265         val="$undef"
6266 fi
6267 set d_suidsafe
6268 eval $setvar
6269
6270 $rm -f reflect flect
6271
6272 : now see if they want to do setuid emulation
6273 echo " "
6274 val="$undef"
6275 case "$d_suidsafe" in
6276 "$define")
6277         val="$undef"
6278         echo "No need to emulate SUID scripts since they are secure here." >&4
6279         ;;
6280 *)
6281         $cat <<EOM
6282 Some systems have disabled setuid scripts, especially systems where
6283 setuid scripts cannot be secure.  On systems where setuid scripts have
6284 been disabled, the setuid/setgid bits on scripts are currently
6285 useless.  It is possible for $package to detect those bits and emulate
6286 setuid/setgid in a secure fashion.  This emulation will only work if
6287 setuid scripts have been disabled in your kernel.
6288
6289 EOM
6290         case "$d_dosuid" in
6291         "$define") dflt=y ;;
6292         *) dflt=n ;;
6293         esac
6294         rp="Do you want to do setuid/setgid emulation?"
6295         . ./myread
6296         case "$ans" in
6297         [yY]*)  val="$define";;
6298         *)      val="$undef";;
6299         esac
6300         ;;
6301 esac
6302 set d_dosuid
6303 eval $setvar
6304
6305 : Find perl5.005 or later.
6306 echo "Looking for a previously installed perl5.005 or later... "
6307 case "$perl5" in
6308 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6309                 : Check if this perl is recent and can load a simple module
6310                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6311                         perl5=$tdir/perl
6312                         break;
6313                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6314                         perl5=$tdir/perl5
6315                         break;
6316                 fi
6317         done
6318         ;;
6319 *)      perl5="$perl5"
6320         ;;
6321 esac
6322 case "$perl5" in
6323 '')     echo "None found.  That's ok.";;
6324 *)      echo "Using $perl5." ;;
6325 esac
6326
6327 $cat <<EOM
6328
6329 After $package is installed, you may wish to install various
6330 add-on modules and utilities.  Typically, these add-ons will
6331 be installed under $prefix with the rest
6332 of this package.  However, you may wish to install such add-ons
6333 elsewhere under a different prefix.
6334
6335 If you do not wish to put everything under a single prefix, that's
6336 ok.  You will be prompted for the individual locations; this siteprefix
6337 is only used to suggest the defaults.
6338
6339 The default should be fine for most people.
6340
6341 EOM
6342 fn=d~+
6343 rp='Installation prefix to use for add-on modules and utilities?'
6344 : XXX Here might be another good place for an installstyle setting.
6345 case "$siteprefix" in
6346 '') dflt=$prefix ;;
6347 *)  dflt=$siteprefix ;;
6348 esac
6349 . ./getfile
6350 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6351 oldsiteprefix=''
6352 case "$siteprefix" in
6353 '') ;;
6354 *)      case "$ans" in
6355         "$prefix") ;;
6356         *) oldsiteprefix="$prefix";;
6357         esac
6358         ;;
6359 esac
6360 siteprefix="$ans"
6361 siteprefixexp="$ansexp"
6362
6363 : determine where site specific libraries go.
6364 : Usual default is /usr/local/lib/perl5/site_perl/$version
6365 : The default "style" setting is made in installstyle.U
6366 : XXX No longer works with Prefixit stuff.
6367 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6368 case "$sitelib" in
6369 '') case "$installstyle" in
6370         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6371         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6372         esac
6373         ;;
6374 *)      dflt="$sitelib"
6375         ;;
6376 esac
6377 $cat <<EOM
6378
6379 The installation process will create a directory for
6380 site-specific extensions and modules.  Most users find it convenient
6381 to place all site-specific files in this directory rather than in the
6382 main distribution directory.
6383
6384 EOM
6385 fn=d~+
6386 rp='Pathname for the site-specific library files?'
6387 . ./getfile
6388 prefixvar=sitelib
6389 . ./setprefixvar
6390 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6391
6392 : Determine list of previous versions to include in @INC
6393 $cat > getverlist <<EOPL
6394 #!$perl5 -w
6395 use File::Basename;
6396 \$api_versionstring = "$api_versionstring";
6397 \$version = "$version";
6398 \$stem = "$sitelib_stem";
6399 \$archname = "$archname";
6400 EOPL
6401         $cat >> getverlist <<'EOPL'
6402 # The list found is store twice for each entry: the original name, and
6403 # the binary broken down version as pack "sss", so sorting is easy and
6404 # unambiguous. This will work for all versions that have a maximum of
6405 # three digit groups, separate by '.'s or '_'s. Names are extended with
6406 # ".0.0" to ensure at least three elements for the pack.
6407 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6408
6409 # Can't have leading @ because metaconfig interprets it as a command!
6410 ;@inc_version_list=();
6411 # XXX Redo to do opendir/readdir?
6412 if (-d $stem) {
6413     chdir($stem);
6414     ;@candidates = map {
6415         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6416 }
6417 else {
6418     ;@candidates = ();
6419 }
6420
6421 ($pversion, $aversion, $vsn5005) = map {
6422     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6423 foreach $d (@candidates) {
6424     if ($d->[1] lt $pversion) {
6425         if ($d->[1] ge $aversion) {
6426             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6427         }
6428         elsif ($d->[1] ge $vsn5005) {
6429             unshift(@inc_version_list, grep { -d } $d->[0]);
6430         }
6431     }
6432     else {
6433         # Skip newer version.  I.e. don't look in
6434         # 5.7.0 if we're installing 5.6.1.
6435     }
6436 }
6437
6438 if (@inc_version_list) {
6439     print join(' ', @inc_version_list);
6440 }
6441 else {
6442     # Blank space to preserve value for next Configure run.
6443     print " ";
6444 }
6445 EOPL
6446 chmod +x getverlist
6447 case "$inc_version_list" in
6448 '')     if test -x "$perl5$exe_ext"; then
6449                 dflt=`$perl5 getverlist`
6450         else
6451                 dflt='none'
6452         fi
6453         ;;
6454 $undef) dflt='none' ;;
6455 *)  eval dflt=\"$inc_version_list\" ;;
6456 esac
6457 case "$dflt" in
6458 ''|' ') dflt=none ;;
6459 esac
6460 case "$dflt" in
6461 5.005) dflt=none ;;
6462 esac
6463 $cat <<EOM
6464
6465 In order to ease the process of upgrading, this version of perl
6466 can be configured to use modules built and installed with earlier
6467 versions of perl that were installed under $prefix.  Specify here
6468 the list of earlier versions that this version of perl should check.
6469 If Configure detected no earlier versions of perl installed under
6470 $prefix, then the list will be empty.  Answer 'none' to tell perl
6471 to not search earlier versions.
6472
6473 The default should almost always be sensible, so if you're not sure,
6474 just accept the default.
6475 EOM
6476
6477 rp='List of earlier versions to include in @INC?'
6478 . ./myread
6479 case "$ans" in
6480 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6481 *) inc_version_list="$ans" ;;
6482 esac
6483 case "$inc_version_list" in
6484 ''|' ')
6485         inc_version_list_init='0'
6486         d_inc_version_list="$undef"
6487         ;;
6488 *)      inc_version_list_init=`echo $inc_version_list |
6489                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6490         d_inc_version_list="$define"
6491         ;;
6492 esac
6493 $rm -f getverlist
6494
6495 : see if this is a malloc.h system
6496 : we want a real compile instead of Inhdr because some systems have a
6497 : malloc.h that just gives a compile error saying to use stdlib.h instead
6498 echo " "
6499 $cat >try.c <<EOCP
6500 #include <stdlib.h>
6501 #include <malloc.h>
6502 int main () { return 0; }
6503 EOCP
6504 set try
6505 if eval $compile; then
6506     echo "<malloc.h> found." >&4
6507     val="$define"
6508 else
6509     echo "<malloc.h> NOT found." >&4
6510     val="$undef"
6511 fi
6512 $rm_try
6513 set i_malloc
6514 eval $setvar
6515
6516 : check for void type
6517 echo " "
6518 echo "Checking to see how well your C compiler groks the void type..." >&4
6519 case "$voidflags" in
6520 '')
6521         $cat >try.c <<EOCP
6522 #$i_stdlib I_STDLIB
6523 #ifdef I_STDLIB
6524 #include <stdlib.h>
6525 #endif
6526 #if TRY & 1
6527 void sub() {
6528 #else
6529 sub() {
6530 #endif
6531         extern void moo();      /* function returning void */
6532         void (*goo)();          /* ptr to func returning void */
6533 #if TRY & 8
6534         void *hue;              /* generic ptr */
6535 #endif
6536 #if TRY & 2
6537         void (*foo[10])();
6538 #endif
6539
6540 #if TRY & 4
6541         if(goo == moo) {
6542                 exit(0);
6543         }
6544 #endif
6545         exit(0);
6546 }
6547 int main() { sub(); }
6548 EOCP
6549         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6550                 voidflags=$defvoidused
6551         echo "Good.  It appears to support void to the level $package wants.">&4
6552                 if $contains warning .out >/dev/null 2>&1; then
6553                         echo "However, you might get some warnings that look like this:"
6554                         $cat .out
6555                 fi
6556         else
6557 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6558                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6559                         echo "It supports 1..."
6560                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6561                                 echo "It also supports 2..."
6562                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6563                                         voidflags=7
6564                                         echo "And it supports 4 but not 8 definitely."
6565                                 else
6566                                         echo "It doesn't support 4..."
6567                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6568                                                 voidflags=11
6569                                                 echo "But it supports 8."
6570                                         else
6571                                                 voidflags=3
6572                                                 echo "Neither does it support 8."
6573                                         fi
6574                                 fi
6575                         else
6576                                 echo "It does not support 2..."
6577                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6578                                         voidflags=13
6579                                         echo "But it supports 4 and 8."
6580                                 else
6581                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6582                                                 voidflags=5
6583                                                 echo "And it supports 4 but has not heard about 8."
6584                                         else
6585                                                 echo "However it supports 8 but not 4."
6586                                         fi
6587                                 fi
6588                         fi
6589                 else
6590                         echo "There is no support at all for void."
6591                         voidflags=0
6592                 fi
6593         fi
6594 esac
6595 case "$voidflags" in
6596 "$defvoidused") ;;
6597 *)      $cat >&4 <<'EOM'
6598   Support flag bits are:
6599     1: basic void declarations.
6600     2: arrays of pointers to functions returning void.
6601     4: operations between pointers to and addresses of void functions.
6602     8: generic void pointers.
6603 EOM
6604         dflt="$voidflags";
6605         rp="Your void support flags add up to what?"
6606         . ./myread
6607         voidflags="$ans"
6608         ;;
6609 esac
6610 $rm_try
6611
6612 : check for length of pointer
6613 echo " "
6614 case "$ptrsize" in
6615 '')
6616         echo "Checking to see how big your pointers are..." >&4
6617         if test "$voidflags" -gt 7; then
6618                 echo '#define VOID_PTR char *' > try.c
6619         else
6620                 echo '#define VOID_PTR void *' > try.c
6621         fi
6622         $cat >>try.c <<EOCP
6623 #include <stdio.h>
6624 #$i_stdlib I_STDLIB
6625 #ifdef I_STDLIB
6626 #include <stdlib.h>
6627 #endif
6628 int main()
6629 {
6630     printf("%d\n", (int)sizeof(VOID_PTR));
6631     exit(0);
6632 }
6633 EOCP
6634         set try
6635         if eval $compile_ok; then
6636                 ptrsize=`$run ./try`
6637                 echo "Your pointers are $ptrsize bytes long."
6638         else
6639                 dflt='4'
6640                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6641                 rp="What is the size of a pointer (in bytes)?"
6642                 . ./myread
6643                 ptrsize="$ans"
6644         fi
6645         ;;
6646 esac
6647 $rm_try
6648 case "$use64bitall" in
6649 "$define"|true|[yY]*)
6650         case "$ptrsize" in
6651         4)      cat <<EOM >&4
6652
6653 *** You have chosen a maximally 64-bit build,
6654 *** but your pointers are only 4 bytes wide.
6655 *** Please rerun Configure without -Duse64bitall.
6656 EOM
6657                 case "$d_quad" in
6658                 define)
6659                         cat <<EOM >&4
6660 *** Since you have quads, you could possibly try with -Duse64bitint.
6661 EOM
6662                         ;;
6663                 esac
6664                 cat <<EOM >&4
6665 *** Cannot continue, aborting.
6666
6667 EOM
6668
6669                 exit 1
6670                 ;;
6671         esac
6672         ;;
6673 esac
6674
6675
6676 : determine whether to use malloc wrapping
6677 echo " "
6678 case "$usemallocwrap" in
6679 [yY]*|true|$define)     dflt='y' ;;
6680 [nN]*|false|$undef)     dflt='n' ;;
6681 *)      case "$usedevel" in
6682         [yY]*|true|$define)     dflt='y' ;;
6683         *) dflt='n' ;;
6684         esac
6685         ;;
6686 esac
6687 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6688 . ./myread
6689 usemallocwrap="$ans"
6690 case "$ans" in
6691 y*|true)
6692         usemallocwrap="$define" ;;
6693 *)
6694         usemallocwrap="$undef" ;;
6695 esac
6696
6697 : determine which malloc to compile in
6698 echo " "
6699 case "$usemymalloc" in
6700 [yY]*|true|$define)     dflt='y' ;;
6701 [nN]*|false|$undef)     dflt='n' ;;
6702 *)      case "$ptrsize" in
6703         4) dflt='y' ;;
6704         *) dflt='n' ;;
6705         esac
6706         ;;
6707 esac
6708 rp="Do you wish to attempt to use the malloc that comes with $package?"
6709 . ./myread
6710 usemymalloc="$ans"
6711 case "$ans" in
6712 y*|true)
6713         usemymalloc='y'
6714         mallocsrc='malloc.c'
6715         mallocobj="malloc$_o"
6716         d_mymalloc="$define"
6717         case "$libs" in
6718         *-lmalloc*)
6719                 : Remove malloc from list of libraries to use
6720                 echo "Removing unneeded -lmalloc from library list" >&4
6721                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6722                 shift
6723                 libs="$*"
6724                 echo "libs = $libs" >&4
6725                 ;;
6726         esac
6727         ;;
6728 *)
6729         usemymalloc='n'
6730         mallocsrc=''
6731         mallocobj=''
6732         d_mymalloc="$undef"
6733         ;;
6734 esac
6735
6736 : compute the return types of malloc and free
6737 echo " "
6738 $cat >malloc.c <<END
6739 #$i_malloc I_MALLOC
6740 #$i_stdlib I_STDLIB
6741 #include <stdio.h>
6742 #include <sys/types.h>
6743 #ifdef I_MALLOC
6744 #include <malloc.h>
6745 #endif
6746 #ifdef I_STDLIB
6747 #include <stdlib.h>
6748 #endif
6749 #ifdef TRY_MALLOC
6750 void *malloc();
6751 #endif
6752 #ifdef TRY_FREE
6753 void free();
6754 #endif
6755 END
6756 case "$malloctype" in
6757 '')
6758         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6759                 malloctype='void *'
6760         else
6761                 malloctype='char *'
6762         fi
6763         ;;
6764 esac
6765 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6766
6767 case "$freetype" in
6768 '')
6769         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6770                 freetype='void'
6771         else
6772                 freetype='int'
6773         fi
6774         ;;
6775 esac
6776 echo "Your system uses $freetype free(), it would seem." >&4
6777 $rm -f malloc.[co]
6778 : determine where site specific architecture-dependent libraries go.
6779 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6780 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6781 : sitelib may have an optional trailing /share.
6782 case "$sitearch" in
6783 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6784         dflt="$dflt/$archname"
6785         ;;
6786 *)      dflt="$sitearch"
6787         ;;
6788 esac
6789 set sitearch sitearch none
6790 eval $prefixit
6791 $cat <<EOM
6792
6793 The installation process will also create a directory for
6794 architecture-dependent site-specific extensions and modules.
6795
6796 EOM
6797 fn=d~+
6798 rp='Pathname for the site-specific architecture-dependent library files?'
6799 . ./getfile
6800 prefixvar=sitearch
6801 . ./setprefixvar
6802 if $test X"$sitearch" = X"$sitelib"; then
6803         d_sitearch="$undef"
6804 else
6805         d_sitearch="$define"
6806 fi
6807
6808 $cat <<EOM
6809
6810 The installation process will also create a directory for
6811 vendor-supplied add-ons.  Vendors who supply perl with their system
6812 may find it convenient to place all vendor-supplied files in this
6813 directory rather than in the main distribution directory.  This will
6814 ease upgrades between binary-compatible maintenance versions of perl.
6815
6816 Of course you may also use these directories in whatever way you see
6817 fit.  For example, you might use them to access modules shared over a
6818 company-wide network.
6819
6820 The default answer should be fine for most people.
6821 This causes further questions about vendor add-ons to be skipped
6822 and no vendor-specific directories will be configured for perl.
6823
6824 EOM
6825 rp='Do you want to configure vendor-specific add-on directories?'
6826 case "$usevendorprefix" in
6827 define|true|[yY]*) dflt=y ;;
6828 *)      : User may have set vendorprefix directly on Configure command line.
6829         case "$vendorprefix" in
6830         ''|' ') dflt=n ;;
6831         *)      dflt=y ;;
6832         esac
6833         ;;
6834 esac
6835 . ./myread
6836 case "$ans" in
6837 [yY]*)  fn=d~+
6838         rp='Installation prefix to use for vendor-supplied add-ons?'
6839         case "$vendorprefix" in
6840         '') dflt='' ;;
6841         *)  dflt=$vendorprefix ;;
6842         esac
6843         . ./getfile
6844         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6845         oldvendorprefix=''
6846         case "$vendorprefix" in
6847         '') ;;
6848         *)      case "$ans" in
6849                 "$prefix") ;;
6850                 *) oldvendorprefix="$prefix";;
6851                 esac
6852                 ;;
6853         esac
6854         usevendorprefix="$define"
6855         vendorprefix="$ans"
6856         vendorprefixexp="$ansexp"
6857         ;;
6858 *)      usevendorprefix="$undef"
6859         vendorprefix=''
6860         vendorprefixexp=''
6861         ;;
6862 esac
6863
6864 case "$vendorprefix" in
6865 '')     d_vendorlib="$undef"
6866         vendorlib=''
6867         vendorlibexp=''
6868         ;;
6869 *)      d_vendorlib="$define"
6870         : determine where vendor-supplied modules go.
6871         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6872         case "$vendorlib" in
6873         '')
6874                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6875                 case "$installstyle" in
6876                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6877                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6878                 esac
6879                 ;;
6880         *)      dflt="$vendorlib"
6881                 ;;
6882         esac
6883         fn=d~+
6884         rp='Pathname for the vendor-supplied library files?'
6885         . ./getfile
6886         vendorlib="$ans"
6887         vendorlibexp="$ansexp"
6888         ;;
6889 esac
6890 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6891 prefixvar=vendorlib
6892 . ./installprefix
6893
6894 case "$vendorprefix" in
6895 '')     d_vendorarch="$undef"
6896         vendorarch=''
6897         vendorarchexp=''
6898         ;;
6899 *)      d_vendorarch="$define"
6900         : determine where vendor-supplied architecture-dependent libraries go.
6901         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6902         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6903         : vendorlib may have an optional trailing /share.
6904         case "$vendorarch" in
6905         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6906                 dflt="$dflt/$archname"
6907                 ;;
6908         *)      dflt="$vendorarch" ;;
6909         esac
6910         fn=d~+
6911         rp='Pathname for vendor-supplied architecture-dependent files?'
6912         . ./getfile
6913         vendorarch="$ans"
6914         vendorarchexp="$ansexp"
6915         ;;
6916 esac
6917 prefixvar=vendorarch
6918 . ./installprefix
6919
6920 : Final catch-all directories to search
6921 $cat <<EOM
6922
6923 Lastly, you can have perl look in other directories for extensions and
6924 modules in addition to those already specified.
6925 These directories will be searched after 
6926         $sitearch 
6927         $sitelib 
6928 EOM
6929 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6930 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6931 echo ' '
6932 case "$otherlibdirs" in
6933 ''|' ') dflt='none' ;;
6934 *)      dflt="$otherlibdirs" ;;
6935 esac
6936 $cat <<EOM
6937 Enter a colon-separated set of extra paths to include in perl's @INC
6938 search path, or enter 'none' for no extra paths.
6939
6940 EOM
6941
6942 rp='Colon-separated list of additional directories for perl to search?'
6943 . ./myread
6944 case "$ans" in
6945 ' '|''|none)    otherlibdirs=' ' ;;     
6946 *)      otherlibdirs="$ans" ;;
6947 esac
6948 case "$otherlibdirs" in
6949 ' ') val=$undef ;;
6950 *)      val=$define ;;
6951 esac
6952 set d_perl_otherlibdirs
6953 eval $setvar
6954
6955 : Cruising for prototypes
6956 echo " "
6957 echo "Checking out function prototypes..." >&4
6958 $cat >prototype.c <<EOCP
6959 #$i_stdlib I_STDLIB
6960 #ifdef I_STDLIB
6961 #include <stdlib.h>
6962 #endif
6963 int main(int argc, char *argv[]) {
6964         exit(0);}
6965 EOCP
6966 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6967         echo "Your C compiler appears to support function prototypes."
6968         val="$define"
6969 else
6970         echo "Your C compiler doesn't seem to understand function prototypes."
6971         val="$undef"
6972 fi
6973 set prototype
6974 eval $setvar
6975 $rm -f prototype*
6976
6977 case "$prototype" in
6978 "$define") ;;
6979 *)      ansi2knr='ansi2knr'
6980         echo " "
6981         cat <<EOM >&4
6982
6983 $me:  FATAL ERROR:
6984 This version of $package can only be compiled by a compiler that 
6985 understands function prototypes.  Unfortunately, your C compiler 
6986         $cc $ccflags
6987 doesn't seem to understand them.  Sorry about that.
6988
6989 If GNU cc is available for your system, perhaps you could try that instead.  
6990
6991 Eventually, we hope to support building Perl with pre-ANSI compilers.
6992 If you would like to help in that effort, please contact <perlbug@perl.org>.
6993
6994 Aborting Configure now.
6995 EOM
6996         exit 2
6997         ;;
6998 esac
6999
7000 echo " "
7001 case "$extras" in
7002 '') dflt='n';;
7003 *) dflt='y';;
7004 esac
7005 cat <<EOM
7006 Perl can be built with extra modules or bundles of modules which
7007 will be fetched from the CPAN and installed alongside Perl.
7008
7009 Notice that you will need access to the CPAN; either via the Internet,
7010 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7011 be asked later to configure the CPAN.pm module which will in turn do
7012 the installation of the rest of the extra modules or bundles.)
7013
7014 Notice also that if the modules require any external software such as
7015 libraries and headers (the libz library and the zlib.h header for the
7016 Compress::Zlib module, for example) you MUST have any such software
7017 already installed, this configuration process will NOT install such
7018 things for you.
7019
7020 If this doesn't make any sense to you, just accept the default '$dflt'.
7021 EOM
7022 rp='Install any extra modules (y or n)?'
7023 . ./myread
7024 case "$ans" in
7025 y|Y)
7026         cat <<EOM
7027
7028 Please list any extra modules or bundles to be installed from CPAN,
7029 with spaces between the names.  The names can be in any format the
7030 'install' command of CPAN.pm will understand.  (Answer 'none',
7031 without the quotes, to install no extra modules or bundles.)
7032 EOM
7033         rp='Extras?'
7034         dflt="$extras"
7035         . ./myread
7036         extras="$ans"
7037 esac
7038 case "$extras" in
7039 ''|'none')
7040         val=''
7041         $rm -f ../extras.lst
7042         ;;
7043 *)      echo "(Saving the list of extras for later...)"
7044         echo "$extras" > ../extras.lst
7045         val="'$extras'"
7046         ;;
7047 esac
7048 set extras
7049 eval $setvar
7050 echo " "
7051
7052 : determine where html pages for programs go
7053 set html1dir html1dir none
7054 eval $prefixit
7055 $cat <<EOM
7056
7057 If you wish to install html files for programs in $spackage, indicate
7058 the appropriate directory here.  To skip installing html files,
7059 answer "none".
7060 EOM
7061 case "$html1dir" in
7062 ''|none|$undef|' ') dflt=none ;;
7063 *) dflt=$html1dir ;;
7064 esac
7065 fn=dn+~
7066 rp="Directory for the main $spackage html pages?"
7067 . ./getfile
7068 prefixvar=html1dir
7069 . ./setprefixvar
7070 : Use ' ' for none so value is preserved next time through Configure
7071 $test X"$html1dir" = "X" && html1dir=' '
7072
7073 : determine where html pages for libraries and modules go
7074 set html3dir html3dir none
7075 eval $prefixit
7076 $cat <<EOM
7077
7078 If you wish to install html files for modules associated with $spackage,
7079 indicate the appropriate directory here.  To skip installing html files,
7080 answer "none".
7081 EOM
7082 : There is no obvious default.  If they have specified html1dir, then
7083 : try to key off that, possibly changing .../html1 into .../html3.
7084 case "$html3dir" in
7085 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7086 *) dflt=$html3dir ;;
7087 esac
7088 fn=dn+~
7089 rp="Directory for the $spackage module html pages?"
7090 . ./getfile
7091 prefixvar=html3dir
7092 . ./setprefixvar
7093 : Use ' ' for none so value is preserved next time through Configure
7094 $test X"$html3dir" = "X" && html3dir=' '
7095
7096 : determine whether to install perl also as /usr/bin/perl
7097
7098 echo " "
7099 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7100         $cat <<EOM
7101 Many scripts expect perl to be installed as /usr/bin/perl.
7102
7103 If you want to, I can install the perl you are about to compile
7104 as /usr/bin/perl (in addition to $bin/perl).
7105 EOM
7106         if test -f /usr/bin/perl; then
7107             $cat <<EOM
7108
7109 However, please note that because you already have a /usr/bin/perl,
7110 overwriting that with a new Perl would very probably cause problems.
7111 Therefore I'm assuming you don't want to do that (unless you insist).
7112
7113 EOM
7114             case "$installusrbinperl" in
7115             "$define"|[yY]*)    dflt='y';;
7116             *)                  dflt='n';;
7117             esac
7118         else
7119             $cat <<EOM
7120
7121 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7122
7123 EOM
7124             case "$installusrbinperl" in
7125             "$undef"|[nN]*)     dflt='n';;
7126             *)                  dflt='y';;
7127             esac
7128         fi
7129         rp="Do you want to install perl as /usr/bin/perl?"
7130         . ./myread
7131         case "$ans" in
7132         [yY]*)  val="$define";;
7133         *)      val="$undef" ;;
7134         esac
7135 else
7136         val="$undef"
7137 fi
7138 set installusrbinperl
7139 eval $setvar
7140
7141 echo " "
7142 echo "Checking for GNU C Library..." >&4
7143 cat >try.c <<'EOCP'
7144 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7145    alone are insufficient to distinguish different versions, such as
7146    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7147    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7148 */
7149 #include <stdio.h>
7150 int main(void)
7151 {
7152 #ifdef __GLIBC__
7153 #   ifdef __GLIBC_MINOR__
7154 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7155 #           include <gnu/libc-version.h>
7156             printf("%s\n",  gnu_get_libc_version());
7157 #       else
7158             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7159 #       endif
7160 #   else
7161         printf("%d\n",  __GLIBC__);
7162 #   endif
7163     return 0;
7164 #else
7165     return 1;
7166 #endif
7167 }
7168 EOCP
7169 set try
7170 if eval $compile_ok && $run ./try > glibc.ver; then
7171         val="$define"
7172         gnulibc_version=`$cat glibc.ver`
7173         echo "You are using the GNU C Library version $gnulibc_version"
7174 else
7175         val="$undef"
7176         gnulibc_version=''
7177         echo "You are not using the GNU C Library"
7178 fi
7179 $rm_try glibc.ver
7180 set d_gnulibc
7181 eval $setvar
7182
7183 : see if nm is to be used to determine whether a symbol is defined or not
7184 case "$usenm" in
7185 '')
7186         dflt=''
7187         case "$d_gnulibc" in
7188         "$define")
7189                 echo " "
7190                 echo "nm probably won't work on the GNU C Library." >&4
7191                 dflt=n
7192                 ;;
7193         esac
7194         case "$dflt" in
7195         '') 
7196                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7197                         echo " "
7198                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7199                         echo "'nm' won't be sufficient on this sytem." >&4
7200                         dflt=n
7201                 fi
7202                 ;;
7203         esac
7204         case "$dflt" in
7205         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7206                 if $test $dflt -gt 20; then
7207                         dflt=y
7208                 else
7209                         dflt=n
7210                 fi
7211                 ;;
7212         esac
7213         ;;
7214 *)
7215         case "$usenm" in
7216         true|$define) dflt=y;;
7217         *) dflt=n;;
7218         esac
7219         ;;
7220 esac
7221 $cat <<EOM
7222
7223 I can use $nm to extract the symbols from your C libraries. This
7224 is a time consuming task which may generate huge output on the disk (up
7225 to 3 megabytes) but that should make the symbols extraction faster. The
7226 alternative is to skip the 'nm' extraction part and to compile a small
7227 test program instead to determine whether each symbol is present. If
7228 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7229 this may be the best solution.
7230
7231 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7232
7233 EOM
7234 rp="Shall I use $nm to extract C symbols from the libraries?"
7235 . ./myread
7236 case "$ans" in
7237 [Nn]*) usenm=false;;
7238 *) usenm=true;;
7239 esac
7240
7241 runnm=$usenm
7242 case "$reuseval" in
7243 true) runnm=false;;
7244 esac
7245
7246 : nm options which may be necessary
7247 case "$nm_opt" in
7248 '') if $test -f /mach_boot; then
7249                 nm_opt=''       # Mach
7250         elif $test -d /usr/ccs/lib; then
7251                 nm_opt='-p'     # Solaris (and SunOS?)
7252         elif $test -f /dgux; then
7253                 nm_opt='-p'     # DG-UX
7254         elif $test -f /lib64/rld; then
7255                 nm_opt='-p'     # 64-bit Irix
7256         else
7257                 nm_opt=''
7258         fi;;
7259 esac
7260
7261 : nm options which may be necessary for shared libraries but illegal
7262 : for archive libraries.  Thank you, Linux.
7263 case "$nm_so_opt" in
7264 '')     case "$myuname" in
7265         *linux*|gnu*)
7266                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7267                         nm_so_opt='--dynamic'
7268                 fi
7269                 ;;
7270         esac
7271         ;;
7272 esac
7273
7274 case "$runnm" in
7275 true)
7276 : get list of predefined functions in a handy place
7277 echo " "
7278 case "$libc" in
7279 '') libc=unknown
7280         case "$libs" in
7281         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7282         esac
7283         ;;
7284 esac
7285 case "$libs" in
7286 '') ;;
7287 *)  for thislib in $libs; do
7288         case "$thislib" in
7289         -lc|-lc_s)
7290                 : Handle C library specially below.
7291                 ;;
7292         -l*)
7293                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7294                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7295                         :
7296                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7297                         :
7298                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7299                         :
7300                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7301                         :
7302                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7303                         :
7304                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7305                         :
7306                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7307                         :
7308                 else
7309                         try=''
7310                 fi
7311                 libnames="$libnames $try"
7312                 ;;
7313         *) libnames="$libnames $thislib" ;;
7314         esac
7315         done
7316         ;;
7317 esac
7318 xxx=normal
7319 case "$libc" in
7320 unknown)
7321         set /lib/libc.$so
7322         for xxx in $libpth; do
7323                 $test -r $1 || set $xxx/libc.$so
7324                 : The messy sed command sorts on library version numbers.
7325                 $test -r $1 || \
7326                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7327                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7328                                 h
7329                                 s/[0-9][0-9]*/0000&/g
7330                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7331                                 G
7332                                 s/\n/ /' | \
7333                          $sort | $sed -e 's/^.* //'`
7334                 eval set \$$#
7335         done
7336         $test -r $1 || set /usr/ccs/lib/libc.$so
7337         $test -r $1 || set /lib/libsys_s$_a
7338         ;;
7339 *)
7340         set blurfl
7341         ;;
7342 esac
7343 if $test -r "$1"; then
7344         echo "Your (shared) C library seems to be in $1."
7345         libc="$1"
7346 elif $test -r /lib/libc && $test -r /lib/clib; then
7347         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7348         xxx=apollo
7349         libc='/lib/clib /lib/libc'
7350         if $test -r /lib/syslib; then
7351                 echo "(Your math library is in /lib/syslib.)"
7352                 libc="$libc /lib/syslib"
7353         fi
7354 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7355         echo "Your C library seems to be in $libc, as you said before."
7356 elif $test -r $incpath/usr/lib/libc$_a; then
7357         libc=$incpath/usr/lib/libc$_a;
7358         echo "Your C library seems to be in $libc.  That's fine."
7359 elif $test -r /lib/libc$_a; then
7360         libc=/lib/libc$_a;
7361         echo "Your C library seems to be in $libc.  You're normal."
7362 else
7363         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7364                 :
7365         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7366                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7367         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7368                 :
7369         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7370                 :
7371         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7372                 :
7373         else
7374                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7375         fi
7376         if $test -r "$tans"; then
7377                 echo "Your C library seems to be in $tans, of all places."
7378                 libc=$tans
7379         else
7380                 libc='blurfl'
7381         fi
7382 fi
7383 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7384         dflt="$libc"
7385         cat <<EOM
7386
7387 If the guess above is wrong (which it might be if you're using a strange
7388 compiler, or your machine supports multiple models), you can override it here.
7389
7390 EOM
7391 else
7392         dflt=''
7393         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7394         cat >&4 <<EOM
7395 I can't seem to find your C library.  I've looked in the following places:
7396
7397 EOM
7398         $sed 's/^/      /' libpath
7399         cat <<EOM
7400
7401 None of these seems to contain your C library. I need to get its name...
7402
7403 EOM
7404 fi
7405 fn=f
7406 rp='Where is your C library?'
7407 . ./getfile
7408 libc="$ans"
7409
7410 echo " "
7411 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7412 set X `cat libnames`
7413 shift
7414 xxx=files
7415 case $# in 1) xxx=file; esac
7416 echo "Extracting names from the following $xxx for later perusal:" >&4
7417 echo " "
7418 $sed 's/^/      /' libnames >&4
7419 echo " "
7420 $echo $n "This may take a while...$c" >&4
7421
7422 for file in $*; do
7423         case $file in
7424         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7425         *) $nm $nm_opt $file 2>/dev/null;;
7426         esac
7427 done >libc.tmp
7428
7429 $echo $n ".$c"
7430 $grep fprintf libc.tmp > libc.ptf
7431 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7432 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7433 xxx='[ADTSIW]'
7434 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7435         eval $xscan;\
7436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7437                 eval $xrun
7438 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7439         eval $xscan;\
7440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7441                 eval $xrun
7442 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/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/^.* D __*//p' -e 's/^.* D //p'";\
7447         eval $xscan;\
7448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449                 eval $xrun
7450 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\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/^.*|FUNC |GLOB .*|//p'";\
7455         eval $xscan;\
7456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457                 eval $xrun
7458 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7459                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7460         eval $xscan;\
7461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7462                 eval $xrun
7463 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7464         eval $xscan;\
7465         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7466                 eval $xrun
7467 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7468         eval $xscan;\
7469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7470                 eval $xrun
7471 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7472         eval $xscan;\
7473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474                 eval $xrun
7475 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7476         eval $xscan;\
7477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478                 eval $xrun
7479 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7480         eval $xscan;\
7481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482                 eval $xrun
7483 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7484         eval $xscan;\
7485         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7486                 eval $xrun
7487 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7488         eval $xscan;\
7489         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490                 eval $xrun
7491 else
7492         $nm -p $* 2>/dev/null >libc.tmp
7493         $grep fprintf libc.tmp > libc.ptf
7494         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7495                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7496         then
7497                 nm_opt='-p'
7498                 eval $xrun
7499         else
7500                 echo " "
7501                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7502                 com=''
7503                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7504                         for thisname in $libnames $libc; do
7505                                 $ar t $thisname >>libc.tmp
7506                         done
7507                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7508                         echo "Ok." >&4
7509                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7510                         # Repeat libc to extract forwarders to DLL entries too
7511                         for thisname in $libnames $libc; do
7512                                 $ar tv $thisname >>libc.tmp
7513                                 # Revision 50 of EMX has bug in $ar.
7514                                 # it will not extract forwarders to DLL entries
7515                                 # Use emximp which will extract exactly them.
7516                                 emximp -o tmp.imp $thisname \
7517                                     2>/dev/null && \
7518                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7519                                     < tmp.imp >>libc.tmp
7520                                 $rm tmp.imp
7521                         done
7522                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7523                         echo "Ok." >&4
7524                 else
7525                         echo "$ar didn't seem to work right." >&4
7526                         echo "Maybe this is a Cray...trying bld instead..." >&4
7527                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7528                         then
7529                                 for thisname in $libnames; do
7530                                         bld t $libnames | \
7531                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7532                                         $ar t $thisname >>libc.tmp
7533                                 done
7534                                 echo "Ok." >&4
7535                         else
7536                                 echo "That didn't work either.  Giving up." >&4
7537                                 exit 1
7538                         fi
7539                 fi
7540         fi
7541 fi
7542 nm_extract="$com"
7543 case "$PASE" in
7544 define)
7545     echo " "
7546     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7547     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7548     ;;
7549 *)  if $test -f /lib/syscalls.exp; then
7550         echo " "
7551         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7552         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7553     fi
7554     ;;
7555 esac
7556 ;;
7557 esac
7558 $rm -f libnames libpath
7559
7560 : see if dld is available
7561 set dld.h i_dld
7562 eval $inhdr
7563
7564
7565 echo " "
7566 echo "Checking for C++..." >&4
7567 cat >try.c <<'EOCP'
7568 #include <stdio.h>
7569 int main(void)
7570 {
7571 #ifdef __cplusplus
7572     printf("define\n");
7573 #else
7574     printf("undef\n");
7575 #endif
7576     return 0;
7577 }
7578 EOCP
7579 set try
7580 if eval $compile_ok && $run ./try >cplusplus$$; then
7581         val=`$cat cplusplus$$`
7582         echo "You are using a C++ compiler."
7583 else
7584         val="$undef"
7585         echo "You are not using a C++ compiler."
7586 fi
7587 $rm_try cplusplus$$
7588 set d_cplusplus
7589 eval $setvar
7590
7591 : is a C symbol defined?
7592 csym='tlook=$1;
7593 case "$3" in
7594 -v) tf=libc.tmp; tdc="";;
7595 -a) tf=libc.tmp; tdc="[]";;
7596 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7597 esac;
7598 tx=yes;
7599 case "$reuseval-$4" in
7600 true-) ;;
7601 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7602 esac;
7603 case "$tx" in
7604 yes)
7605         tval=false;
7606         case "$d_cplusplus" in
7607                 $define) extern_C=\"C\";;
7608         esac;
7609         if $test "$runnm" = true; then
7610                 if $contains $tlook $tf >/dev/null 2>&1; then
7611                         tval=true;
7612                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7613                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7614                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7615                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7616                         $rm_try;
7617                 fi;
7618         else
7619                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7620                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7621                 $rm_try;
7622         fi;
7623         ;;
7624 *)
7625         case "$tval" in
7626         $define) tval=true;;
7627         *) tval=false;;
7628         esac;
7629         ;;
7630 esac;
7631 eval "$2=$tval"'
7632
7633 : define an is-in-libc? function
7634 inlibc='echo " "; td=$define; tu=$undef;
7635 sym=$1; var=$2; eval "was=\$$2";
7636 tx=yes;
7637 case "$reuseval$was" in
7638 true) ;;
7639 true*) tx=no;;
7640 esac;
7641 case "$tx" in
7642 yes)
7643         set $sym tres -f;
7644         eval $csym;
7645         case "$tres" in
7646         true)
7647                 echo "$sym() found." >&4;
7648                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7649         *)
7650                 echo "$sym() NOT found." >&4;
7651                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7652         esac;;
7653 *)
7654         case "$was" in
7655         $define) echo "$sym() found." >&4;;
7656         *) echo "$sym() NOT found." >&4;;
7657         esac;;
7658 esac'
7659
7660 : see if dlopen exists
7661 xxx_runnm="$runnm"
7662 xxx_ccflags="$ccflags"
7663 runnm=false
7664 : with g++ one needs -shared to get is-in-libc to work for dlopen
7665 case "$gccversion" in
7666 '')     ;;
7667 *)      case "$d_cplusplus" in
7668         "$define") ccflags="$ccflags -shared" ;;
7669         esac
7670         ;;
7671 esac
7672 set dlopen d_dlopen
7673 eval $inlibc
7674 runnm="$xxx_runnm"
7675 ccflags="$xxx_ccflags"
7676
7677 : see if this is a unistd.h system
7678 set unistd.h i_unistd
7679 eval $inhdr
7680
7681 : determine which dynamic loading, if any, to compile in
7682 echo " "
7683 dldir="ext/DynaLoader"
7684 case "$usedl" in
7685 $define|y|true)
7686         dflt='y'
7687         usedl="$define"
7688         ;;
7689 $undef|n|false)
7690         dflt='n'
7691         usedl="$undef"
7692         ;;
7693 *)
7694         dflt='n'
7695         case "$d_dlopen" in
7696             $define) dflt='y' ;;
7697         esac
7698         case "$i_dld" in
7699             $define) dflt='y' ;;
7700         esac
7701         : Does a dl_xxx.xs file exist for this operating system
7702         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7703         ;;
7704 esac
7705 rp="Do you wish to use dynamic loading?"
7706 . ./myread
7707 usedl="$ans"
7708 case "$ans" in
7709 y*) usedl="$define"
7710         case "$dlsrc" in
7711         '')
7712                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7713                         dflt="$dldir/dl_${osname}.xs"
7714                 elif $test "$d_dlopen" = "$define" ; then
7715                         dflt="$dldir/dl_dlopen.xs"
7716                 elif $test "$i_dld" = "$define" ; then
7717                         dflt="$dldir/dl_dld.xs"
7718                 else
7719                         dflt=''
7720                 fi
7721                 ;;
7722         *)      dflt="$dldir/$dlsrc"
7723                 ;;
7724         esac
7725     echo "The following dynamic loading files are available:"
7726         : Can not go over to $dldir because getfile has path hard-coded in.
7727         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7728         rp="Source file to use for dynamic loading"
7729         fn="fne"
7730         gfpth="$src"
7731         . ./getfile
7732         usedl="$define"
7733         : emulate basename
7734         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7735
7736         $cat << EOM
7737
7738 Some systems may require passing special flags to $cc -c to
7739 compile modules that will be used to create a shared library.
7740 To use no flags, say "none".
7741
7742 EOM
7743     case "$cccdlflags" in
7744     '') case "$gccversion" in
7745                 '') case "$osname" in
7746                         hpux)   dflt='+z' ;;
7747                         next)   dflt='none' ;;
7748                         irix*)  dflt='-KPIC' ;;
7749                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7750                         sunos)  dflt='-pic' ;;
7751                         *)      dflt='none' ;;
7752                     esac
7753                         ;;
7754                 *)  case "$osname" in
7755                         darwin) dflt='none' ;;
7756                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7757                         *)      dflt='-fpic' ;;
7758                     esac ;;
7759             esac ;;
7760         ' ') dflt='none' ;;
7761     *)  dflt="$cccdlflags" ;;
7762     esac
7763     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7764     . ./myread
7765     case "$ans" in
7766     none) cccdlflags=' ' ;;
7767     *) cccdlflags="$ans" ;;
7768     esac
7769
7770     cat << EOM
7771
7772 Some systems use ld to create libraries that can be dynamically loaded,
7773 while other systems (such as those using ELF) use $cc.
7774
7775 EOM
7776         case "$ld" in
7777         '')     $cat >try.c <<EOM
7778 /* Test for whether ELF binaries are produced */
7779 #include <fcntl.h>
7780 #$i_stdlib I_STDLIB
7781 #ifdef I_STDLIB
7782 #include <stdlib.h>
7783 #endif
7784 #$i_unistd I_UNISTD
7785 #ifdef I_UNISTD
7786 #include <unistd.h>
7787 #endif
7788 int main() {
7789         char b[4];
7790         int i = open("a.out",O_RDONLY);
7791         if(i == -1)
7792                 exit(1); /* fail */
7793         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7794                 exit(0); /* succeed (yes, it's ELF) */
7795         else
7796                 exit(1); /* fail */
7797 }
7798 EOM
7799                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7800                         cat <<EOM
7801 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7802 EOM
7803                         dflt="$cc"
7804                 else
7805                         echo "I'll use ld to build dynamic libraries."
7806                         dflt='ld'
7807                 fi
7808                 $rm_try
7809                 ;;
7810         *)      dflt="$ld"
7811                 ;;
7812         esac
7813
7814     rp="What command should be used to create dynamic libraries?"
7815     . ./myread
7816         ld="$ans"
7817
7818     cat << EOM
7819
7820 Some systems may require passing special flags to $ld to create a
7821 library that can be dynamically loaded.  If your ld flags include
7822 -L/other/path options to locate libraries outside your loader's normal
7823 search path, you may need to specify those -L options here as well.  To
7824 use no flags, say "none".
7825
7826 EOM
7827     case "$lddlflags" in
7828     '') case "$osname" in
7829                         beos) dflt='-nostart' ;;
7830                         hpux) dflt='-b';
7831                               case "$gccversion" in
7832                               '') dflt="$dflt +vnocompatwarnings" ;;
7833                               esac
7834                               ;;
7835                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7836                         next)  dflt='none' ;;
7837                         solaris) dflt='-G' ;;
7838                         sunos) dflt='-assert nodefinitions' ;;
7839                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7840                 *)     dflt='none' ;;
7841                         esac
7842                         ;;
7843     *) dflt="$lddlflags" ;;
7844     esac
7845
7846         : Try to guess additional flags to pick up local libraries.
7847         : Be careful not to append to a plain 'none'
7848         case "$dflt" in
7849         none) dflt='' ;;
7850         esac
7851         for thisflag in $ldflags; do
7852                 case "$thisflag" in
7853                 -L*|-R*|-Wl,-R*)
7854                         case " $dflt " in
7855                         *" $thisflag "*) ;;
7856                         *) dflt="$dflt $thisflag" ;;
7857                         esac
7858                         ;;
7859                 esac
7860         done
7861
7862         case "$dflt" in
7863         ''|' ') dflt='none' ;;
7864         esac
7865
7866     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7867     . ./myread
7868     case "$ans" in
7869     none) lddlflags=' ' ;;
7870     *) lddlflags="$ans" ;;
7871     esac
7872
7873         cat <<EOM
7874
7875 Some systems may require passing special flags to $cc to indicate that
7876 the resulting executable will use dynamic linking.  To use no flags,
7877 say "none".
7878
7879 EOM
7880     case "$ccdlflags" in
7881     '') case "$osname" in
7882             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7883             next|sunos) dflt='none' ;;
7884             *)          dflt='none' ;;
7885             esac ;;
7886     ' ')  dflt='none' ;;
7887     *)  dflt="$ccdlflags" ;;
7888     esac
7889     rp="Any special flags to pass to $cc to use dynamic linking?"
7890     . ./myread
7891     case "$ans" in
7892     none) ccdlflags=' ' ;;
7893     *) ccdlflags="$ans" ;;
7894     esac
7895     ;;
7896 *)  usedl="$undef"
7897         ld='ld'
7898     dlsrc='dl_none.xs'
7899     lddlflags=''
7900     ccdlflags=''
7901     ;;
7902 esac
7903
7904 also=''
7905 case "$usedl" in
7906 $undef)
7907         # No dynamic loading being used, so don't bother even to prompt.
7908         useshrplib='false'
7909         ;;
7910 *)      case "$useshrplib" in
7911         '')     case "$osname" in
7912                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7913                         dflt=y
7914                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7915                         ;;
7916                 next*)
7917                         case "$osvers" in
7918                         4*)     dflt=y
7919                                 also='Building a shared libperl is needed for MAB support.'
7920                                 ;;
7921                         *)      dflt=n
7922                                 ;;
7923                         esac
7924                         ;;
7925                 *)      dflt=n
7926                         ;;
7927                 esac
7928                 ;;
7929         $define|true|[Yy]*)
7930                 dflt=y
7931                 ;;
7932         *)      dflt=n
7933                 ;;
7934         esac
7935         $cat << EOM
7936
7937 The perl executable is normally obtained by linking perlmain.c with
7938 libperl${_a}, any static extensions (usually just DynaLoader), and
7939 any other libraries needed on this system (such as -lm, etc.).  Since
7940 your system supports dynamic loading, it is probably possible to build
7941 a shared libperl.$so.  If you will have more than one executable linked
7942 to libperl.$so, this will significantly reduce the size of each
7943 executable, but it may have a noticeable effect on performance.  The
7944 default is probably sensible for your system.
7945 $also
7946
7947 EOM
7948         rp="Build a shared libperl.$so (y/n)"
7949         . ./myread
7950         case "$ans" in
7951         true|$define|[Yy]*)
7952                 useshrplib='true'  ;;
7953         *)      useshrplib='false' ;;
7954         esac
7955         ;;
7956 esac
7957
7958 case "$useshrplib" in
7959 true)
7960         case "$libperl" in
7961         '')
7962                 # Figure out a good name for libperl.so.  Since it gets stored in
7963                 # a version-specific architecture-dependent library, the version
7964                 # number isn't really that important, except for making cc/ld happy.
7965                 #
7966                 # A name such as libperl.so.3.1
7967                 majmin="libperl.$so.$patchlevel.$subversion"
7968                 # A name such as libperl.so.301
7969                 majonly=`echo $patchlevel $subversion |
7970                         $awk '{printf "%d%02d", $1, $2}'`
7971                 majonly=libperl.$so.$majonly
7972                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7973                 # rely on figuring it out from the naming of libc.
7974                 case "${osname}${osvers}" in
7975                 next4*)
7976                         dflt=libperl.5.$so
7977                         # XXX How handle the --version stuff for MAB?
7978                         ;;
7979                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7980                         dflt=libperl.$so
7981                         ;;
7982                 cygwin*) # ld links against an importlib
7983                         dflt=libperl$lib_ext
7984                         ;;
7985                 *)      # Try to guess based on whether libc has major.minor.
7986                         case "$libc" in
7987                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7988                         *libc.$so.[0-9]*) dflt=$majonly ;;
7989                         *)      dflt=libperl.$so ;;
7990                         esac
7991                         ;;
7992                 esac
7993                 ;;
7994         *)      dflt=$libperl
7995                 ;;
7996         esac
7997         cat << EOM
7998
7999 I need to select a good name for the shared libperl.  If your system uses
8000 library names with major and minor numbers, then you might want something
8001 like $majmin.  Alternatively, if your system uses a single version
8002 number for shared libraries, then you might want to use $majonly.
8003 Or, your system might be quite happy with a simple libperl.$so.
8004
8005 Since the shared libperl will get installed into a version-specific
8006 architecture-dependent directory, the version number of the shared perl
8007 library probably isn't important, so the default should be o.k.
8008
8009 EOM
8010         rp='What name do you want to give to the shared libperl?'
8011         . ./myread
8012         libperl=$ans
8013         echo "Ok, I'll use $libperl"
8014         ;;
8015 *)
8016         libperl="libperl${_a}"
8017         ;;
8018 esac
8019
8020 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8021 case "$shrpdir" in
8022 '') ;;
8023 *)      $cat >&4 <<EOM
8024 WARNING:  Use of the shrpdir variable for the installation location of
8025 the shared $libperl is not supported.  It was never documented and
8026 will not work in this version.  Let me (perlbug@perl.org)
8027 know of any problems this may cause.
8028
8029 EOM
8030         case "$shrpdir" in
8031         "$archlibexp/CORE")
8032                 $cat >&4 <<EOM
8033 But your current setting of $shrpdir is
8034 the default anyway, so it's harmless.
8035 EOM
8036                 ;;
8037         *)
8038                 $cat >&4 <<EOM
8039 Further, your current attempted setting of $shrpdir
8040 conflicts with the value of $archlibexp/CORE
8041 that installperl will use.
8042 EOM
8043                 ;;
8044         esac
8045         ;;
8046 esac
8047
8048 # How will the perl executable find the installed shared $libperl?
8049 # Add $xxx to ccdlflags.
8050 # If we can't figure out a command-line option, use $shrpenv to
8051 # set env LD_RUN_PATH.  The main perl makefile uses this.
8052 shrpdir=$archlibexp/CORE
8053 xxx=''
8054 tmp_shrpenv=''
8055 if "$useshrplib"; then
8056     case "$osname" in 
8057         aix)
8058                 # We'll set it in Makefile.SH...
8059                 ;;
8060         solaris)
8061                 xxx="-R $shrpdir"
8062                 ;;
8063         freebsd|netbsd|openbsd|interix|dragonfly)
8064                 xxx="-Wl,-R$shrpdir"
8065                 ;;
8066         bsdos|linux|irix*|dec_osf|gnu*)
8067                 xxx="-Wl,-rpath,$shrpdir"
8068                 ;;
8069         next)
8070                 # next doesn't like the default...
8071                 ;;
8072         beos)
8073                 # beos doesn't like the default, either.
8074                 ;;
8075         hpux*)
8076                 # hpux doesn't like the default, either.
8077                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8078                 ;;
8079         *)
8080                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8081                 ;;
8082         esac
8083         case "$xxx" in
8084         '') ;;
8085         *)      
8086                 # Only add $xxx if it isn't already in ccdlflags.
8087                 case " $ccdlflags " in
8088                 *" $xxx "*)     ;;
8089                 *)      ccdlflags="$ccdlflags $xxx"
8090                         cat <<EOM >&4
8091
8092 Adding $xxx to the flags
8093 passed to $ld so that the perl executable will find the 
8094 installed shared $libperl.
8095
8096 EOM
8097                         ;;
8098                 esac
8099                 ;;
8100         esac
8101 fi
8102 # Fix ccdlflags in AIX for building external extensions.
8103 # (For building Perl itself bare -bE:perl.exp is needed,
8104 #  Makefile.SH takes care of this.)
8105 case "$osname" in
8106 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8107 esac
8108 # Respect a hint or command-line value.
8109 case "$shrpenv" in
8110 '') shrpenv="$tmp_shrpenv" ;;
8111 esac
8112 case "$ldlibpthname" in
8113 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8114 none)   ldlibpthname='' ;;
8115 esac
8116
8117 : determine where manual pages are on this system
8118 echo " "
8119 case "$sysman" in
8120 '') 
8121         syspath='/usr/share/man/man1 /usr/man/man1'
8122         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8123         syspath="$syspath /usr/man/u_man/man1"
8124         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8125         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8126         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8127         sysman=`./loc . /usr/man/man1 $syspath`
8128         ;;
8129 esac
8130 if $test -d "$sysman"; then
8131         echo "System manual is in $sysman." >&4
8132 else
8133         echo "Could not find manual pages in source form." >&4
8134 fi
8135
8136 : determine where manual pages go
8137 set man1dir man1dir none
8138 eval $prefixit
8139 $cat <<EOM
8140
8141 $spackage has manual pages available in source form.
8142 EOM
8143 case "$nroff" in
8144 nroff)
8145         echo "However, you don't have nroff, so they're probably useless to you."
8146         case "$man1dir" in
8147         '') man1dir="none";;
8148         esac;;
8149 esac
8150 echo "If you don't want the manual sources installed, answer 'none'."
8151 case "$man1dir" in
8152 ' ') dflt=none
8153         ;;
8154 '')
8155         lookpath="$prefixexp/share/man/man1"
8156         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8157         lookpath="$lookpath $prefixexp/man/p_man/man1"
8158         lookpath="$lookpath $prefixexp/man/u_man/man1"
8159         lookpath="$lookpath $prefixexp/man/man.1"
8160         case "$sysman" in
8161         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8162         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8163         esac
8164         set dflt
8165         eval $prefixup
8166         ;;
8167 *)  dflt="$man1dir"
8168         ;;
8169 esac
8170 echo " "
8171 fn=dn+~
8172 rp="Where do the main $spackage manual pages (source) go?"
8173 . ./getfile
8174 if $test "X$man1direxp" != "X$ansexp"; then
8175         installman1dir=''
8176 fi
8177 prefixvar=man1dir
8178 . ./setprefixvar
8179
8180 case "$man1dir" in
8181 '')     man1dir=' '
8182         installman1dir='';;
8183 esac
8184
8185 : What suffix to use on installed man pages
8186
8187 case "$man1dir" in
8188 ' ')
8189         man1ext='0'
8190         ;;
8191 *)
8192         rp="What suffix should be used for the main $spackage man pages?"
8193         case "$man1ext" in
8194         '')     case "$man1dir" in
8195                 *1)  dflt=1 ;;
8196                 *1p) dflt=1p ;;
8197                 *1pm) dflt=1pm ;;
8198                 *l) dflt=l;;
8199                 *n) dflt=n;;
8200                 *o) dflt=o;;
8201                 *p) dflt=p;;
8202                 *C) dflt=C;;
8203                 *L) dflt=L;;
8204                 *L1) dflt=L1;;
8205                 *) dflt=1;;
8206                 esac
8207                 ;;
8208         *)      dflt="$man1ext";;
8209         esac
8210         . ./myread
8211         man1ext="$ans"
8212         ;;
8213 esac
8214
8215 : see if we can have long filenames
8216 echo " "
8217 first=123456789abcdef
8218 $rm -f $first
8219 if (echo hi >$first) 2>/dev/null; then
8220         if $test -f 123456789abcde; then
8221                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8222                 val="$undef"
8223         else
8224                 echo 'You can have filenames longer than 14 characters.'>&4
8225                 val="$define"
8226         fi
8227 else
8228         $cat <<'EOM'
8229 You can't have filenames longer than 14 chars.
8230 You can't even think about them!
8231 EOM
8232         val="$undef"
8233 fi 
8234 set d_flexfnam
8235 eval $setvar
8236 $rm -rf 123456789abcde*
8237
8238 : determine where library module manual pages go
8239 set man3dir man3dir none
8240 eval $prefixit
8241 $cat <<EOM
8242
8243 $spackage has manual pages for many of the library modules.
8244 EOM
8245
8246 case "$nroff" in
8247 nroff)
8248         $cat <<'EOM'
8249 However, you don't have nroff, so they're probably useless to you.
8250 EOM
8251         case "$man3dir" in
8252         '') man3dir="none";;
8253         esac;;
8254 esac
8255
8256 case "$d_flexfnam" in
8257 undef)
8258         $cat <<'EOM'
8259 However, your system can't handle the long file names like File::Basename.3.
8260 EOM
8261         case "$man3dir" in
8262         '') man3dir="none";;
8263         esac;;
8264 esac
8265
8266 echo "If you don't want the manual sources installed, answer 'none'."
8267 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8268 case "$man3dir" in
8269 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8270         if $test -d "$privlib/man/man3"; then
8271                 cat <<EOM >&4
8272
8273 WARNING:  Previous versions of perl installed man3 pages into
8274 $privlib/man/man3.  This version will suggest a
8275 new default of $dflt.
8276 EOM
8277                 tdflt=$dflt
8278                 dflt='n'
8279                 rp='Do you wish to preserve the old behavior?(y/n)'
8280                 . ./myread
8281                 case "$ans" in
8282                 y*) dflt="$privlib/man/man3" ;;
8283                 *)  dflt=$tdflt ;;
8284                 esac
8285     fi
8286         ;;
8287 *)      dflt="$man3dir" ;;
8288 esac
8289 case "$dflt" in
8290 ' ') dflt=none ;;
8291 esac
8292 echo " "
8293 fn=dn+~
8294 rp="Where do the $package library man pages (source) go?"
8295 . ./getfile
8296 prefixvar=man3dir
8297 . ./setprefixvar
8298
8299 case "$man3dir" in
8300 '')     man3dir=' '
8301         installman3dir='';;
8302 esac
8303
8304 : What suffix to use on installed man pages
8305 case "$man3dir" in
8306 ' ')
8307         man3ext='0'
8308         ;;
8309 *)
8310         rp="What suffix should be used for the $package library man pages?"
8311         case "$man3ext" in
8312         '')     case "$man3dir" in
8313                 *3)  dflt=3 ;;
8314                 *3p) dflt=3p ;;
8315                 *3pm) dflt=3pm ;;
8316                 *l) dflt=l;;
8317                 *n) dflt=n;;
8318                 *o) dflt=o;;
8319                 *p) dflt=p;;
8320                 *C) dflt=C;;
8321                 *L) dflt=L;;
8322                 *L3) dflt=L3;;
8323                 *) dflt=3;;
8324                 esac
8325                 ;;
8326         *)      dflt="$man3ext";;
8327         esac
8328         . ./myread
8329         man3ext="$ans"
8330         ;;
8331 esac
8332
8333 : see if we have to deal with yellow pages, now NIS.
8334 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8335         if $test -f /usr/etc/nibindd; then
8336                 echo " "
8337                 echo "I'm fairly confident you're on a NeXT."
8338                 echo " "
8339                 rp='Do you get the hosts file via NetInfo?'
8340                 dflt=y
8341                 case "$hostcat" in
8342                 nidump*) ;;
8343                 '') ;;
8344                 *) dflt=n;;
8345                 esac
8346                 . ./myread
8347                 case "$ans" in
8348                 y*) hostcat='nidump hosts .';;
8349                 *)      case "$hostcat" in
8350                         nidump*) hostcat='';;
8351                         esac
8352                         ;;
8353                 esac
8354         fi
8355         case "$hostcat" in
8356         nidump*) ;;
8357         *)
8358                 case "$hostcat" in
8359                 *ypcat*) dflt=y;;
8360                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8361                                 dflt=y
8362                         else
8363                                 dflt=n
8364                         fi;;
8365                 *) dflt=n;;
8366                 esac
8367                 echo " "
8368                 rp='Are you getting the hosts file via yellow pages?'
8369                 . ./myread
8370                 case "$ans" in
8371                 y*) hostcat='ypcat hosts';;
8372                 *) hostcat='cat /etc/hosts';;
8373                 esac
8374                 ;;
8375         esac
8376 fi
8377 case "$hostcat" in
8378 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8379 esac
8380 case "$groupcat" in
8381 '') test -f /etc/group && groupcat='cat /etc/group';;
8382 esac
8383 case "$passcat" in
8384 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8385 esac
8386
8387 : now get the host name
8388 echo " "
8389 echo "Figuring out host name..." >&4
8390 case "$myhostname" in
8391 '') cont=true
8392         echo 'Maybe "hostname" will work...'
8393         if tans=`sh -c hostname 2>&1` ; then
8394                 myhostname=$tans
8395                 phostname=hostname
8396                 cont=''
8397         fi
8398         ;;
8399 *) cont='';;
8400 esac
8401 if $test "$cont"; then
8402         if ./xenix; then
8403                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8404                 if tans=`cat /etc/systemid 2>&1` ; then
8405                         myhostname=$tans
8406                         phostname='cat /etc/systemid'
8407                         echo "Whadyaknow.  Xenix always was a bit strange..."
8408                         cont=''
8409                 fi
8410         elif $test -r /etc/systemid; then
8411                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8412         fi
8413 fi
8414 if $test "$cont"; then
8415         echo 'No, maybe "uuname -l" will work...'
8416         if tans=`sh -c 'uuname -l' 2>&1` ; then
8417                 myhostname=$tans
8418                 phostname='uuname -l'
8419         else
8420                 echo 'Strange.  Maybe "uname -n" will work...'
8421                 if tans=`sh -c 'uname -n' 2>&1` ; then
8422                         myhostname=$tans
8423                         phostname='uname -n'
8424                 else
8425                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8426                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8427                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8428                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8429                         else
8430                                 case "$myhostname" in
8431                                 '') echo "Does this machine have an identity crisis or something?"
8432                                         phostname='';;
8433                                 *)
8434                                         echo "Well, you said $myhostname before..."
8435                                         phostname='echo $myhostname';;
8436                                 esac
8437                         fi
8438                 fi
8439         fi
8440 fi
8441 case "$myhostname" in
8442 '') myhostname=noname ;;
8443 esac
8444 : you do not want to know about this
8445 set $myhostname
8446 myhostname=$1
8447
8448 : verify guess
8449 if $test "$myhostname" ; then
8450         dflt=y
8451         rp='Your host name appears to be "'$myhostname'".'" Right?"
8452         . ./myread
8453         case "$ans" in
8454         y*) ;;
8455         *) myhostname='';;
8456         esac
8457 fi
8458
8459 : bad guess or no guess
8460 while $test "X$myhostname" = X ; do
8461         dflt=''
8462         rp="Please type the (one word) name of your host:"
8463         . ./myread
8464         myhostname="$ans"
8465 done
8466
8467 : translate upper to lower if necessary
8468 case "$myhostname" in
8469 *[A-Z]*)
8470         echo "(Normalizing case in your host name)"
8471         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8472         ;;
8473 esac
8474
8475 case "$myhostname" in
8476 *.*)
8477         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8478         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8479         echo "(Trimming domain name from host name--host name is now $myhostname)"
8480         ;;
8481 *) case "$mydomain" in
8482         '')
8483                 {
8484                         test "X$hostcat" = "Xypcat hosts" &&
8485                         ypmatch "$myhostname" hosts 2>/dev/null |\
8486                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8487                         $test -s hosts
8488                 } || {
8489                         test "X$hostcat" != "X" &&
8490                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8491                                         /[       ]$myhostname[  . ]/p" > hosts
8492                 }
8493                 tmp_re="[       . ]"
8494                 if $test -f hosts; then
8495                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8496                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8497                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8498                                 hosts | $sort | $uniq | \
8499                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8500                         case `$echo X$dflt` in
8501                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8502                                 dflt=.
8503                                 ;;
8504                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8505                                 ;;
8506                         esac
8507                 else
8508                         echo "(I cannot locate a hosts database anywhere)"
8509                         dflt=.
8510                 fi
8511                 case "$dflt" in
8512                 .)
8513                         tans=`./loc resolv.conf X /etc /usr/etc`
8514                         if $test -f "$tans"; then
8515                                 echo "(Attempting domain name extraction from $tans)"
8516                                 dflt=.`$sed -n -e 's/   / /g' \
8517                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8518                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8519                                 case "$dflt" in
8520                                 .) dflt=.`$sed -n -e 's/        / /g' \
8521                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8522                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8523                                         ;;
8524                                 esac
8525                         fi
8526                         ;;
8527                 esac
8528                 case "$dflt" in
8529                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8530                         dflt=.`sh -c domainname 2>/dev/null`
8531                         case "$dflt" in
8532                         '') dflt='.';;
8533                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8534                         esac
8535                         ;;
8536                 esac
8537                 case "$dflt$osname" in
8538                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8539                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8540                         ;;
8541                 esac
8542                 case "$dflt" in
8543                 .) echo "(Lost all hope -- silly guess then)"
8544                         dflt='.nonet'
8545                         ;;
8546                 esac
8547                 $rm -f hosts
8548                 ;;
8549         *) dflt="$mydomain";;
8550         esac;;
8551 esac
8552 echo " "
8553 rp="What is your domain name?"
8554 . ./myread
8555 tans="$ans"
8556 case "$ans" in
8557 '') ;;
8558 .*) ;;
8559 *) tans=".$tans";;
8560 esac
8561 mydomain="$tans"
8562
8563 : translate upper to lower if necessary
8564 case "$mydomain" in
8565 *[A-Z]*)
8566         echo "(Normalizing case in your domain name)"
8567         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8568         ;;
8569 esac
8570
8571 : a little sanity check here
8572 case "$phostname" in
8573 '') ;;
8574 *)
8575         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8576         $myhostname$mydomain|$myhostname) ;;
8577         *)
8578                 case "$phostname" in
8579                 sed*)
8580                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8581                         ;;
8582                 *)
8583                         echo "(That doesn't agree with your $phostname command, by the way.)"
8584                         ;;
8585                 esac
8586         ;;
8587         esac
8588         ;;
8589 esac
8590
8591 $cat <<EOM
8592
8593 I need to get your e-mail address in Internet format if possible, i.e.
8594 something like user@host.domain. Please answer accurately since I have
8595 no easy means to double check it. The default value provided below
8596 is most probably close to reality but may not be valid from outside
8597 your organization...
8598
8599 EOM
8600 cont=x
8601 while test "$cont"; do
8602         case "$cf_email" in
8603         '') dflt="$cf_by@$myhostname$mydomain";;
8604         *) dflt="$cf_email";;
8605         esac
8606         rp='What is your e-mail address?'
8607         . ./myread
8608         cf_email="$ans"
8609         case "$cf_email" in
8610         *@*.*) cont='' ;;
8611         *)
8612                 rp='Address does not look like an Internet one.  Use it anyway?'
8613                 case "$fastread" in
8614                 yes) dflt=y ;;
8615                 *) dflt=n ;;
8616                 esac
8617                 . ./myread
8618                 case "$ans" in
8619                 y*) cont='' ;;
8620                 *) echo " " ;;
8621                 esac
8622                 ;;
8623         esac
8624 done
8625
8626 $cat <<EOM
8627
8628 If you or somebody else will be maintaining perl at your site, please
8629 fill in the correct e-mail address here so that they may be contacted
8630 if necessary. Currently, the "perlbug" program included with perl
8631 will send mail to this address in addition to perlbug@perl.org. You may
8632 enter "none" for no administrator.
8633
8634 EOM
8635 case "$perladmin" in
8636 '') dflt="$cf_email";;
8637 *) dflt="$perladmin";;
8638 esac
8639 rp='Perl administrator e-mail address'
8640 . ./myread
8641 perladmin="$ans"
8642
8643 : determine whether to only install version-specific parts.
8644 echo " "
8645 $cat <<EOM
8646 Do you want to install only the version-specific parts of the perl
8647 distribution?  Usually you do *not* want to do this.
8648 EOM
8649 case "$versiononly" in
8650 "$define"|[Yy]*|true) dflt='y' ;;
8651 *) dflt='n';
8652 esac
8653 rp="Do you want to install only the version-specific parts of perl?"
8654 . ./myread
8655 case "$ans" in
8656 [yY]*)  val="$define";;
8657 *)      val="$undef" ;;
8658 esac
8659 set versiononly
8660 eval $setvar
8661
8662 case "$versiononly" in
8663 "$define") inc_version_list=''
8664            inc_version_list_init=0
8665            ;;
8666 esac
8667
8668 : figure out how to guarantee perl startup
8669 : XXX Note that this currently takes advantage of the bug that binexp ignores
8670 :     the Configure -Dinstallprefix setting, which in turn means that under
8671 :     relocatable @INC, initialinstalllocation is what binexp started as.
8672 case "$startperl" in
8673 '')
8674         case "$sharpbang" in
8675         *!)
8676                 $cat <<EOH
8677
8678 I can use the #! construct to start perl on your system. This will
8679 make startup of perl scripts faster, but may cause problems if you
8680 want to share those scripts and perl is not in a standard place
8681 ($initialinstalllocation/perl) on all your platforms. The alternative
8682 is to force a shell by starting the script with a single ':' character.
8683
8684 EOH
8685                 case "$versiononly" in
8686                 "$define")      dflt="$initialinstalllocation/perl$version";;
8687                 *)              dflt="$initialinstalllocation/perl";;
8688                 esac
8689                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8690                 . ./myread
8691                 case "$ans" in
8692                 none)   startperl=": # use perl";;
8693                 *)      startperl="#!$ans"
8694                         if $test 30 -lt `echo "$ans" | wc -c`; then
8695                                 $cat >&4 <<EOM
8696
8697 WARNING:  Some systems limit the #! command to 32 characters.
8698 If you experience difficulty running Perl scripts with #!, try
8699 installing Perl in a directory with a shorter pathname.
8700
8701 EOM
8702                         fi ;;
8703                 esac
8704                 ;;
8705         *) startperl=": # use perl"
8706                 ;;
8707         esac
8708         ;;
8709 esac
8710 echo "I'll use $startperl to start perl scripts."
8711
8712 : figure best path for perl in scripts
8713 case "$perlpath" in
8714 '')
8715         case "$versiononly" in
8716         "$define")      perlpath="$initialinstalllocation/perl$version";;
8717         *)              perlpath="$initialinstalllocation/perl";;
8718         esac
8719         case "$startperl" in
8720         *!*) ;;
8721         *)
8722                 $cat <<EOH
8723
8724 I will use the "eval 'exec'" idiom to start Perl on your system.
8725 I can use the full path of your Perl binary for this purpose, but
8726 doing so may cause problems if you want to share those scripts and
8727 Perl is not always in a standard place ($initialinstalllocation/perl).
8728
8729 EOH
8730                 dflt="$initialinstalllocation/perl"
8731                 rp="What path shall I use in \"eval 'exec'\"?"
8732                 . ./myread
8733                 perlpath="$ans"
8734                 ;;
8735         esac
8736         ;;
8737 esac
8738 case "$startperl" in
8739 *!*)    ;;
8740 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8741 esac
8742
8743 : determine where public executable scripts go
8744 set scriptdir scriptdir
8745 eval $prefixit
8746 case "$scriptdir" in
8747 '')
8748         dflt="$bin"
8749         : guess some guesses
8750         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8751         $test -d /usr/share/bin     && dflt=/usr/share/bin
8752         $test -d /usr/local/script  && dflt=/usr/local/script
8753         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8754         $test -d $prefixexp/script  && dflt=$prefixexp/script
8755         set dflt
8756         eval $prefixup
8757         ;;
8758 *)  dflt="$scriptdir"
8759         ;;
8760 esac
8761 $cat <<EOM
8762
8763 Some installations have a separate directory just for executable scripts so
8764 that they can mount it across multiple architectures but keep the scripts in
8765 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8766 Or you might just lump your scripts in with all your other executables.
8767
8768 EOM
8769 fn=d~
8770 rp='Where do you keep publicly executable scripts?'
8771 . ./getfile
8772 if $test "X$ansexp" != "X$scriptdirexp"; then
8773         installscript=''
8774 fi
8775 installscriptdir=''
8776 prefixvar=scriptdir
8777 . ./setprefixvar
8778 : A little fix up for an irregularly named variable.
8779 installscript="$installscriptdir"
8780
8781 : determine where add-on public executables go
8782 case "$sitebin" in
8783 '')     dflt=$siteprefix/bin ;;
8784 *)      dflt=$sitebin ;;
8785 esac
8786 fn=d~
8787 rp='Pathname where the add-on public executables should be installed?'
8788 . ./getfile
8789 prefixvar=sitebin
8790 . ./setprefixvar
8791
8792 : determine where add-on html pages go
8793 : There is no standard location, so try to copy the previously-selected
8794 : directory structure for the core html pages.
8795 case "$sitehtml1dir" in
8796 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8797 *)     dflt=$sitehtml1dir ;;
8798 esac
8799 case "$dflt" in
8800 ''|' ') dflt=none ;;
8801 esac
8802 fn=dn+~
8803 rp='Pathname where the site-specific html pages should be installed?'
8804 . ./getfile
8805 prefixvar=sitehtml1dir
8806 . ./setprefixvar
8807
8808 : determine where add-on library html pages go
8809 : There is no standard location, so try to copy the previously-selected
8810 : directory structure for the core html pages.
8811 case "$sitehtml3dir" in
8812 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8813 *)     dflt=$sitehtml3dir ;;
8814 esac
8815 case "$dflt" in
8816 ''|' ') dflt=none ;;
8817 esac
8818 fn=dn+~
8819 rp='Pathname where the site-specific library html pages should be installed?'
8820 . ./getfile
8821 prefixvar=sitehtml3dir
8822 . ./setprefixvar
8823
8824 : determine where add-on manual pages go
8825 case "$siteman1dir" in
8826 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8827 *)      dflt=$siteman1dir ;;
8828 esac
8829 case "$dflt" in
8830 ''|' ') dflt=none ;;
8831 esac
8832 fn=dn+~
8833 rp='Pathname where the site-specific manual pages should be installed?'
8834 . ./getfile
8835 prefixvar=siteman1dir
8836 . ./setprefixvar
8837
8838 : determine where add-on library man pages go
8839 case "$siteman3dir" in
8840 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8841 *)      dflt=$siteman3dir ;;
8842 esac
8843 case "$dflt" in
8844 ''|' ') dflt=none ;;
8845 esac
8846 fn=dn+~
8847 rp='Pathname where the site-specific library manual pages should be installed?'
8848 . ./getfile
8849 prefixvar=siteman3dir
8850 . ./setprefixvar
8851
8852 : determine where add-on public executable scripts go
8853 case "$sitescript" in
8854 '')     dflt=$siteprefix/script
8855         $test -d $dflt || dflt=$sitebin ;;
8856 *)  dflt="$sitescript" ;;
8857 esac
8858 fn=d~+
8859 rp='Pathname where add-on public executable scripts should be installed?'
8860 . ./getfile
8861 prefixvar=sitescript
8862 . ./setprefixvar
8863
8864 case "$usefaststdio" in
8865 $define|true|[yY]*|'')
8866         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8867         case "$xversion" in
8868         [68])   dflt='y' ;;
8869         *)      dflt='n' ;;
8870         esac
8871         ;;
8872 *) dflt='n';;
8873 esac
8874 cat <<EOM
8875
8876 Perl can be built to use 'fast stdio', which means using the stdio
8877 library but also directly manipulating the stdio buffers to enable
8878 faster I/O.  Using stdio is better for backward compatibility (especially
8879 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8880 interface has been preferred instead of stdio.
8881
8882 If this doesn't make any sense to you, just accept the default '$dflt'.
8883 EOM
8884 rp='Use the "fast stdio" if available?'
8885 . ./myread
8886 case "$ans" in
8887 y|Y)    val="$define" ;;     
8888 *)      val="$undef" ;;
8889 esac
8890 set usefaststdio
8891 eval $setvar
8892
8893
8894 : define an is-a-typedef? function
8895 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8896 case "$inclist" in
8897 "") inclist="sys/types.h";;
8898 esac;
8899 eval "varval=\$$var";
8900 case "$varval" in
8901 "")
8902         $rm -f temp.c;
8903         for inc in $inclist; do
8904                 echo "#include <$inc>" >>temp.c;
8905         done;
8906         echo "#ifdef $type" >> temp.c;
8907         echo "printf(\"We have $type\");" >> temp.c;
8908         echo "#endif" >> temp.c;
8909         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8910         if $contains $type temp.E >/dev/null 2>&1; then
8911                 eval "$var=\$type";
8912         else
8913                 eval "$var=\$def";
8914         fi;
8915         $rm -f temp.?;;
8916 *) eval "$var=\$varval";;
8917 esac'
8918
8919 : define an is-a-typedef? function that prompts if the type is not available.
8920 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8921 case "$inclist" in
8922 "") inclist="sys/types.h";;
8923 esac;
8924 eval "varval=\$$var";
8925 case "$varval" in
8926 "")
8927         $rm -f temp.c;
8928         for inc in $inclist; do
8929                 echo "#include <$inc>" >>temp.c;
8930         done;
8931         echo "#ifdef $type" >> temp.c;
8932         echo "printf(\"We have $type\");" >> temp.c;
8933         echo "#endif" >> temp.c;
8934         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8935         echo " " ;
8936         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8937         if $contains $type temp.E >/dev/null 2>&1; then
8938                 echo "$type found." >&4;
8939                 eval "$var=\$type";
8940         else
8941                 echo "$type NOT found." >&4;
8942                 dflt="$def";
8943                 . ./myread ;
8944                 eval "$var=\$ans";
8945         fi;
8946         $rm -f temp.?;;
8947 *) eval "$var=\$varval";;
8948 esac'
8949
8950 : see what type lseek is declared as in the kernel
8951 rp="What is the type used for lseek's offset on this system?"
8952 set off_t lseektype long stdio.h sys/types.h
8953 eval $typedef_ask
8954
8955 echo " "
8956 echo "Checking to see how big your file offsets are..." >&4
8957 $cat >try.c <<EOCP
8958 #include <sys/types.h>
8959 #include <stdio.h>
8960 int main()
8961 {
8962     printf("%d\n", (int)sizeof($lseektype));
8963     return(0);
8964 }
8965 EOCP
8966 set try
8967 if eval $compile_ok; then
8968         lseeksize=`$run ./try`
8969         echo "Your file offsets are $lseeksize bytes long."
8970 else
8971         dflt=$longsize
8972         echo " "
8973         echo "(I can't seem to compile the test program.  Guessing...)"
8974         rp="What is the size of your file offsets (in bytes)?"
8975         . ./myread
8976         lseeksize="$ans"
8977 fi
8978 $rm_try
8979
8980 : see what type file positions are declared as in the library
8981 rp="What is the type for file position used by fsetpos()?"
8982 set fpos_t fpostype long stdio.h sys/types.h
8983 eval $typedef_ask
8984
8985 echo " "
8986 case "$fpostype" in
8987 *_t) zzz="$fpostype"    ;;
8988 *)   zzz="fpos_t"       ;;
8989 esac
8990 echo "Checking the size of $zzz..." >&4 
8991 cat > try.c <<EOCP
8992 #include <sys/types.h>
8993 #include <stdio.h>
8994 #$i_stdlib I_STDLIB
8995 #ifdef I_STDLIB
8996 #include <stdlib.h>
8997 #endif
8998 int main() {
8999     printf("%d\n", (int)sizeof($fpostype));
9000     exit(0);
9001 }
9002 EOCP
9003 set try
9004 if eval $compile_ok; then
9005         yyy=`$run ./try`
9006         case "$yyy" in
9007         '')     fpossize=4
9008                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9009                 ;;
9010         *)      fpossize=$yyy
9011                 echo "Your $zzz is $fpossize bytes long."
9012                 ;;
9013         esac
9014 else
9015         dflt="$longsize"
9016         echo " " >&4
9017         echo "(I can't compile the test program.  Guessing...)" >&4
9018         rp="What is the size of your file positions (in bytes)?"
9019         . ./myread
9020         fpossize="$ans"
9021 fi
9022
9023 # Backward compatibility (uselfs is deprecated).
9024 case "$uselfs" in
9025 "$define"|true|[yY]*)
9026         cat <<EOM >&4
9027
9028 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9029 EOM
9030         uselargefiles="$define"
9031         ;;
9032 esac
9033
9034 case "$lseeksize:$fpossize" in
9035 8:8) cat <<EOM
9036
9037 You can have files larger than 2 gigabytes.
9038 EOM
9039    val="$define" ;;
9040 *)    case "$uselargefiles" in
9041    "$undef"|false|[nN]*) dflt='n' ;;
9042    *)   dflt='y' ;;
9043    esac
9044    cat <<EOM
9045
9046 Perl can be built to understand large files (files larger than 2 gigabytes)
9047 on some systems.  To do so, Configure can be run with -Duselargefiles.
9048
9049 If this doesn't make any sense to you, just accept the default '$dflt'.
9050 EOM
9051    rp='Try to understand large files, if available?'
9052    . ./myread
9053    case "$ans" in
9054    y|Y)         val="$define" ;;
9055    *)           val="$undef"  ;;
9056    esac
9057    ;;
9058 esac
9059 set uselargefiles
9060 eval $setvar
9061 : Look for a hint-file generated 'call-back-unit'.  If the
9062 : user has specified that a large files perl is to be built,
9063 : we may need to set or change some other defaults.
9064 if $test -f uselargefiles.cbu; then
9065         echo "Your platform has some specific hints regarding large file builds, using them..."
9066         . ./uselargefiles.cbu
9067 fi
9068 case "$uselargefiles" in
9069 "$define")
9070         if $test -f uselargefiles.cbu; then
9071                 echo " "
9072                 echo "Rechecking to see how big your file offsets are..." >&4
9073                 $cat >try.c <<EOCP
9074 #include <sys/types.h>
9075 #include <stdio.h>
9076 int main()
9077 {
9078     printf("%d\n", (int)sizeof($lseektype));
9079     return(0);
9080 }
9081 EOCP
9082                 set try
9083                 if eval $compile_ok; then
9084                         lseeksize=`$run ./try`
9085                         $echo "Your file offsets are now $lseeksize bytes long."
9086                 else
9087                         dflt="$lseeksize"
9088                         echo " "
9089                         echo "(I can't seem to compile the test program.  Guessing...)"
9090                         rp="What is the size of your file offsets (in bytes)?"
9091                         . ./myread
9092                         lseeksize="$ans"
9093                 fi
9094                 case "$fpostype" in
9095                 *_t) zzz="$fpostype"    ;;
9096                 *)   zzz="fpos_t"       ;;
9097                 esac
9098                 $echo $n "Rechecking the size of $zzz...$c" >&4
9099                 $cat > try.c <<EOCP
9100 #include <sys/types.h>
9101 #include <stdio.h>
9102 #$i_stdlib I_STDLIB
9103 #ifdef I_STDLIB
9104 #include <stdlib.h>
9105 #endif
9106 int main() {
9107     printf("%d\n", (int)sizeof($fpostype));
9108     return(0);
9109 }
9110 EOCP
9111                 set try
9112                 if eval $compile_ok; then
9113                         yyy=`$run ./try`
9114                         dflt="$lseeksize"
9115                         case "$yyy" in
9116                         '')     echo " "
9117                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9118                                 ;;
9119                         *)      fpossize=$yyy
9120                                 echo " $fpossize bytes." >&4
9121                                 ;;
9122                         esac
9123                 else
9124                         dflt="$fpossize"
9125                         echo " "
9126                         echo "(I can't compile the test program.  Guessing...)" >&4
9127                         rp="What is the size of your file positions (in bytes)?"
9128                         . ./myread
9129                         fpossize="$ans"
9130                 fi
9131                 $rm_try
9132         fi
9133         ;;
9134 esac
9135
9136 case "$vendorprefix" in
9137 '')     d_vendorbin="$undef"
9138         vendorbin=''
9139         vendorbinexp=''
9140         ;;
9141 *)      d_vendorbin="$define"
9142         : determine where vendor-supplied executables go.
9143         case "$vendorbin" in
9144         '') dflt=$vendorprefix/bin ;;
9145         *)      dflt="$vendorbin" ;;
9146         esac
9147         fn=d~+
9148         rp='Pathname for the vendor-supplied executables directory?'
9149         . ./getfile
9150         vendorbin="$ans"
9151         vendorbinexp="$ansexp"
9152         ;;
9153 esac
9154 prefixvar=vendorbin
9155 . ./installprefix
9156
9157 case "$vendorprefix" in
9158 '')     vendorhtml1dir=''
9159         vendorhtml1direxp=''
9160         ;;
9161 *)      : determine where vendor-supplied html pages go.
9162         : There is no standard location, so try to copy the previously-selected
9163         : directory structure for the core html pages.
9164         : XXX Better default suggestions would be welcome.
9165         case "$vendorhtml1dir" in
9166         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9167         *)      dflt=$vendorhtml1dir ;;
9168         esac
9169         case "$dflt" in
9170         ''|' ') dflt=none ;;
9171         esac
9172         fn=dn+~
9173         rp='Pathname for the vendor-supplied html pages?'
9174         . ./getfile
9175         vendorhtml1dir="$ans"
9176         vendorhtml1direxp="$ansexp"
9177         ;;
9178 esac
9179 : Use ' ' for none so value is preserved next time through Configure
9180 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9181 prefixvar=vendorhtml1dir
9182 . ./installprefix
9183
9184 case "$vendorprefix" in
9185 '')     vendorhtml3dir=''
9186         vendorhtml3direxp=''
9187         ;;
9188 *)      : determine where vendor-supplied module html pages go.
9189         : There is no standard location, so try to copy the previously-selected
9190         : directory structure for the core html pages.
9191         : XXX Better default suggestions would be welcome.
9192         case "$vendorhtml3dir" in
9193         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9194         *)      dflt=$vendorhtml3dir ;;
9195         esac
9196         case "$dflt" in
9197         ''|' ') dflt=none ;;
9198         esac
9199         fn=dn+~
9200         rp='Pathname for the vendor-supplied html pages?'
9201         . ./getfile
9202         vendorhtml3dir="$ans"
9203         vendorhtml3direxp="$ansexp"
9204         ;;
9205 esac
9206 : Use ' ' for none so value is preserved next time through Configure
9207 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9208 prefixvar=vendorhtml3dir
9209 . ./installprefix
9210
9211 case "$vendorprefix" in
9212 '')     vendorman1dir=''
9213         vendorman1direxp=''
9214         ;;
9215 *)      : determine where vendor-supplied manual pages go.
9216         case "$vendorman1dir" in
9217         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9218         *)      dflt=$vendorman1dir ;;
9219         esac
9220         case "$dflt" in
9221         ''|' ') dflt=none ;;
9222         esac
9223         fn=nd~+
9224         rp='Pathname for the vendor-supplied manual section 1 pages?'
9225         . ./getfile
9226         vendorman1dir="$ans"
9227         vendorman1direxp="$ansexp"
9228         ;;
9229 esac
9230 : Use ' ' for none so value is preserved next time through Configure
9231 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9232 prefixvar=vendorman1dir
9233 . ./installprefix
9234
9235 case "$vendorprefix" in
9236 '')     vendorman3dir=''
9237         vendorman3direxp=''
9238         ;;
9239 *)      : determine where vendor-supplied module manual pages go.
9240         case "$vendorman3dir" in
9241         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9242         *)      dflt=$vendorman3dir ;;
9243         esac
9244         case "$dflt" in
9245         ''|' ') dflt=none ;;
9246         esac
9247         fn=nd~+
9248         rp='Pathname for the vendor-supplied manual section 3 pages?'
9249         . ./getfile
9250         vendorman3dir="$ans"
9251         vendorman3direxp="$ansexp"
9252         ;;
9253 esac
9254 : Use ' ' for none so value is preserved next time through Configure
9255 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9256 prefixvar=vendorman3dir
9257 . ./installprefix
9258
9259 case "$vendorprefix" in
9260 '')     d_vendorscript="$undef"
9261         vendorscript=''
9262         vendorscriptexp=''
9263         ;;
9264 *)      d_vendorscript="$define"
9265         : determine where vendor-supplied scripts go.
9266         case "$vendorscript" in
9267         '')     dflt=$vendorprefix/script
9268                 $test -d $dflt || dflt=$vendorbin ;;
9269         *)  dflt="$vendorscript" ;;
9270         esac
9271         $cat <<EOM
9272
9273 The installation process will create a directory for
9274 vendor-supplied scripts.
9275
9276 EOM
9277         fn=d~+
9278         rp='Pathname for the vendor-supplied scripts directory?'
9279         . ./getfile
9280         vendorscript="$ans"
9281         vendorscriptexp="$ansexp"
9282         ;;
9283 esac
9284 prefixvar=vendorscript
9285 . ./installprefix
9286
9287 : see if qgcvt exists
9288 set qgcvt d_qgcvt
9289 eval $inlibc
9290
9291 echo " "
9292
9293 if $test X"$d_longdbl" = X"$define"; then
9294
9295 echo "Checking how to print long doubles..." >&4
9296
9297 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9298         $cat >try.c <<'EOCP'
9299 #include <sys/types.h>
9300 #include <stdio.h>
9301 int main() {
9302   double d = 123.456;
9303   printf("%.3f\n", d);
9304 }
9305 EOCP
9306         set try
9307         if eval $compile; then
9308                 yyy=`$run ./try`
9309                 case "$yyy" in
9310                 123.456)
9311                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9312                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9313                         echo "We will use %f."
9314                         ;;
9315                 esac
9316         fi
9317 fi
9318
9319 if $test X"$sPRIfldbl" = X; then
9320         $cat >try.c <<'EOCP'
9321 #include <sys/types.h>
9322 #include <stdio.h>
9323 int main() {
9324   long double d = 123.456;
9325   printf("%.3Lf\n", d);
9326 }
9327 EOCP
9328         set try
9329         if eval $compile; then
9330                 yyy=`$run ./try`
9331                 case "$yyy" in
9332                 123.456)
9333                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9334                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9335                         echo "We will use %Lf."
9336                         ;;
9337                 esac
9338         fi
9339 fi
9340
9341 if $test X"$sPRIfldbl" = X; then
9342         $cat >try.c <<'EOCP'
9343 #include <sys/types.h>
9344 #include <stdio.h>
9345 int main() {
9346   long double d = 123.456;
9347   printf("%.3llf\n", d);
9348 }
9349 EOCP
9350         set try
9351         if eval $compile; then
9352                 yyy=`$run ./try`
9353                 case "$yyy" in
9354                 123.456)
9355                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9356                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9357                         echo "We will use %llf."
9358                         ;;
9359                 esac
9360         fi
9361 fi
9362
9363 if $test X"$sPRIfldbl" = X; then
9364         $cat >try.c <<'EOCP'
9365 #include <sys/types.h>
9366 #include <stdio.h>
9367 int main() {
9368   long double d = 123.456;
9369   printf("%.3lf\n", d);
9370 }
9371 EOCP
9372         set try
9373         if eval $compile; then
9374                 yyy=`$run ./try`
9375                 case "$yyy" in
9376                 123.456)
9377                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9378                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9379                         echo "We will use %lf."
9380                         ;;
9381                 esac
9382         fi
9383 fi
9384
9385 if $test X"$sPRIfldbl" = X; then
9386         echo "Cannot figure out how to print long doubles." >&4
9387 else
9388         sSCNfldbl=$sPRIfldbl    # expect consistency
9389 fi
9390
9391 $rm_try
9392
9393 fi # d_longdbl
9394
9395 case "$sPRIfldbl" in
9396 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9397         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9398         d_SCNfldbl="$undef";
9399         ;;
9400 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9401         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9402         d_SCNfldbl="$define";
9403         ;;
9404 esac
9405
9406 : Check how to convert floats to strings.
9407
9408 if test "X$d_Gconvert" = X; then
9409
9410 echo " "
9411 echo "Checking for an efficient way to convert floats to strings."
9412 echo " " > try.c
9413 case "$uselongdouble" in
9414 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9415 esac
9416 case "$d_longdbl" in
9417 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9418 esac
9419 case "$d_PRIgldbl" in
9420 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9421 esac
9422 $cat >>try.c <<EOP
9423 #ifdef TRY_gconvert
9424 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9425 char *myname = "gconvert";
9426 #endif
9427 #ifdef TRY_gcvt
9428 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9429 char *myname = "gcvt";
9430 #endif
9431 #ifdef TRY_qgcvt
9432 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9433 char *myname = "qgcvt";
9434 #define DOUBLETYPE long double
9435 #endif
9436 #ifdef TRY_sprintf
9437 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9438 #ifdef HAS_PRIgldbl
9439 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9440 #else
9441 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9442 #endif
9443 #else
9444 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9445 #endif
9446 char *myname = "sprintf";
9447 #endif
9448
9449 #ifndef DOUBLETYPE
9450 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9451 #define DOUBLETYPE long double
9452 #else
9453 #define DOUBLETYPE double
9454 #endif
9455 #endif
9456
9457 #include <stdio.h>
9458
9459 #define I_STDLIB $i_stdlib
9460 #ifdef I_STDLIB
9461 #include <stdlib.h>
9462 #endif
9463
9464 int
9465 checkit(expect, got)
9466 char *expect;
9467 char *got;
9468 {
9469     if (strcmp(expect, got)) {
9470                 printf("%s oddity:  Expected %s, got %s\n",
9471                         myname, expect, got);
9472                 exit(1);
9473         }
9474 }
9475
9476 int main()
9477 {
9478         char buf[64];
9479         buf[63] = '\0';
9480
9481         /* This must be 1st test on (which?) platform */
9482         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9483         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9484         checkit("0.1", buf);
9485
9486         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9487         checkit("0.01", buf);
9488
9489         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9490         checkit("0.001", buf);
9491
9492         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9493         checkit("0.0001", buf);
9494
9495         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9496         if (strlen(buf) > 5)
9497             checkit("9e-005", buf); /* for Microsoft ?? */
9498         else
9499             checkit("9e-05", buf);
9500
9501         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9502         checkit("1", buf);
9503
9504         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9505         checkit("1.1", buf);
9506
9507         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9508         checkit("1.01", buf);
9509
9510         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9511         checkit("1.001", buf);
9512
9513         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9514         checkit("1.0001", buf);
9515
9516         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9517         checkit("1.00001", buf);
9518
9519         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9520         checkit("1.000001", buf);
9521
9522         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9523         checkit("0", buf);
9524
9525         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9526         checkit("-1", buf);
9527
9528         /* Some Linux gcvt's give 1.e+5 here. */
9529         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9530         checkit("100000", buf);
9531
9532         /* Some Linux gcvt's give -1.e+5 here. */
9533         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9534         checkit("-100000", buf);
9535
9536         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9537         checkit("123.456", buf);
9538
9539         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9540         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9541         /* 34 should be enough to scare even long double
9542          * places into using the e notation. */
9543         if (strlen(buf) > 5)
9544             checkit("1e+034", buf); /* for Microsoft */
9545         else
9546             checkit("1e+34", buf);
9547
9548         /* For Perl, if you add additional tests here, also add them to
9549          * t/base/num.t for benefit of platforms not using Configure or
9550          * overriding d_Gconvert */
9551
9552         exit(0);
9553 }
9554 EOP
9555 : first add preferred functions to our list
9556 xxx_list=""
9557 for xxx_convert in $gconvert_preference; do
9558     case $xxx_convert in
9559     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9560     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9561     esac
9562 done
9563 : then add any others
9564 for xxx_convert in gconvert gcvt sprintf; do
9565     case "$xxx_list" in
9566     *$xxx_convert*) ;;
9567     *) xxx_list="$xxx_list $xxx_convert" ;;
9568     esac
9569 done
9570
9571 case "$d_longdbl$uselongdouble" in
9572 "$define$define")
9573     : again, add prefered functions to our list first
9574     xxx_ld_list=""
9575     for xxx_convert in $gconvert_ld_preference; do
9576         case $xxx_convert in
9577         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9578         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9579         esac
9580     done
9581     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9582     for xxx_convert in qgcvt sprintf $xxx_list; do
9583         case "$xxx_ld_list" in
9584         $xxx_convert*|*" $xxx_convert"*) ;;
9585         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9586         esac
9587     done
9588     : if sprintf cannot do long doubles, move it to the end
9589     if test "$d_PRIgldbl" != "$define"; then
9590         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9591     fi
9592     : if no qgcvt, remove it
9593     if test "$d_qgcvt" != "$define"; then
9594         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9595     fi
9596     : use the ld_list
9597     xxx_list="$xxx_ld_list"
9598     ;;
9599 esac
9600
9601 for xxx_convert in $xxx_list; do
9602         echo "Trying $xxx_convert..."
9603         $rm -f try try$_o core
9604         set try -DTRY_$xxx_convert
9605         if eval $compile; then
9606                 echo "$xxx_convert() found." >&4
9607                 if $run ./try; then
9608                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9609                         break;
9610                 else
9611                         echo "...But $xxx_convert didn't work as I expected."
9612                         xxx_convert=''
9613                 fi
9614         else
9615                 echo "$xxx_convert NOT found." >&4
9616         fi
9617 done
9618
9619 if test X$xxx_convert = X; then
9620     echo "*** WHOA THERE!!! ***" >&4
9621     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9622     xxx_convert=sprintf
9623 fi
9624
9625 case "$xxx_convert" in
9626 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9627 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9628 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9629 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9630    "$define$define$define")
9631       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9632    "$define$define$undef")
9633       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9634    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9635    esac
9636    ;;
9637 esac
9638
9639 fi
9640 $rm_try
9641
9642 : see if _fwalk exists
9643 set fwalk d__fwalk
9644 eval $inlibc
9645
9646 : Initialize h_fcntl
9647 h_fcntl=false
9648
9649 : Initialize h_sysfile
9650 h_sysfile=false
9651
9652 : access call always available on UNIX
9653 set access d_access
9654 eval $inlibc
9655
9656 : locate the flags for 'access()'
9657 case "$d_access" in
9658 "$define")
9659         echo " "
9660         $cat >access.c <<EOCP
9661 #include <sys/types.h>
9662 #ifdef I_FCNTL
9663 #include <fcntl.h>
9664 #endif
9665 #ifdef I_SYS_FILE
9666 #include <sys/file.h>
9667 #endif
9668 #ifdef I_UNISTD
9669 #include <unistd.h>
9670 #endif
9671 #$i_stdlib I_STDLIB
9672 #ifdef I_STDLIB
9673 #include <stdlib.h>
9674 #endif
9675 int main() {
9676         exit(R_OK);
9677 }
9678 EOCP
9679         : check sys/file.h first, no particular reason here
9680         if $test `./findhdr sys/file.h` && \
9681                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9682                 h_sysfile=true;
9683                 echo "<sys/file.h> defines the *_OK access constants." >&4
9684         elif $test `./findhdr fcntl.h` && \
9685                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9686                 h_fcntl=true;
9687                 echo "<fcntl.h> defines the *_OK access constants." >&4
9688         elif $test `./findhdr unistd.h` && \
9689                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9690                 echo "<unistd.h> defines the *_OK access constants." >&4
9691         else
9692                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9693         fi
9694         ;;
9695 esac
9696 $rm -f access*
9697
9698 : see if accessx exists
9699 set accessx d_accessx
9700 eval $inlibc
9701
9702 : see if aintl exists
9703 set aintl d_aintl
9704 eval $inlibc
9705
9706 : see if alarm exists
9707 set alarm d_alarm
9708 eval $inlibc
9709
9710 : see if POSIX threads are available
9711 set pthread.h i_pthread
9712 eval $inhdr
9713
9714 : define a fucntion to check prototypes
9715 $cat > protochk <<EOSH
9716 $startsh
9717 cc="$cc"
9718 optimize="$optimize"
9719 ccflags="$ccflags"
9720 prototype="$prototype"
9721 define="$define"
9722 rm_try="$rm_try"
9723 usethreads=$usethreads
9724 i_pthread=$i_pthread
9725 pthread_h_first=$pthread_h_first
9726 EOSH
9727
9728 $cat >> protochk <<'EOSH'
9729
9730 $rm_try
9731 foo="$1"
9732 shift
9733 while test $# -ge 2; do
9734         case "$1" in
9735                 $define) echo "#include <$2>" >> try.c ;;
9736                 literal) echo "$2" >> try.c ;;
9737         esac
9738     # Extra magic for the benefit of systems that need pthread.h
9739     # to be included early to correctly detect threadsafe functions.
9740     # Such functions must guarantee themselves, though, that the usethreads
9741     # and i_pthread have been defined, before calling protochk.
9742     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9743         echo "#include <pthread.h>" >> try.c
9744         pthread_h_done=yes
9745     fi
9746     shift 2
9747 done
9748 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9749 cat >> try.c <<'EOCP'
9750 #ifdef CAN_PROTOTYPE
9751 #define _(args) args
9752 #else
9753 #define _(args) ()
9754 #endif
9755 EOCP
9756 echo "$foo" >> try.c
9757 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9758 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9759 status=$?
9760 $rm_try
9761 exit $status
9762 EOSH
9763 chmod +x protochk
9764 $eunicefix protochk
9765
9766 hasproto='varname=$1; func=$2; shift; shift;
9767 while $test $# -ge 2; do
9768         case "$1" in
9769         $define) echo "#include <$2>";;
9770         esac ;
9771     shift 2;
9772 done > try.c;
9773 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9774 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9775         echo "$func() prototype found.";
9776         val="$define";
9777 else
9778         echo "$func() prototype NOT found.";
9779         val="$undef";
9780 fi;
9781 set $varname;
9782 eval $setvar;
9783 $rm_try tryout.c'
9784
9785 : see if sys/types.h has to be included
9786 set sys/types.h i_systypes
9787 eval $inhdr
9788
9789 : see if sys/select.h has to be included
9790 set sys/select.h i_sysselct
9791 eval $inhdr
9792
9793 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9794 while $test $# -ge 2; do
9795         case "$1" in
9796         $define) echo "#include <$2>";;
9797         esac ;
9798     shift 2;
9799 done > try.c;
9800 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9801 set try;
9802 if eval $compile; then
9803         val="$define";
9804 else
9805         val="$undef";
9806 fi;
9807 set $varname;
9808 eval $setvar;
9809 $rm_try'
9810
9811 : see if we should include time.h, sys/time.h, or both
9812 echo " "
9813 if test "X$timeincl" = X; then
9814         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9815         $echo $n "I'm now running the test program...$c"
9816         $cat >try.c <<EOCP
9817 #include <sys/types.h>
9818 #ifdef I_TIME
9819 #include <time.h>
9820 #endif
9821 #ifdef I_SYSTIME
9822 #ifdef SYSTIMEKERNEL
9823 #define KERNEL
9824 #endif
9825 #include <sys/time.h>
9826 #endif
9827 #ifdef I_SYSSELECT
9828 #include <sys/select.h>
9829 #endif
9830 #$i_stdlib I_STDLIB
9831 #ifdef I_STDLIB
9832 #include <stdlib.h>
9833 #endif
9834 int main()
9835 {
9836         struct tm foo;
9837 #ifdef S_TIMEVAL
9838         struct timeval bar;
9839 #endif
9840 #ifdef S_TIMEZONE
9841         struct timezone tzp;
9842 #endif
9843         if (foo.tm_sec == foo.tm_sec)
9844                 exit(0);
9845 #ifdef S_TIMEVAL
9846         if (bar.tv_sec == bar.tv_sec)
9847                 exit(0);
9848 #endif
9849         exit(1);
9850 }
9851 EOCP
9852         flags=''
9853         for s_timezone in '-DS_TIMEZONE' ''; do
9854         sysselect=''
9855         for s_timeval in '-DS_TIMEVAL' ''; do
9856         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9857         for i_time in '' '-DI_TIME'; do
9858         for i_systime in '-DI_SYSTIME' ''; do
9859                 case "$flags" in
9860                 '') $echo $n ".$c"
9861                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9862                         if eval $compile; then
9863                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9864                                 shift
9865                                 flags="$*"
9866                                 echo " "
9867                                 $echo $n "Succeeded with $flags$c"
9868                         fi
9869                         ;;
9870                 esac
9871         done
9872         done
9873         done
9874         done
9875         done
9876         timeincl=''
9877         echo " "
9878         case "$flags" in
9879         *SYSTIMEKERNEL*) i_systimek="$define"
9880                 timeincl=`./findhdr sys/time.h`
9881                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9882         *) i_systimek="$undef";;
9883         esac
9884         case "$flags" in
9885         *I_TIME*) i_time="$define"
9886                 timeincl=`./findhdr time.h`" $timeincl"
9887                 echo "We'll include <time.h>." >&4;;
9888         *) i_time="$undef";;
9889         esac
9890         case "$flags" in
9891         *I_SYSTIME*) i_systime="$define"
9892                 timeincl=`./findhdr sys/time.h`" $timeincl"
9893                 echo "We'll include <sys/time.h>." >&4;;
9894         *) i_systime="$undef";;
9895         esac
9896         $rm_try
9897 fi
9898 : see if struct tm knows about tm_zone
9899 case "$i_systime$i_time" in
9900 *$define*)
9901         echo " "
9902         echo "Checking to see if your struct tm has tm_zone field..." >&4
9903         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9904         eval $hasfield
9905         ;;
9906 *)      val="$undef"
9907         set d_tm_tm_zone
9908         eval $setvar
9909         ;;
9910 esac
9911 case "$d_tm_tm_zone" in
9912 "$define")      echo "Yes, it does."   ;;
9913 *)              echo "No, it doesn't." ;;
9914 esac
9915 : see if struct tm knows about tm_gmtoff
9916 case "$i_systime$i_time" in
9917 *$define*)
9918         echo " "
9919         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9920         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9921         eval $hasfield
9922         ;;
9923 *)      val="$undef"
9924         set d_tm_tm_gmtoff
9925         eval $setvar
9926         ;;
9927 esac
9928 case "$d_tm_tm_gmtoff" in
9929 "$define")      echo "Yes, it does."   ;;
9930 *)              echo "No, it doesn't." ;;
9931 esac
9932
9933 : see if asctime_r exists
9934 set asctime_r d_asctime_r
9935 eval $inlibc
9936 case "$d_asctime_r" in
9937 "$define")
9938         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9939         case "$d_asctime_r_proto:$usethreads" in
9940         ":define")      d_asctime_r_proto=define
9941                 set d_asctime_r_proto asctime_r $hdrs
9942                 eval $hasproto ;;
9943         *)      ;;
9944         esac
9945         case "$d_asctime_r_proto" in
9946         define)
9947         case "$asctime_r_proto" in
9948         ''|0) try='char* asctime_r(const struct tm*, char*);'
9949         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9950         esac
9951         case "$asctime_r_proto" in
9952         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9953         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9954         esac
9955         case "$asctime_r_proto" in
9956         ''|0) try='int asctime_r(const struct tm*, char*);'
9957         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9958         esac
9959         case "$asctime_r_proto" in
9960         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9961         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9962         esac
9963         case "$asctime_r_proto" in
9964         ''|0)   d_asctime_r=undef
9965                 asctime_r_proto=0
9966                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9967         * )     case "$asctime_r_proto" in
9968                 REENTRANT_PROTO*) ;;
9969                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9970                 esac
9971                 echo "Prototype: $try" ;;
9972         esac
9973         ;;
9974         *)      case "$usethreads" in
9975                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9976                 esac
9977                 d_asctime_r=undef
9978                 asctime_r_proto=0
9979                 ;;
9980         esac
9981         ;;
9982 *)      asctime_r_proto=0
9983         ;;
9984 esac
9985
9986 : see if atolf exists
9987 set atolf d_atolf
9988 eval $inlibc
9989
9990 : see if atoll exists
9991 set atoll d_atoll
9992 eval $inlibc
9993
9994 : Look for GCC-style attribute format
9995 case "$d_attribute_format" in
9996 '')
9997 echo " "
9998 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9999 $cat >attrib.c <<'EOCP'
10000 #include <stdio.h>
10001 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10002 EOCP
10003 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10004         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10005                 echo "Your C compiler doesn't support __attribute__((format))."
10006                 val="$undef"
10007         else
10008                 echo "Your C compiler supports __attribute__((format))."
10009                 val="$define"
10010         fi
10011 else
10012         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10013         val="$undef"
10014 fi
10015 ;;
10016 *) val="$d_attribute_format" ;;
10017 esac
10018 set d_attribute_format
10019 eval $setvar
10020 $rm -f attrib*
10021
10022 : Look for GCC-style attribute format with null format allowed
10023 case "$d_printf_format_null" in
10024 '') case "$d_attribute_format" in
10025     $define)
10026         echo " "
10027         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10028 $cat >attrib.c <<EOCP
10029 #include <stdio.h>
10030 #$i_stdlib I_STDLIB
10031 #ifdef I_STDLIB
10032 #include <stdlib.h>
10033 #endif
10034 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10035 int null_printf (char* pat,...) { return (int)pat; }
10036 int main () { exit(null_printf(NULL)); }
10037 EOCP
10038         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10039             : run the executable in case it produces a run-time warning
10040             if $run ./attrib >>attrib.out 2>&1; then
10041                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10042                     echo "Your C compiler doesn't allow __printf__ format to be null."
10043                     val="$undef"
10044                 else
10045                     echo "Your C compiler allows __printf__ format to be null."
10046                     val="$define"
10047                 fi
10048             else
10049             echo "Your C compiler executable failed with __printf__ format null."
10050             val="$undef"
10051         fi
10052     else
10053         echo "Your C compiler fails with __printf__ format null."
10054         val="$undef"
10055     fi
10056     ;;
10057     *)  val="$undef" ;;
10058     esac
10059 ;;
10060 *)  val="$d_printf_format_null" ;;
10061 esac
10062 set d_printf_format_null
10063 eval $setvar
10064 $rm -f attrib*
10065
10066 : Look for GCC-style attribute malloc
10067 case "$d_attribute_malloc" in
10068 '')
10069 echo " "
10070 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10071 $cat >attrib.c <<'EOCP'
10072 #include <stdio.h>
10073 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10074 EOCP
10075 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10076         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10077                 echo "Your C compiler doesn't support __attribute__((malloc))."
10078                 val="$undef"
10079         else
10080                 echo "Your C compiler supports __attribute__((malloc))."
10081                 val="$define"
10082         fi
10083 else
10084         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10085         val="$undef"
10086 fi
10087 ;;
10088 *) val="$d_attribute_malloc" ;;
10089 esac
10090 set d_attribute_malloc
10091 eval $setvar
10092 $rm -f attrib*
10093
10094 : Look for GCC-style attribute nonnull
10095 case "$d_attribute_nonnull" in
10096 '')
10097 echo " "
10098 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10099 $cat >attrib.c <<'EOCP'
10100 #include <stdio.h>
10101 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10102 EOCP
10103 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10104         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10105                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10106                 val="$undef"
10107         else
10108                 echo "Your C compiler supports __attribute__((nonnull))."
10109                 val="$define"
10110         fi
10111 else
10112         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10113         val="$undef"
10114 fi
10115 ;;
10116 *) val="$d_attribute_nonnull" ;;
10117 esac
10118 set d_attribute_nonnull
10119 eval $setvar
10120 $rm -f attrib*
10121
10122 : Look for GCC-style attribute noreturn
10123 case "$d_attribute_noreturn" in
10124 '')
10125 echo " "
10126 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10127 $cat >attrib.c <<'EOCP'
10128 #include <stdio.h>
10129 void fall_over_dead( void ) __attribute__((noreturn));
10130 EOCP
10131 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10132         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10133                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10134                 val="$undef"
10135         else
10136                 echo "Your C compiler supports __attribute__((noreturn))."
10137                 val="$define"
10138         fi
10139 else
10140         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10141         val="$undef"
10142 fi
10143 ;;
10144 *) val="$d_attribute_noreturn" ;;
10145 esac
10146 set d_attribute_noreturn
10147 eval $setvar
10148 $rm -f attrib*
10149
10150 : Look for GCC-style attribute pure
10151 case "$d_attribute_pure" in
10152 '')
10153 echo " "
10154 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10155 $cat >attrib.c <<'EOCP'
10156 #include <stdio.h>
10157 int square( int n ) __attribute__((pure));
10158 EOCP
10159 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10160         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10161                 echo "Your C compiler doesn't support __attribute__((pure))."
10162                 val="$undef"
10163         else
10164                 echo "Your C compiler supports __attribute__((pure))."
10165                 val="$define"
10166         fi
10167 else
10168         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10169         val="$undef"
10170 fi
10171 ;;
10172 *) val="$d_attribute_pure" ;;
10173 esac
10174 set d_attribute_pure
10175 eval $setvar
10176 $rm -f attrib*
10177
10178 : Look for GCC-style attribute unused
10179 case "$d_attribute_unused" in
10180 '')
10181 echo " "
10182 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10183 $cat >attrib.c <<'EOCP'
10184 #include <stdio.h>
10185 int do_something( int dummy __attribute__((unused)), int n );
10186 EOCP
10187 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10188         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10189                 echo "Your C compiler doesn't support __attribute__((unused))."
10190                 val="$undef"
10191         else
10192                 echo "Your C compiler supports __attribute__((unused))."
10193                 val="$define"
10194         fi
10195 else
10196         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10197         val="$undef"
10198 fi
10199 ;;
10200 *) val="$d_attribute_unused" ;;
10201 esac
10202 set d_attribute_unused
10203 eval $setvar
10204 $rm -f attrib*
10205
10206 : Look for GCC-style attribute warn_unused_result
10207 case "$d_attribute_warn_unused_result" in
10208 '')
10209 echo " "
10210 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10211 $cat >attrib.c <<'EOCP'
10212 #include <stdio.h>
10213 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10214 EOCP
10215 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10216         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10217                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10218                 val="$undef"
10219         else
10220                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10221                 val="$define"
10222         fi
10223 else
10224         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10225         val="$undef"
10226 fi
10227 ;;
10228 *) val="$d_attribute_warn_unused_result" ;;
10229 esac
10230 set d_attribute_warn_unused_result
10231 eval $setvar
10232 $rm -f attrib*
10233
10234 : see if bcmp exists
10235 set bcmp d_bcmp
10236 eval $inlibc
10237
10238 : see if bcopy exists
10239 set bcopy d_bcopy
10240 eval $inlibc
10241
10242 : see if getpgrp exists
10243 set getpgrp d_getpgrp
10244 eval $inlibc
10245
10246 case "$d_getpgrp" in
10247 "$define")
10248         echo " "
10249         echo "Checking to see which flavor of getpgrp is in use..."
10250         $cat >try.c <<EOP
10251 #$i_unistd I_UNISTD
10252 #include <sys/types.h>
10253 #ifdef I_UNISTD
10254 #  include <unistd.h>
10255 #endif
10256 #$i_stdlib I_STDLIB
10257 #ifdef I_STDLIB
10258 #include <stdlib.h>
10259 #endif
10260 int main()
10261 {
10262         if (getuid() == 0) {
10263                 printf("(I see you are running Configure as super-user...)\n");
10264                 setuid(1);
10265         }
10266 #ifdef TRY_BSD_PGRP
10267         if (getpgrp(1) == 0)
10268                 exit(0);
10269 #else
10270         if (getpgrp() > 0)
10271                 exit(0);
10272 #endif
10273         exit(1);
10274 }
10275 EOP
10276         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10277                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10278                 val="$define"
10279         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10280                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10281                 val="$undef"
10282         else
10283                 echo "I can't seem to compile and run the test program."
10284                 if ./usg; then
10285                         xxx="a USG one, i.e. you use getpgrp()."
10286                 else
10287                         # SVR4 systems can appear rather BSD-ish.
10288                         case "$i_unistd" in
10289                         $undef)
10290                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10291                                 val="$define"
10292                                 ;;
10293                         $define)
10294                                 xxx="probably a USG one, i.e. you use getpgrp()."
10295                                 val="$undef"
10296                                 ;;
10297                         esac
10298                 fi
10299                 echo "Assuming your getpgrp is $xxx" >&4
10300         fi
10301         ;;
10302 *) val="$undef";;
10303 esac
10304 set d_bsdgetpgrp
10305 eval $setvar
10306 $rm_try
10307
10308 : see if setpgrp exists
10309 set setpgrp d_setpgrp
10310 eval $inlibc
10311
10312 case "$d_setpgrp" in
10313 "$define")
10314         echo " "
10315         echo "Checking to see which flavor of setpgrp is in use..."
10316         $cat >try.c <<EOP
10317 #$i_unistd I_UNISTD
10318 #include <sys/types.h>
10319 #ifdef I_UNISTD
10320 #  include <unistd.h>
10321 #endif
10322 #$i_stdlib I_STDLIB
10323 #ifdef I_STDLIB
10324 #include <stdlib.h>
10325 #endif
10326 int main()
10327 {
10328         if (getuid() == 0) {
10329                 printf("(I see you are running Configure as super-user...)\n");
10330                 setuid(1);
10331         }
10332 #ifdef TRY_BSD_PGRP
10333         if (-1 == setpgrp(1, 1))
10334                 exit(0);
10335 #else
10336         if (setpgrp() != -1)
10337                 exit(0);
10338 #endif
10339         exit(1);
10340 }
10341 EOP
10342         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10343                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10344                 val="$define"
10345         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10346                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10347                 val="$undef"
10348         else
10349                 echo "(I can't seem to compile and run the test program.)"
10350                 if ./usg; then
10351                         xxx="a USG one, i.e. you use setpgrp()."
10352                 else
10353                         # SVR4 systems can appear rather BSD-ish.
10354                         case "$i_unistd" in
10355                         $undef)
10356                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10357                                 val="$define"
10358                                 ;;
10359                         $define)
10360                                 xxx="probably a USG one, i.e. you use setpgrp()."
10361                                 val="$undef"
10362                                 ;;
10363                         esac
10364                 fi
10365                 echo "Assuming your setpgrp is $xxx" >&4
10366         fi
10367         ;;
10368 *) val="$undef";;
10369 esac
10370 set d_bsdsetpgrp
10371 eval $setvar
10372 $rm_try
10373
10374 : Look for GCC-style __builtin_choose_expr
10375 case "$d_builtin_choose_expr" in
10376 '')
10377     echo " "
10378     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10379     $cat >try.c <<'EOCP'
10380 #include <assert.h>
10381 #include <stdlib.h>
10382 #include <stdio.h>
10383
10384 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10385
10386 int main(void) {
10387     assert( SYRINX(1) == 2112 );
10388     assert( SYRINX(1) != 5150 );
10389     assert( SYRINX(0) == 5150 );
10390     assert( SYRINX(0) != 2112 );
10391     puts( "All good!" );
10392     exit(0);
10393 }
10394
10395 EOCP
10396     set try
10397     if eval $compile; then
10398         echo "Your C compiler supports __builtin_choose_expr."
10399         val="$define"
10400     else
10401         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10402         val="$undef"
10403     fi
10404 ;;
10405 *) val="$d_builtin_choose_expr" ;;
10406 esac
10407
10408 set d_builtin_choose_expr
10409 eval $setvar
10410 $rm_try
10411
10412 : Look for GCC-style __builtin_expect
10413 case "$d_builtin_expect" in
10414 '')
10415     echo " "
10416     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10417     $cat >builtin.c <<'EOCP'
10418 int main(void) {
10419     int n = 50;
10420     if ( __builtin_expect(n, 0) ) n = 1;
10421 }
10422 EOCP
10423     set try
10424     if eval $compile; then
10425         echo "Your C compiler supports __builtin_choose_expr."
10426         val="$define"
10427     else
10428         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10429         val="$undef"
10430     fi
10431     ;;
10432 *) val="$d_builtin_expect" ;;
10433 esac
10434
10435 set d_builtin_expect
10436 eval $setvar
10437 $rm_try
10438
10439 : see if bzero exists
10440 set bzero d_bzero
10441 eval $inlibc
10442
10443 : see if stdarg is available
10444 echo " "
10445 if $test `./findhdr stdarg.h`; then
10446         echo "<stdarg.h> found." >&4
10447         valstd="$define"
10448 else
10449         echo "<stdarg.h> NOT found." >&4
10450         valstd="$undef"
10451 fi
10452
10453 : see if varags is available
10454 echo " "
10455 if $test `./findhdr varargs.h`; then
10456         echo "<varargs.h> found." >&4
10457 else
10458         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10459 fi
10460
10461 : set up the varargs testing programs
10462 $cat > varargs.c <<EOP
10463 #ifdef I_STDARG
10464 #include <stdarg.h>
10465 #endif
10466 #ifdef I_VARARGS
10467 #include <varargs.h>
10468 #endif
10469
10470 #ifdef I_STDARG
10471 int f(char *p, ...)
10472 #else
10473 int f(va_alist)
10474 va_dcl
10475 #endif
10476 {
10477         va_list ap;
10478 #ifndef I_STDARG
10479         char *p;
10480 #endif
10481 #ifdef I_STDARG
10482         va_start(ap,p);
10483 #else
10484         va_start(ap);
10485         p = va_arg(ap, char *);
10486 #endif
10487         va_end(ap);
10488         return 0;
10489 }
10490 EOP
10491 $cat > varargs <<EOP
10492 $startsh
10493 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10494         echo "true"
10495 else
10496         echo "false"
10497 fi
10498 $rm -f varargs$_o
10499 EOP
10500 chmod +x varargs
10501
10502 : now check which varargs header should be included
10503 echo " "
10504 i_varhdr=''
10505 case "$valstd" in
10506 "$define")
10507         if `./varargs I_STDARG`; then
10508                 val='stdarg.h'
10509         elif `./varargs I_VARARGS`; then
10510                 val='varargs.h'
10511         fi
10512         ;;
10513 *)
10514         if `./varargs I_VARARGS`; then
10515                 val='varargs.h'
10516         fi
10517         ;;
10518 esac
10519 case "$val" in
10520 '')
10521 echo "I could not find the definition for va_dcl... You have problems..." >&4
10522         val="$undef"; set i_stdarg; eval $setvar
10523         val="$undef"; set i_varargs; eval $setvar
10524         ;;
10525 *) 
10526         set i_varhdr
10527         eval $setvar
10528         case "$i_varhdr" in
10529         stdarg.h)
10530                 val="$define"; set i_stdarg; eval $setvar
10531                 val="$undef"; set i_varargs; eval $setvar
10532                 ;;
10533         varargs.h)
10534                 val="$undef"; set i_stdarg; eval $setvar
10535                 val="$define"; set i_varargs; eval $setvar
10536                 ;;
10537         esac
10538         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10539 esac
10540 $rm -f varargs*
10541
10542 : see if the Compiler supports C99 variadic macros
10543 case "$i_stdarg$i_stdlib" in
10544     "$define$define")
10545     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10546     $cat >try.c <<EOCP
10547 #include <stdio.h>
10548 #include <stdarg.h>
10549
10550 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10551
10552 int main() {
10553   char buf[20];
10554   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10555   puts(buf);
10556   return 0;
10557 }
10558 EOCP
10559     set try
10560     if eval $compile && $run ./try 2>&1 >/dev/null; then
10561         case "`$run ./try`" in
10562             "123 456 789")
10563             echo "You have C99 variadic macros." >&4
10564             d_c99_variadic_macros="$define"
10565             ;;
10566             *)
10567             echo "You don't have functional C99 variadic macros." >&4
10568             d_c99_variadic_macros="$undef"
10569             ;;
10570         esac
10571     else
10572         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10573         d_c99_variadic_macros="$undef"
10574     fi
10575     $rm_try
10576     ;;
10577     *)
10578     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10579     d_c99_variadic_macros="$undef"
10580     ;;
10581 esac
10582
10583 : see if signal is declared as pointer to function returning int or void
10584 echo " "
10585 xxx=`./findhdr signal.h`
10586 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10587 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10588         echo "You have int (*signal())() instead of void." >&4
10589         val="$undef"
10590 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10591         echo "You have void (*signal())()." >&4
10592         val="$define"
10593 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10594         echo "You have int (*signal())() instead of void." >&4
10595         val="$undef"
10596 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10597         echo "You have void (*signal())()." >&4
10598         val="$define"
10599 else
10600         case "$d_voidsig" in
10601         '')
10602         echo "I can't determine whether signal handler returns void or int..." >&4
10603                 dflt=void
10604                 rp="What type does your signal handler return?"
10605                 . ./myread
10606                 case "$ans" in
10607                 v*) val="$define";;
10608                 *) val="$undef";;
10609                 esac;;
10610         "$define")
10611                 echo "As you already told me, signal handler returns void." >&4
10612                 val="$define"
10613                 ;;
10614         *)      echo "As you already told me, signal handler returns int." >&4
10615                 val="$undef"
10616                 ;;
10617         esac
10618 fi
10619 set d_voidsig
10620 eval $setvar
10621 case "$d_voidsig" in
10622 "$define") signal_t="void";;
10623 *) signal_t="int";;
10624 esac
10625 $rm -f $$.tmp
10626
10627 : check for ability to cast large floats to 32-bit ints.
10628 echo " "
10629 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10630 if $test "$intsize" -ge 4; then
10631         xxx=int
10632 else
10633         xxx=long
10634 fi
10635 $cat >try.c <<EOCP
10636 #include <stdio.h>
10637 #$i_stdlib I_STDLIB
10638 #ifdef I_STDLIB
10639 #include <stdlib.h>
10640 #endif
10641 #include <sys/types.h>
10642 #include <signal.h>
10643 $signal_t blech(int s) { exit(3); }
10644 int main()
10645 {
10646         $xxx i32;
10647         double f, g;
10648         int result = 0;
10649         char str[16];
10650         signal(SIGFPE, blech);
10651
10652         /* Don't let compiler optimize the test away.  Store the number
10653            in a writable string for gcc to pass to sscanf under HP/UX.
10654         */
10655         sprintf(str, "2147483647");
10656         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10657         g = 10 * f;
10658         i32  = ($xxx) g;
10659
10660         /* x86 processors will probably give 0x8000 0000, which is a
10661            sign change.  We don't want that.  We want to mimic SPARC
10662            behavior here, which is to preserve the sign and give
10663            back 0x7fff ffff.
10664         */
10665         if (i32 != ($xxx) f)
10666                 result |= 1;
10667         exit(result);
10668 }
10669 EOCP
10670 set try
10671 if eval $compile_ok; then
10672         $run ./try
10673         yyy=$?
10674 else
10675         echo "(I can't seem to compile the test program--assuming it can't)"
10676         yyy=1
10677 fi
10678 case "$yyy" in
10679 0)      val="$define"
10680         echo "Yup, it can."
10681         ;;
10682 *)      val="$undef"
10683         echo "Nope, it can't."
10684         ;;
10685 esac
10686 set d_casti32
10687 eval $setvar
10688 $rm_try
10689
10690 : check for ability to cast negative floats to unsigned
10691 echo " "
10692 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10693 $cat >try.c <<EOCP
10694 #include <stdio.h>
10695 #$i_stdlib I_STDLIB
10696 #ifdef I_STDLIB
10697 #include <stdlib.h>
10698 #endif
10699 #include <sys/types.h>
10700 #include <signal.h>
10701 $signal_t blech(int s) { exit(7); }
10702 $signal_t blech_in_list(int s) { exit(4); }
10703 unsigned long dummy_long(unsigned long p) { return p; }
10704 unsigned int dummy_int(unsigned int p) { return p; }
10705 unsigned short dummy_short(unsigned short p) { return p; }
10706 int main()
10707 {
10708         double f;
10709         unsigned long along;
10710         unsigned int aint;
10711         unsigned short ashort;
10712         int result = 0;
10713         char str[16];
10714
10715         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10716            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10717            optimized the whole file away
10718         */
10719         /* Store the number in a writable string for gcc to pass to
10720            sscanf under HP/UX.
10721         */
10722         sprintf(str, "-123");
10723         sscanf(str, "%lf", &f);  /* f = -123.; */
10724
10725         signal(SIGFPE, blech);
10726         along = (unsigned long)f;
10727         aint = (unsigned int)f;
10728         ashort = (unsigned short)f;
10729         if (along != (unsigned long)-123)
10730                 result |= 1;
10731         if (aint != (unsigned int)-123)
10732                 result |= 1;
10733         if (ashort != (unsigned short)-123)
10734                 result |= 1;
10735         sprintf(str, "1073741824.");
10736         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10737         f = f + f;
10738         along = 0;
10739         along = (unsigned long)f;
10740         if (along != 0x80000000)
10741                 result |= 2;
10742         f -= 1.;
10743         along = 0;
10744         along = (unsigned long)f;
10745         if (along != 0x7fffffff)
10746                 result |= 1;
10747         f += 2.;
10748         along = 0;
10749         along = (unsigned long)f;
10750         if (along != 0x80000001)
10751                 result |= 2;
10752         if (result)
10753                 exit(result);
10754         signal(SIGFPE, blech_in_list);
10755         sprintf(str, "123.");
10756         sscanf(str, "%lf", &f);  /* f = 123.; */
10757         along = dummy_long((unsigned long)f);
10758         aint = dummy_int((unsigned int)f);
10759         ashort = dummy_short((unsigned short)f);
10760         if (along != (unsigned long)123)
10761                 result |= 4;
10762         if (aint != (unsigned int)123)
10763                 result |= 4;
10764         if (ashort != (unsigned short)123)
10765                 result |= 4;
10766         exit(result);
10767
10768 }
10769 EOCP
10770 set try
10771 if eval $compile_ok; then
10772         $run ./try
10773         castflags=$?
10774 else
10775         echo "(I can't seem to compile the test program--assuming it can't)"
10776         castflags=7
10777 fi
10778 case "$castflags" in
10779 0)      val="$define"
10780         echo "Yup, it can."
10781         ;;
10782 *)      val="$undef"
10783         echo "Nope, it can't."
10784         ;;
10785 esac
10786 set d_castneg
10787 eval $setvar
10788 $rm_try
10789
10790 : see if vprintf exists
10791 echo " "
10792 if set vprintf val -f d_vprintf; eval $csym; $val; then
10793         echo 'vprintf() found.' >&4
10794         val="$define"
10795         $cat >try.c <<EOF
10796 #include <varargs.h>
10797 #$i_stdlib I_STDLIB
10798 #ifdef I_STDLIB
10799 #include <stdlib.h>
10800 #endif
10801
10802 int main() { xxx("foo"); }
10803
10804 xxx(va_alist)
10805 va_dcl
10806 {
10807         va_list args;
10808         char buf[10];
10809
10810         va_start(args);
10811         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10812 }
10813 EOF
10814         set try
10815         if eval $compile && $run ./try; then
10816                 echo "Your vsprintf() returns (int)." >&4
10817                 val2="$undef"
10818         else
10819                 echo "Your vsprintf() returns (char*)." >&4
10820                 val2="$define"
10821         fi
10822 else
10823         echo 'vprintf() NOT found.' >&4
10824                 val="$undef"
10825                 val2="$undef"
10826 fi
10827 $rm_try
10828 set d_vprintf
10829 eval $setvar
10830 val=$val2
10831 set d_charvspr
10832 eval $setvar
10833
10834 : see if chown exists
10835 set chown d_chown
10836 eval $inlibc
10837
10838 : see if chroot exists
10839 set chroot d_chroot
10840 eval $inlibc
10841
10842 : see if chsize exists
10843 set chsize d_chsize
10844 eval $inlibc
10845
10846 : see if class exists
10847 set class d_class
10848 eval $inlibc
10849
10850 : see if clearenv exists
10851 set clearenv d_clearenv
10852 eval $inlibc
10853
10854 hasstruct='varname=$1; struct=$2; shift; shift;
10855 while $test $# -ge 2; do
10856         case "$1" in
10857         $define) echo "#include <$2>";;
10858         esac ;
10859     shift 2;
10860 done > try.c;
10861 echo "int main () { struct $struct foo; }" >> try.c;
10862 set try;
10863 if eval $compile; then
10864         val="$define";
10865 else
10866         val="$undef";
10867 fi;
10868 set $varname;
10869 eval $setvar;
10870 $rm_try'
10871
10872 socketlib=''
10873 sockethdr=''
10874 : see whether socket exists
10875 echo " "
10876 $echo $n "Hmm... $c" >&4
10877 if set socket val -f d_socket; eval $csym; $val; then
10878         echo "Looks like you have Berkeley networking support." >&4
10879         d_socket="$define"
10880         if set setsockopt val -f; eval $csym; $val; then
10881                 d_oldsock="$undef"
10882         else
10883                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10884                 d_oldsock="$define"
10885         fi
10886 else
10887         if $contains socklib libc.list >/dev/null 2>&1; then
10888                 echo "Looks like you have Berkeley networking support." >&4
10889                 d_socket="$define"
10890                 : we will have to assume that it supports the 4.2 BSD interface
10891                 d_oldsock="$undef"
10892         else
10893                 echo "You don't have Berkeley networking in libc$_a..." >&4
10894                 if test "X$d_socket" = "X$define"; then
10895                    echo "...but you seem to believe that you have sockets." >&4
10896                 else
10897                         for net in net socket
10898                         do
10899                                 if test -f /usr/lib/lib$net$_a; then
10900                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10901                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10902                                         if $contains socket libc.list >/dev/null 2>&1; then
10903                                                 d_socket="$define"
10904                                                 socketlib="-l$net"
10905                                                 case "$net" in
10906                                                 net)
10907                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10908                                                         sockethdr="-I/usr/netinclude"
10909                                                         ;;
10910                                                 esac
10911                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10912                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10913                                                         d_oldsock="$undef"
10914                                                 else
10915                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10916                                                         d_oldsock="$define"
10917                                                 fi
10918                                                 break
10919                                         fi
10920                                 fi
10921                         done
10922                         if test "X$d_socket" != "X$define"; then
10923                            echo "or anywhere else I see." >&4
10924                            d_socket="$undef"
10925                            d_oldsock="$undef"
10926                         fi
10927                 fi
10928         fi
10929 fi
10930
10931 : see if socketpair exists
10932 set socketpair d_sockpair
10933 eval $inlibc
10934
10935
10936 echo " "
10937 echo "Checking the availability of certain socket constants..." >&4
10938 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10939         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10940         $cat >try.c <<EOF
10941 #include <sys/types.h>
10942 #include <sys/socket.h>
10943 int main() {
10944     int i = $ENUM;
10945 }
10946 EOF
10947         val="$undef"
10948         set try; if eval $compile; then
10949                 val="$define"
10950         fi
10951         set d_${enum}; eval $setvar
10952         $rm_try
10953 done
10954
10955 : see if this is a sys/uio.h system
10956 set sys/uio.h i_sysuio
10957 eval $inhdr
10958
10959
10960 echo " "
10961 echo "Checking to see if your system supports struct cmsghdr..." >&4
10962 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10963 eval $hasstruct
10964 case "$d_cmsghdr_s" in
10965 "$define")      echo "Yes, it does."   ;;
10966 *)              echo "No, it doesn't." ;;
10967 esac
10968
10969
10970 : check for const keyword
10971 echo " "
10972 echo 'Checking to see if your C compiler knows about "const"...' >&4
10973 $cat >const.c <<'EOCP'
10974 typedef struct spug { int drokk; } spug;
10975 int main()
10976 {
10977         const char *foo;
10978         const spug y = { 0 };
10979 }
10980 EOCP
10981 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10982         val="$define"
10983         echo "Yup, it does."
10984 else
10985         val="$undef"
10986         echo "Nope, it doesn't."
10987 fi
10988 set d_const
10989 eval $setvar
10990
10991 : see if copysignl exists
10992 set copysignl d_copysignl
10993 eval $inlibc
10994
10995 : see if crypt exists
10996 echo " "
10997 set crypt d_crypt
10998 eval $inlibc
10999 case "$d_crypt" in
11000 $define) cryptlib='' ;;
11001 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11002                 echo 'crypt() found.' >&4
11003                 val="$define"
11004                 cryptlib=''
11005         else
11006                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11007                 if $test -z "$cryptlib"; then
11008                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11009                 else
11010                         cryptlib=-lcrypt
11011                 fi
11012                 if $test -z "$cryptlib"; then
11013                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11014                 else
11015                         cryptlib=-lcrypt
11016                 fi
11017                 if $test -z "$cryptlib"; then
11018                         cryptlib=`./loc libcrypt$_a "" $libpth`
11019                 else
11020                         cryptlib=-lcrypt
11021                 fi
11022                 if $test -z "$cryptlib"; then
11023                         echo 'crypt() NOT found.' >&4
11024                         val="$undef"
11025                 else
11026                         val="$define"
11027                 fi
11028         fi
11029         set d_crypt
11030         eval $setvar
11031         ;;
11032 esac
11033
11034 : see if this is a crypt.h system
11035 set crypt.h i_crypt
11036 eval $inhdr
11037
11038 : see if crypt_r exists
11039 set crypt_r d_crypt_r
11040 eval $inlibc
11041 case "$d_crypt_r" in
11042 "$define")
11043         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11044         case "$d_crypt_r_proto:$usethreads" in
11045         ":define")      d_crypt_r_proto=define
11046                 set d_crypt_r_proto crypt_r $hdrs
11047                 eval $hasproto ;;
11048         *)      ;;
11049         esac
11050         case "$d_crypt_r_proto" in
11051         define)
11052         case "$crypt_r_proto" in
11053         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11054         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11055         esac
11056         case "$crypt_r_proto" in
11057         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11058         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11059         esac
11060         case "$crypt_r_proto" in
11061         ''|0)   d_crypt_r=undef
11062                 crypt_r_proto=0
11063                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11064         * )     case "$crypt_r_proto" in
11065                 REENTRANT_PROTO*) ;;
11066                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11067                 esac
11068                 echo "Prototype: $try" ;;
11069         esac
11070         ;;
11071         *)      case "$usethreads" in
11072                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11073                 esac
11074                 d_crypt_r=undef
11075                 crypt_r_proto=0
11076                 ;;
11077         esac
11078         ;;
11079 *)      crypt_r_proto=0
11080         ;;
11081 esac
11082
11083 : get csh whereabouts
11084 case "$csh" in
11085 'csh') val="$undef" ;;
11086 *) val="$define" ;;
11087 esac
11088 set d_csh
11089 eval $setvar
11090 : Respect a hint or command line value for full_csh.
11091 case "$full_csh" in
11092 '') full_csh=$csh ;;
11093 esac
11094
11095 : see if ctermid exists
11096 set ctermid d_ctermid
11097 eval $inlibc
11098
11099 : see if ctermid_r exists
11100 set ctermid_r d_ctermid_r
11101 eval $inlibc
11102 case "$d_ctermid_r" in
11103 "$define")
11104         hdrs="$i_systypes sys/types.h define stdio.h "
11105         case "$d_ctermid_r_proto:$usethreads" in
11106         ":define")      d_ctermid_r_proto=define
11107                 set d_ctermid_r_proto ctermid_r $hdrs
11108                 eval $hasproto ;;
11109         *)      ;;
11110         esac
11111         case "$d_ctermid_r_proto" in
11112         define)
11113         case "$ctermid_r_proto" in
11114         ''|0) try='char* ctermid_r(char*);'
11115         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11116         esac
11117         case "$ctermid_r_proto" in
11118         ''|0)   d_ctermid_r=undef
11119                 ctermid_r_proto=0
11120                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11121         * )     case "$ctermid_r_proto" in
11122                 REENTRANT_PROTO*) ;;
11123                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11124                 esac
11125                 echo "Prototype: $try" ;;
11126         esac
11127         ;;
11128         *)      case "$usethreads" in
11129                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11130                 esac
11131                 d_ctermid_r=undef
11132                 ctermid_r_proto=0
11133                 ;;
11134         esac
11135         ;;
11136 *)      ctermid_r_proto=0
11137         ;;
11138 esac
11139
11140 : see if ctime_r exists
11141 set ctime_r d_ctime_r
11142 eval $inlibc
11143 case "$d_ctime_r" in
11144 "$define")
11145         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11146         case "$d_ctime_r_proto:$usethreads" in
11147         ":define")      d_ctime_r_proto=define
11148                 set d_ctime_r_proto ctime_r $hdrs
11149                 eval $hasproto ;;
11150         *)      ;;
11151         esac
11152         case "$d_ctime_r_proto" in
11153         define)
11154         case "$ctime_r_proto" in
11155         ''|0) try='char* ctime_r(const time_t*, char*);'
11156         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11157         esac
11158         case "$ctime_r_proto" in
11159         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11160         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11161         esac
11162         case "$ctime_r_proto" in
11163         ''|0) try='int ctime_r(const time_t*, char*);'
11164         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11165         esac
11166         case "$ctime_r_proto" in
11167         ''|0) try='int ctime_r(const time_t*, char*, int);'
11168         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11169         esac
11170         case "$ctime_r_proto" in
11171         ''|0)   d_ctime_r=undef
11172                 ctime_r_proto=0
11173                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11174         * )     case "$ctime_r_proto" in
11175                 REENTRANT_PROTO*) ;;
11176                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11177                 esac
11178                 echo "Prototype: $try" ;;
11179         esac
11180         ;;
11181         *)      case "$usethreads" in
11182                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11183                 esac
11184                 d_ctime_r=undef
11185                 ctime_r_proto=0
11186                 ;;
11187         esac
11188         ;;
11189 *)      ctime_r_proto=0
11190         ;;
11191 esac
11192
11193 : see if cuserid exists
11194 set cuserid d_cuserid
11195 eval $inlibc
11196
11197 : see if this is a limits.h system
11198 set limits.h i_limits
11199 eval $inhdr
11200
11201 : see if this is a float.h system
11202 set float.h i_float
11203 eval $inhdr
11204
11205 : See if number of significant digits in a double precision number is known
11206 echo " "
11207 $cat >dbl_dig.c <<EOM
11208 #$i_limits I_LIMITS
11209 #$i_float I_FLOAT
11210 #ifdef I_LIMITS
11211 #include <limits.h>
11212 #endif
11213 #ifdef I_FLOAT
11214 #include <float.h>
11215 #endif
11216 #ifdef DBL_DIG
11217 printf("Contains DBL_DIG");
11218 #endif
11219 EOM
11220 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11221 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11222         echo "DBL_DIG found." >&4
11223         val="$define"
11224 else
11225         echo "DBL_DIG NOT found." >&4
11226         val="$undef"
11227 fi
11228 $rm -f dbl_dig.?
11229 set d_dbl_dig
11230 eval $setvar
11231
11232 : see if dbm.h is available
11233 : see if dbmclose exists
11234 set dbmclose d_dbmclose
11235 eval $inlibc
11236
11237 case "$d_dbmclose" in
11238 $define)
11239         set dbm.h i_dbm
11240         eval $inhdr
11241         case "$i_dbm" in
11242         $define)
11243                 val="$undef"
11244                 set i_rpcsvcdbm
11245                 eval $setvar
11246                 ;;
11247         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11248                 eval $inhdr
11249                 ;;
11250         esac
11251         ;;
11252 *)      echo "We won't be including <dbm.h>"
11253         val="$undef"
11254         set i_dbm
11255         eval $setvar
11256         val="$undef"
11257         set i_rpcsvcdbm
11258         eval $setvar
11259         ;;
11260 esac
11261
11262 : see if prototype for dbminit is available
11263 echo " "
11264 set d_dbminitproto dbminit $i_dbm dbm.h
11265 eval $hasproto
11266
11267 : see if difftime exists
11268 set difftime d_difftime
11269 eval $inlibc
11270
11271 : see if this is a dirent system
11272 echo " "
11273 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11274         val="$define"
11275         echo "<dirent.h> found." >&4
11276 else
11277         val="$undef"
11278         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11279                 echo "<sys/dir.h> found." >&4
11280                 echo " "
11281         else
11282                 xinc=`./findhdr sys/ndir.h`
11283         fi
11284         echo "<dirent.h> NOT found." >&4
11285 fi
11286 set i_dirent
11287 eval $setvar
11288
11289 : Look for type of directory structure.
11290 echo " "
11291 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11292
11293 case "$direntrytype" in
11294 ''|' ')
11295         case "$i_dirent" in
11296         $define) guess1='struct dirent' ;;
11297         *) guess1='struct direct'  ;;
11298         esac
11299         ;;
11300 *)      guess1="$direntrytype"
11301         ;;
11302 esac
11303
11304 case "$guess1" in
11305 'struct dirent') guess2='struct direct' ;;
11306 *) guess2='struct dirent' ;;
11307 esac
11308
11309 if $contains "$guess1" try.c >/dev/null 2>&1; then
11310         direntrytype="$guess1"
11311         echo "Your directory entries are $direntrytype." >&4
11312 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11313         direntrytype="$guess2"
11314         echo "Your directory entries seem to be $direntrytype." >&4
11315 else
11316         echo "I don't recognize your system's directory entries." >&4
11317         rp="What type is used for directory entries on this system?"
11318         dflt="$guess1"
11319         . ./myread
11320         direntrytype="$ans"
11321 fi
11322 $rm_try
11323
11324 : see if the directory entry stores field length
11325 echo " "
11326 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11327 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11328         echo "Good, your directory entry keeps length information in d_namlen." >&4
11329         val="$define"
11330 else
11331         echo "Your directory entry does not know about the d_namlen field." >&4
11332         val="$undef"
11333 fi
11334 set d_dirnamlen
11335 eval $setvar
11336 $rm_try
11337
11338 : Look for DIR.dd_fd
11339 case "$i_dirent" in
11340 "$define")
11341     echo "Checking to see if DIR has a dd_fd member variable" >&4
11342     $cat >try.c <<EOCP
11343 #$i_stdlib I_STDLIB
11344 #ifdef I_STDLIB
11345 #include <stdlib.h>
11346 #endif
11347 #include <dirent.h>
11348
11349 int main() {
11350     DIR dir;
11351     dir.dd_fd = 1;
11352     return 0;
11353 }
11354 EOCP
11355     val=$undef
11356     set try
11357     if eval $compile; then
11358         echo "Yes, it does."
11359         val="$define"
11360     else
11361         echo "No, it does not."
11362         val="$undef"
11363     fi
11364     ;;
11365 *)
11366     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11367     val="$undef"
11368     ;;
11369 esac
11370 set d_dir_dd_fd
11371 eval $setvar
11372 $rm_try
11373
11374 : see if this is an sysdir system
11375 set sys/dir.h i_sysdir
11376 eval $inhdr
11377
11378 : see if this is an sysndir system
11379 set sys/ndir.h i_sysndir
11380 eval $inhdr
11381
11382 : Look for dirfd
11383 echo " "
11384 $cat >dirfd.c <<EOM
11385 #include <stdio.h>
11386 #$i_stdlib I_STDLIB
11387 #ifdef I_STDLIB
11388 #include <stdlib.h>
11389 #endif
11390 #$i_dirent I_DIRENT             /**/
11391 #$i_sysdir I_SYS_DIR            /**/
11392 #$i_sysndir I_SYS_NDIR          /**/
11393 #$i_systypes I_SYS_TYPES        /**/
11394 #if defined(I_SYS_TYPES)
11395 #include <sys/types.h>
11396 #endif
11397 #if defined(I_DIRENT)
11398 #include <dirent.h>
11399 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11400 #include <sys/dir.h>
11401 #endif
11402 #else
11403 #ifdef I_SYS_NDIR
11404 #include <sys/ndir.h>
11405 #else
11406 #ifdef I_SYS_DIR
11407 #ifdef hp9000s500
11408 #include <ndir.h>       /* may be wrong in the future */
11409 #else
11410 #include <sys/dir.h>
11411 #endif
11412 #endif
11413 #endif
11414 #endif 
11415 int main() {
11416         DIR *dirp = opendir(".");
11417         if (dirfd(dirp) >= 0)
11418                 exit(0);
11419         else
11420                 exit(1);
11421 }
11422 EOM
11423 val=$undef
11424 set dirfd
11425 if eval $compile; then
11426         val="$define"
11427 fi
11428 case "$val" in
11429 $define)        echo "dirfd() found." >&4       ;;
11430 *)              echo "dirfd() NOT found." >&4   ;;
11431 esac
11432 set d_dirfd
11433 eval $setvar
11434 $rm -f dirfd*
11435
11436 : see if dlerror exists
11437 xxx_runnm="$runnm"
11438 runnm=false
11439 set dlerror d_dlerror
11440 eval $inlibc
11441 runnm="$xxx_runnm"
11442
11443 : see if dlfcn is available
11444 set dlfcn.h i_dlfcn
11445 eval $inhdr
11446
11447 case "$usedl" in
11448 $define|y|true)
11449         $cat << EOM
11450
11451 On a few systems, the dynamically loaded modules that perl generates and uses
11452 will need a different extension than shared libs. The default will probably
11453 be appropriate.
11454
11455 EOM
11456         case "$dlext" in
11457         '')     dflt="$so" ;;
11458         *)      dflt="$dlext" ;;
11459         esac
11460         rp='What is the extension of dynamically loaded modules'
11461         . ./myread
11462         dlext="$ans"
11463         ;;
11464 *)
11465         dlext="none"
11466         ;;
11467 esac
11468
11469 : Check if dlsym need a leading underscore
11470 echo " "
11471 val="$undef"
11472
11473 case "$dlsrc" in
11474 dl_dlopen.xs)
11475         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11476         $cat >dyna.c <<'EOM'
11477 fred () { }
11478 EOM
11479
11480 $cat >fred.c<<EOM
11481
11482 #include <stdio.h>
11483 #$i_stdlib I_STDLIB
11484 #ifdef I_STDLIB
11485 #include <stdlib.h>
11486 #endif
11487 #$i_dlfcn I_DLFCN
11488 #ifdef I_DLFCN
11489 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11490 #else
11491 #include <sys/types.h>
11492 #include <nlist.h>
11493 #include <link.h>
11494 #endif
11495
11496 extern int fred() ;
11497
11498 int main()
11499 {
11500     void * handle ;
11501     void * symbol ;
11502 #ifndef RTLD_LAZY
11503     int mode = 1 ;
11504 #else
11505     int mode = RTLD_LAZY ;
11506 #endif
11507     handle = dlopen("./dyna.$dlext", mode) ;
11508     if (handle == NULL) {
11509         printf ("1\n") ;
11510         fflush (stdout) ;
11511         exit(0);
11512     }
11513     symbol = dlsym(handle, "fred") ;
11514     if (symbol == NULL) {
11515         /* try putting a leading underscore */
11516         symbol = dlsym(handle, "_fred") ;
11517         if (symbol == NULL) {
11518             printf ("2\n") ;
11519             fflush (stdout) ;
11520             exit(0);
11521         }
11522         printf ("3\n") ;
11523     }
11524     else
11525         printf ("4\n") ;
11526     fflush (stdout) ;
11527     exit(0);
11528 }
11529 EOM
11530         : Call the object file tmp-dyna.o in case dlext=o.
11531         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11532                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11533                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11534                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11535                 xxx=`$run ./fred`
11536                 case $xxx in
11537                 1)      echo "Test program failed using dlopen." >&4
11538                         echo "Perhaps you should not use dynamic loading." >&4;;
11539                 2)      echo "Test program failed using dlsym." >&4
11540                         echo "Perhaps you should not use dynamic loading." >&4;;
11541                 3)      echo "dlsym needs a leading underscore" >&4
11542                         val="$define" ;;
11543                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11544                 esac
11545         else
11546                 echo "I can't compile and run the test program." >&4
11547                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11548         fi
11549         ;;
11550 esac
11551                 
11552 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11553
11554 set d_dlsymun
11555 eval $setvar
11556
11557 : see if drand48_r exists
11558 set drand48_r d_drand48_r
11559 eval $inlibc
11560 case "$d_drand48_r" in
11561 "$define")
11562         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11563         case "$d_drand48_r_proto:$usethreads" in
11564         ":define")      d_drand48_r_proto=define
11565                 set d_drand48_r_proto drand48_r $hdrs
11566                 eval $hasproto ;;
11567         *)      ;;
11568         esac
11569         case "$d_drand48_r_proto" in
11570         define)
11571         case "$drand48_r_proto" in
11572         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11573         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11574         esac
11575         case "$drand48_r_proto" in
11576         ''|0)   d_drand48_r=undef
11577                 drand48_r_proto=0
11578                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11579         * )     case "$drand48_r_proto" in
11580                 REENTRANT_PROTO*) ;;
11581                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11582                 esac
11583                 echo "Prototype: $try" ;;
11584         esac
11585         ;;
11586         *)      case "$usethreads" in
11587                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11588                 esac
11589                 d_drand48_r=undef
11590                 drand48_r_proto=0
11591                 ;;
11592         esac
11593         ;;
11594 *)      drand48_r_proto=0
11595         ;;
11596 esac
11597
11598 : see if prototype for drand48 is available
11599 echo " "
11600 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11601 eval $hasproto
11602
11603 : see if dup2 exists
11604 set dup2 d_dup2
11605 eval $inlibc
11606
11607 : see if eaccess exists
11608 set eaccess d_eaccess
11609 eval $inlibc
11610
11611 : see if endgrent exists
11612 set endgrent d_endgrent
11613 eval $inlibc
11614
11615 : see if this is an grp system
11616 set grp.h i_grp
11617 eval $inhdr
11618
11619 case "$i_grp" in
11620 $define)
11621         xxx=`./findhdr grp.h`
11622         $cppstdin $cppflags $cppminus < $xxx >$$.h
11623
11624         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11625                 val="$define"
11626         else
11627                 val="$undef"
11628         fi
11629         set d_grpasswd
11630         eval $setvar
11631
11632         $rm -f $$.h
11633         ;;
11634 *)
11635         val="$undef";
11636         set d_grpasswd; eval $setvar
11637         ;;
11638 esac
11639
11640 : see if endgrent_r exists
11641 set endgrent_r d_endgrent_r
11642 eval $inlibc
11643 case "$d_endgrent_r" in
11644 "$define")
11645         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11646         case "$d_endgrent_r_proto:$usethreads" in
11647         ":define")      d_endgrent_r_proto=define
11648                 set d_endgrent_r_proto endgrent_r $hdrs
11649                 eval $hasproto ;;
11650         *)      ;;
11651         esac
11652         case "$d_endgrent_r_proto" in
11653         define)
11654         case "$endgrent_r_proto" in
11655         ''|0) try='int endgrent_r(FILE**);'
11656         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11657         esac
11658         case "$endgrent_r_proto" in
11659         ''|0) try='void endgrent_r(FILE**);'
11660         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11661         esac
11662         case "$endgrent_r_proto" in
11663         ''|0)   d_endgrent_r=undef
11664                 endgrent_r_proto=0
11665                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11666         * )     case "$endgrent_r_proto" in
11667                 REENTRANT_PROTO*) ;;
11668                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11669                 esac
11670                 echo "Prototype: $try" ;;
11671         esac
11672         ;;
11673         *)      case "$usethreads" in
11674                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11675                 esac
11676                 d_endgrent_r=undef
11677                 endgrent_r_proto=0
11678                 ;;
11679         esac
11680         ;;
11681 *)      endgrent_r_proto=0
11682         ;;
11683 esac
11684
11685 : see if endhostent exists
11686 set endhostent d_endhent
11687 eval $inlibc
11688
11689 : see if this is a netdb.h system
11690 set netdb.h i_netdb
11691 eval $inhdr
11692
11693 : see if endhostent_r exists
11694 set endhostent_r d_endhostent_r
11695 eval $inlibc
11696 case "$d_endhostent_r" in
11697 "$define")
11698         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11699         case "$d_endhostent_r_proto:$usethreads" in
11700         ":define")      d_endhostent_r_proto=define
11701                 set d_endhostent_r_proto endhostent_r $hdrs
11702                 eval $hasproto ;;
11703         *)      ;;
11704         esac
11705         case "$d_endhostent_r_proto" in
11706         define)
11707         case "$endhostent_r_proto" in
11708         ''|0) try='int endhostent_r(struct hostent_data*);'
11709         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11710         esac
11711         case "$endhostent_r_proto" in
11712         ''|0) try='void endhostent_r(struct hostent_data*);'
11713         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11714         esac
11715         case "$endhostent_r_proto" in
11716         ''|0)   d_endhostent_r=undef
11717                 endhostent_r_proto=0
11718                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11719         * )     case "$endhostent_r_proto" in
11720                 REENTRANT_PROTO*) ;;
11721                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11722                 esac
11723                 echo "Prototype: $try" ;;
11724         esac
11725         ;;
11726         *)      case "$usethreads" in
11727                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11728                 esac
11729                 d_endhostent_r=undef
11730                 endhostent_r_proto=0
11731                 ;;
11732         esac
11733         ;;
11734 *)      endhostent_r_proto=0
11735         ;;
11736 esac
11737
11738 : see if endnetent exists
11739 set endnetent d_endnent
11740 eval $inlibc
11741
11742 : see if endnetent_r exists
11743 set endnetent_r d_endnetent_r
11744 eval $inlibc
11745 case "$d_endnetent_r" in
11746 "$define")
11747         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11748         case "$d_endnetent_r_proto:$usethreads" in
11749         ":define")      d_endnetent_r_proto=define
11750                 set d_endnetent_r_proto endnetent_r $hdrs
11751                 eval $hasproto ;;
11752         *)      ;;
11753         esac
11754         case "$d_endnetent_r_proto" in
11755         define)
11756         case "$endnetent_r_proto" in
11757         ''|0) try='int endnetent_r(struct netent_data*);'
11758         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11759         esac
11760         case "$endnetent_r_proto" in
11761         ''|0) try='void endnetent_r(struct netent_data*);'
11762         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11763         esac
11764         case "$endnetent_r_proto" in
11765         ''|0)   d_endnetent_r=undef
11766                 endnetent_r_proto=0
11767                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11768         * )     case "$endnetent_r_proto" in
11769                 REENTRANT_PROTO*) ;;
11770                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11771                 esac
11772                 echo "Prototype: $try" ;;
11773         esac
11774         ;;
11775         *)      case "$usethreads" in
11776                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11777                 esac
11778                 d_endnetent_r=undef
11779                 endnetent_r_proto=0
11780                 ;;
11781         esac
11782         ;;
11783 *)      endnetent_r_proto=0
11784         ;;
11785 esac
11786
11787 : see if endprotoent exists
11788 set endprotoent d_endpent
11789 eval $inlibc
11790
11791 : see if endprotoent_r exists
11792 set endprotoent_r d_endprotoent_r
11793 eval $inlibc
11794 case "$d_endprotoent_r" in
11795 "$define")
11796         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11797         case "$d_endprotoent_r_proto:$usethreads" in
11798         ":define")      d_endprotoent_r_proto=define
11799                 set d_endprotoent_r_proto endprotoent_r $hdrs
11800                 eval $hasproto ;;
11801         *)      ;;
11802         esac
11803         case "$d_endprotoent_r_proto" in
11804         define)
11805         case "$endprotoent_r_proto" in
11806         ''|0) try='int endprotoent_r(struct protoent_data*);'
11807         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11808         esac
11809         case "$endprotoent_r_proto" in
11810         ''|0) try='void endprotoent_r(struct protoent_data*);'
11811         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11812         esac
11813         case "$endprotoent_r_proto" in
11814         ''|0)   d_endprotoent_r=undef
11815                 endprotoent_r_proto=0
11816                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11817         * )     case "$endprotoent_r_proto" in
11818                 REENTRANT_PROTO*) ;;
11819                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11820                 esac
11821                 echo "Prototype: $try" ;;
11822         esac
11823         ;;
11824         *)      case "$usethreads" in
11825                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11826                 esac
11827                 d_endprotoent_r=undef
11828                 endprotoent_r_proto=0
11829                 ;;
11830         esac
11831         ;;
11832 *)      endprotoent_r_proto=0
11833         ;;
11834 esac
11835
11836 : see if endpwent exists
11837 set endpwent d_endpwent
11838 eval $inlibc
11839
11840 : see if this is a pwd.h system
11841 set pwd.h i_pwd
11842 eval $inhdr
11843
11844 case "$i_pwd" in
11845 $define)
11846         xxx=`./findhdr pwd.h`
11847         $cppstdin $cppflags $cppminus < $xxx >$$.h
11848
11849         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11850                 val="$define"
11851         else
11852                 val="$undef"
11853         fi
11854         set d_pwquota
11855         eval $setvar
11856
11857         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11858                 val="$define"
11859         else
11860                 val="$undef"
11861         fi
11862         set d_pwage
11863         eval $setvar
11864
11865         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11866                 val="$define"
11867         else
11868                 val="$undef"
11869         fi
11870         set d_pwchange
11871         eval $setvar
11872
11873         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11874                 val="$define"
11875         else
11876                 val="$undef"
11877         fi
11878         set d_pwclass
11879         eval $setvar
11880
11881         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11882                 val="$define"
11883         else
11884                 val="$undef"
11885         fi
11886         set d_pwexpire
11887         eval $setvar
11888
11889         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11890                 val="$define"
11891         else
11892                 val="$undef"
11893         fi
11894         set d_pwcomment
11895         eval $setvar
11896
11897         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11898                 val="$define"
11899         else
11900                 val="$undef"
11901         fi
11902         set d_pwgecos
11903         eval $setvar
11904
11905         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11906                 val="$define"
11907         else
11908                 val="$undef"
11909         fi
11910         set d_pwpasswd
11911         eval $setvar
11912
11913         $rm -f $$.h
11914         ;;
11915 *)
11916         val="$undef"; 
11917         set d_pwquota; eval $setvar
11918         set d_pwage; eval $setvar
11919         set d_pwchange; eval $setvar
11920         set d_pwclass; eval $setvar
11921         set d_pwexpire; eval $setvar
11922         set d_pwcomment; eval $setvar
11923         set d_pwgecos; eval $setvar
11924         set d_pwpasswd; eval $setvar
11925         ;;
11926 esac
11927
11928 : see if endpwent_r exists
11929 set endpwent_r d_endpwent_r
11930 eval $inlibc
11931 case "$d_endpwent_r" in
11932 "$define")
11933         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11934         case "$d_endpwent_r_proto:$usethreads" in
11935         ":define")      d_endpwent_r_proto=define
11936                 set d_endpwent_r_proto endpwent_r $hdrs
11937                 eval $hasproto ;;
11938         *)      ;;
11939         esac
11940         case "$d_endpwent_r_proto" in
11941         define)
11942         case "$endpwent_r_proto" in
11943         ''|0) try='int endpwent_r(FILE**);'
11944         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11945         esac
11946         case "$endpwent_r_proto" in
11947         ''|0) try='void endpwent_r(FILE**);'
11948         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11949         esac
11950         case "$endpwent_r_proto" in
11951         ''|0)   d_endpwent_r=undef
11952                 endpwent_r_proto=0
11953                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11954         * )     case "$endpwent_r_proto" in
11955                 REENTRANT_PROTO*) ;;
11956                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11957                 esac
11958                 echo "Prototype: $try" ;;
11959         esac
11960         ;;
11961         *)      case "$usethreads" in
11962                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11963                 esac
11964                 d_endpwent_r=undef
11965                 endpwent_r_proto=0
11966                 ;;
11967         esac
11968         ;;
11969 *)      endpwent_r_proto=0
11970         ;;
11971 esac
11972
11973 : see if endservent exists
11974 set endservent d_endsent
11975 eval $inlibc
11976
11977 : see if endservent_r exists
11978 set endservent_r d_endservent_r
11979 eval $inlibc
11980 case "$d_endservent_r" in
11981 "$define")
11982         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11983         case "$d_endservent_r_proto:$usethreads" in
11984         ":define")      d_endservent_r_proto=define
11985                 set d_endservent_r_proto endservent_r $hdrs
11986                 eval $hasproto ;;
11987         *)      ;;
11988         esac
11989         case "$d_endservent_r_proto" in
11990         define)
11991         case "$endservent_r_proto" in
11992         ''|0) try='int endservent_r(struct servent_data*);'
11993         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11994         esac
11995         case "$endservent_r_proto" in
11996         ''|0) try='void endservent_r(struct servent_data*);'
11997         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11998         esac
11999         case "$endservent_r_proto" in
12000         ''|0)   d_endservent_r=undef
12001                 endservent_r_proto=0
12002                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12003         * )     case "$endservent_r_proto" in
12004                 REENTRANT_PROTO*) ;;
12005                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12006                 esac
12007                 echo "Prototype: $try" ;;
12008         esac
12009         ;;
12010         *)      case "$usethreads" in
12011                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12012                 esac
12013                 d_endservent_r=undef
12014                 endservent_r_proto=0
12015                 ;;
12016         esac
12017         ;;
12018 *)      endservent_r_proto=0
12019         ;;
12020 esac
12021
12022 : Locate the flags for 'open()'
12023 echo " "
12024 $cat >try.c <<EOCP
12025 #include <sys/types.h>
12026 #ifdef I_FCNTL
12027 #include <fcntl.h>
12028 #endif
12029 #ifdef I_SYS_FILE
12030 #include <sys/file.h>
12031 #endif
12032 #$i_stdlib I_STDLIB
12033 #ifdef I_STDLIB
12034 #include <stdlib.h>
12035 #endif
12036 int main() {
12037         if(O_RDONLY);
12038 #ifdef O_TRUNC
12039         exit(0);
12040 #else
12041         exit(1);
12042 #endif
12043 }
12044 EOCP
12045 : check sys/file.h first to get FREAD on Sun
12046 if $test `./findhdr sys/file.h` && \
12047                 set try -DI_SYS_FILE && eval $compile; then
12048         h_sysfile=true;
12049         echo "<sys/file.h> defines the O_* constants..." >&4
12050         if $run ./try; then
12051                 echo "and you have the 3 argument form of open()." >&4
12052                 val="$define"
12053         else
12054                 echo "but not the 3 argument form of open().  Oh, well." >&4
12055                 val="$undef"
12056         fi
12057 elif $test `./findhdr fcntl.h` && \
12058                 set try -DI_FCNTL && eval $compile; then
12059         h_fcntl=true;
12060         echo "<fcntl.h> defines the O_* constants..." >&4
12061         if $run ./try; then
12062                 echo "and you have the 3 argument form of open()." >&4
12063                 val="$define"
12064         else
12065                 echo "but not the 3 argument form of open().  Oh, well." >&4
12066                 val="$undef"
12067         fi
12068 else
12069         val="$undef"
12070         echo "I can't find the O_* constant definitions!  You got problems." >&4
12071 fi
12072 set d_open3
12073 eval $setvar
12074 $rm_try
12075
12076 : see which of string.h or strings.h is needed
12077 echo " "
12078 strings=`./findhdr string.h`
12079 if $test "$strings" && $test -r "$strings"; then
12080         echo "Using <string.h> instead of <strings.h>." >&4
12081         val="$define"
12082 else
12083         val="$undef"
12084         strings=`./findhdr strings.h`
12085         if $test "$strings" && $test -r "$strings"; then
12086                 echo "Using <strings.h> instead of <string.h>." >&4
12087         else
12088                 echo "No string header found -- You'll surely have problems." >&4
12089         fi
12090 fi
12091 set i_string
12092 eval $setvar
12093 case "$i_string" in
12094 "$undef") strings=`./findhdr strings.h`;;
12095 *)        strings=`./findhdr string.h`;;
12096 esac
12097
12098 : see if this is a sys/file.h system
12099 val=''
12100 set sys/file.h val
12101 eval $inhdr
12102
12103 : do we need to include sys/file.h ?
12104 case "$val" in
12105 "$define")
12106         echo " "
12107         if $h_sysfile; then
12108                 val="$define"
12109                 echo "We'll be including <sys/file.h>." >&4
12110         else
12111                 val="$undef"
12112                 echo "We won't be including <sys/file.h>." >&4
12113         fi
12114         ;;
12115 *)
12116         h_sysfile=false
12117         ;;
12118 esac
12119 set i_sysfile
12120 eval $setvar
12121
12122 : see if fcntl.h is there
12123 val=''
12124 set fcntl.h val
12125 eval $inhdr
12126
12127 : see if we can include fcntl.h
12128 case "$val" in
12129 "$define")
12130         echo " "
12131         if $h_fcntl; then
12132                 val="$define"
12133                 echo "We'll be including <fcntl.h>." >&4
12134         else
12135                 val="$undef"
12136                 if $h_sysfile; then
12137         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12138                 else
12139                         echo "We won't be including <fcntl.h>." >&4
12140                 fi
12141         fi
12142         ;;
12143 *)
12144         h_fcntl=false
12145         val="$undef"
12146         ;;
12147 esac
12148 set i_fcntl
12149 eval $setvar
12150
12151 : check for non-blocking I/O stuff
12152 case "$h_sysfile" in
12153 true) echo "#include <sys/file.h>" > head.c;;
12154 *)
12155        case "$h_fcntl" in
12156        true) echo "#include <fcntl.h>" > head.c;;
12157        *) echo "#include <sys/fcntl.h>" > head.c;;
12158        esac
12159        ;;
12160 esac
12161 echo " "
12162 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12163 case "$o_nonblock" in
12164 '')
12165         $cat head.c > try.c
12166         $cat >>try.c <<EOCP
12167 #include <stdio.h>
12168 #$i_stdlib I_STDLIB
12169 #ifdef I_STDLIB
12170 #include <stdlib.h>
12171 #endif
12172 #$i_fcntl I_FCNTL
12173 #ifdef I_FCNTL
12174 #include <fcntl.h>
12175 #endif
12176 int main() {
12177 #ifdef O_NONBLOCK
12178         printf("O_NONBLOCK\n");
12179         exit(0);
12180 #endif
12181 #ifdef O_NDELAY
12182         printf("O_NDELAY\n");
12183         exit(0);
12184 #endif
12185 #ifdef FNDELAY
12186         printf("FNDELAY\n");
12187         exit(0);
12188 #endif
12189         exit(0);
12190 }
12191 EOCP
12192         set try
12193         if eval $compile_ok; then
12194                 o_nonblock=`$run ./try`
12195                 case "$o_nonblock" in
12196                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12197                 *) echo "Seems like we can use $o_nonblock.";;
12198                 esac
12199         else
12200                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12201         fi
12202         ;;
12203 *) echo "Using $hint value $o_nonblock.";;
12204 esac
12205 $rm_try
12206
12207 echo " "
12208 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12209 case "$eagain" in
12210 '')
12211         $cat head.c > try.c
12212         $cat >>try.c <<EOCP
12213 #include <errno.h>
12214 #include <sys/types.h>
12215 #include <signal.h>
12216 #include <stdio.h>
12217 #$i_stdlib I_STDLIB
12218 #ifdef I_STDLIB
12219 #include <stdlib.h>
12220 #endif
12221 #$i_fcntl I_FCNTL
12222 #ifdef I_FCNTL
12223 #include <fcntl.h>
12224 #endif
12225 #define MY_O_NONBLOCK $o_nonblock
12226 #ifndef errno  /* XXX need better Configure test */
12227 extern int errno;
12228 #endif
12229 #$i_unistd I_UNISTD
12230 #ifdef I_UNISTD
12231 #include <unistd.h>
12232 #endif
12233 #$i_string I_STRING
12234 #ifdef I_STRING
12235 #include <string.h>
12236 #else
12237 #include <strings.h>
12238 #endif
12239 $signal_t blech(int x) { exit(3); }
12240 EOCP
12241         $cat >> try.c <<'EOCP'
12242 int main()
12243 {
12244         int pd[2];
12245         int pu[2];
12246         char buf[1];
12247         char string[100];
12248
12249         pipe(pd);       /* Down: child -> parent */
12250         pipe(pu);       /* Up: parent -> child */
12251         if (0 != fork()) {
12252                 int ret;
12253                 close(pd[1]);   /* Parent reads from pd[0] */
12254                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12255 #ifdef F_SETFL
12256                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12257                         exit(1);
12258 #else
12259                 exit(4);
12260 #endif
12261                 signal(SIGALRM, blech);
12262                 alarm(5);
12263                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12264                         exit(2);
12265                 sprintf(string, "%d\n", ret);
12266                 write(2, string, strlen(string));
12267                 alarm(0);
12268 #ifdef EAGAIN
12269                 if (errno == EAGAIN) {
12270                         printf("EAGAIN\n");
12271                         goto ok;
12272                 }
12273 #endif
12274 #ifdef EWOULDBLOCK
12275                 if (errno == EWOULDBLOCK)
12276                         printf("EWOULDBLOCK\n");
12277 #endif
12278         ok:
12279                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12280                 sleep(2);                               /* Give it time to close our pipe */
12281                 alarm(5);
12282                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12283                 alarm(0);
12284                 sprintf(string, "%d\n", ret);
12285                 write(4, string, strlen(string));
12286                 exit(0);
12287         }
12288
12289         close(pd[0]);                   /* We write to pd[1] */
12290         close(pu[1]);                   /* We read from pu[0] */
12291         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12292         close(pd[1]);                   /* Pipe pd is now fully closed! */
12293         exit(0);                                /* Bye bye, thank you for playing! */
12294 }
12295 EOCP
12296         set try
12297         if eval $compile_ok; then
12298                 echo "$startsh" >mtry
12299                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12300                 chmod +x mtry
12301                 ./mtry >/dev/null 2>&1
12302                 case $? in
12303                 0) eagain=`$cat try.out`;;
12304                 1) echo "Could not perform non-blocking setting!";;
12305                 2) echo "I did a successful read() for something that was not there!";;
12306                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12307                 4) echo "Could not find F_SETFL!";;
12308                 *) echo "Something terribly wrong happened during testing.";;
12309                 esac
12310                 rd_nodata=`$cat try.ret`
12311                 echo "A read() system call with no data present returns $rd_nodata."
12312                 case "$rd_nodata" in
12313                 0|-1) ;;
12314                 *)
12315                         echo "(That's peculiar, fixing that to be -1.)"
12316                         rd_nodata=-1
12317                         ;;
12318                 esac
12319                 case "$eagain" in
12320                 '')
12321                         echo "Forcing errno EAGAIN on read() with no data available."
12322                         eagain=EAGAIN
12323                         ;;
12324                 *)
12325                         echo "Your read() sets errno to $eagain when no data is available."
12326                         ;;
12327                 esac
12328                 status=`$cat try.err`
12329                 case "$status" in
12330                 0) echo "And it correctly returns 0 to signal EOF.";;
12331                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12332                 *) echo "However, your read() returns '$status' on EOF??";;
12333                 esac
12334                 val="$define"
12335                 if test "$status" = "$rd_nodata"; then
12336                         echo "WARNING: you can't distinguish between EOF and no data!"
12337                         val="$undef"
12338                 fi
12339         else
12340                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12341                 eagain=EAGAIN
12342         fi
12343         set d_eofnblk
12344         eval $setvar
12345         ;;
12346 *)
12347         echo "Using $hint value $eagain."
12348         echo "Your read() returns $rd_nodata when no data is present."
12349         case "$d_eofnblk" in
12350         "$define") echo "And you can see EOF because read() returns 0.";;
12351         "$undef") echo "But you can't see EOF status from read() returned value.";;
12352         *)
12353                 echo "(Assuming you can't see EOF status from read anyway.)"
12354                 d_eofnblk=$undef
12355                 ;;
12356         esac
12357         ;;
12358 esac
12359 $rm_try head.c mtry
12360
12361 : see if _ptr and _cnt from stdio act std
12362 echo " "
12363
12364 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12365         echo "(Looks like you have stdio.h from BSD.)"
12366         case "$stdio_ptr" in
12367         '') stdio_ptr='((fp)->_p)'
12368                 ptr_lval=$define
12369                 ;;
12370         *)      ptr_lval=$d_stdio_ptr_lval;;
12371         esac
12372         case "$stdio_cnt" in
12373         '') stdio_cnt='((fp)->_r)'
12374                 cnt_lval=$define
12375                 ;;
12376         *)      cnt_lval=$d_stdio_cnt_lval;;
12377         esac
12378         case "$stdio_base" in
12379         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12380         esac
12381         case "$stdio_bufsiz" in
12382         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12383         esac
12384 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12385         echo "(Looks like you have stdio.h from Linux.)"
12386         case "$stdio_ptr" in
12387         '') stdio_ptr='((fp)->_IO_read_ptr)'
12388                 ptr_lval=$define
12389                 ;;
12390         *)      ptr_lval=$d_stdio_ptr_lval;;
12391         esac
12392         case "$stdio_cnt" in
12393         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12394                 cnt_lval=$undef
12395                 ;;
12396         *)      cnt_lval=$d_stdio_cnt_lval;;
12397         esac
12398         case "$stdio_base" in
12399         '') stdio_base='((fp)->_IO_read_base)';;
12400         esac
12401         case "$stdio_bufsiz" in
12402         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12403         esac
12404 else
12405         case "$stdio_ptr" in
12406         '') stdio_ptr='((fp)->_ptr)'
12407                 ptr_lval=$define
12408                 ;;
12409         *)      ptr_lval=$d_stdio_ptr_lval;;
12410         esac
12411         case "$stdio_cnt" in
12412         '') stdio_cnt='((fp)->_cnt)'
12413                 cnt_lval=$define
12414                 ;;
12415         *)      cnt_lval=$d_stdio_cnt_lval;;
12416         esac
12417         case "$stdio_base" in
12418         '') stdio_base='((fp)->_base)';;
12419         esac
12420         case "$stdio_bufsiz" in
12421         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12422         esac
12423 fi
12424
12425 : test whether _ptr and _cnt really work
12426 echo "Checking how std your stdio is..." >&4
12427 $cat >try.c <<EOP
12428 #include <stdio.h>
12429 #$i_stdlib I_STDLIB
12430 #ifdef I_STDLIB
12431 #include <stdlib.h>
12432 #endif
12433 #define FILE_ptr(fp)    $stdio_ptr
12434 #define FILE_cnt(fp)    $stdio_cnt
12435 int main() {
12436         FILE *fp = fopen("try.c", "r");
12437         char c = getc(fp);
12438         if (
12439                 18 <= FILE_cnt(fp) &&
12440                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12441         )
12442                 exit(0);
12443         exit(1);
12444 }
12445 EOP
12446 val="$undef"
12447 set try
12448 if eval $compile && $to try.c; then
12449         if $run ./try; then
12450                 echo "Your stdio acts pretty std."
12451                 val="$define"
12452         else
12453                 echo "Your stdio isn't very std."
12454         fi
12455 else
12456         echo "Your stdio doesn't appear very std."
12457 fi
12458 $rm_try
12459
12460 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12461 # direct buffer manipulation no longer works.  The Configure tests
12462 # should be changed to correctly detect this, but until then,
12463 # the following check should at least let perl compile and run.
12464 # (This quick fix should be updated before 5.8.1.)
12465 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12466 # A. Dougherty, June 3, 2002.
12467 case "$d_gnulibc" in
12468 $define)
12469         case "$gnulibc_version" in
12470         2.[01]*)  ;;
12471         2.2) ;;
12472         2.2.[0-9]) ;;
12473         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12474                 val="$undef"
12475                 ;;
12476         esac
12477         ;;
12478 esac
12479 set d_stdstdio
12480 eval $setvar
12481
12482 : Can _ptr be used as an lvalue?
12483 case "$d_stdstdio$ptr_lval" in
12484 $define$define) val=$define ;;
12485 *) val=$undef ;;
12486 esac
12487 set d_stdio_ptr_lval
12488 eval $setvar
12489
12490 : Can _cnt be used as an lvalue?
12491 case "$d_stdstdio$cnt_lval" in
12492 $define$define) val=$define ;;
12493 *) val=$undef ;;
12494 esac
12495 set d_stdio_cnt_lval
12496 eval $setvar
12497
12498
12499 : test whether setting _ptr sets _cnt as a side effect
12500 d_stdio_ptr_lval_sets_cnt="$undef"
12501 d_stdio_ptr_lval_nochange_cnt="$undef"
12502 case "$d_stdio_ptr_lval$d_stdstdio" in
12503 $define$define)
12504         echo "Checking to see what happens if we set the stdio ptr..." >&4
12505 $cat >try.c <<EOP
12506 #include <stdio.h>
12507 /* Can we scream? */
12508 /* Eat dust sed :-) */
12509 /* In the buffer space, no one can hear you scream. */
12510 #$i_stdlib I_STDLIB
12511 #ifdef I_STDLIB
12512 #include <stdlib.h>
12513 #endif
12514 #define FILE_ptr(fp)    $stdio_ptr
12515 #define FILE_cnt(fp)    $stdio_cnt
12516 #include <sys/types.h>
12517 int main() {
12518         FILE *fp = fopen("try.c", "r");
12519         int c;
12520         char *ptr;
12521         size_t cnt;
12522         if (!fp) {
12523             puts("Fail even to read");
12524             exit(1);
12525         }
12526         c = getc(fp); /* Read away the first # */
12527         if (c == EOF) {
12528             puts("Fail even to read");
12529             exit(1);
12530         }
12531         if (!(
12532                 18 <= FILE_cnt(fp) &&
12533                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12534         )) {
12535                 puts("Fail even to read");
12536                 exit (1);
12537         }
12538         ptr = (char*) FILE_ptr(fp);
12539         cnt = (size_t)FILE_cnt(fp);
12540
12541         FILE_ptr(fp) += 42;
12542
12543         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12544                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12545                 exit (1);
12546         }
12547         if (FILE_cnt(fp) <= 20) {
12548                 printf ("Fail (<20 chars to test)");
12549                 exit (1);
12550         }
12551         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12552                 puts("Fail compare");
12553                 exit (1);
12554         }
12555         if (cnt == FILE_cnt(fp)) {
12556                 puts("Pass_unchanged");
12557                 exit (0);
12558         }
12559         if (FILE_cnt(fp) == (cnt - 42)) {
12560                 puts("Pass_changed");
12561                 exit (0);
12562         }
12563         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12564         return 1;
12565
12566 }
12567 EOP
12568         set try
12569         if eval $compile && $to try.c; then
12570                 case `$run ./try` in
12571                 Pass_changed)
12572                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12573                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12574                 Pass_unchanged)
12575                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12576                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12577                 Fail*)
12578                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12579                 *)
12580                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12581         esac
12582         else
12583                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12584         fi
12585         $rm_try
12586         ;;
12587 esac
12588
12589 : see if _base is also standard
12590 val="$undef"
12591 case "$d_stdstdio" in
12592 $define)
12593         $cat >try.c <<EOP
12594 #include <stdio.h>
12595 #$i_stdlib I_STDLIB
12596 #ifdef I_STDLIB
12597 #include <stdlib.h>
12598 #endif
12599 #define FILE_base(fp)   $stdio_base
12600 #define FILE_bufsiz(fp) $stdio_bufsiz
12601 int main() {
12602         FILE *fp = fopen("try.c", "r");
12603         char c = getc(fp);
12604         if (
12605                 19 <= FILE_bufsiz(fp) &&
12606                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12607         )
12608                 exit(0);
12609         exit(1);
12610 }
12611 EOP
12612         set try
12613         if eval $compile && $to try.c; then
12614                 if $run ./try; then
12615                         echo "And its _base field acts std."
12616                         val="$define"
12617                 else
12618                         echo "But its _base field isn't std."
12619                 fi
12620         else
12621                 echo "However, it seems to be lacking the _base field."
12622         fi
12623         $rm_try
12624         ;;
12625 esac
12626 set d_stdiobase
12627 eval $setvar
12628
12629 : see if fast_stdio exists
12630 val="$undef"
12631 case "$d_stdstdio:$d_stdio_ptr_lval" in
12632 "$define:$define")
12633         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12634         *$define*)
12635                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12636                 val="$define"
12637                 ;;
12638         esac
12639         ;;
12640 esac
12641 set d_faststdio
12642 eval $setvar
12643
12644
12645
12646 : see if fchdir exists
12647 set fchdir d_fchdir
12648 eval $inlibc
12649
12650 : see if fchmod exists
12651 set fchmod d_fchmod
12652 eval $inlibc
12653
12654 : see if fchown exists
12655 set fchown d_fchown
12656 eval $inlibc
12657
12658 : see if this is an fcntl system
12659 set fcntl d_fcntl
12660 eval $inlibc
12661
12662 echo " "
12663 : See if fcntl-based locking works.
12664 $cat >try.c <<EOCP
12665 #$i_stdlib I_STDLIB
12666 #ifdef I_STDLIB
12667 #include <stdlib.h>
12668 #endif
12669 #include <unistd.h>
12670 #include <fcntl.h>
12671 #include <signal.h>
12672 $signal_t blech(int x) { exit(3); }
12673 int main() {
12674 #if defined(F_SETLK) && defined(F_SETLKW)
12675      struct flock flock;
12676      int retval, fd;
12677      fd = open("try.c", O_RDONLY);
12678      flock.l_type = F_RDLCK;
12679      flock.l_whence = SEEK_SET;
12680      flock.l_start = flock.l_len = 0;
12681      signal(SIGALRM, blech);
12682      alarm(10);
12683      retval = fcntl(fd, F_SETLK, &flock);
12684      close(fd);
12685      (retval < 0 ? exit(2) : exit(0));
12686 #else
12687      exit(2);
12688 #endif
12689 }
12690 EOCP
12691 echo "Checking if fcntl-based file locking works... "
12692 case "$d_fcntl" in
12693 "$define")
12694         set try
12695         if eval $compile_ok; then
12696                 if $run ./try; then
12697                         echo "Yes, it seems to work."
12698                         val="$define"
12699                 else
12700                         echo "Nope, it didn't work."
12701                         val="$undef"
12702                         case "$?" in
12703                         3) $cat >&4 <<EOM
12704 ***
12705 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12706 *** This is (almost) impossible.
12707 *** If your NFS lock daemons are not feeling well, something like
12708 *** this may happen, please investigate.  Cannot continue, aborting.
12709 ***
12710 EOM
12711                                 exit 1
12712                                 ;;
12713                         esac
12714                 fi
12715         else
12716                 echo "I'm unable to compile the test program, so I'll assume not."
12717                 val="$undef"
12718         fi
12719         ;;
12720 *) val="$undef";
12721         echo "Nope, since you don't even have fcntl()."
12722         ;;
12723 esac
12724 set d_fcntl_can_lock
12725 eval $setvar
12726 $rm_try
12727
12728 : check for fd_set items
12729 $cat <<EOM
12730
12731 Checking to see how well your C compiler handles fd_set and friends ...
12732 EOM
12733 $cat >try.c <<EOCP
12734 #$i_stdlib I_STDLIB
12735 #ifdef I_STDLIB
12736 #include <stdlib.h>
12737 #endif
12738 #$i_systime I_SYS_TIME
12739 #$i_sysselct I_SYS_SELECT
12740 #$d_socket HAS_SOCKET
12741 #include <sys/types.h>
12742 #ifdef HAS_SOCKET
12743 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12744 #endif
12745 #ifdef I_SYS_TIME
12746 #include <sys/time.h>
12747 #endif
12748 #ifdef I_SYS_SELECT
12749 #include <sys/select.h>
12750 #endif
12751 int main() {
12752         fd_set fds;
12753
12754 #ifdef TRYBITS
12755         if(fds.fds_bits);
12756 #endif
12757
12758 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12759         exit(0);
12760 #else
12761         exit(1);
12762 #endif
12763 }
12764 EOCP
12765 set try -DTRYBITS
12766 if eval $compile; then
12767         d_fds_bits="$define"
12768         d_fd_set="$define"
12769         echo "Well, your system knows about the normal fd_set typedef..." >&4
12770         if $run ./try; then
12771                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12772                 d_fd_macros="$define"
12773         else
12774                 $cat >&4 <<'EOM'
12775 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12776 EOM
12777                 d_fd_macros="$undef"
12778         fi
12779 else
12780         $cat <<'EOM'
12781 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12782 EOM
12783         set try
12784         if eval $compile; then
12785                 d_fds_bits="$undef"
12786                 d_fd_set="$define"
12787                 echo "Well, your system has some sort of fd_set available..." >&4
12788                 if $run ./try; then
12789                         echo "and you have the normal fd_set macros." >&4
12790                         d_fd_macros="$define"
12791                 else
12792                         $cat <<'EOM'
12793 but not the normal fd_set macros!  Gross!  More work for me...
12794 EOM
12795                         d_fd_macros="$undef"
12796                 fi
12797         else
12798         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12799                 d_fd_set="$undef"
12800                 d_fds_bits="$undef"
12801                 d_fd_macros="$undef"
12802         fi
12803 fi
12804 $rm_try
12805
12806 : see if fgetpos exists
12807 set fgetpos d_fgetpos
12808 eval $inlibc
12809
12810 : see if finite exists
12811 set finite d_finite
12812 eval $inlibc
12813
12814 : see if finitel exists
12815 set finitel d_finitel
12816 eval $inlibc
12817
12818 : see if flock exists
12819 set flock d_flock
12820 eval $inlibc
12821
12822 : see if prototype for flock is available
12823 echo " "
12824 set d_flockproto flock $i_sysfile sys/file.h
12825 eval $hasproto
12826
12827 : see if fork exists
12828 set fork d_fork
12829 eval $inlibc
12830
12831 : see if fp_class exists
12832 set fp_class d_fp_class
12833 eval $inlibc
12834
12835 : see if pathconf exists
12836 set pathconf d_pathconf
12837 eval $inlibc
12838
12839 : see if fpathconf exists
12840 set fpathconf d_fpathconf
12841 eval $inlibc
12842
12843 : see if fpclass exists
12844 set fpclass d_fpclass
12845 eval $inlibc
12846
12847 : see if fpclassify exists
12848 set fpclassify d_fpclassify
12849 eval $inlibc
12850
12851 : see if fpclassl exists
12852 set fpclassl d_fpclassl
12853 eval $inlibc
12854
12855
12856 : check for fpos64_t
12857 echo " "
12858 echo "Checking to see if you have fpos64_t..." >&4
12859 $cat >try.c <<EOCP
12860 #include <stdio.h>
12861 int main() { fpos64_t x = 7; }
12862 EOCP
12863 set try
12864 if eval $compile; then
12865         val="$define"
12866         echo "You have fpos64_t."
12867 else
12868         val="$undef"
12869         echo "You do not have fpos64_t."
12870         case "$fpossize" in
12871         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12872         esac
12873 fi
12874 $rm_try
12875 set d_fpos64_t
12876 eval $setvar
12877
12878 : see if frexpl exists
12879 set frexpl d_frexpl
12880 eval $inlibc
12881
12882 : see if this is a sys/param system
12883 set sys/param.h i_sysparam
12884 eval $inhdr
12885
12886 : see if this is a sys/mount.h system
12887 set sys/mount.h i_sysmount
12888 eval $inhdr
12889
12890
12891 echo " "
12892 echo "Checking to see if your system supports struct fs_data..." >&4
12893 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12894 eval $hasstruct
12895 case "$d_fs_data_s" in
12896 "$define")      echo "Yes, it does."   ;;
12897 *)              echo "No, it doesn't." ;;
12898 esac
12899
12900 : see if fseeko exists
12901 set fseeko d_fseeko
12902 eval $inlibc
12903 case "$longsize" in
12904 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12905 esac
12906
12907 : see if fsetpos exists
12908 set fsetpos d_fsetpos
12909 eval $inlibc
12910
12911
12912 : see if fstatfs exists
12913 set fstatfs d_fstatfs
12914 eval $inlibc
12915
12916
12917 : see if statvfs exists
12918 set statvfs d_statvfs
12919 eval $inlibc
12920
12921 : see if fstatvfs exists
12922 set fstatvfs d_fstatvfs
12923 eval $inlibc
12924
12925
12926 : see if fsync exists
12927 set fsync d_fsync
12928 eval $inlibc
12929
12930 : see if ftello exists
12931 set ftello d_ftello
12932 eval $inlibc
12933 case "$longsize" in
12934 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12935 esac
12936
12937 d_futimes="$undef"
12938 : check for a working futimes
12939 echo " "
12940 echo "Checking if you have a working futimes()" >&4
12941 $cat >try.c <<EOCP
12942 #include <stdio.h>
12943 #include <sys/time.h>
12944 #include <errno.h>
12945 #include <fcntl.h>
12946
12947 int main ()
12948 {
12949     int fd, rv;
12950     fd = open ("try.c", O_RDWR);
12951     if (-1 == fd) exit (1);
12952     rv = futimes (fd, NULL);
12953     exit (rv == -1 ? errno : 0);
12954 }
12955 EOCP
12956 set try
12957 if eval $compile; then
12958     `$run ./try`
12959     rc=$?
12960     case "$rc" in
12961         0)  echo "Yes, you have" >&4
12962             d_futimes="$define"
12963             ;;
12964         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
12965             ;;
12966     esac
12967 else
12968     echo "No, it does not (probably harmless)" >&4
12969 fi
12970 $rm_try
12971
12972 : see if getcwd exists
12973 set getcwd d_getcwd
12974 eval $inlibc
12975
12976 : see if getespwnam exists
12977 set getespwnam d_getespwnam
12978 eval $inlibc
12979
12980
12981 : see if getfsstat exists
12982 set getfsstat d_getfsstat
12983 eval $inlibc
12984
12985 : see if getgrent exists
12986 set getgrent d_getgrent
12987 eval $inlibc
12988
12989 : see if getgrent_r exists
12990 set getgrent_r d_getgrent_r
12991 eval $inlibc
12992 case "$d_getgrent_r" in
12993 "$define")
12994         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12995         case "$d_getgrent_r_proto:$usethreads" in
12996         ":define")      d_getgrent_r_proto=define
12997                 set d_getgrent_r_proto getgrent_r $hdrs
12998                 eval $hasproto ;;
12999         *)      ;;
13000         esac
13001         case "$d_getgrent_r_proto" in
13002         define)
13003         case "$getgrent_r_proto" in
13004         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13005         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13006         esac
13007         case "$getgrent_r_proto" in
13008         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13009         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13010         esac
13011         case "$getgrent_r_proto" in
13012         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13013         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13014         esac
13015         case "$getgrent_r_proto" in
13016         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13017         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13018         esac
13019         case "$getgrent_r_proto" in
13020         ''|0) try='int getgrent_r(struct group*, char*, int);'
13021         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13022         esac
13023         case "$getgrent_r_proto" in
13024         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13025         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13026         esac
13027         case "$getgrent_r_proto" in
13028         ''|0)   d_getgrent_r=undef
13029                 getgrent_r_proto=0
13030                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13031         * )     case "$getgrent_r_proto" in
13032                 REENTRANT_PROTO*) ;;
13033                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13034                 esac
13035                 echo "Prototype: $try" ;;
13036         esac
13037         ;;
13038         *)      case "$usethreads" in
13039                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13040                 esac
13041                 d_getgrent_r=undef
13042                 getgrent_r_proto=0
13043                 ;;
13044         esac
13045         ;;
13046 *)      getgrent_r_proto=0
13047         ;;
13048 esac
13049
13050 : see if getgrgid_r exists
13051 set getgrgid_r d_getgrgid_r
13052 eval $inlibc
13053 case "$d_getgrgid_r" in
13054 "$define")
13055         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13056         case "$d_getgrgid_r_proto:$usethreads" in
13057         ":define")      d_getgrgid_r_proto=define
13058                 set d_getgrgid_r_proto getgrgid_r $hdrs
13059                 eval $hasproto ;;
13060         *)      ;;
13061         esac
13062         case "$d_getgrgid_r_proto" in
13063         define)
13064         case "$getgrgid_r_proto" in
13065         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13066         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13067         esac
13068         case "$getgrgid_r_proto" in
13069         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13070         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13071         esac
13072         case "$getgrgid_r_proto" in
13073         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13074         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13075         esac
13076         case "$getgrgid_r_proto" in
13077         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13078         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13079         esac
13080         case "$getgrgid_r_proto" in
13081         ''|0)   d_getgrgid_r=undef
13082                 getgrgid_r_proto=0
13083                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13084         * )     case "$getgrgid_r_proto" in
13085                 REENTRANT_PROTO*) ;;
13086                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13087                 esac
13088                 echo "Prototype: $try" ;;
13089         esac
13090         ;;
13091         *)      case "$usethreads" in
13092                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13093                 esac
13094                 d_getgrgid_r=undef
13095                 getgrgid_r_proto=0
13096                 ;;
13097         esac
13098         ;;
13099 *)      getgrgid_r_proto=0
13100         ;;
13101 esac
13102
13103 : see if getgrnam_r exists
13104 set getgrnam_r d_getgrnam_r
13105 eval $inlibc
13106 case "$d_getgrnam_r" in
13107 "$define")
13108         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13109         case "$d_getgrnam_r_proto:$usethreads" in
13110         ":define")      d_getgrnam_r_proto=define
13111                 set d_getgrnam_r_proto getgrnam_r $hdrs
13112                 eval $hasproto ;;
13113         *)      ;;
13114         esac
13115         case "$d_getgrnam_r_proto" in
13116         define)
13117         case "$getgrnam_r_proto" in
13118         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13119         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13120         esac
13121         case "$getgrnam_r_proto" in
13122         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13123         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13124         esac
13125         case "$getgrnam_r_proto" in
13126         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13127         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13128         esac
13129         case "$getgrnam_r_proto" in
13130         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13131         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13132         esac
13133         case "$getgrnam_r_proto" in
13134         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13135         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13136         esac
13137         case "$getgrnam_r_proto" in
13138         ''|0)   d_getgrnam_r=undef
13139                 getgrnam_r_proto=0
13140                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13141         * )     case "$getgrnam_r_proto" in
13142                 REENTRANT_PROTO*) ;;
13143                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13144                 esac
13145                 echo "Prototype: $try" ;;
13146         esac
13147         ;;
13148         *)      case "$usethreads" in
13149                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13150                 esac
13151                 d_getgrnam_r=undef
13152                 getgrnam_r_proto=0
13153                 ;;
13154         esac
13155         ;;
13156 *)      getgrnam_r_proto=0
13157         ;;
13158 esac
13159
13160 : see if gethostbyaddr exists
13161 set gethostbyaddr d_gethbyaddr
13162 eval $inlibc
13163
13164 : see if gethostbyname exists
13165 set gethostbyname d_gethbyname
13166 eval $inlibc
13167
13168 : see if gethostent exists
13169 set gethostent d_gethent
13170 eval $inlibc
13171
13172 : see how we will look up host name
13173 echo " "
13174 call=''
13175 if set gethostname val -f d_gethname; eval $csym; $val; then
13176         echo 'gethostname() found.' >&4
13177         d_gethname="$define"
13178         call=gethostname
13179 fi
13180 if set uname val -f d_uname; eval $csym; $val; then
13181         if ./xenix; then
13182                 $cat <<'EOM'
13183 uname() was found, but you're running xenix, and older versions of xenix
13184 have a broken uname(). If you don't really know whether your xenix is old
13185 enough to have a broken system call, use the default answer.
13186
13187 EOM
13188                 dflt=y
13189                 case "$d_uname" in
13190                 "$define") dflt=n;;
13191                 esac
13192                 rp='Is your uname() broken?'
13193                 . ./myread
13194                 case "$ans" in
13195                 n*) d_uname="$define"; call=uname;;
13196                 esac
13197         else
13198                 echo 'uname() found.' >&4
13199                 d_uname="$define"
13200                 case "$call" in
13201                 '') call=uname ;;
13202                 esac
13203         fi
13204 fi
13205 case "$d_gethname" in
13206 '') d_gethname="$undef";;
13207 esac
13208 case "$d_uname" in
13209 '') d_uname="$undef";;
13210 esac
13211 case "$d_uname$d_gethname" in
13212 *define*)
13213         dflt=n
13214         cat <<EOM
13215  
13216 Every now and then someone has a $call() that lies about the hostname
13217 but can't be fixed for political or economic reasons.  If you wish, I can
13218 pretend $call() isn't there and maybe compute hostname at run-time
13219 thanks to the '$phostname' command.
13220
13221 EOM
13222         rp="Shall I ignore $call() from now on?"
13223         . ./myread
13224         case "$ans" in
13225         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13226         esac;;
13227 esac
13228 case "$phostname" in
13229 '') aphostname='';;
13230 *) case "$aphostname" in
13231         /*) ;;
13232         *) set X $phostname
13233                 shift
13234                 file=$1
13235                 shift
13236                 file=`./loc $file $file $pth`
13237                 aphostname=`echo $file $*`
13238                 ;;
13239         esac
13240         ;;
13241 esac
13242 case "$d_uname$d_gethname" in
13243 *define*) ;;
13244 *)
13245         case "$phostname" in
13246         '')
13247                 echo "There will be no way for $package to get your hostname." >&4;;
13248         *)
13249         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13250                 ;;
13251         esac;;
13252 esac
13253 case "$d_phostname" in
13254 '') d_phostname="$undef";;
13255 esac
13256
13257 : see if gethostbyaddr_r exists
13258 set gethostbyaddr_r d_gethostbyaddr_r
13259 eval $inlibc
13260 case "$d_gethostbyaddr_r" in
13261 "$define")
13262         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13263         case "$d_gethostbyaddr_r_proto:$usethreads" in
13264         ":define")      d_gethostbyaddr_r_proto=define
13265                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13266                 eval $hasproto ;;
13267         *)      ;;
13268         esac
13269         case "$d_gethostbyaddr_r_proto" in
13270         define)
13271         case "$gethostbyaddr_r_proto" in
13272         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13273         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13274         esac
13275         case "$gethostbyaddr_r_proto" in
13276         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13277         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13278         esac
13279         case "$gethostbyaddr_r_proto" in
13280         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13281         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13282         esac
13283         case "$gethostbyaddr_r_proto" in
13284         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13285         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13286         esac
13287         case "$gethostbyaddr_r_proto" in
13288         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13289         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13290         esac
13291         case "$gethostbyaddr_r_proto" in
13292         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13293         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13294         esac
13295         case "$gethostbyaddr_r_proto" in
13296         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13297         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13298         esac
13299         case "$gethostbyaddr_r_proto" in
13300         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13301         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13302         esac
13303         case "$gethostbyaddr_r_proto" in
13304         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13305         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13306         esac
13307         case "$gethostbyaddr_r_proto" in
13308         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13309         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13310         esac
13311         case "$gethostbyaddr_r_proto" in
13312         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13313         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13314         esac
13315         case "$gethostbyaddr_r_proto" in
13316         ''|0)   d_gethostbyaddr_r=undef
13317                 gethostbyaddr_r_proto=0
13318                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13319         * )     case "$gethostbyaddr_r_proto" in
13320                 REENTRANT_PROTO*) ;;
13321                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13322                 esac
13323                 echo "Prototype: $try" ;;
13324         esac
13325         ;;
13326         *)      case "$usethreads" in
13327                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13328                 esac
13329                 d_gethostbyaddr_r=undef
13330                 gethostbyaddr_r_proto=0
13331                 ;;
13332         esac
13333         ;;
13334 *)      gethostbyaddr_r_proto=0
13335         ;;
13336 esac
13337
13338 : see if gethostbyname_r exists
13339 set gethostbyname_r d_gethostbyname_r
13340 eval $inlibc
13341 case "$d_gethostbyname_r" in
13342 "$define")
13343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13344         case "$d_gethostbyname_r_proto:$usethreads" in
13345         ":define")      d_gethostbyname_r_proto=define
13346                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13347                 eval $hasproto ;;
13348         *)      ;;
13349         esac
13350         case "$d_gethostbyname_r_proto" in
13351         define)
13352         case "$gethostbyname_r_proto" in
13353         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13354         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13355         esac
13356         case "$gethostbyname_r_proto" in
13357         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13358         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13359         esac
13360         case "$gethostbyname_r_proto" in
13361         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13362         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13363         esac
13364         case "$gethostbyname_r_proto" in
13365         ''|0)   d_gethostbyname_r=undef
13366                 gethostbyname_r_proto=0
13367                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13368         * )     case "$gethostbyname_r_proto" in
13369                 REENTRANT_PROTO*) ;;
13370                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13371                 esac
13372                 echo "Prototype: $try" ;;
13373         esac
13374         ;;
13375         *)      case "$usethreads" in
13376                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13377                 esac
13378                 d_gethostbyname_r=undef
13379                 gethostbyname_r_proto=0
13380                 ;;
13381         esac
13382         ;;
13383 *)      gethostbyname_r_proto=0
13384         ;;
13385 esac
13386
13387 : see if gethostent_r exists
13388 set gethostent_r d_gethostent_r
13389 eval $inlibc
13390 case "$d_gethostent_r" in
13391 "$define")
13392         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13393         case "$d_gethostent_r_proto:$usethreads" in
13394         ":define")      d_gethostent_r_proto=define
13395                 set d_gethostent_r_proto gethostent_r $hdrs
13396                 eval $hasproto ;;
13397         *)      ;;
13398         esac
13399         case "$d_gethostent_r_proto" in
13400         define)
13401         case "$gethostent_r_proto" in
13402         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13403         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13404         esac
13405         case "$gethostent_r_proto" in
13406         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13407         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13408         esac
13409         case "$gethostent_r_proto" in
13410         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13411         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13412         esac
13413         case "$gethostent_r_proto" in
13414         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13415         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13416         esac
13417         case "$gethostent_r_proto" in
13418         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13419         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13420         esac
13421         case "$gethostent_r_proto" in
13422         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13423         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13424         esac
13425         case "$gethostent_r_proto" in
13426         ''|0)   d_gethostent_r=undef
13427                 gethostent_r_proto=0
13428                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13429         * )     case "$gethostent_r_proto" in
13430                 REENTRANT_PROTO*) ;;
13431                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13432                 esac
13433                 echo "Prototype: $try" ;;
13434         esac
13435         ;;
13436         *)      case "$usethreads" in
13437                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13438                 esac
13439                 d_gethostent_r=undef
13440                 gethostent_r_proto=0
13441                 ;;
13442         esac
13443         ;;
13444 *)      gethostent_r_proto=0
13445         ;;
13446 esac
13447
13448 : see if prototypes for various gethostxxx netdb.h functions are available
13449 echo " "
13450 set d_gethostprotos gethostent $i_netdb netdb.h
13451 eval $hasproto
13452
13453 : see if getitimer exists
13454 set getitimer d_getitimer
13455 eval $inlibc
13456
13457 : see if getlogin exists
13458 set getlogin d_getlogin
13459 eval $inlibc
13460
13461 : see if getlogin_r exists
13462 set getlogin_r d_getlogin_r
13463 eval $inlibc
13464 case "$d_getlogin_r" in
13465 "$define")
13466         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13467         case "$d_getlogin_r_proto:$usethreads" in
13468         ":define")      d_getlogin_r_proto=define
13469                 set d_getlogin_r_proto getlogin_r $hdrs
13470                 eval $hasproto ;;
13471         *)      ;;
13472         esac
13473         case "$d_getlogin_r_proto" in
13474         define)
13475         case "$getlogin_r_proto" in
13476         ''|0) try='int getlogin_r(char*, size_t);'
13477         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13478         esac
13479         case "$getlogin_r_proto" in
13480         ''|0) try='int getlogin_r(char*, int);'
13481         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13482         esac
13483         case "$getlogin_r_proto" in
13484         ''|0) try='char* getlogin_r(char*, size_t);'
13485         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13486         esac
13487         case "$getlogin_r_proto" in
13488         ''|0) try='char* getlogin_r(char*, int);'
13489         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13490         esac
13491         case "$getlogin_r_proto" in
13492         ''|0)   d_getlogin_r=undef
13493                 getlogin_r_proto=0
13494                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13495         * )     case "$getlogin_r_proto" in
13496                 REENTRANT_PROTO*) ;;
13497                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13498                 esac
13499                 echo "Prototype: $try" ;;
13500         esac
13501         ;;
13502         *)      case "$usethreads" in
13503                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13504                 esac
13505                 d_getlogin_r=undef
13506                 getlogin_r_proto=0
13507                 ;;
13508         esac
13509         ;;
13510 *)      getlogin_r_proto=0
13511         ;;
13512 esac
13513
13514 : see if getmnt exists
13515 set getmnt d_getmnt
13516 eval $inlibc
13517
13518 : see if getmntent exists
13519 set getmntent d_getmntent
13520 eval $inlibc
13521
13522 : see if getnetbyaddr exists
13523 set getnetbyaddr d_getnbyaddr
13524 eval $inlibc
13525
13526 : see if getnetbyname exists
13527 set getnetbyname d_getnbyname
13528 eval $inlibc
13529
13530 : see if getnetent exists
13531 set getnetent d_getnent
13532 eval $inlibc
13533
13534 : see if getnetbyaddr_r exists
13535 set getnetbyaddr_r d_getnetbyaddr_r
13536 eval $inlibc
13537 case "$d_getnetbyaddr_r" in
13538 "$define")
13539         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13540         case "$d_getnetbyaddr_r_proto:$usethreads" in
13541         ":define")      d_getnetbyaddr_r_proto=define
13542                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13543                 eval $hasproto ;;
13544         *)      ;;
13545         esac
13546         case "$d_getnetbyaddr_r_proto" in
13547         define)
13548         case "$getnetbyaddr_r_proto" in
13549         ''|0) try='int getnetbyaddr_r(unsigned long, 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) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13554         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13555         esac
13556         case "$getnetbyaddr_r_proto" in
13557         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13558         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13559         esac
13560         case "$getnetbyaddr_r_proto" in
13561         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13562         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13563         esac
13564         case "$getnetbyaddr_r_proto" in
13565         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13566         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13567         esac
13568         case "$getnetbyaddr_r_proto" in
13569         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13570         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13571         esac
13572         case "$getnetbyaddr_r_proto" in
13573         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13574         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13575         esac
13576         case "$getnetbyaddr_r_proto" in
13577         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13578         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13579         esac
13580         case "$getnetbyaddr_r_proto" in
13581         ''|0)   d_getnetbyaddr_r=undef
13582                 getnetbyaddr_r_proto=0
13583                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13584         * )     case "$getnetbyaddr_r_proto" in
13585                 REENTRANT_PROTO*) ;;
13586                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13587                 esac
13588                 echo "Prototype: $try" ;;
13589         esac
13590         ;;
13591         *)      case "$usethreads" in
13592                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13593                 esac
13594                 d_getnetbyaddr_r=undef
13595                 getnetbyaddr_r_proto=0
13596                 ;;
13597         esac
13598         ;;
13599 *)      getnetbyaddr_r_proto=0
13600         ;;
13601 esac
13602
13603 : see if getnetbyname_r exists
13604 set getnetbyname_r d_getnetbyname_r
13605 eval $inlibc
13606 case "$d_getnetbyname_r" in
13607 "$define")
13608         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13609         case "$d_getnetbyname_r_proto:$usethreads" in
13610         ":define")      d_getnetbyname_r_proto=define
13611                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13612                 eval $hasproto ;;
13613         *)      ;;
13614         esac
13615         case "$d_getnetbyname_r_proto" in
13616         define)
13617         case "$getnetbyname_r_proto" in
13618         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13619         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13620         esac
13621         case "$getnetbyname_r_proto" in
13622         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13623         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13624         esac
13625         case "$getnetbyname_r_proto" in
13626         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13627         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13628         esac
13629         case "$getnetbyname_r_proto" in
13630         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13631         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13632         esac
13633         case "$getnetbyname_r_proto" in
13634         ''|0)   d_getnetbyname_r=undef
13635                 getnetbyname_r_proto=0
13636                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13637         * )     case "$getnetbyname_r_proto" in
13638                 REENTRANT_PROTO*) ;;
13639                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13640                 esac
13641                 echo "Prototype: $try" ;;
13642         esac
13643         ;;
13644         *)      case "$usethreads" in
13645                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13646                 esac
13647                 d_getnetbyname_r=undef
13648                 getnetbyname_r_proto=0
13649                 ;;
13650         esac
13651         ;;
13652 *)      getnetbyname_r_proto=0
13653         ;;
13654 esac
13655
13656 : see if getnetent_r exists
13657 set getnetent_r d_getnetent_r
13658 eval $inlibc
13659 case "$d_getnetent_r" in
13660 "$define")
13661         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13662         case "$d_getnetent_r_proto:$usethreads" in
13663         ":define")      d_getnetent_r_proto=define
13664                 set d_getnetent_r_proto getnetent_r $hdrs
13665                 eval $hasproto ;;
13666         *)      ;;
13667         esac
13668         case "$d_getnetent_r_proto" in
13669         define)
13670         case "$getnetent_r_proto" in
13671         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13672         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13673         esac
13674         case "$getnetent_r_proto" in
13675         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13676         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13677         esac
13678         case "$getnetent_r_proto" in
13679         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13680         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13681         esac
13682         case "$getnetent_r_proto" in
13683         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13684         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13685         esac
13686         case "$getnetent_r_proto" in
13687         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13688         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13689         esac
13690         case "$getnetent_r_proto" in
13691         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13692         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13693         esac
13694         case "$getnetent_r_proto" in
13695         ''|0)   d_getnetent_r=undef
13696                 getnetent_r_proto=0
13697                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13698         * )     case "$getnetent_r_proto" in
13699                 REENTRANT_PROTO*) ;;
13700                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13701                 esac
13702                 echo "Prototype: $try" ;;
13703         esac
13704         ;;
13705         *)      case "$usethreads" in
13706                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13707                 esac
13708                 d_getnetent_r=undef
13709                 getnetent_r_proto=0
13710                 ;;
13711         esac
13712         ;;
13713 *)      getnetent_r_proto=0
13714         ;;
13715 esac
13716
13717 : see if prototypes for various getnetxxx netdb.h functions are available
13718 echo " "
13719 set d_getnetprotos getnetent $i_netdb netdb.h
13720 eval $hasproto
13721
13722 : see if getpagesize exists
13723 set getpagesize d_getpagsz
13724 eval $inlibc
13725
13726
13727 : see if getprotobyname exists
13728 set getprotobyname d_getpbyname
13729 eval $inlibc
13730
13731 : see if getprotobynumber exists
13732 set getprotobynumber d_getpbynumber
13733 eval $inlibc
13734
13735 : see if getprotoent exists
13736 set getprotoent d_getpent
13737 eval $inlibc
13738
13739 : see if getpgid exists
13740 set getpgid d_getpgid
13741 eval $inlibc
13742
13743 : see if getpgrp2 exists
13744 set getpgrp2 d_getpgrp2
13745 eval $inlibc
13746
13747 : see if getppid exists
13748 set getppid d_getppid
13749 eval $inlibc
13750
13751 : see if getpriority exists
13752 set getpriority d_getprior
13753 eval $inlibc
13754
13755 : see if getprotobyname_r exists
13756 set getprotobyname_r d_getprotobyname_r
13757 eval $inlibc
13758 case "$d_getprotobyname_r" in
13759 "$define")
13760         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13761         case "$d_getprotobyname_r_proto:$usethreads" in
13762         ":define")      d_getprotobyname_r_proto=define
13763                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13764                 eval $hasproto ;;
13765         *)      ;;
13766         esac
13767         case "$d_getprotobyname_r_proto" in
13768         define)
13769         case "$getprotobyname_r_proto" in
13770         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13771         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13772         esac
13773         case "$getprotobyname_r_proto" in
13774         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13775         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13776         esac
13777         case "$getprotobyname_r_proto" in
13778         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13779         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13780         esac
13781         case "$getprotobyname_r_proto" in
13782         ''|0)   d_getprotobyname_r=undef
13783                 getprotobyname_r_proto=0
13784                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13785         * )     case "$getprotobyname_r_proto" in
13786                 REENTRANT_PROTO*) ;;
13787                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13788                 esac
13789                 echo "Prototype: $try" ;;
13790         esac
13791         ;;
13792         *)      case "$usethreads" in
13793                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13794                 esac
13795                 d_getprotobyname_r=undef
13796                 getprotobyname_r_proto=0
13797                 ;;
13798         esac
13799         ;;
13800 *)      getprotobyname_r_proto=0
13801         ;;
13802 esac
13803
13804 : see if getprotobynumber_r exists
13805 set getprotobynumber_r d_getprotobynumber_r
13806 eval $inlibc
13807 case "$d_getprotobynumber_r" in
13808 "$define")
13809         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13810         case "$d_getprotobynumber_r_proto:$usethreads" in
13811         ":define")      d_getprotobynumber_r_proto=define
13812                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13813                 eval $hasproto ;;
13814         *)      ;;
13815         esac
13816         case "$d_getprotobynumber_r_proto" in
13817         define)
13818         case "$getprotobynumber_r_proto" in
13819         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13820         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13821         esac
13822         case "$getprotobynumber_r_proto" in
13823         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13824         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13825         esac
13826         case "$getprotobynumber_r_proto" in
13827         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13828         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13829         esac
13830         case "$getprotobynumber_r_proto" in
13831         ''|0)   d_getprotobynumber_r=undef
13832                 getprotobynumber_r_proto=0
13833                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13834         * )     case "$getprotobynumber_r_proto" in
13835                 REENTRANT_PROTO*) ;;
13836                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13837                 esac
13838                 echo "Prototype: $try" ;;
13839         esac
13840         ;;
13841         *)      case "$usethreads" in
13842                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13843                 esac
13844                 d_getprotobynumber_r=undef
13845                 getprotobynumber_r_proto=0
13846                 ;;
13847         esac
13848         ;;
13849 *)      getprotobynumber_r_proto=0
13850         ;;
13851 esac
13852
13853 : see if getprotoent_r exists
13854 set getprotoent_r d_getprotoent_r
13855 eval $inlibc
13856 case "$d_getprotoent_r" in
13857 "$define")
13858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13859         case "$d_getprotoent_r_proto:$usethreads" in
13860         ":define")      d_getprotoent_r_proto=define
13861                 set d_getprotoent_r_proto getprotoent_r $hdrs
13862                 eval $hasproto ;;
13863         *)      ;;
13864         esac
13865         case "$d_getprotoent_r_proto" in
13866         define)
13867         case "$getprotoent_r_proto" in
13868         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13869         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13870         esac
13871         case "$getprotoent_r_proto" in
13872         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13873         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13874         esac
13875         case "$getprotoent_r_proto" in
13876         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13877         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13878         esac
13879         case "$getprotoent_r_proto" in
13880         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13881         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13882         esac
13883         case "$getprotoent_r_proto" in
13884         ''|0)   d_getprotoent_r=undef
13885                 getprotoent_r_proto=0
13886                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13887         * )     case "$getprotoent_r_proto" in
13888                 REENTRANT_PROTO*) ;;
13889                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13890                 esac
13891                 echo "Prototype: $try" ;;
13892         esac
13893         ;;
13894         *)      case "$usethreads" in
13895                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13896                 esac
13897                 d_getprotoent_r=undef
13898                 getprotoent_r_proto=0
13899                 ;;
13900         esac
13901         ;;
13902 *)      getprotoent_r_proto=0
13903         ;;
13904 esac
13905
13906 : see if prototypes for various getprotoxxx netdb.h functions are available
13907 echo " "
13908 set d_getprotoprotos getprotoent $i_netdb netdb.h
13909 eval $hasproto
13910
13911 : see if getprpwnam exists
13912 set getprpwnam d_getprpwnam
13913 eval $inlibc
13914
13915 : see if getpwent exists
13916 set getpwent d_getpwent
13917 eval $inlibc
13918
13919 : see if getpwent_r exists
13920 set getpwent_r d_getpwent_r
13921 eval $inlibc
13922 case "$d_getpwent_r" in
13923 "$define")
13924         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13925         case "$d_getpwent_r_proto:$usethreads" in
13926         ":define")      d_getpwent_r_proto=define
13927                 set d_getpwent_r_proto getpwent_r $hdrs
13928                 eval $hasproto ;;
13929         *)      ;;
13930         esac
13931         case "$d_getpwent_r_proto" in
13932         define)
13933         case "$getpwent_r_proto" in
13934         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13935         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13936         esac
13937         case "$getpwent_r_proto" in
13938         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13939         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13940         esac
13941         case "$getpwent_r_proto" in
13942         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13943         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13944         esac
13945         case "$getpwent_r_proto" in
13946         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13947         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13948         esac
13949         case "$getpwent_r_proto" in
13950         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13951         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13952         esac
13953         case "$getpwent_r_proto" in
13954         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13955         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13956         esac
13957         case "$getpwent_r_proto" in
13958         ''|0)   d_getpwent_r=undef
13959                 getpwent_r_proto=0
13960                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getpwent_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getpwent_r=undef
13972                 getpwent_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getpwent_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if getpwnam_r exists
13981 set getpwnam_r d_getpwnam_r
13982 eval $inlibc
13983 case "$d_getpwnam_r" in
13984 "$define")
13985         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13986         case "$d_getpwnam_r_proto:$usethreads" in
13987         ":define")      d_getpwnam_r_proto=define
13988                 set d_getpwnam_r_proto getpwnam_r $hdrs
13989                 eval $hasproto ;;
13990         *)      ;;
13991         esac
13992         case "$d_getpwnam_r_proto" in
13993         define)
13994         case "$getpwnam_r_proto" in
13995         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13996         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13997         esac
13998         case "$getpwnam_r_proto" in
13999         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14000         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14001         esac
14002         case "$getpwnam_r_proto" in
14003         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14004         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14005         esac
14006         case "$getpwnam_r_proto" in
14007         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14008         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14009         esac
14010         case "$getpwnam_r_proto" in
14011         ''|0)   d_getpwnam_r=undef
14012                 getpwnam_r_proto=0
14013                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14014         * )     case "$getpwnam_r_proto" in
14015                 REENTRANT_PROTO*) ;;
14016                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14017                 esac
14018                 echo "Prototype: $try" ;;
14019         esac
14020         ;;
14021         *)      case "$usethreads" in
14022                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14023                 esac
14024                 d_getpwnam_r=undef
14025                 getpwnam_r_proto=0
14026                 ;;
14027         esac
14028         ;;
14029 *)      getpwnam_r_proto=0
14030         ;;
14031 esac
14032
14033 : see if getpwuid_r exists
14034 set getpwuid_r d_getpwuid_r
14035 eval $inlibc
14036 case "$d_getpwuid_r" in
14037 "$define")
14038         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14039         case "$d_getpwuid_r_proto:$usethreads" in
14040         ":define")      d_getpwuid_r_proto=define
14041                 set d_getpwuid_r_proto getpwuid_r $hdrs
14042                 eval $hasproto ;;
14043         *)      ;;
14044         esac
14045         case "$d_getpwuid_r_proto" in
14046         define)
14047         case "$getpwuid_r_proto" in
14048         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14049         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14050         esac
14051         case "$getpwuid_r_proto" in
14052         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14053         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14054         esac
14055         case "$getpwuid_r_proto" in
14056         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14057         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14058         esac
14059         case "$getpwuid_r_proto" in
14060         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14061         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14062         esac
14063         case "$getpwuid_r_proto" in
14064         ''|0)   d_getpwuid_r=undef
14065                 getpwuid_r_proto=0
14066                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14067         * )     case "$getpwuid_r_proto" in
14068                 REENTRANT_PROTO*) ;;
14069                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14070                 esac
14071                 echo "Prototype: $try" ;;
14072         esac
14073         ;;
14074         *)      case "$usethreads" in
14075                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14076                 esac
14077                 d_getpwuid_r=undef
14078                 getpwuid_r_proto=0
14079                 ;;
14080         esac
14081         ;;
14082 *)      getpwuid_r_proto=0
14083         ;;
14084 esac
14085
14086
14087 : see if getservbyname exists
14088 set getservbyname d_getsbyname
14089 eval $inlibc
14090
14091 : see if getservbyport exists
14092 set getservbyport d_getsbyport
14093 eval $inlibc
14094
14095 : see if getservent exists
14096 set getservent d_getsent
14097 eval $inlibc
14098
14099 : see if getservbyname_r exists
14100 set getservbyname_r d_getservbyname_r
14101 eval $inlibc
14102 case "$d_getservbyname_r" in
14103 "$define")
14104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14105         case "$d_getservbyname_r_proto:$usethreads" in
14106         ":define")      d_getservbyname_r_proto=define
14107                 set d_getservbyname_r_proto getservbyname_r $hdrs
14108                 eval $hasproto ;;
14109         *)      ;;
14110         esac
14111         case "$d_getservbyname_r_proto" in
14112         define)
14113         case "$getservbyname_r_proto" in
14114         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14115         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14116         esac
14117         case "$getservbyname_r_proto" in
14118         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14119         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14120         esac
14121         case "$getservbyname_r_proto" in
14122         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14123         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14124         esac
14125         case "$getservbyname_r_proto" in
14126         ''|0)   d_getservbyname_r=undef
14127                 getservbyname_r_proto=0
14128                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14129         * )     case "$getservbyname_r_proto" in
14130                 REENTRANT_PROTO*) ;;
14131                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14132                 esac
14133                 echo "Prototype: $try" ;;
14134         esac
14135         ;;
14136         *)      case "$usethreads" in
14137                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14138                 esac
14139                 d_getservbyname_r=undef
14140                 getservbyname_r_proto=0
14141                 ;;
14142         esac
14143         ;;
14144 *)      getservbyname_r_proto=0
14145         ;;
14146 esac
14147
14148 : see if getservbyport_r exists
14149 set getservbyport_r d_getservbyport_r
14150 eval $inlibc
14151 case "$d_getservbyport_r" in
14152 "$define")
14153         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14154         case "$d_getservbyport_r_proto:$usethreads" in
14155         ":define")      d_getservbyport_r_proto=define
14156                 set d_getservbyport_r_proto getservbyport_r $hdrs
14157                 eval $hasproto ;;
14158         *)      ;;
14159         esac
14160         case "$d_getservbyport_r_proto" in
14161         define)
14162         case "$getservbyport_r_proto" in
14163         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14164         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14165         esac
14166         case "$getservbyport_r_proto" in
14167         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14168         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14169         esac
14170         case "$getservbyport_r_proto" in
14171         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14172         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14173         esac
14174         case "$getservbyport_r_proto" in
14175         ''|0)   d_getservbyport_r=undef
14176                 getservbyport_r_proto=0
14177                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14178         * )     case "$getservbyport_r_proto" in
14179                 REENTRANT_PROTO*) ;;
14180                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14181                 esac
14182                 echo "Prototype: $try" ;;
14183         esac
14184         ;;
14185         *)      case "$usethreads" in
14186                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14187                 esac
14188                 d_getservbyport_r=undef
14189                 getservbyport_r_proto=0
14190                 ;;
14191         esac
14192         ;;
14193 *)      getservbyport_r_proto=0
14194         ;;
14195 esac
14196
14197 : see if getservent_r exists
14198 set getservent_r d_getservent_r
14199 eval $inlibc
14200 case "$d_getservent_r" in
14201 "$define")
14202         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14203         case "$d_getservent_r_proto:$usethreads" in
14204         ":define")      d_getservent_r_proto=define
14205                 set d_getservent_r_proto getservent_r $hdrs
14206                 eval $hasproto ;;
14207         *)      ;;
14208         esac
14209         case "$d_getservent_r_proto" in
14210         define)
14211         case "$getservent_r_proto" in
14212         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14213         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14214         esac
14215         case "$getservent_r_proto" in
14216         ''|0) try='int getservent_r(struct servent*, char*, int);'
14217         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14218         esac
14219         case "$getservent_r_proto" in
14220         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14221         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14222         esac
14223         case "$getservent_r_proto" in
14224         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14225         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14226         esac
14227         case "$getservent_r_proto" in
14228         ''|0)   d_getservent_r=undef
14229                 getservent_r_proto=0
14230                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14231         * )     case "$getservent_r_proto" in
14232                 REENTRANT_PROTO*) ;;
14233                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14234                 esac
14235                 echo "Prototype: $try" ;;
14236         esac
14237         ;;
14238         *)      case "$usethreads" in
14239                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14240                 esac
14241                 d_getservent_r=undef
14242                 getservent_r_proto=0
14243                 ;;
14244         esac
14245         ;;
14246 *)      getservent_r_proto=0
14247         ;;
14248 esac
14249
14250 : see if prototypes for various getservxxx netdb.h functions are available
14251 echo " "
14252 set d_getservprotos getservent $i_netdb netdb.h
14253 eval $hasproto
14254
14255 : see if getspnam exists
14256 set getspnam d_getspnam
14257 eval $inlibc
14258
14259 : see if this is a shadow.h system
14260 set shadow.h i_shadow
14261 eval $inhdr
14262
14263 : see if getspnam_r exists
14264 set getspnam_r d_getspnam_r
14265 eval $inlibc
14266 case "$d_getspnam_r" in
14267 "$define")
14268         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14269         case "$d_getspnam_r_proto:$usethreads" in
14270         ":define")      d_getspnam_r_proto=define
14271                 set d_getspnam_r_proto getspnam_r $hdrs
14272                 eval $hasproto ;;
14273         *)      ;;
14274         esac
14275         case "$d_getspnam_r_proto" in
14276         define)
14277         case "$getspnam_r_proto" in
14278         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14279         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14280         esac
14281         case "$getspnam_r_proto" in
14282         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14283         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14284         esac
14285         case "$getspnam_r_proto" in
14286         ''|0)   d_getspnam_r=undef
14287                 getspnam_r_proto=0
14288                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14289         * )     case "$getspnam_r_proto" in
14290                 REENTRANT_PROTO*) ;;
14291                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14292                 esac
14293                 echo "Prototype: $try" ;;
14294         esac
14295         ;;
14296         *)      case "$usethreads" in
14297                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14298                 esac
14299                 d_getspnam_r=undef
14300                 getspnam_r_proto=0
14301                 ;;
14302         esac
14303         ;;
14304 *)      getspnam_r_proto=0
14305         ;;
14306 esac
14307
14308 : see if gettimeofday or ftime exists
14309 set gettimeofday d_gettimeod
14310 eval $inlibc
14311 case "$d_gettimeod" in
14312 "$undef")
14313         set ftime d_ftime 
14314         eval $inlibc
14315         ;;
14316 *)
14317         val="$undef"; set d_ftime; eval $setvar
14318         ;;
14319 esac
14320 case "$d_gettimeod$d_ftime" in
14321 "$undef$undef")
14322         echo " "
14323         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14324         ;;
14325 esac
14326
14327 : see if gmtime_r exists
14328 set gmtime_r d_gmtime_r
14329 eval $inlibc
14330 case "$d_gmtime_r" in
14331 "$define")
14332         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14333         case "$d_gmtime_r_proto:$usethreads" in
14334         ":define")      d_gmtime_r_proto=define
14335                 set d_gmtime_r_proto gmtime_r $hdrs
14336                 eval $hasproto ;;
14337         *)      ;;
14338         esac
14339         case "$d_gmtime_r_proto" in
14340         define)
14341         case "$gmtime_r_proto" in
14342         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14343         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14344         esac
14345         case "$gmtime_r_proto" in
14346         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14347         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14348         esac
14349         case "$gmtime_r_proto" in
14350         ''|0)   d_gmtime_r=undef
14351                 gmtime_r_proto=0
14352                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14353         * )     case "$gmtime_r_proto" in
14354                 REENTRANT_PROTO*) ;;
14355                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14356                 esac
14357                 echo "Prototype: $try" ;;
14358         esac
14359         ;;
14360         *)      case "$usethreads" in
14361                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14362                 esac
14363                 d_gmtime_r=undef
14364                 gmtime_r_proto=0
14365                 ;;
14366         esac
14367         ;;
14368 *)      gmtime_r_proto=0
14369         ;;
14370 esac
14371
14372 : see if hasmntopt exists
14373 set hasmntopt d_hasmntopt
14374 eval $inlibc
14375
14376 : see if this is a netinet/in.h or sys/in.h system
14377 set netinet/in.h i_niin sys/in.h i_sysin
14378 eval $inhdr
14379
14380 : see if arpa/inet.h has to be included
14381 set arpa/inet.h i_arpainet
14382 eval $inhdr
14383
14384 : see if htonl --and friends-- exists
14385 val=''
14386 set htonl val
14387 eval $inlibc
14388
14389 : Maybe they are macros.
14390 case "$val" in
14391 $undef)
14392         $cat >htonl.c <<EOM
14393 #include <stdio.h>
14394 #include <sys/types.h>
14395 #$i_niin I_NETINET_IN
14396 #$i_sysin I_SYS_IN
14397 #$i_arpainet I_ARPA_INET
14398 #ifdef I_NETINET_IN
14399 #include <netinet/in.h>
14400 #endif
14401 #ifdef I_SYS_IN
14402 #include <sys/in.h>
14403 #endif
14404 #ifdef I_ARPA_INET
14405 #include <arpa/inet.h>
14406 #endif
14407 #ifdef htonl
14408 printf("Defined as a macro.");
14409 #endif
14410 EOM
14411         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14412         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14413                 val="$define"
14414                 echo "But it seems to be defined as a macro." >&4
14415         fi
14416         $rm -f htonl.?
14417         ;;
14418 esac
14419 set d_htonl
14420 eval $setvar
14421
14422 : see if ilogbl exists
14423 set ilogbl d_ilogbl
14424 eval $inlibc
14425
14426 : index or strchr
14427 echo " "
14428 if set index val -f; eval $csym; $val; then
14429         if set strchr val -f d_strchr; eval $csym; $val; then
14430                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14431                         val="$define"
14432                         vali="$undef"
14433                         echo "strchr() found." >&4
14434                 else
14435                         val="$undef"
14436                         vali="$define"
14437                         echo "index() found." >&4
14438                 fi
14439         else
14440                 val="$undef"
14441                 vali="$define"
14442                 echo "index() found." >&4
14443         fi
14444 else
14445         if set strchr val -f d_strchr; eval $csym; $val; then
14446                 val="$define"
14447                 vali="$undef"
14448                 echo "strchr() found." >&4
14449         else
14450                 echo "No index() or strchr() found!" >&4
14451                 val="$undef"
14452                 vali="$undef"
14453         fi
14454 fi
14455 set d_strchr; eval $setvar
14456 val="$vali"
14457 set d_index; eval $setvar
14458
14459 : check whether inet_aton exists
14460 set inet_aton d_inetaton
14461 eval $inlibc
14462
14463 : Look for isascii
14464 echo " "
14465 $cat >isascii.c <<EOCP
14466 #include <stdio.h>
14467 #include <ctype.h>
14468 #$i_stdlib I_STDLIB
14469 #ifdef I_STDLIB
14470 #include <stdlib.h>
14471 #endif
14472 int main() {
14473         int c = 'A';
14474         if (isascii(c))
14475                 exit(0);
14476         else
14477                 exit(1);
14478 }
14479 EOCP
14480 set isascii
14481 if eval $compile; then
14482         echo "isascii() found." >&4
14483         val="$define"
14484 else
14485         echo "isascii() NOT found." >&4
14486         val="$undef"
14487 fi
14488 set d_isascii
14489 eval $setvar
14490 $rm -f isascii*
14491
14492 : see if isfinite exists
14493 set isfinite d_isfinite
14494 eval $inlibc
14495
14496 : see if isinf exists
14497 set isinf d_isinf
14498 eval $inlibc
14499
14500 : see if isnan exists
14501 set isnan d_isnan
14502 eval $inlibc
14503
14504 : see if isnanl exists
14505 set isnanl d_isnanl
14506 eval $inlibc
14507
14508 : see if killpg exists
14509 set killpg d_killpg
14510 eval $inlibc
14511
14512 : see if lchown exists
14513 echo " "
14514 $cat > try.c <<'EOCP'
14515 /* System header to define __stub macros and hopefully few prototypes,
14516     which can conflict with char lchown(); below.  */
14517 #include <assert.h>
14518 /* Override any gcc2 internal prototype to avoid an error.  */
14519 /* We use char because int might match the return type of a gcc2
14520    builtin and then its argument prototype would still apply.  */
14521 char lchown();
14522 int main() {
14523     /*  The GNU C library defines this for functions which it implements
14524         to always fail with ENOSYS.  Some functions are actually named
14525         something starting with __ and the normal name is an alias.  */
14526 #if defined (__stub_lchown) || defined (__stub___lchown)
14527 choke me
14528 #else
14529 lchown();
14530 #endif
14531 ; return 0; }
14532 EOCP
14533 set try
14534 if eval $compile; then
14535     $echo "lchown() found." >&4
14536     val="$define"
14537 else
14538     $echo "lchown() NOT found." >&4
14539     val="$undef"
14540 fi
14541 set d_lchown
14542 eval $setvar
14543
14544 : See if number of significant digits in a double precision number is known
14545 echo " "
14546 $cat >ldbl_dig.c <<EOM
14547 #$i_limits I_LIMITS
14548 #$i_float I_FLOAT
14549 #ifdef I_LIMITS
14550 #include <limits.h>
14551 #endif
14552 #ifdef I_FLOAT
14553 #include <float.h>
14554 #endif
14555 #ifdef LDBL_DIG
14556 printf("Contains LDBL_DIG");
14557 #endif
14558 EOM
14559 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14560 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14561         echo "LDBL_DIG found." >&4
14562         val="$define"
14563 else
14564         echo "LDBL_DIG NOT found." >&4
14565         val="$undef"
14566 fi
14567 $rm -f ldbl_dig.?
14568 set d_ldbl_dig
14569 eval $setvar
14570
14571 : see if this is a math.h system
14572 set math.h i_math
14573 eval $inhdr
14574
14575 d_libm_lib_version="$undef"
14576 case $i_math in
14577     $define)
14578         : check to see if math.h defines _LIB_VERSION
14579         echo " "
14580         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14581         $cat >try.c <<EOCP
14582 #include <unistd.h>
14583 #include <math.h>
14584 int main (int argc, char *argv[])
14585 {
14586     printf ("%d\n", _LIB_VERSION);
14587     return (0);
14588     } /* main */
14589 EOCP
14590         set try
14591         if eval $compile; then
14592             foo=`$run ./try`
14593             echo "Yes, it does ($foo)" >&4
14594             d_libm_lib_version="$define"
14595         else
14596             echo "No, it does not (probably harmless)\n" >&4
14597             fi
14598         $rm_try
14599         ;;
14600
14601     esac
14602
14603 : see if link exists
14604 set link d_link
14605 eval $inlibc
14606
14607 : see if localtime_r exists
14608 set localtime_r d_localtime_r
14609 eval $inlibc
14610 case "$d_localtime_r" in
14611 "$define")
14612         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14613         case "$d_localtime_r_proto:$usethreads" in
14614         ":define")      d_localtime_r_proto=define
14615                 set d_localtime_r_proto localtime_r $hdrs
14616                 eval $hasproto ;;
14617         *)      ;;
14618         esac
14619         case "$d_localtime_r_proto" in
14620         define)
14621         case "$localtime_r_proto" in
14622         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14623         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14624         esac
14625         case "$localtime_r_proto" in
14626         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14627         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14628         esac
14629         case "$localtime_r_proto" in
14630         ''|0)   d_localtime_r=undef
14631                 localtime_r_proto=0
14632                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14633         * )     case "$localtime_r_proto" in
14634                 REENTRANT_PROTO*) ;;
14635                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14636                 esac
14637                 echo "Prototype: $try" ;;
14638         esac
14639         ;;
14640         *)      case "$usethreads" in
14641                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14642                 esac
14643                 d_localtime_r=undef
14644                 localtime_r_proto=0
14645                 ;;
14646         esac
14647         ;;
14648 *)      localtime_r_proto=0
14649         ;;
14650 esac
14651
14652 : see if localtime_r calls tzset
14653 case "$localtime_r_proto" in
14654 REENTRANT_PROTO*)
14655         $cat >try.c <<EOCP
14656 /*  Does our libc's localtime_r call tzset ?
14657  *  return 0 if so, 1 otherwise.
14658  */
14659 #include <sys/types.h>
14660 #include <unistd.h>
14661 #include <time.h>
14662 #include <string.h>
14663 #include <malloc.h>
14664 int main()
14665 {
14666     time_t t = time(0L);
14667     char w_tz[]="TZ" "=GMT+5",
14668          e_tz[]="TZ" "=GMT-5",
14669         *tz_e = (char*)malloc(16),
14670         *tz_w = (char*)malloc(16);
14671     struct tm tm_e, tm_w;
14672     memset(&tm_e,'\0',sizeof(struct tm));
14673     memset(&tm_w,'\0',sizeof(struct tm));
14674     strcpy(tz_e,e_tz);
14675     strcpy(tz_w,w_tz);
14676
14677     putenv(tz_e);
14678     localtime_r(&t, &tm_e);
14679
14680     putenv(tz_w);
14681     localtime_r(&t, &tm_w);
14682
14683     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14684         return 1;
14685     return 0;
14686 }
14687 EOCP
14688         set try
14689         if eval $compile; then
14690             if $run ./try; then
14691                 d_localtime_r_needs_tzset=undef;
14692             else
14693                 d_localtime_r_needs_tzset=define;
14694             fi;
14695         else
14696             d_localtime_r_needs_tzset=undef;
14697         fi;
14698      ;;
14699   *)
14700      d_localtime_r_needs_tzset=undef;
14701      ;;
14702 esac
14703 $rm_try
14704
14705 : see if localeconv exists
14706 set localeconv d_locconv
14707 eval $inlibc
14708
14709 : see if lockf exists
14710 set lockf d_lockf
14711 eval $inlibc
14712
14713 : see if prototype for lseek is available
14714 echo " "
14715 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14716 eval $hasproto
14717
14718 : see if lstat exists
14719 set lstat d_lstat
14720 eval $inlibc
14721
14722 : see if madvise exists
14723 set madvise d_madvise
14724 eval $inlibc
14725
14726 : see if malloc_size exists
14727 set malloc_size d_malloc_size
14728 eval $inlibc
14729
14730 : see if malloc_size_good exists
14731 set malloc_good_size d_malloc_good_size
14732 eval $inlibc
14733
14734 : see if mblen exists
14735 set mblen d_mblen
14736 eval $inlibc
14737
14738 : see if mbstowcs exists
14739 set mbstowcs d_mbstowcs
14740 eval $inlibc
14741
14742 : see if mbtowc exists
14743 set mbtowc d_mbtowc
14744 eval $inlibc
14745
14746 : see if memchr exists
14747 set memchr d_memchr
14748 eval $inlibc
14749
14750 : see if memcmp exists
14751 set memcmp d_memcmp
14752 eval $inlibc
14753
14754 : see if memcpy exists
14755 set memcpy d_memcpy
14756 eval $inlibc
14757
14758 : see if memmove exists
14759 set memmove d_memmove
14760 eval $inlibc
14761
14762 : see if memset exists
14763 set memset d_memset
14764 eval $inlibc
14765
14766 : see if mkdir exists
14767 set mkdir d_mkdir
14768 eval $inlibc
14769
14770 : see if mkdtemp exists
14771 set mkdtemp d_mkdtemp
14772 eval $inlibc
14773
14774 : see if mkfifo exists
14775 set mkfifo d_mkfifo
14776 eval $inlibc
14777
14778 : see if mkstemp exists
14779 set mkstemp d_mkstemp
14780 eval $inlibc
14781
14782 : see if mkstemps exists
14783 set mkstemps d_mkstemps
14784 eval $inlibc
14785
14786 : see if mktime exists
14787 set mktime d_mktime
14788 eval $inlibc
14789
14790 : see if this is a sys/mman.h system
14791 set sys/mman.h i_sysmman
14792 eval $inhdr
14793
14794 : see if mmap exists
14795 set mmap d_mmap
14796 eval $inlibc
14797 : see what shmat returns
14798 : default to something harmless
14799 mmaptype='void *'
14800 case "$i_sysmman$d_mmap" in
14801 "$define$define")
14802         $cat >mmap.c <<'END'
14803 #include <sys/mman.h>
14804 void *mmap();
14805 END
14806         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14807                 mmaptype='void *'
14808         else
14809                 mmaptype='caddr_t'
14810         fi
14811         echo "and it returns ($mmaptype)." >&4
14812         ;;
14813 esac
14814
14815
14816
14817 : see if sqrtl exists
14818 set sqrtl d_sqrtl
14819 eval $inlibc
14820
14821 : see if scalbnl exists
14822 set scalbnl d_scalbnl
14823 eval $inlibc
14824
14825 : see if modfl exists
14826 set modfl d_modfl
14827 eval $inlibc
14828
14829 : see if prototype for modfl is available
14830 echo " "
14831 set d_modflproto modfl $i_math math.h
14832 eval $hasproto
14833
14834 d_modfl_pow32_bug="$undef"
14835
14836 case "$d_longdbl$d_modfl" in
14837 $define$define)
14838         $cat <<EOM
14839 Checking to see whether your modfl() is okay for large values...
14840 EOM
14841 $cat >try.c <<EOCP
14842 #include <math.h>
14843 #include <stdio.h>
14844 EOCP
14845 if $test "X$d_modflproto" != "X$define"; then
14846         $cat >>try.c <<EOCP
14847 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14848 long double modfl (long double, long double *);
14849 EOCP
14850 fi
14851 $cat >>try.c <<EOCP
14852 int main() {
14853     long double nv = 4294967303.15;
14854     long double v, w;
14855     v = modfl(nv, &w);
14856 #ifdef __GLIBC__
14857     printf("glibc");
14858 #endif
14859     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14860     return 0;
14861 }
14862 EOCP
14863         case "$osname:$gccversion" in
14864         aix:)   saveccflags="$ccflags"
14865                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14866         esac
14867         set try
14868         if eval $compile; then
14869                 foo=`$run ./try`
14870                 case "$foo" in
14871                 *" 4294967303.150000 1.150000 4294967302.000000")
14872                         echo >&4 "Your modfl() is broken for large values."
14873                         d_modfl_pow32_bug="$define"
14874                         case "$foo" in
14875                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14876                         ;;
14877                         esac
14878                         ;;
14879                 *" 4294967303.150000 0.150000 4294967303.000000")
14880                         echo >&4 "Your modfl() seems okay for large values."
14881                         ;;
14882                 *)      echo >&4 "I don't understand your modfl() at all."
14883                         d_modfl="$undef"
14884                         ;;
14885                 esac
14886                 $rm_try
14887         else
14888                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14889                 d_modfl="$undef"
14890         fi
14891         case "$osname:$gccversion" in
14892         aix:)   ccflags="$saveccflags" ;; # restore
14893         esac
14894         ;;
14895 esac
14896
14897 if $test "$uselongdouble" = "$define"; then
14898     message=""
14899     if $test "$d_sqrtl" != "$define"; then
14900         message="$message sqrtl"
14901     fi
14902     if $test "$d_modfl" != "$define"; then
14903         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14904             echo "You have both aintl and copysignl, so I can emulate modfl."
14905         else
14906             message="$message modfl"
14907         fi
14908     fi
14909     if $test "$d_frexpl" != "$define"; then
14910         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14911             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14912         else
14913             message="$message frexpl"
14914         fi
14915     fi
14916
14917     if $test "$message" != ""; then
14918         $cat <<EOM >&4
14919
14920 *** You requested the use of long doubles but you do not seem to have
14921 *** the following mathematical functions needed for long double support:
14922 ***    $message
14923 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14924 *** Cannot continue, aborting.
14925
14926 EOM
14927
14928         exit 1
14929     fi
14930 fi
14931
14932 : see if mprotect exists
14933 set mprotect d_mprotect
14934 eval $inlibc
14935
14936 : see if msgctl exists
14937 set msgctl d_msgctl
14938 eval $inlibc
14939
14940 : see if msgget exists
14941 set msgget d_msgget
14942 eval $inlibc
14943
14944 : see if msgsnd exists
14945 set msgsnd d_msgsnd
14946 eval $inlibc
14947
14948 : see if msgrcv exists
14949 set msgrcv d_msgrcv
14950 eval $inlibc
14951
14952 : see how much of the 'msg*(2)' library is present.
14953 h_msg=true
14954 echo " "
14955 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14956 *"$undef"*) h_msg=false;;
14957 esac
14958 case "$osname" in
14959 freebsd)
14960     case "`ipcs 2>&1`" in
14961     "SVID messages"*"not configured"*)
14962         echo "Your $osname does not have the msg*(2) configured." >&4
14963         h_msg=false
14964         val="$undef"
14965         set msgctl d_msgctl
14966         eval $setvar
14967         set msgget d_msgget
14968         eval $setvar
14969         set msgsnd d_msgsnd
14970         eval $setvar
14971         set msgrcv d_msgrcv
14972         eval $setvar
14973         ;;
14974     esac
14975     ;;
14976 esac
14977 : we could also check for sys/ipc.h ...
14978 if $h_msg && $test `./findhdr sys/msg.h`; then
14979         echo "You have the full msg*(2) library." >&4
14980         val="$define"
14981 else
14982         echo "You don't have the full msg*(2) library." >&4
14983         val="$undef"
14984 fi
14985 set d_msg
14986 eval $setvar
14987
14988
14989 echo " "
14990 echo "Checking to see if your system supports struct msghdr..." >&4
14991 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14992 eval $hasstruct
14993 case "$d_msghdr_s" in
14994 "$define")      echo "Yes, it does."   ;;
14995 *)              echo "No, it doesn't." ;;
14996 esac
14997
14998
14999 : see if msync exists
15000 set msync d_msync
15001 eval $inlibc
15002
15003 : see if munmap exists
15004 set munmap d_munmap
15005 eval $inlibc
15006
15007 : see if nice exists
15008 set nice d_nice
15009 eval $inlibc
15010
15011 : see if this is a langinfo.h system
15012 set langinfo.h i_langinfo
15013 eval $inhdr
15014
15015 : see if nl_langinfo exists
15016 set nl_langinfo d_nl_langinfo
15017 eval $inlibc
15018
15019 : check for length of character
15020 echo " "
15021 case "$charsize" in
15022 '')
15023         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15024         $cat >try.c <<EOCP
15025 #include <stdio.h>
15026 #$i_stdlib I_STDLIB
15027 #ifdef I_STDLIB
15028 #include <stdlib.h>
15029 #endif
15030 int main()
15031 {
15032     printf("%d\n", (int)sizeof(char));
15033     exit(0);
15034 }
15035 EOCP
15036         set try
15037         if eval $compile_ok; then
15038                 dflt=`$run ./try`
15039         else
15040                 dflt='1'
15041                 echo "(I can't seem to compile the test program.  Guessing...)"
15042         fi
15043         ;;
15044 *)
15045         dflt="$charsize"
15046         ;;
15047 esac
15048 rp="What is the size of a character (in bytes)?"
15049 . ./myread
15050 charsize="$ans"
15051 $rm_try
15052
15053 : check for volatile keyword
15054 echo " "
15055 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15056 $cat >try.c <<'EOCP'
15057 int main()
15058 {
15059         typedef struct _goo_struct goo_struct;
15060         goo_struct * volatile goo = ((goo_struct *)0);
15061         struct _goo_struct {
15062                 long long_int;
15063                 int reg_int;
15064                 char char_var;
15065         };
15066         typedef unsigned short foo_t;
15067         char *volatile foo;
15068         volatile int bar;
15069         volatile foo_t blech;
15070         foo = foo;
15071 }
15072 EOCP
15073 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15074         val="$define"
15075         echo "Yup, it does."
15076 else
15077         val="$undef"
15078         echo "Nope, it doesn't."
15079 fi
15080 set d_volatile
15081 eval $setvar
15082 $rm_try
15083
15084
15085 echo " "
15086 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15087
15088 case "$use64bitint:$d_quad:$quadtype" in
15089 define:define:?*)
15090         ivtype="$quadtype"
15091         uvtype="$uquadtype"
15092         ivsize=8
15093         uvsize=8
15094         ;;
15095 *)      ivtype="long"
15096         uvtype="unsigned long"
15097         ivsize=$longsize
15098         uvsize=$longsize
15099         ;;
15100 esac
15101
15102 case "$uselongdouble:$d_longdbl" in
15103 define:define)
15104         nvtype="long double"
15105         nvsize=$longdblsize
15106         ;;
15107 *)      nvtype=double
15108         nvsize=$doublesize
15109         ;;
15110 esac
15111
15112 $echo "(IV will be "$ivtype", $ivsize bytes)"
15113 $echo "(UV will be "$uvtype", $uvsize bytes)"
15114 $echo "(NV will be "$nvtype", $nvsize bytes)"
15115
15116 $cat >try.c <<EOCP
15117 #$i_inttypes I_INTTYPES
15118 #ifdef I_INTTYPES
15119 #include <inttypes.h>
15120 #endif
15121 #include <stdio.h>
15122 int main() {
15123 #ifdef INT8
15124    int8_t i =  INT8_MAX;
15125   uint8_t u = UINT8_MAX;
15126   printf("int8_t\n");
15127 #endif
15128 #ifdef INT16
15129    int16_t i =  INT16_MAX;
15130   uint16_t i = UINT16_MAX;
15131   printf("int16_t\n");
15132 #endif
15133 #ifdef INT32
15134    int32_t i =  INT32_MAX;
15135   uint32_t u = UINT32_MAX;
15136   printf("int32_t\n");
15137 #endif
15138 }
15139 EOCP
15140
15141 case "$i8type" in
15142 '')     case "$charsize" in
15143         1)      i8type=char
15144                 u8type="unsigned char"
15145                 i8size=$charsize
15146                 u8size=$charsize
15147                 ;;
15148         esac
15149         ;;
15150 esac
15151 case "$i8type" in
15152 '')     set try -DINT8
15153         if eval $compile; then
15154                 case "`$run ./try`" in
15155                 int8_t) i8type=int8_t
15156                         u8type=uint8_t
15157                         i8size=1
15158                         u8size=1
15159                         ;;
15160                 esac
15161         fi
15162         ;;
15163 esac
15164 case "$i8type" in
15165 '')     if $test $charsize -ge 1; then
15166                 i8type=char
15167                 u8type="unsigned char"
15168                 i8size=$charsize
15169                 u8size=$charsize
15170         fi
15171         ;;
15172 esac
15173
15174 case "$i16type" in
15175 '')     case "$shortsize" in
15176         2)      i16type=short
15177                 u16type="unsigned short"
15178                 i16size=$shortsize
15179                 u16size=$shortsize
15180                 ;;
15181         esac
15182         ;;
15183 esac
15184 case "$i16type" in
15185 '')     set try -DINT16
15186         if eval $compile; then
15187                 case "`$run ./try`" in
15188                 int16_t)
15189                         i16type=int16_t
15190                         u16type=uint16_t
15191                         i16size=2
15192                         u16size=2
15193                         ;;
15194                 esac
15195         fi
15196         ;;
15197 esac
15198 case "$i16type" in
15199 '')     if $test $shortsize -ge 2; then
15200                 i16type=short
15201                 u16type="unsigned short"
15202                 i16size=$shortsize
15203                 u16size=$shortsize
15204         fi
15205         ;;
15206 esac
15207
15208 case "$i32type" in
15209 '')     case "$longsize" in
15210         4)      i32type=long
15211                 u32type="unsigned long"
15212                 i32size=$longsize
15213                 u32size=$longsize
15214                 ;;
15215         *)      case "$intsize" in
15216                 4)      i32type=int
15217                         u32type="unsigned int"
15218                         i32size=$intsize
15219                         u32size=$intsize
15220                         ;;
15221                 esac
15222                 ;;
15223         esac
15224         ;;
15225 esac
15226 case "$i32type" in
15227 '')     set try -DINT32
15228         if eval $compile; then
15229                 case "`$run ./try`" in
15230                 int32_t)
15231                         i32type=int32_t
15232                         u32type=uint32_t
15233                         i32size=4
15234                         u32size=4
15235                         ;;
15236                 esac
15237         fi
15238         ;;
15239 esac
15240 case "$i32type" in
15241 '')     if $test $intsize -ge 4; then
15242                 i32type=int
15243                 u32type="unsigned int"
15244                 i32size=$intsize
15245                 u32size=$intsize
15246         fi
15247         ;;
15248 esac
15249
15250 case "$i64type" in
15251 '')     case "$d_quad:$quadtype" in
15252         define:?*)
15253                 i64type="$quadtype"
15254                 u64type="$uquadtype"
15255                 i64size=8
15256                 u64size=8
15257                 ;;
15258         esac
15259         ;;
15260 esac
15261
15262 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15263 : volatile so that the compiler has to store it out to memory.
15264 if test X"$d_volatile" = X"$define"; then
15265         volatile=volatile
15266 fi
15267 $cat <<EOP >try.c
15268 #include <stdio.h>
15269 #$i_stdlib I_STDLIB
15270 #ifdef I_STDLIB
15271 #include <stdlib.h>
15272 #endif
15273 #include <sys/types.h>
15274 #include <signal.h>
15275 #ifdef SIGFPE
15276 $volatile int bletched = 0;
15277 $signal_t blech(int s) { bletched = 1; }
15278 #endif
15279 int main() {
15280     $uvtype u = 0;
15281     $nvtype d;
15282     int     n = 8 * $uvsize;
15283     int     i;
15284 #ifdef SIGFPE
15285     signal(SIGFPE, blech);
15286 #endif
15287
15288     for (i = 0; i < n; i++) {
15289       u = u << 1 | ($uvtype)1;
15290       d = ($nvtype)u;
15291       if (($uvtype)d != u)
15292         break;
15293       if (d <= 0)
15294         break;
15295       d = ($nvtype)(u - 1);
15296       if (($uvtype)d != (u - 1))
15297         break;
15298 #ifdef SIGFPE
15299       if (bletched)
15300         break;
15301 #endif
15302     }
15303     printf("%d\n", ((i == n) ? -n : i));
15304     exit(0);
15305 }
15306 EOP
15307 set try
15308
15309 d_nv_preserves_uv="$undef"
15310 if eval $compile; then
15311         nv_preserves_uv_bits="`$run ./try`"
15312 fi
15313 case "$nv_preserves_uv_bits" in
15314 \-[1-9]*)
15315         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15316         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15317         d_nv_preserves_uv="$define"
15318         ;;
15319 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15320         d_nv_preserves_uv="$undef" ;;
15321 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15322         nv_preserves_uv_bits="0" ;;
15323 esac
15324 $rm_try
15325
15326 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15327 : volatile so that the compiler has to store it out to memory.
15328 if test X"$d_volatile" = X"$define"; then
15329         volatile=volatile
15330 fi
15331 $cat <<EOP >try.c
15332 #include <stdio.h>
15333 #$i_stdlib I_STDLIB
15334 #ifdef I_STDLIB
15335 #include <stdlib.h>
15336 #endif
15337 #$i_string I_STRING
15338 #ifdef I_STRING
15339 #  include <string.h>
15340 #else
15341 #  include <strings.h>
15342 #endif
15343 #include <sys/types.h>
15344 #include <signal.h>
15345 #ifdef SIGFPE
15346 $volatile int bletched = 0;
15347 $signal_t blech(int s) { bletched = 1; }
15348 #endif
15349
15350 int checkit($nvtype d, char *where) {
15351     unsigned char *p = (char *)&d;
15352     unsigned char *end = p + sizeof(d);
15353     int fail = 0;
15354
15355     while (p < end)
15356         fail += *p++;
15357
15358     if (!fail)
15359         return 0;
15360
15361     p = (char *)&d;
15362     printf("No - %s: 0x", where);
15363     while (p < end)
15364         printf ("%02X", *p++);
15365     printf("\n");
15366     return 1;
15367 }
15368
15369 int main(int argc, char **argv) {
15370     $nvtype d = 0.0;
15371     int fail = 0;
15372     fail += checkit(d, "0.0");
15373
15374     /* The compiler shouldn't be assuming that bletched is 0  */
15375     d = bletched;
15376
15377     fail += checkit(d, "bleched");
15378
15379 #ifdef SIGFPE
15380     signal(SIGFPE, blech);
15381 #endif
15382
15383     /* Paranoia - the compiler should have no way of knowing that ANSI says
15384        that argv[argc] will always be NULL.  Actually, if it did assume this it
15385        would be buggy, as this is C and main() can be called from elsewhere in
15386        the program.  */
15387     d = argv[argc] ? 1 : 0;
15388
15389     if (d) {
15390         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15391     }
15392
15393     fail += checkit(d, "ternary");
15394
15395     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15396
15397     if (d != 0.0) {
15398         printf("No - memset doesn't give 0.0\n");
15399         /* This might just blow up:  */
15400         printf("(gives %g)\n", d);
15401         return 1;
15402     }
15403
15404 #ifdef SIGFPE
15405     if (bletched) {
15406         printf("No - something bleched\n");
15407         return 1;
15408     }
15409 #endif
15410     if (fail) {
15411       printf("No - %d fail(s)\n", fail);
15412       return 1;
15413     }
15414     printf("Yes\n");
15415     return 0;
15416 }
15417 EOP
15418 set try
15419
15420 d_nv_zero_is_allbits_zero="$undef"
15421 if eval $compile; then
15422     xxx="`$run ./try`"
15423     case "$?" in
15424         0)
15425             case "$xxx" in
15426                 Yes)  cat >&4 <<EOM
15427 0.0 is represented as all bits zero in memory
15428 EOM
15429                     d_nv_zero_is_allbits_zero="$define"
15430                     ;;
15431                 *)  cat >&4 <<EOM
15432 0.0 is not represented as all bits zero in memory
15433 EOM
15434                     d_nv_zero_is_allbits_zero="$undef"
15435                     ;;
15436             esac
15437             ;;
15438         *)  cat >&4 <<EOM
15439 0.0 is not represented as all bits zero in memory
15440 EOM
15441             d_nv_zero_is_allbits_zero="$undef"
15442             ;;
15443     esac
15444 fi
15445 $rm_try
15446
15447 : check for off64_t
15448 echo " "
15449 echo "Checking to see if you have off64_t..." >&4
15450 $cat >try.c <<EOCP
15451 #include <sys/types.h>
15452 #include <unistd.h>
15453 int main() { off64_t x = 7; }
15454 EOCP
15455 set try
15456 if eval $compile; then
15457         val="$define"
15458         echo "You have off64_t."
15459 else
15460         val="$undef"
15461         echo "You do not have off64_t."
15462         case "$lseeksize" in
15463         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15464         esac
15465 fi
15466 $rm_try
15467 set d_off64_t
15468 eval $setvar
15469
15470 : how to create joinable pthreads
15471 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15472         echo " "
15473         echo "Checking what constant to use for creating joinable pthreads..." >&4
15474         $cat >try.c <<'EOCP'
15475 #include <pthread.h>
15476 int main() {
15477     int detachstate = JOINABLE;
15478 }
15479 EOCP
15480         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15481         if eval $compile; then
15482                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15483                 val="$undef" # Yes, undef.
15484                 set d_old_pthread_create_joinable
15485                 eval $setvar
15486                 val=""
15487                 set old_pthread_create_joinable
15488                 eval $setvar
15489         else
15490                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15491                 if eval $compile; then
15492                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15493                         val="$define"
15494                         set d_old_pthread_create_joinable
15495                         eval $setvar
15496                         val=PTHREAD_CREATE_UNDETACHED
15497                         set old_pthread_create_joinable
15498                         eval $setvar
15499                 else
15500                         set try -DJOINABLE=__UNDETACHED
15501                         if eval $compile; then
15502                                 echo "You seem to use __UNDETACHED." >&4
15503                                 val="$define"
15504                                 set d_old_pthread_create_joinable
15505                                 eval $setvar
15506                                 val=__UNDETACHED
15507                                 set old_pthread_create_joinable
15508                                 eval $setvar
15509                         else
15510                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15511                                 val="$define"
15512                                 set d_old_pthread_create_joinable
15513                                 eval $setvar
15514                                 val=0
15515                                 set old_pthread_create_joinable
15516                                 eval $setvar
15517                         fi
15518                 fi
15519         fi
15520         $rm_try
15521 else
15522     d_old_pthread_create_joinable="$undef"
15523     old_pthread_create_joinable=""
15524 fi
15525
15526 : see if pause exists
15527 set pause d_pause
15528 eval $inlibc
15529
15530 : see if pipe exists
15531 set pipe d_pipe
15532 eval $inlibc
15533
15534 : see if poll exists
15535 set poll d_poll
15536 eval $inlibc
15537
15538 : see if readlink exists
15539 set readlink d_readlink
15540 eval $inlibc
15541
15542 echo " "
15543 procselfexe=''
15544 val="$undef"
15545 case "$d_readlink" in
15546 "$define")
15547         if $issymlink /proc/self/exe ; then
15548                 $ls -l /proc/self/exe > reflect
15549                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15550                         echo "You have Linux-like /proc/self/exe."
15551                         procselfexe='"/proc/self/exe"'
15552                         val="$define"
15553                 fi
15554         fi
15555         if $issymlink /proc/curproc/file ; then
15556                 $ls -l /proc/curproc/file > reflect
15557                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15558                         echo "You have BSD-like /proc/curproc/file."
15559                         procselfexe='"/proc/curproc/file"'
15560                         val="$define"
15561                 fi
15562         fi
15563         ;;
15564 esac
15565 $rm -f reflect
15566 set d_procselfexe
15567 eval $setvar
15568
15569 : backward compatibility for d_hvfork
15570 if test X$d_hvfork != X; then
15571         d_vfork="$d_hvfork"
15572         d_hvfork=''
15573 fi
15574 : see if there is a vfork
15575 val=''
15576 set vfork val
15577 eval $inlibc
15578
15579 d_pseudofork=$undef
15580
15581 : Ok, but do we want to use it. vfork is reportedly unreliable in
15582 : perl on Solaris 2.x, and probably elsewhere.
15583 case "$val" in
15584 $define)
15585         echo " "
15586         case "$usevfork" in
15587         false) dflt='n';;
15588         *) dflt='y';;
15589         esac
15590         cat <<'EOM'
15591
15592 Perl can only use a vfork() that doesn't suffer from strict
15593 restrictions on calling functions or modifying global data in
15594 the child.  For example, glibc-2.1 contains such a vfork()
15595 that is unsuitable.  If your system provides a proper fork()
15596 call, chances are that you do NOT want perl to use vfork().
15597
15598 EOM
15599         rp="Do you still want to use vfork()?"
15600         . ./myread
15601         case "$ans" in
15602         y|Y) ;;
15603         *)
15604                 echo "Ok, we won't use vfork()."
15605                 val="$undef"
15606                 ;;
15607         esac
15608         ;;
15609 esac
15610 set d_vfork
15611 eval $setvar
15612 case "$d_vfork" in
15613 $define) usevfork='true';;
15614 *) usevfork='false';;
15615 esac
15616
15617 : see whether the pthread_atfork exists
15618 $cat >try.c <<EOP
15619 #include <pthread.h>
15620 #include <stdio.h>
15621 int main() {
15622 #ifdef  PTHREAD_ATFORK
15623         pthread_atfork(NULL,NULL,NULL);
15624 #endif
15625 }
15626 EOP
15627
15628 : see if pthread_atfork exists
15629 set try -DPTHREAD_ATFORK
15630 if eval $compile; then
15631     val="$define"
15632 else
15633     val="$undef"
15634 fi
15635 case "$usethreads" in
15636 $define)
15637         case "$val" in
15638         $define) echo 'pthread_atfork found.' >&4        ;;
15639         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15640         esac
15641 esac
15642 set d_pthread_atfork
15643 eval $setvar
15644
15645 : see if pthread_attr_setscope exists
15646 set pthread_attr_setscope d_pthread_attr_setscope
15647 eval $inlibc
15648
15649
15650 : see whether the various POSIXish _yields exist
15651 $cat >try.c <<EOP
15652 #include <pthread.h>
15653 #include <stdio.h>
15654 int main() {
15655 #ifdef SCHED_YIELD
15656         sched_yield();
15657 #else
15658 #ifdef PTHREAD_YIELD
15659         pthread_yield();
15660 #else
15661 #ifdef PTHREAD_YIELD_NULL
15662         pthread_yield(NULL);
15663 #endif
15664 #endif
15665 #endif
15666 }
15667 EOP
15668 : see if sched_yield exists
15669 set try -DSCHED_YIELD
15670 if eval $compile; then
15671     val="$define"
15672     sched_yield='sched_yield()'
15673 else
15674     val="$undef"
15675 fi
15676 case "$usethreads" in
15677 $define)
15678         case "$val" in
15679         $define) echo 'sched_yield() found.' >&4        ;;
15680         *)       echo 'sched_yield() NOT found.' >&4    ;;
15681         esac
15682 esac
15683 set d_sched_yield
15684 eval $setvar
15685
15686 : see if pthread_yield exists
15687 set try -DPTHREAD_YIELD
15688 if eval $compile; then
15689     val="$define"
15690     case "$sched_yield" in
15691     '') sched_yield='pthread_yield()' ;;
15692     esac
15693 else
15694     set try -DPTHREAD_YIELD_NULL
15695     if eval $compile; then
15696         val="$define"
15697         case "$sched_yield" in
15698         '') sched_yield='pthread_yield(NULL)' ;;
15699         esac
15700     else
15701         val="$undef"
15702     fi
15703 fi
15704 case "$usethreads" in
15705 $define)
15706         case "$val" in
15707         $define) echo 'pthread_yield() found.' >&4      ;;
15708         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15709         esac
15710         ;;
15711 esac
15712 set d_pthread_yield
15713 eval $setvar
15714 case "$sched_yield" in
15715 '') sched_yield=undef ;;
15716 esac
15717 $rm_try
15718
15719 : see if random_r exists
15720 set random_r d_random_r
15721 eval $inlibc
15722 case "$d_random_r" in
15723 "$define")
15724         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15725         case "$d_random_r_proto:$usethreads" in
15726         ":define")      d_random_r_proto=define
15727                 set d_random_r_proto random_r $hdrs
15728                 eval $hasproto ;;
15729         *)      ;;
15730         esac
15731         case "$d_random_r_proto" in
15732         define)
15733         case "$random_r_proto" in
15734         ''|0) try='int random_r(int*, struct random_data*);'
15735         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15736         esac
15737         case "$random_r_proto" in
15738         ''|0) try='int random_r(long*, struct random_data*);'
15739         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15740         esac
15741         case "$random_r_proto" in
15742         ''|0) try='int random_r(struct random_data*, int32_t*);'
15743         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15744         esac
15745         case "$random_r_proto" in
15746         ''|0)   d_random_r=undef
15747                 random_r_proto=0
15748                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15749         * )     case "$random_r_proto" in
15750                 REENTRANT_PROTO*) ;;
15751                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15752                 esac
15753                 echo "Prototype: $try" ;;
15754         esac
15755         ;;
15756         *)      case "$usethreads" in
15757                 define) echo "random_r has no prototype, not using it." >&4 ;;
15758                 esac
15759                 d_random_r=undef
15760                 random_r_proto=0
15761                 ;;
15762         esac
15763         ;;
15764 *)      random_r_proto=0
15765         ;;
15766 esac
15767
15768 : see if readdir and friends exist
15769 set readdir d_readdir
15770 eval $inlibc
15771 set seekdir d_seekdir
15772 eval $inlibc
15773 set telldir d_telldir
15774 eval $inlibc
15775 set rewinddir d_rewinddir
15776 eval $inlibc
15777
15778 : see if readdir64_r exists
15779 set readdir64_r d_readdir64_r
15780 eval $inlibc
15781 case "$d_readdir64_r" in
15782 "$define")
15783         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15784         case "$d_readdir64_r_proto:$usethreads" in
15785         ":define")      d_readdir64_r_proto=define
15786                 set d_readdir64_r_proto readdir64_r $hdrs
15787                 eval $hasproto ;;
15788         *)      ;;
15789         esac
15790         case "$d_readdir64_r_proto" in
15791         define)
15792         case "$readdir64_r_proto" in
15793         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15794         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15795         esac
15796         case "$readdir64_r_proto" in
15797         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15798         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15799         esac
15800         case "$readdir64_r_proto" in
15801         ''|0)   d_readdir64_r=undef
15802                 readdir64_r_proto=0
15803                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15804         * )     case "$readdir64_r_proto" in
15805                 REENTRANT_PROTO*) ;;
15806                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15807                 esac
15808                 echo "Prototype: $try" ;;
15809         esac
15810         ;;
15811         *)      case "$usethreads" in
15812                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15813                 esac
15814                 d_readdir64_r=undef
15815                 readdir64_r_proto=0
15816                 ;;
15817         esac
15818         ;;
15819 *)      readdir64_r_proto=0
15820         ;;
15821 esac
15822
15823 : see if readdir_r exists
15824 set readdir_r d_readdir_r
15825 eval $inlibc
15826 case "$d_readdir_r" in
15827 "$define")
15828         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15829         case "$d_readdir_r_proto:$usethreads" in
15830         ":define")      d_readdir_r_proto=define
15831                 set d_readdir_r_proto readdir_r $hdrs
15832                 eval $hasproto ;;
15833         *)      ;;
15834         esac
15835         case "$d_readdir_r_proto" in
15836         define)
15837         case "$readdir_r_proto" in
15838         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15839         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15840         esac
15841         case "$readdir_r_proto" in
15842         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15843         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15844         esac
15845         case "$readdir_r_proto" in
15846         ''|0)   d_readdir_r=undef
15847                 readdir_r_proto=0
15848                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15849         * )     case "$readdir_r_proto" in
15850                 REENTRANT_PROTO*) ;;
15851                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15852                 esac
15853                 echo "Prototype: $try" ;;
15854         esac
15855         ;;
15856         *)      case "$usethreads" in
15857                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15858                 esac
15859                 d_readdir_r=undef
15860                 readdir_r_proto=0
15861                 ;;
15862         esac
15863         ;;
15864 *)      readdir_r_proto=0
15865         ;;
15866 esac
15867
15868 : see if readv exists
15869 set readv d_readv
15870 eval $inlibc
15871
15872 : see if recvmsg exists
15873 set recvmsg d_recvmsg
15874 eval $inlibc
15875
15876 : see if rename exists
15877 set rename d_rename
15878 eval $inlibc
15879
15880 : see if rmdir exists
15881 set rmdir d_rmdir
15882 eval $inlibc
15883
15884 : see if memory.h is available.
15885 val=''
15886 set memory.h val
15887 eval $inhdr
15888
15889 : See if it conflicts with string.h
15890 case "$val" in
15891 $define)
15892         case "$strings" in
15893         '') ;;
15894         *)
15895                 $cppstdin $cppflags $cppminus < $strings > mem.h
15896                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15897                         echo " "
15898                         echo "We won't be including <memory.h>."
15899                         val="$undef"
15900                 fi
15901                 $rm -f mem.h
15902                 ;;
15903         esac
15904 esac
15905 set i_memory
15906 eval $setvar
15907
15908 : can bcopy handle overlapping blocks?
15909 echo " "
15910 val="$undef"
15911 case "$d_memmove" in
15912 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15913 *)      case "$d_bcopy" in
15914         "$define")
15915                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15916                 $cat >try.c <<EOCP
15917 #$i_memory I_MEMORY
15918 #$i_stdlib I_STDLIB
15919 #$i_string I_STRING
15920 #$i_unistd I_UNISTD
15921 EOCP
15922         $cat >>try.c <<'EOCP'
15923 #include <stdio.h>
15924 #ifdef I_MEMORY
15925 #  include <memory.h>
15926 #endif
15927 #ifdef I_STDLIB
15928 #  include <stdlib.h>
15929 #endif
15930 #ifdef I_STRING
15931 #  include <string.h>
15932 #else
15933 #  include <strings.h>
15934 #endif
15935 #ifdef I_UNISTD
15936 #  include <unistd.h>  /* Needed for NetBSD */
15937 #endif
15938 int main()
15939 {
15940 char buf[128], abc[128];
15941 char *b;
15942 int len;
15943 int off;
15944 int align;
15945
15946 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15947    try to store the string in read-only memory. */
15948 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15949
15950 for (align = 7; align >= 0; align--) {
15951         for (len = 36; len; len--) {
15952                 b = buf+align;
15953                 bcopy(abc, b, len);
15954                 for (off = 1; off <= len; off++) {
15955                         bcopy(b, b+off, len);
15956                         bcopy(b+off, b, len);
15957                         if (bcmp(b, abc, len))
15958                                 exit(1);
15959                 }
15960         }
15961 }
15962 exit(0);
15963 }
15964 EOCP
15965                 set try
15966                 if eval $compile_ok; then
15967                         if $run ./try 2>/dev/null; then
15968                                 echo "Yes, it can."
15969                                 val="$define"
15970                         else
15971                                 echo "It can't, sorry."
15972                         fi
15973                 else
15974                         echo "(I can't compile the test program, so we'll assume not...)"
15975                 fi
15976                 ;;
15977         esac
15978         $rm_try
15979         ;;
15980 esac
15981 set d_safebcpy
15982 eval $setvar
15983
15984 : can memcpy handle overlapping blocks?
15985 echo " "
15986 val="$undef"
15987 case "$d_memmove" in
15988 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15989 *)      case "$d_memcpy" in
15990         "$define")
15991                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15992                 $cat >try.c <<EOCP
15993 #$i_memory I_MEMORY
15994 #$i_stdlib I_STDLIB
15995 #$i_string I_STRING
15996 #$i_unistd I_UNISTD
15997 EOCP
15998         $cat >>try.c <<'EOCP'
15999 #include <stdio.h>
16000 #ifdef I_MEMORY
16001 #  include <memory.h>
16002 #endif
16003 #ifdef I_STDLIB
16004 #  include <stdlib.h>
16005 #endif
16006 #ifdef I_STRING
16007 #  include <string.h>
16008 #else
16009 #  include <strings.h>
16010 #endif
16011 #ifdef I_UNISTD
16012 #  include <unistd.h>  /* Needed for NetBSD */
16013 #endif
16014 int main()
16015 {
16016 char buf[128], abc[128];
16017 char *b;
16018 int len;
16019 int off;
16020 int align;
16021
16022 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16023    try to store the string in read-only memory. */
16024 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16025
16026 for (align = 7; align >= 0; align--) {
16027         for (len = 36; len; len--) {
16028                 b = buf+align;
16029                 memcpy(b, abc, len);
16030                 for (off = 1; off <= len; off++) {
16031                         memcpy(b+off, b, len);
16032                         memcpy(b, b+off, len);
16033                         if (memcmp(b, abc, len))
16034                                 exit(1);
16035                 }
16036         }
16037 }
16038 exit(0);
16039 }
16040 EOCP
16041                 set try
16042                 if eval $compile_ok; then
16043                         if $run ./try 2>/dev/null; then
16044                                 echo "Yes, it can."
16045                                 val="$define"
16046                         else
16047                                 echo "It can't, sorry."
16048                         fi
16049                 else
16050                         echo "(I can't compile the test program, so we'll assume not...)"
16051                 fi
16052                 ;;
16053         esac
16054         $rm_try
16055         ;;
16056 esac
16057 set d_safemcpy
16058 eval $setvar
16059
16060 : can memcmp be trusted to compare relative magnitude?
16061 val="$undef"
16062 case "$d_memcmp" in
16063 "$define")
16064         echo " "
16065         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16066         $cat >try.c <<EOCP
16067 #$i_memory I_MEMORY
16068 #$i_stdlib I_STDLIB
16069 #$i_string I_STRING
16070 #$i_unistd I_UNISTD
16071 EOCP
16072         $cat >>try.c <<'EOCP'
16073 #include <stdio.h>
16074 #ifdef I_MEMORY
16075 #  include <memory.h>
16076 #endif
16077 #ifdef I_STDLIB
16078 #  include <stdlib.h>
16079 #endif
16080 #ifdef I_STRING
16081 #  include <string.h>
16082 #else
16083 #  include <strings.h>
16084 #endif
16085 #ifdef I_UNISTD
16086 #  include <unistd.h>  /* Needed for NetBSD */
16087 #endif
16088 int main()
16089 {
16090 char a = -1;
16091 char b = 0;
16092 if ((a < b) && memcmp(&a, &b, 1) < 0)
16093         exit(1);
16094 exit(0);
16095 }
16096 EOCP
16097         set try
16098         if eval $compile_ok; then
16099                 if $run ./try 2>/dev/null; then
16100                         echo "Yes, it can."
16101                         val="$define"
16102                 else
16103                         echo "No, it can't (it uses signed chars)."
16104                 fi
16105         else
16106                 echo "(I can't compile the test program, so we'll assume not...)"
16107         fi
16108         ;;
16109 esac
16110 $rm_try
16111 set d_sanemcmp
16112 eval $setvar
16113
16114 : see if prototype for sbrk is available
16115 echo " "
16116 set d_sbrkproto sbrk $i_unistd unistd.h
16117 eval $hasproto
16118
16119 : see if select exists
16120 set select d_select
16121 eval $inlibc
16122
16123 : see if semctl exists
16124 set semctl d_semctl
16125 eval $inlibc
16126
16127 : see if semget exists
16128 set semget d_semget
16129 eval $inlibc
16130
16131 : see if semop exists
16132 set semop d_semop
16133 eval $inlibc
16134
16135 : see how much of the 'sem*(2)' library is present.
16136 h_sem=true
16137 echo " "
16138 case "$d_semctl$d_semget$d_semop" in
16139 *"$undef"*) h_sem=false;;
16140 esac
16141 case "$osname" in
16142 freebsd)
16143     case "`ipcs 2>&1`" in
16144     "SVID messages"*"not configured"*)
16145         echo "Your $osname does not have the sem*(2) configured." >&4
16146         h_sem=false
16147         val="$undef"
16148         set semctl d_semctl
16149         eval $setvar
16150         set semget d_semget
16151         eval $setvar
16152         set semop d_semop
16153         eval $setvar
16154         ;;
16155     esac
16156     ;;
16157 esac
16158 : we could also check for sys/ipc.h ...
16159 if $h_sem && $test `./findhdr sys/sem.h`; then
16160         echo "You have the full sem*(2) library." >&4
16161         val="$define"
16162 else
16163         echo "You don't have the full sem*(2) library." >&4
16164         val="$undef"
16165 fi
16166 set d_sem
16167 eval $setvar
16168
16169 : see whether sys/sem.h defines union semun
16170 echo " "
16171 $cat > try.c <<'END'
16172 #include <sys/types.h>
16173 #include <sys/ipc.h>
16174 #include <sys/sem.h>
16175 int main () { union semun semun; semun.buf = 0; }
16176 END
16177 set try
16178 if eval $compile; then
16179     echo "You have union semun in <sys/sem.h>." >&4
16180     val="$define"
16181 else
16182     echo "You do not have union semun in <sys/sem.h>." >&4
16183     val="$undef"
16184 fi
16185 $rm_try
16186 set d_union_semun
16187 eval $setvar
16188
16189 : see how to do semctl IPC_STAT
16190 case "$d_sem" in
16191 $define)
16192     echo " "
16193     $cat > tryh.h <<END
16194 #ifndef S_IRUSR
16195 #   ifdef S_IREAD
16196 #       define S_IRUSR S_IREAD
16197 #       define S_IWUSR S_IWRITE
16198 #       define S_IXUSR S_IEXEC
16199 #   else
16200 #       define S_IRUSR 0400
16201 #       define S_IWUSR 0200
16202 #       define S_IXUSR 0100
16203 #   endif
16204 #   define S_IRGRP (S_IRUSR>>3)
16205 #   define S_IWGRP (S_IWUSR>>3)
16206 #   define S_IXGRP (S_IXUSR>>3)
16207 #   define S_IROTH (S_IRUSR>>6)
16208 #   define S_IWOTH (S_IWUSR>>6)
16209 #   define S_IXOTH (S_IXUSR>>6)
16210 #endif
16211 #ifndef S_IRWXU
16212 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16213 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16214 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16215 #endif
16216 END
16217     : see whether semctl IPC_STAT can use union semun
16218     case "$d_semctl_semun" in
16219     '')
16220       val="$undef"
16221       $cat > try.c <<END
16222 #include <sys/types.h>
16223 #include <sys/ipc.h>
16224 #include <sys/sem.h>
16225 #include <sys/stat.h>
16226 #include <stdio.h>
16227 #include <errno.h>
16228 #include "tryh.h"
16229 #ifndef errno
16230 extern int errno;
16231 #endif
16232 #$d_union_semun HAS_UNION_SEMUN
16233 int main() {
16234     union semun
16235 #ifndef HAS_UNION_SEMUN
16236     {
16237         int val;
16238         struct semid_ds *buf;
16239         unsigned short *array;
16240     }
16241 #endif
16242     arg;
16243     int sem, st;
16244
16245 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16246     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16247     if (sem > -1) {
16248         struct semid_ds argbuf;
16249         arg.buf = &argbuf;
16250 #       ifdef IPC_STAT
16251         st = semctl(sem, 0, IPC_STAT, arg);
16252         if (st == 0)
16253             printf("semun\n");
16254         else
16255 #       endif /* IPC_STAT */
16256             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16257 #       ifdef IPC_RMID
16258         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16259 #       endif /* IPC_RMID */
16260             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16261     } else
16262 #endif /* IPC_PRIVATE && ... */
16263         printf("semget failed: errno = %d\n", errno);
16264   return 0;
16265 }
16266 END
16267       set try
16268       if eval $compile; then
16269           xxx=`$run ./try`
16270           case "$xxx" in
16271           semun) val="$define" ;;
16272           esac
16273       fi
16274       $rm_try
16275       set d_semctl_semun
16276       eval $setvar
16277       ;;
16278     esac
16279     case "$d_semctl_semun" in
16280     $define)
16281         echo "You can use union semun for semctl IPC_STAT." >&4
16282         also='also'
16283         ;;
16284     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16285         also=''
16286         ;;
16287     esac
16288
16289     : see whether semctl IPC_STAT can use struct semid_ds pointer
16290     case "$d_semctl_semid_ds" in
16291     '')
16292       val="$undef"
16293       $cat > try.c <<'END'
16294 #include <sys/types.h>
16295 #include <sys/ipc.h>
16296 #include <sys/sem.h>
16297 #include <sys/stat.h>
16298 #include "tryh.h"
16299 #include <stdio.h>
16300 #include <errno.h>
16301 #ifndef errno
16302 extern int errno;
16303 #endif
16304 int main() {
16305     struct semid_ds arg;
16306     int sem, st;
16307
16308 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16309     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16310     if (sem > -1) {
16311 #       ifdef IPC_STAT
16312         st = semctl(sem, 0, IPC_STAT, &arg);
16313         if (st == 0)
16314             printf("semid_ds\n");
16315         else
16316 #       endif /* IPC_STAT */
16317             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16318 #       ifdef IPC_RMID
16319         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16320 #       endif /* IPC_RMID */
16321             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16322     } else
16323 #endif /* IPC_PRIVATE && ... */
16324         printf("semget failed: errno = %d\n", errno);
16325
16326     return 0;
16327 }
16328 END
16329       set try
16330       if eval $compile; then
16331           xxx=`$run ./try`
16332           case "$xxx" in
16333           semid_ds) val="$define" ;;
16334           esac
16335       fi
16336       $rm_try
16337       set d_semctl_semid_ds
16338       eval $setvar
16339       ;;
16340     esac
16341     case "$d_semctl_semid_ds" in
16342     $define)
16343         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16344         ;;
16345     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16346         ;;
16347     esac
16348     ;;
16349 *)  val="$undef"
16350
16351     # We do not have the full sem*(2) library, so assume we can not
16352     # use either.
16353
16354     set d_semctl_semun
16355     eval $setvar
16356
16357     set d_semctl_semid_ds
16358     eval $setvar
16359     ;;
16360 esac
16361 $rm_try tryh.h
16362
16363 : see if sendmsg exists
16364 set sendmsg d_sendmsg
16365 eval $inlibc
16366
16367 : see if setegid exists
16368 set setegid d_setegid
16369 eval $inlibc
16370
16371 : see if seteuid exists
16372 set seteuid d_seteuid
16373 eval $inlibc
16374
16375 : see if setgrent exists
16376 set setgrent d_setgrent
16377 eval $inlibc
16378
16379 : see if setgrent_r exists
16380 set setgrent_r d_setgrent_r
16381 eval $inlibc
16382 case "$d_setgrent_r" in
16383 "$define")
16384         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16385         case "$d_setgrent_r_proto:$usethreads" in
16386         ":define")      d_setgrent_r_proto=define
16387                 set d_setgrent_r_proto setgrent_r $hdrs
16388                 eval $hasproto ;;
16389         *)      ;;
16390         esac
16391         case "$d_setgrent_r_proto" in
16392         define)
16393         case "$setgrent_r_proto" in
16394         ''|0) try='int setgrent_r(FILE**);'
16395         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16396         esac
16397         case "$setgrent_r_proto" in
16398         ''|0) try='void setgrent_r(FILE**);'
16399         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16400         esac
16401         case "$setgrent_r_proto" in
16402         ''|0)   d_setgrent_r=undef
16403                 setgrent_r_proto=0
16404                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16405         * )     case "$setgrent_r_proto" in
16406                 REENTRANT_PROTO*) ;;
16407                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16408                 esac
16409                 echo "Prototype: $try" ;;
16410         esac
16411         ;;
16412         *)      case "$usethreads" in
16413                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16414                 esac
16415                 d_setgrent_r=undef
16416                 setgrent_r_proto=0
16417                 ;;
16418         esac
16419         ;;
16420 *)      setgrent_r_proto=0
16421         ;;
16422 esac
16423
16424 : see if sethostent exists
16425 set sethostent d_sethent
16426 eval $inlibc
16427
16428 : see if sethostent_r exists
16429 set sethostent_r d_sethostent_r
16430 eval $inlibc
16431 case "$d_sethostent_r" in
16432 "$define")
16433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16434         case "$d_sethostent_r_proto:$usethreads" in
16435         ":define")      d_sethostent_r_proto=define
16436                 set d_sethostent_r_proto sethostent_r $hdrs
16437                 eval $hasproto ;;
16438         *)      ;;
16439         esac
16440         case "$d_sethostent_r_proto" in
16441         define)
16442         case "$sethostent_r_proto" in
16443         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16444         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16445         esac
16446         case "$sethostent_r_proto" in
16447         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16448         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16449         esac
16450         case "$sethostent_r_proto" in
16451         ''|0)   d_sethostent_r=undef
16452                 sethostent_r_proto=0
16453                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16454         * )     case "$sethostent_r_proto" in
16455                 REENTRANT_PROTO*) ;;
16456                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16457                 esac
16458                 echo "Prototype: $try" ;;
16459         esac
16460         ;;
16461         *)      case "$usethreads" in
16462                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16463                 esac
16464                 d_sethostent_r=undef
16465                 sethostent_r_proto=0
16466                 ;;
16467         esac
16468         ;;
16469 *)      sethostent_r_proto=0
16470         ;;
16471 esac
16472
16473 : see if setitimer exists
16474 set setitimer d_setitimer
16475 eval $inlibc
16476
16477 : see if setlinebuf exists
16478 set setlinebuf d_setlinebuf
16479 eval $inlibc
16480
16481 : see if setlocale exists
16482 set setlocale d_setlocale
16483 eval $inlibc
16484
16485 : see if locale.h is available
16486 set locale.h i_locale
16487 eval $inhdr
16488
16489 : see if setlocale_r exists
16490 set setlocale_r d_setlocale_r
16491 eval $inlibc
16492 case "$d_setlocale_r" in
16493 "$define")
16494         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16495         case "$d_setlocale_r_proto:$usethreads" in
16496         ":define")      d_setlocale_r_proto=define
16497                 set d_setlocale_r_proto setlocale_r $hdrs
16498                 eval $hasproto ;;
16499         *)      ;;
16500         esac
16501         case "$d_setlocale_r_proto" in
16502         define)
16503         case "$setlocale_r_proto" in
16504         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16505         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16506         esac
16507         case "$setlocale_r_proto" in
16508         ''|0)   d_setlocale_r=undef
16509                 setlocale_r_proto=0
16510                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16511         * )     case "$setlocale_r_proto" in
16512                 REENTRANT_PROTO*) ;;
16513                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16514                 esac
16515                 echo "Prototype: $try" ;;
16516         esac
16517         ;;
16518         *)      case "$usethreads" in
16519                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16520                 esac
16521                 d_setlocale_r=undef
16522                 setlocale_r_proto=0
16523                 ;;
16524         esac
16525         ;;
16526 *)      setlocale_r_proto=0
16527         ;;
16528 esac
16529
16530 : see if setnetent exists
16531 set setnetent d_setnent
16532 eval $inlibc
16533
16534 : see if setnetent_r exists
16535 set setnetent_r d_setnetent_r
16536 eval $inlibc
16537 case "$d_setnetent_r" in
16538 "$define")
16539         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16540         case "$d_setnetent_r_proto:$usethreads" in
16541         ":define")      d_setnetent_r_proto=define
16542                 set d_setnetent_r_proto setnetent_r $hdrs
16543                 eval $hasproto ;;
16544         *)      ;;
16545         esac
16546         case "$d_setnetent_r_proto" in
16547         define)
16548         case "$setnetent_r_proto" in
16549         ''|0) try='int setnetent_r(int, struct netent_data*);'
16550         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16551         esac
16552         case "$setnetent_r_proto" in
16553         ''|0) try='void setnetent_r(int, struct netent_data*);'
16554         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16555         esac
16556         case "$setnetent_r_proto" in
16557         ''|0)   d_setnetent_r=undef
16558                 setnetent_r_proto=0
16559                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16560         * )     case "$setnetent_r_proto" in
16561                 REENTRANT_PROTO*) ;;
16562                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16563                 esac
16564                 echo "Prototype: $try" ;;
16565         esac
16566         ;;
16567         *)      case "$usethreads" in
16568                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16569                 esac
16570                 d_setnetent_r=undef
16571                 setnetent_r_proto=0
16572                 ;;
16573         esac
16574         ;;
16575 *)      setnetent_r_proto=0
16576         ;;
16577 esac
16578
16579 : see if setprotoent exists
16580 set setprotoent d_setpent
16581 eval $inlibc
16582
16583 : see if setpgid exists
16584 set setpgid d_setpgid
16585 eval $inlibc
16586
16587 : see if setpgrp2 exists
16588 set setpgrp2 d_setpgrp2
16589 eval $inlibc
16590
16591 : see if setpriority exists
16592 set setpriority d_setprior
16593 eval $inlibc
16594
16595 : see if setproctitle exists
16596 set setproctitle d_setproctitle
16597 eval $inlibc
16598
16599 : see if setprotoent_r exists
16600 set setprotoent_r d_setprotoent_r
16601 eval $inlibc
16602 case "$d_setprotoent_r" in
16603 "$define")
16604         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16605         case "$d_setprotoent_r_proto:$usethreads" in
16606         ":define")      d_setprotoent_r_proto=define
16607                 set d_setprotoent_r_proto setprotoent_r $hdrs
16608                 eval $hasproto ;;
16609         *)      ;;
16610         esac
16611         case "$d_setprotoent_r_proto" in
16612         define)
16613         case "$setprotoent_r_proto" in
16614         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16615         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16616         esac
16617         case "$setprotoent_r_proto" in
16618         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16619         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16620         esac
16621         case "$setprotoent_r_proto" in
16622         ''|0)   d_setprotoent_r=undef
16623                 setprotoent_r_proto=0
16624                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16625         * )     case "$setprotoent_r_proto" in
16626                 REENTRANT_PROTO*) ;;
16627                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16628                 esac
16629                 echo "Prototype: $try" ;;
16630         esac
16631         ;;
16632         *)      case "$usethreads" in
16633                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16634                 esac
16635                 d_setprotoent_r=undef
16636                 setprotoent_r_proto=0
16637                 ;;
16638         esac
16639         ;;
16640 *)      setprotoent_r_proto=0
16641         ;;
16642 esac
16643
16644 : see if setpwent exists
16645 set setpwent d_setpwent
16646 eval $inlibc
16647
16648 : see if setpwent_r exists
16649 set setpwent_r d_setpwent_r
16650 eval $inlibc
16651 case "$d_setpwent_r" in
16652 "$define")
16653         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16654         case "$d_setpwent_r_proto:$usethreads" in
16655         ":define")      d_setpwent_r_proto=define
16656                 set d_setpwent_r_proto setpwent_r $hdrs
16657                 eval $hasproto ;;
16658         *)      ;;
16659         esac
16660         case "$d_setpwent_r_proto" in
16661         define)
16662         case "$setpwent_r_proto" in
16663         ''|0) try='int setpwent_r(FILE**);'
16664         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16665         esac
16666         case "$setpwent_r_proto" in
16667         ''|0) try='void setpwent_r(FILE**);'
16668         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16669         esac
16670         case "$setpwent_r_proto" in
16671         ''|0)   d_setpwent_r=undef
16672                 setpwent_r_proto=0
16673                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16674         * )     case "$setpwent_r_proto" in
16675                 REENTRANT_PROTO*) ;;
16676                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16677                 esac
16678                 echo "Prototype: $try" ;;
16679         esac
16680         ;;
16681         *)      case "$usethreads" in
16682                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16683                 esac
16684                 d_setpwent_r=undef
16685                 setpwent_r_proto=0
16686                 ;;
16687         esac
16688         ;;
16689 *)      setpwent_r_proto=0
16690         ;;
16691 esac
16692
16693 : see if setregid exists
16694 set setregid d_setregid
16695 eval $inlibc
16696 set setresgid d_setresgid
16697 eval $inlibc
16698
16699 : see if setreuid exists
16700 set setreuid d_setreuid
16701 eval $inlibc
16702 set setresuid d_setresuid
16703 eval $inlibc
16704
16705 : see if setrgid exists
16706 set setrgid d_setrgid
16707 eval $inlibc
16708
16709 : see if setruid exists
16710 set setruid d_setruid
16711 eval $inlibc
16712
16713 : see if setservent exists
16714 set setservent d_setsent
16715 eval $inlibc
16716
16717 : see if setservent_r exists
16718 set setservent_r d_setservent_r
16719 eval $inlibc
16720 case "$d_setservent_r" in
16721 "$define")
16722         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16723         case "$d_setservent_r_proto:$usethreads" in
16724         ":define")      d_setservent_r_proto=define
16725                 set d_setservent_r_proto setservent_r $hdrs
16726                 eval $hasproto ;;
16727         *)      ;;
16728         esac
16729         case "$d_setservent_r_proto" in
16730         define)
16731         case "$setservent_r_proto" in
16732         ''|0) try='int setservent_r(int, struct servent_data*);'
16733         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16734         esac
16735         case "$setservent_r_proto" in
16736         ''|0) try='void setservent_r(int, struct servent_data*);'
16737         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16738         esac
16739         case "$setservent_r_proto" in
16740         ''|0)   d_setservent_r=undef
16741                 setservent_r_proto=0
16742                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16743         * )     case "$setservent_r_proto" in
16744                 REENTRANT_PROTO*) ;;
16745                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16746                 esac
16747                 echo "Prototype: $try" ;;
16748         esac
16749         ;;
16750         *)      case "$usethreads" in
16751                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16752                 esac
16753                 d_setservent_r=undef
16754                 setservent_r_proto=0
16755                 ;;
16756         esac
16757         ;;
16758 *)      setservent_r_proto=0
16759         ;;
16760 esac
16761
16762 : see if setsid exists
16763 set setsid d_setsid
16764 eval $inlibc
16765
16766 : see if setvbuf exists
16767 set setvbuf d_setvbuf
16768 eval $inlibc
16769
16770 : see if sfio.h is available
16771 set sfio.h i_sfio
16772 eval $inhdr
16773
16774
16775 : see if sfio library is available
16776 case "$i_sfio" in
16777 $define)
16778         val=''
16779         set sfreserve val
16780         eval $inlibc
16781         ;;
16782 *)
16783         val="$undef"
16784         ;;
16785 esac
16786 : Ok, but do we want to use it.
16787 case "$val" in
16788 $define)
16789         case "$usesfio" in
16790         true|$define|[yY]*) dflt='y';;
16791         *) dflt='n';;
16792         esac
16793         echo "$package can use the sfio library, but it is experimental."
16794         case "$useperlio" in
16795         "$undef")
16796             echo "For sfio also the PerlIO abstraction layer is needed."
16797             echo "Earlier you said you wouldn't want that."
16798             ;;
16799         esac
16800         rp="You seem to have sfio available, do you want to try using it?"
16801         . ./myread
16802         case "$ans" in
16803         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16804                 useperlio="$define"
16805                 val="$define"
16806                 ;;
16807         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16808                 val="$undef"
16809                 ;;
16810         esac
16811         ;;
16812 *)      case "$usesfio" in
16813         true|$define|[yY]*)
16814                 echo "Sorry, cannot find sfio on this machine." >&4
16815                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16816                 val="$undef"
16817                 ;;
16818         esac
16819         ;;
16820 esac
16821 set d_sfio
16822 eval $setvar
16823 case "$d_sfio" in
16824 $define) usesfio='true';;
16825 *) usesfio='false';;
16826 esac
16827 case "$d_sfio" in
16828 $define) ;;
16829 *)      : Remove sfio from list of libraries to use
16830         case "$libs" in
16831         *-lsfio*)
16832                 echo "Removing unneeded -lsfio from library list" >&4
16833                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16834                 shift
16835                 libs="$*"
16836                 echo "libs = $libs" >&4
16837                 ;;
16838         esac
16839 ;;
16840 esac
16841
16842
16843 : see if shmctl exists
16844 set shmctl d_shmctl
16845 eval $inlibc
16846
16847 : see if shmget exists
16848 set shmget d_shmget
16849 eval $inlibc
16850
16851 : see if shmat exists
16852 set shmat d_shmat
16853 eval $inlibc
16854 : see what shmat returns
16855 case "$d_shmat" in
16856 "$define")
16857         $cat >shmat.c <<'END'
16858 #include <sys/shm.h>
16859 void *shmat();
16860 END
16861         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16862                 shmattype='void *'
16863         else
16864                 shmattype='char *'
16865         fi
16866         echo "and it returns ($shmattype)." >&4
16867         : see if a prototype for shmat is available
16868         xxx=`./findhdr sys/shm.h`
16869         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16870         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16871                 val="$define"
16872         else
16873                 val="$undef"
16874         fi
16875         $rm -f shmat.[co]
16876         ;;
16877 *)
16878         val="$undef"
16879         ;;
16880 esac
16881 set d_shmatprototype
16882 eval $setvar
16883
16884 : see if shmdt exists
16885 set shmdt d_shmdt
16886 eval $inlibc
16887
16888 : see how much of the 'shm*(2)' library is present.
16889 h_shm=true
16890 echo " "
16891 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16892 *"$undef"*) h_shm=false;;
16893 esac
16894 case "$osname" in
16895 freebsd)
16896     case "`ipcs 2>&1`" in
16897     "SVID shared memory"*"not configured"*)
16898         echo "Your $osname does not have the shm*(2) configured." >&4
16899         h_shm=false
16900         val="$undef"
16901         set shmctl d_shmctl
16902         evat $setvar
16903         set shmget d_shmget
16904         evat $setvar
16905         set shmat d_shmat
16906         evat $setvar
16907         set shmdt d_shmdt
16908         evat $setvar
16909         ;;
16910     esac
16911     ;;
16912 esac
16913 : we could also check for sys/ipc.h ...
16914 if $h_shm && $test `./findhdr sys/shm.h`; then
16915         echo "You have the full shm*(2) library." >&4
16916         val="$define"
16917 else
16918         echo "You don't have the full shm*(2) library." >&4
16919         val="$undef"
16920 fi
16921 set d_shm
16922 eval $setvar
16923
16924 echo " "
16925 : see if we have sigaction
16926 if set sigaction val -f d_sigaction; eval $csym; $val; then
16927         echo 'sigaction() found.' >&4
16928         $cat > try.c <<EOP
16929 #include <stdio.h>
16930 #include <sys/types.h>
16931 #include <signal.h>
16932 #$i_stdlib I_STDLIB
16933 #ifdef I_STDLIB
16934 #include <stdlib.h>
16935 #endif
16936 int main()
16937 {
16938     struct sigaction act, oact;
16939     act.sa_flags = 0;
16940     oact.sa_handler = 0;
16941     /* so that act and oact are used */
16942     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16943 }
16944 EOP
16945         set try
16946         if eval $compile_ok; then
16947                 val="$define"
16948         else
16949                 echo "But you don't seem to have a useable struct sigaction." >&4
16950                 val="$undef"
16951         fi
16952 else
16953         echo 'sigaction NOT found.' >&4
16954         val="$undef"
16955 fi
16956 set d_sigaction; eval $setvar
16957 $rm_try
16958
16959 : see if this is a sunmath.h system
16960 set sunmath.h i_sunmath
16961 eval $inhdr
16962
16963 : see if signbit exists
16964 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16965 $cat >try.c <<EOCP
16966 #$i_math I_MATH
16967 #$i_sunmath I_SUNMATH
16968 #ifdef I_MATH
16969 #  include <math.h>
16970 #endif
16971 #ifdef I_SUNMATH  /* Solaris special math library */
16972 #  include <sunmath.h>
16973 #endif
16974 #define NV $nvtype
16975 int main(int argc, char **argv)
16976 {
16977     NV x = 0.0;
16978     NV y = -0.0;
16979     if ((signbit(x) == 0) && (signbit(y) != 0))
16980         return 0;
16981     else
16982         return 1;
16983 }
16984 EOCP
16985 val="$undef"
16986 set try
16987 if eval $compile; then
16988     if $run ./try; then
16989         $echo "Yes." >&4
16990         val="$define"
16991     else
16992         $echo "Signbit seems to be available, but doesn't work as I expected."
16993         $echo "I won't use it." >&4
16994         val="$undef"
16995     fi
16996 else
16997     $echo "Nope." >&4
16998     dflt="$undef"
16999 fi
17000 set d_signbit
17001 eval $setvar
17002 $rm_try
17003
17004 : see if sigprocmask exists
17005 set sigprocmask d_sigprocmask
17006 eval $inlibc
17007
17008 : see if sigsetjmp exists
17009 echo " "
17010 case "$d_sigsetjmp" in
17011 '')
17012         $cat >try.c <<EOP
17013 #include <setjmp.h>
17014 #$i_stdlib I_STDLIB
17015 #ifdef I_STDLIB
17016 #include <stdlib.h>
17017 #endif
17018 sigjmp_buf env;
17019 int set = 1;
17020 int main()
17021 {
17022         if (sigsetjmp(env,1))
17023                 exit(set);
17024         set = 0;
17025         siglongjmp(env, 1);
17026         exit(1);
17027 }
17028 EOP
17029         set try
17030         if eval $compile; then
17031                 if $run ./try >/dev/null 2>&1; then
17032                         echo "POSIX sigsetjmp found." >&4
17033                         val="$define"
17034                 else
17035                         $cat >&4 <<EOM
17036 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17037 I'll ignore them.
17038 EOM
17039                         val="$undef"
17040                 fi
17041         else
17042                 echo "sigsetjmp not found." >&4
17043                 val="$undef"
17044         fi
17045         ;;
17046 *) val="$d_sigsetjmp"
17047         case "$d_sigsetjmp" in
17048         $define) echo "POSIX sigsetjmp found." >&4;;
17049         $undef) echo "sigsetjmp not found." >&4;;
17050         esac
17051         ;;
17052 esac
17053 set d_sigsetjmp
17054 eval $setvar
17055 $rm_try
17056
17057 : see if snprintf exists
17058 set snprintf d_snprintf
17059 eval $inlibc
17060
17061 : see if vsnprintf exists
17062 set vsnprintf d_vsnprintf
17063 eval $inlibc
17064
17065 case "$d_snprintf-$d_vsnprintf" in
17066 "$define-$define")
17067     $cat <<EOM
17068 Checking whether your snprintf() and vsnprintf() work okay...
17069 EOM
17070     $cat >try.c <<'EOCP'
17071 /* v?snprintf testing logic courtesy of Russ Allbery.
17072  * According to C99:
17073  * - if the buffer is too short it still must be \0-terminated
17074  * - if the buffer is too short the potentially required length
17075  *   must be returned and not -1
17076  * - if the buffer is NULL the potentially required length
17077  *   must be returned and not -1 or core dump
17078  */
17079 #include <stdio.h>
17080 #include <stdarg.h>
17081
17082 char buf[2];
17083
17084 int test (char *format, ...)
17085 {
17086     va_list args;
17087     int count;
17088
17089     va_start (args, format);
17090     count = vsnprintf (buf, sizeof buf, format, args);
17091     va_end (args);
17092     return count;
17093 }
17094
17095 int main ()
17096 {
17097     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17098              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17099 }
17100 EOCP
17101     set try
17102     if eval $compile; then
17103         `$run ./try`
17104         case "$?" in
17105         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17106         *) cat <<EOM >&4
17107 Your snprintf() and snprintf() don't seem to be working okay.
17108 EOM
17109            d_snprintf="$undef"
17110            d_vsnprintf="$undef"
17111            ;;
17112         esac
17113     else
17114         echo "(I can't seem to compile the test program--assuming they don't)"
17115         d_snprintf="$undef"
17116         d_vsnprintf="$undef"
17117     fi
17118     $rm_try
17119     ;;
17120 esac
17121
17122 : see if sockatmark exists
17123 set sockatmark d_sockatmark
17124 eval $inlibc
17125
17126 : see if prototype for sockatmark is available
17127 echo " "
17128 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17129 eval $hasproto
17130
17131 : see if socks5_init exists
17132 set socks5_init d_socks5_init
17133 eval $inlibc
17134
17135 : see if sprintf returns the length of the string in the buffer as per ANSI
17136 $echo "Checking whether sprintf returns the length of the string..." >&4
17137 $cat <<EOP >try.c
17138 #include <stdio.h>
17139 #$i_stdlib I_STDLIB
17140 #ifdef I_STDLIB
17141 #include <stdlib.h>
17142 #endif
17143 #$i_string I_STRING
17144 #ifdef I_STRING
17145 #  include <string.h>
17146 #else
17147 #  include <strings.h>
17148 #endif
17149 #$i_math I_MATH
17150 #ifdef I_MATH
17151 #include <math.h>
17152 #endif
17153
17154 char buffer[256];
17155
17156 int check (size_t expect, int test) {
17157   size_t got = strlen(buffer);
17158   if (expect == got)
17159     return 0;
17160
17161   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17162        test, buffer);
17163   exit (test);
17164 }
17165
17166 int main(int argc, char **argv) {
17167   int test = 0;
17168
17169   check(sprintf(buffer, ""), ++test);
17170   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17171   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17172
17173   return 0;
17174 }
17175 EOP
17176 set try
17177
17178 d_sprintf_returns_strlen="$undef"
17179 if eval $compile; then
17180     xxx="`$run ./try`"
17181     case "$?" in
17182         0) cat >&4 <<EOM
17183 sprintf returns the length of the string (as ANSI says it should)
17184 EOM
17185         d_sprintf_returns_strlen="$define"
17186         ;;
17187         *) cat >&4 <<EOM
17188 sprintf does not return the length of the string (how old is this system?)
17189 EOM
17190         d_sprintf_returns_strlen="$undef"
17191         ;;
17192     esac
17193 fi
17194 $rm_try
17195
17196 : see if srand48_r exists
17197 set srand48_r d_srand48_r
17198 eval $inlibc
17199 case "$d_srand48_r" in
17200 "$define")
17201         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17202         case "$d_srand48_r_proto:$usethreads" in
17203         ":define")      d_srand48_r_proto=define
17204                 set d_srand48_r_proto srand48_r $hdrs
17205                 eval $hasproto ;;
17206         *)      ;;
17207         esac
17208         case "$d_srand48_r_proto" in
17209         define)
17210         case "$srand48_r_proto" in
17211         ''|0) try='int srand48_r(long, struct drand48_data*);'
17212         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17213         esac
17214         case "$srand48_r_proto" in
17215         ''|0)   d_srand48_r=undef
17216                 srand48_r_proto=0
17217                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17218         * )     case "$srand48_r_proto" in
17219                 REENTRANT_PROTO*) ;;
17220                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17221                 esac
17222                 echo "Prototype: $try" ;;
17223         esac
17224         ;;
17225         *)      case "$usethreads" in
17226                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17227                 esac
17228                 d_srand48_r=undef
17229                 srand48_r_proto=0
17230                 ;;
17231         esac
17232         ;;
17233 *)      srand48_r_proto=0
17234         ;;
17235 esac
17236
17237 : see if srandom_r exists
17238 set srandom_r d_srandom_r
17239 eval $inlibc
17240 case "$d_srandom_r" in
17241 "$define")
17242         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17243         case "$d_srandom_r_proto:$usethreads" in
17244         ":define")      d_srandom_r_proto=define
17245                 set d_srandom_r_proto srandom_r $hdrs
17246                 eval $hasproto ;;
17247         *)      ;;
17248         esac
17249         case "$d_srandom_r_proto" in
17250         define)
17251         case "$srandom_r_proto" in
17252         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17253         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17254         esac
17255         case "$srandom_r_proto" in
17256         ''|0)   d_srandom_r=undef
17257                 srandom_r_proto=0
17258                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17259         * )     case "$srandom_r_proto" in
17260                 REENTRANT_PROTO*) ;;
17261                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17262                 esac
17263                 echo "Prototype: $try" ;;
17264         esac
17265         ;;
17266         *)      case "$usethreads" in
17267                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17268                 esac
17269                 d_srandom_r=undef
17270                 srandom_r_proto=0
17271                 ;;
17272         esac
17273         ;;
17274 *)      srandom_r_proto=0
17275         ;;
17276 esac
17277
17278 : see if prototype for setresgid is available
17279 echo " "
17280 set d_sresgproto setresgid $i_unistd unistd.h
17281 eval $hasproto
17282
17283 : see if prototype for setresuid is available
17284 echo " "
17285 set d_sresuproto setresuid $i_unistd unistd.h
17286 eval $hasproto
17287
17288 : see if sys/stat.h is available
17289 set sys/stat.h i_sysstat
17290 eval $inhdr
17291
17292
17293 : see if stat knows about block sizes
17294 echo " "
17295 echo "Checking to see if your struct stat has st_blocks field..." >&4
17296 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17297 eval $hasfield
17298
17299
17300 : see if this is a sys/vfs.h system
17301 set sys/vfs.h i_sysvfs
17302 eval $inhdr
17303
17304
17305 : see if this is a sys/statfs.h system
17306 set sys/statfs.h i_sysstatfs
17307 eval $inhdr
17308
17309
17310 echo " "
17311 echo "Checking to see if your system supports struct statfs..." >&4
17312 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
17313 eval $hasstruct
17314 case "$d_statfs_s" in
17315 "$define")      echo "Yes, it does."   ;;
17316 *)              echo "No, it doesn't." ;;
17317 esac
17318
17319
17320
17321 : see if struct statfs knows about f_flags
17322 case "$d_statfs_s" in
17323 define) 
17324         echo " "
17325         echo "Checking to see if your struct statfs has f_flags field..." >&4
17326         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
17327         eval $hasfield
17328         ;;
17329 *)      val="$undef"
17330         set d_statfs_f_flags
17331         eval $setvar
17332         ;;
17333 esac
17334 case "$d_statfs_f_flags" in
17335 "$define")      echo "Yes, it does."   ;;
17336 *)              echo "No, it doesn't." ;;
17337 esac
17338
17339 $cat >&4 <<EOM
17340 Checking how to access stdio streams by file descriptor number...
17341 EOM
17342 case "$stdio_stream_array" in
17343 '')     $cat >try.c <<EOCP
17344 #include <stdio.h>
17345 int main() {
17346   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17347     printf("yes\n");
17348 }
17349 EOCP
17350         for s in _iob __iob __sF
17351         do
17352                 set try -DSTDIO_STREAM_ARRAY=$s
17353                 if eval $compile; then
17354                         case "`$run ./try`" in
17355                         yes)    stdio_stream_array=$s; break ;;
17356                         esac
17357                 fi
17358         done
17359         $rm_try
17360 esac
17361 case "$stdio_stream_array" in
17362 '')     $cat >&4 <<EOM
17363 I can't figure out how to access stdio streams by file descriptor number.
17364 EOM
17365         d_stdio_stream_array="$undef"
17366         ;;
17367 *)      $cat >&4 <<EOM
17368 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17369 EOM
17370         d_stdio_stream_array="$define"
17371         ;;
17372 esac
17373
17374 : see if strcoll exists
17375 set strcoll d_strcoll
17376 eval $inlibc
17377
17378 : check for structure copying
17379 echo " "
17380 echo "Checking to see if your C compiler can copy structs..." >&4
17381 $cat >try.c <<'EOCP'
17382 int main()
17383 {
17384         struct blurfl {
17385                 int dyick;
17386         } foo, bar;
17387
17388         foo = bar;
17389 }
17390 EOCP
17391 if $cc -c try.c >/dev/null 2>&1 ; then
17392         val="$define"
17393         echo "Yup, it can."
17394 else
17395         val="$undef"
17396         echo "Nope, it can't."
17397 fi
17398 set d_strctcpy
17399 eval $setvar
17400 $rm_try
17401
17402 : see if strerror and/or sys_errlist[] exist
17403 echo " "
17404 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17405     if set strerror val -f d_strerror; eval $csym; $val; then
17406                 echo 'strerror() found.' >&4
17407                 d_strerror="$define"
17408                 d_strerrm='strerror(e)'
17409                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17410                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17411                         d_syserrlst="$define"
17412                 else
17413                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17414                         d_syserrlst="$undef"
17415                 fi
17416     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17417                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17418                 echo 'strerror() found in string header.' >&4
17419                 d_strerror="$define"
17420                 d_strerrm='strerror(e)'
17421                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17422                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17423                                 d_syserrlst="$define"
17424                 else
17425                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17426                         d_syserrlst="$undef"
17427                 fi
17428     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17429                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17430                 d_strerror="$undef"
17431                 d_syserrlst="$define"
17432                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17433     else
17434                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17435                 d_strerror="$undef"
17436                 d_syserrlst="$undef"
17437                 d_strerrm='"unknown"'
17438     fi
17439 fi
17440
17441 : see if strerror_r exists
17442 set strerror_r d_strerror_r
17443 eval $inlibc
17444 case "$d_strerror_r" in
17445 "$define")
17446         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17447         case "$d_strerror_r_proto:$usethreads" in
17448         ":define")      d_strerror_r_proto=define
17449                 set d_strerror_r_proto strerror_r $hdrs
17450                 eval $hasproto ;;
17451         *)      ;;
17452         esac
17453         case "$d_strerror_r_proto" in
17454         define)
17455         case "$strerror_r_proto" in
17456         ''|0) try='int strerror_r(int, char*, size_t);'
17457         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17458         esac
17459         case "$strerror_r_proto" in
17460         ''|0) try='int strerror_r(int, char*, int);'
17461         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17462         esac
17463         case "$strerror_r_proto" in
17464         ''|0) try='char* strerror_r(int, char*, size_t);'
17465         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17466         esac
17467         case "$strerror_r_proto" in
17468         ''|0)   d_strerror_r=undef
17469                 strerror_r_proto=0
17470                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17471         * )     case "$strerror_r_proto" in
17472                 REENTRANT_PROTO*) ;;
17473                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17474                 esac
17475                 echo "Prototype: $try" ;;
17476         esac
17477         ;;
17478         *)      case "$usethreads" in
17479                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17480                 esac
17481                 d_strerror_r=undef
17482                 strerror_r_proto=0
17483                 ;;
17484         esac
17485         ;;
17486 *)      strerror_r_proto=0
17487         ;;
17488 esac
17489
17490 : see if strftime exists
17491 set strftime d_strftime
17492 eval $inlibc
17493
17494 : see if strlcat exists
17495 set strlcat d_strlcat
17496 eval $inlibc
17497
17498 : see if strlcpy exists
17499 set strlcpy d_strlcpy
17500 eval $inlibc
17501
17502 : see if strtod exists
17503 set strtod d_strtod
17504 eval $inlibc
17505
17506 : see if strtol exists
17507 set strtol d_strtol
17508 eval $inlibc
17509
17510 : see if strtold exists
17511 set strtold d_strtold
17512 eval $inlibc
17513
17514 : see if strtoll exists
17515 set strtoll d_strtoll
17516 eval $inlibc
17517
17518 case "$d_longlong-$d_strtoll" in
17519 "$define-$define")
17520         $cat <<EOM
17521 Checking whether your strtoll() works okay...
17522 EOM
17523         $cat >try.c <<'EOCP'
17524 #include <errno.h>
17525 #ifdef __hpux
17526 #define strtoll __strtoll
17527 #endif
17528 #ifdef __EMX__
17529 #define strtoll _strtoll
17530 #endif
17531 #include <stdio.h>
17532 extern long long int strtoll(char *s, char **, int); 
17533 static int bad = 0;
17534 int check(char *s, long long ell, int een) {
17535         long long gll;
17536         errno = 0;
17537         gll = strtoll(s, 0, 10);
17538         if (!((gll == ell) && (errno == een)))
17539                 bad++;
17540 }
17541 int main() {
17542         check(" 1",                                      1LL, 0);
17543         check(" 0",                                      0LL, 0);
17544         check("-1",                                     -1LL, 0);
17545         check("-9223372036854775808", -9223372036854775808LL, 0);
17546         check("-9223372036854775808", -9223372036854775808LL, 0);
17547         check(" 9223372036854775807",  9223372036854775807LL, 0);
17548         check("-9223372036854775808", -9223372036854775808LL, 0);
17549         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17550         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17551         if (!bad)
17552                 printf("ok\n");
17553 }
17554 EOCP
17555         set try
17556         if eval $compile; then
17557                 yyy=`$run ./try`
17558                 case "$yyy" in
17559                 ok) echo "Your strtoll() seems to be working okay." ;;
17560                 *) cat <<EOM >&4
17561 Your strtoll() doesn't seem to be working okay.
17562 EOM
17563                    d_strtoll="$undef"
17564                    ;;
17565                 esac
17566         else
17567                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17568                 d_strtoll="$undef"
17569         fi
17570         ;;
17571 esac
17572
17573 : see if strtoq exists
17574 set strtoq d_strtoq
17575 eval $inlibc
17576
17577 : see if strtoul exists
17578 set strtoul d_strtoul
17579 eval $inlibc
17580
17581 case "$d_strtoul" in
17582 "$define")
17583         $cat <<EOM
17584 Checking whether your strtoul() works okay...
17585 EOM
17586         $cat >try.c <<'EOCP'
17587 #include <errno.h>
17588 #include <stdio.h>
17589 extern unsigned long int strtoul(char *s, char **, int); 
17590 static int bad = 0;
17591 void check(char *s, unsigned long eul, int een) {
17592         unsigned long gul;
17593         errno = 0;
17594         gul = strtoul(s, 0, 10);
17595         if (!((gul == eul) && (errno == een)))
17596                 bad++;
17597 }
17598 int main() {
17599         check(" 1", 1L, 0);
17600         check(" 0", 0L, 0);
17601 EOCP
17602         case "$longsize" in
17603         8)
17604             $cat >>try.c <<'EOCP'
17605         check("18446744073709551615", 18446744073709551615UL, 0);
17606         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17607 #if 0 /* strtoul() for /^-/ strings is undefined. */
17608         check("-1", 18446744073709551615UL, 0);
17609         check("-18446744073709551614", 2, 0);
17610         check("-18446744073709551615", 1, 0);
17611         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17612         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17613 #endif
17614 EOCP
17615                 ;;
17616         4)
17617                     $cat >>try.c <<'EOCP'
17618         check("4294967295", 4294967295UL, 0);
17619         check("4294967296", 4294967295UL, ERANGE);
17620 #if 0 /* strtoul() for /^-/ strings is undefined. */
17621         check("-1", 4294967295UL, 0);
17622         check("-4294967294", 2, 0);
17623         check("-4294967295", 1, 0);
17624         check("-4294967296", 4294967295UL, ERANGE);
17625         check("-4294967297", 4294967295UL, ERANGE);
17626 #endif
17627 EOCP
17628                 ;;
17629         *)
17630 : Should we write these tests to be more portable by sprintf-ing
17631 : ~0 and then manipulating that char string as input for strtol?
17632                 ;;
17633         esac
17634         $cat >>try.c <<'EOCP'
17635         if (!bad)
17636                 printf("ok\n");
17637         return 0;
17638 }
17639 EOCP
17640         set try
17641         if eval $compile; then
17642                 case "`$run ./try`" in
17643                 ok) echo "Your strtoul() seems to be working okay." ;;
17644                 *) cat <<EOM >&4
17645 Your strtoul() doesn't seem to be working okay.
17646 EOM
17647                    d_strtoul="$undef"
17648                    ;;
17649                 esac
17650         else
17651                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17652                 d_strtoul="$undef"
17653         fi
17654         ;;
17655 esac
17656
17657 : see if strtoull exists
17658 set strtoull d_strtoull
17659 eval $inlibc
17660
17661 case "$d_longlong-$d_strtoull" in
17662 "$define-$define")
17663         $cat <<EOM
17664 Checking whether your strtoull() works okay...
17665 EOM
17666         $cat >try.c <<'EOCP'
17667 #include <errno.h>
17668 #ifdef __hpux
17669 #define strtoull __strtoull
17670 #endif
17671 #include <stdio.h>
17672 extern unsigned long long int strtoull(char *s, char **, int); 
17673 static int bad = 0;
17674 int check(char *s, long long eull, int een) {
17675         long long gull;
17676         errno = 0;
17677         gull = strtoull(s, 0, 10);
17678         if (!((gull == eull) && (errno == een)))
17679                 bad++;
17680 }
17681 int main() {
17682         check(" 1",                                        1LL, 0);
17683         check(" 0",                                        0LL, 0);
17684         check("18446744073709551615",  18446744073709551615ULL, 0);
17685         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17686 #if 0 /* strtoull() for /^-/ strings is undefined. */
17687         check("-1",                    18446744073709551615ULL, 0);
17688         check("-18446744073709551614",                     2LL, 0);
17689         check("-18446744073709551615",                     1LL, 0);
17690         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17691         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17692 #endif
17693         if (!bad)
17694                 printf("ok\n");
17695 }
17696 EOCP
17697         set try
17698         if eval $compile; then
17699                 case "`$run ./try`" in
17700                 ok) echo "Your strtoull() seems to be working okay." ;;
17701                 *) cat <<EOM >&4
17702 Your strtoull() doesn't seem to be working okay.
17703 EOM
17704                    d_strtoull="$undef"
17705                    ;;
17706                 esac
17707         else
17708                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17709                 d_strtoull="$undef"
17710         fi
17711         ;;
17712 esac
17713
17714 : see if strtouq exists
17715 set strtouq d_strtouq
17716 eval $inlibc
17717
17718 case "$d_strtouq" in
17719 "$define")
17720         $cat <<EOM
17721 Checking whether your strtouq() works okay...
17722 EOM
17723         $cat >try.c <<'EOCP'
17724 #include <errno.h>
17725 #include <stdio.h>
17726 extern unsigned long long int strtouq(char *s, char **, int); 
17727 static int bad = 0;
17728 void check(char *s, unsigned long long eull, int een) {
17729         unsigned long long gull;
17730         errno = 0;
17731         gull = strtouq(s, 0, 10);
17732         if (!((gull == eull) && (errno == een)))
17733                 bad++;
17734 }
17735 int main() {
17736         check(" 1",                                        1LL, 0);
17737         check(" 0",                                        0LL, 0);
17738         check("18446744073709551615",  18446744073709551615ULL, 0);
17739         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17740 #if 0 /* strtouq() for /^-/ strings is undefined. */
17741         check("-1",                    18446744073709551615ULL, 0);
17742         check("-18446744073709551614",                     2LL, 0);
17743         check("-18446744073709551615",                     1LL, 0);
17744         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17745         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17746 #endif
17747         if (!bad)
17748                 printf("ok\n");
17749         return 0;
17750 }
17751 EOCP
17752         set try
17753         if eval $compile; then
17754                 case "`$run ./try`" in
17755                 ok) echo "Your strtouq() seems to be working okay." ;;
17756                 *) cat <<EOM >&4
17757 Your strtouq() doesn't seem to be working okay.
17758 EOM
17759                    d_strtouq="$undef"
17760                    ;;
17761                 esac
17762         else
17763                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17764                 d_strtouq="$undef"
17765         fi
17766         ;;
17767 esac
17768
17769 : see if strxfrm exists
17770 set strxfrm d_strxfrm
17771 eval $inlibc
17772
17773 : see if symlink exists
17774 set symlink d_symlink
17775 eval $inlibc
17776
17777 : see if syscall exists
17778 set syscall d_syscall
17779 eval $inlibc
17780
17781 : see if prototype for syscall is available
17782 echo " "
17783 set d_syscallproto syscall $i_unistd unistd.h
17784 eval $hasproto
17785
17786 : see if sysconf exists
17787 set sysconf d_sysconf
17788 eval $inlibc
17789
17790 : see if system exists
17791 set system d_system
17792 eval $inlibc
17793
17794 : see if tcgetpgrp exists
17795 set tcgetpgrp d_tcgetpgrp
17796 eval $inlibc
17797
17798 : see if tcsetpgrp exists
17799 set tcsetpgrp d_tcsetpgrp
17800 eval $inlibc
17801
17802 : see if prototype for telldir is available
17803 echo " "
17804 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17805 eval $hasproto
17806
17807 : see if time exists
17808 echo " "
17809 if test "X$d_time" = X -o X"$timetype" = X; then
17810     if set time val -f d_time; eval $csym; $val; then
17811                 echo 'time() found.' >&4
17812                 val="$define"
17813                 rp="What is the type returned by time() on this system?"
17814                 set time_t timetype long stdio.h sys/types.h
17815                 eval $typedef_ask
17816     else
17817                 echo 'time() not found, hope that will do.' >&4
17818                 val="$undef"
17819                 timetype='int';
17820     fi
17821     set d_time
17822     eval $setvar
17823 fi
17824
17825 : see if this is a sys/times.h system
17826 set sys/times.h i_systimes
17827 eval $inhdr
17828
17829 : see if times exists
17830 echo " "
17831 if set times val -f d_times; eval $csym; $val; then
17832         echo 'times() found.' >&4
17833         d_times="$define"
17834         inc=''
17835         case "$i_systimes" in
17836         "$define") inc='sys/times.h';;
17837         esac
17838         rp="What is the type returned by times() on this system?"
17839         set clock_t clocktype long stdio.h sys/types.h $inc
17840         eval $typedef_ask
17841 else
17842         echo 'times() NOT found, hope that will do.' >&4
17843         d_times="$undef"
17844         clocktype='int'
17845 fi
17846
17847 : see if tmpnam_r exists
17848 set tmpnam_r d_tmpnam_r
17849 eval $inlibc
17850 case "$d_tmpnam_r" in
17851 "$define")
17852         hdrs="$i_systypes sys/types.h define stdio.h "
17853         case "$d_tmpnam_r_proto:$usethreads" in
17854         ":define")      d_tmpnam_r_proto=define
17855                 set d_tmpnam_r_proto tmpnam_r $hdrs
17856                 eval $hasproto ;;
17857         *)      ;;
17858         esac
17859         case "$d_tmpnam_r_proto" in
17860         define)
17861         case "$tmpnam_r_proto" in
17862         ''|0) try='char* tmpnam_r(char*);'
17863         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17864         esac
17865         case "$tmpnam_r_proto" in
17866         ''|0)   d_tmpnam_r=undef
17867                 tmpnam_r_proto=0
17868                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17869         * )     case "$tmpnam_r_proto" in
17870                 REENTRANT_PROTO*) ;;
17871                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17872                 esac
17873                 echo "Prototype: $try" ;;
17874         esac
17875         ;;
17876         *)      case "$usethreads" in
17877                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17878                 esac
17879                 d_tmpnam_r=undef
17880                 tmpnam_r_proto=0
17881                 ;;
17882         esac
17883         ;;
17884 *)      tmpnam_r_proto=0
17885         ;;
17886 esac
17887
17888 : see if truncate exists
17889 set truncate d_truncate
17890 eval $inlibc
17891
17892 : see if ttyname_r exists
17893 set ttyname_r d_ttyname_r
17894 eval $inlibc
17895 case "$d_ttyname_r" in
17896 "$define")
17897         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17898         case "$d_ttyname_r_proto:$usethreads" in
17899         ":define")      d_ttyname_r_proto=define
17900                 set d_ttyname_r_proto ttyname_r $hdrs
17901                 eval $hasproto ;;
17902         *)      ;;
17903         esac
17904         case "$d_ttyname_r_proto" in
17905         define)
17906         case "$ttyname_r_proto" in
17907         ''|0) try='int ttyname_r(int, char*, size_t);'
17908         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17909         esac
17910         case "$ttyname_r_proto" in
17911         ''|0) try='int ttyname_r(int, char*, int);'
17912         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17913         esac
17914         case "$ttyname_r_proto" in
17915         ''|0) try='char* ttyname_r(int, char*, int);'
17916         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17917         esac
17918         case "$ttyname_r_proto" in
17919         ''|0)   d_ttyname_r=undef
17920                 ttyname_r_proto=0
17921                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17922         * )     case "$ttyname_r_proto" in
17923                 REENTRANT_PROTO*) ;;
17924                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17925                 esac
17926                 echo "Prototype: $try" ;;
17927         esac
17928         ;;
17929         *)      case "$usethreads" in
17930                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17931                 esac
17932                 d_ttyname_r=undef
17933                 ttyname_r_proto=0
17934                 ;;
17935         esac
17936         ;;
17937 *)      ttyname_r_proto=0
17938         ;;
17939 esac
17940
17941 : see if tzname[] exists
17942 echo " "
17943 if set tzname val -a d_tzname; eval $csym; $val; then
17944         val="$define"
17945         echo 'tzname[] found.' >&4
17946 else
17947         val="$undef"
17948         echo 'tzname[] NOT found.' >&4
17949 fi
17950 set d_tzname
17951 eval $setvar
17952
17953 case "$osname" in
17954 next|rhapsody|darwin) multiarch="$define" ;;
17955 esac
17956 case "$multiarch" in
17957 ''|[nN]*) multiarch="$undef" ;;
17958 esac
17959
17960 : check for ordering of bytes in a UV
17961 echo " "
17962 case "$usecrosscompile$multiarch" in
17963 *$define*)
17964         $cat <<EOM
17965 You seem to be either cross-compiling or doing a multiarchitecture build,
17966 skipping the byteorder check.
17967
17968 EOM
17969         byteorder='ffff'
17970         ;;
17971 *)
17972         case "$byteorder" in
17973         '')
17974                 $cat <<'EOM'
17975 In the following, larger digits indicate more significance.  A big-endian
17976 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17977 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17978 machines may have weird orders like 3412.  A Cray will report 87654321,
17979 an Alpha will report 12345678. If the test program works the default is
17980 probably right.
17981 I'm now running the test program...
17982 EOM
17983                 $cat >try.c <<EOCP
17984 #include <stdio.h>
17985 #$i_stdlib I_STDLIB
17986 #ifdef I_STDLIB
17987 #include <stdlib.h>
17988 #endif
17989 #include <sys/types.h>
17990 typedef $uvtype UV;
17991 int main()
17992 {
17993         int i;
17994         union {
17995                 UV l;
17996                 char c[$uvsize];
17997         } u;
17998
17999         if ($uvsize > 4)
18000                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18001         else
18002                 u.l = (UV)0x04030201;
18003         for (i = 0; i < $uvsize; i++)
18004                 printf("%c", u.c[i]+'0');
18005         printf("\n");
18006         exit(0);
18007 }
18008 EOCP
18009                 xxx_prompt=y
18010                 set try
18011                 if eval $compile && $run ./try > /dev/null; then
18012                         dflt=`$run ./try`
18013                         case "$dflt" in
18014                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18015                                 echo "(The test program ran ok.)"
18016                                 echo "byteorder=$dflt"
18017                                 xxx_prompt=n
18018                         ;;
18019                         ????|????????) echo "(The test program ran ok.)" ;;
18020                         *) echo "(The test program didn't run right for some reason.)" ;;
18021                         esac
18022                 else
18023                         dflt='4321'
18024                         cat <<'EOM'
18025 (I can't seem to compile the test program.  Guessing big-endian...)
18026 EOM
18027                 fi
18028                 case "$xxx_prompt" in
18029                 y)
18030                         rp="What is the order of bytes in $uvtype?"
18031                         . ./myread
18032                         byteorder="$ans"
18033                         ;;
18034                 *)      byteorder=$dflt
18035                         ;;
18036                 esac
18037                 ;;
18038         esac
18039         $rm_try
18040         ;;
18041 esac
18042
18043 $cat <<EOM
18044
18045 Checking to see whether you can access character data unalignedly...
18046 EOM
18047 case "$d_u32align" in
18048 '')   $cat >try.c <<EOCP
18049 #include <stdio.h>
18050 #$i_stdlib I_STDLIB
18051 #ifdef I_STDLIB
18052 #include <stdlib.h>
18053 #endif
18054 #define U32 $u32type
18055 #define BYTEORDER 0x$byteorder
18056 #define U8 $u8type
18057 #include <signal.h>
18058 #ifdef SIGBUS
18059 $signal_t bletch(int s) { exit(4); }
18060 #endif
18061 int main() {
18062 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18063     U8 buf[8];
18064     U32 *up;
18065     int i;
18066
18067     if (sizeof(U32) != 4) {
18068         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18069         exit(1);
18070     }
18071
18072     fflush(stdout);
18073
18074 #ifdef SIGBUS
18075     signal(SIGBUS, bletch);
18076 #endif
18077
18078     buf[0] = 0;
18079     buf[1] = 0;
18080     buf[2] = 0;
18081     buf[3] = 1;
18082     buf[4] = 0;
18083     buf[5] = 0;
18084     buf[6] = 0;
18085     buf[7] = 1;
18086
18087     for (i = 0; i < 4; i++) {
18088         up = (U32*)(buf + i);
18089         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18090                (*up == 1 << (8*(3-i)))  /* little-endian */
18091               )
18092            )
18093         {
18094             printf("read failed (%x)\n", *up);
18095             exit(2);
18096         }
18097     }
18098
18099     /* write test */
18100     for (i = 0; i < 4; i++) {
18101         up = (U32*)(buf + i);
18102         *up = 0xBeef;
18103         if (*up != 0xBeef) {
18104             printf("write failed (%x)\n", *up);
18105             exit(3);
18106         }
18107     }
18108
18109     exit(0);
18110 #else
18111     printf("1\n");
18112     exit(1);
18113 #endif
18114     return 0;
18115 }
18116 EOCP
18117 set try
18118 if eval $compile_ok; then
18119         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18120         $run ./try 2>&1 >/dev/null
18121         case "$?" in
18122         0)      cat >&4 <<EOM
18123 You can access character data pretty unalignedly.
18124 EOM
18125                 d_u32align="$undef"
18126                 ;;
18127         *)      cat >&4 <<EOM
18128 It seems that you must access character data in an aligned manner.
18129 EOM
18130                 d_u32align="$define"
18131                 ;;
18132         esac
18133 else
18134         rp='Can you access character data at unaligned addresses?'
18135         dflt='n'
18136         . ./myread
18137         case "$ans" in
18138         [yY]*)  d_u32align="$undef"  ;;
18139         *)      d_u32align="$define" ;;
18140         esac
18141 fi
18142 $rm_try
18143 ;;
18144 esac
18145
18146 : see if ualarm exists
18147 set ualarm d_ualarm
18148 eval $inlibc
18149
18150 : see if umask exists
18151 set umask d_umask
18152 eval $inlibc
18153
18154 : see if unordered exists
18155 set unordered d_unordered
18156 eval $inlibc
18157
18158 : see if unsetenv exists
18159 set unsetenv d_unsetenv
18160 eval $inlibc
18161
18162 : see if usleep exists
18163 set usleep d_usleep
18164 eval $inlibc
18165
18166 : see if prototype for usleep is available
18167 echo " "
18168 set d_usleepproto usleep $i_unistd unistd.h
18169 eval $hasproto
18170
18171 : see if ustat exists
18172 set ustat d_ustat
18173 eval $inlibc
18174
18175 : see if closedir exists
18176 set closedir d_closedir
18177 eval $inlibc
18178
18179 case "$d_closedir" in
18180 "$define")
18181         echo " "
18182         echo "Checking whether closedir() returns a status..." >&4
18183         cat > try.c <<EOM
18184 #$i_dirent I_DIRENT             /**/
18185 #$i_sysdir I_SYS_DIR            /**/
18186 #$i_sysndir I_SYS_NDIR          /**/
18187 #$i_systypes I_SYS_TYPES        /**/
18188
18189 #if defined(I_SYS_TYPES)
18190 #include <sys/types.h>
18191 #endif
18192 #if defined(I_DIRENT)
18193 #include <dirent.h>
18194 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18195 #include <sys/dir.h>
18196 #endif
18197 #else
18198 #ifdef I_SYS_NDIR
18199 #include <sys/ndir.h>
18200 #else
18201 #ifdef I_SYS_DIR
18202 #ifdef hp9000s500
18203 #include <ndir.h>       /* may be wrong in the future */
18204 #else
18205 #include <sys/dir.h>
18206 #endif
18207 #endif
18208 #endif
18209 #endif
18210 int main() { return closedir(opendir(".")); }
18211 EOM
18212         set try
18213         if eval $compile_ok; then
18214                 if $run ./try > /dev/null 2>&1 ; then
18215                         echo "Yes, it does."
18216                         val="$undef"
18217                 else
18218                         echo "No, it doesn't."
18219                         val="$define"
18220                 fi
18221         else
18222                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18223                 val="$define"
18224         fi
18225         ;;
18226 *)
18227         val="$undef";
18228         ;;
18229 esac
18230 set d_void_closedir
18231 eval $setvar
18232 $rm_try
18233
18234 : see if there is a wait4
18235 set wait4 d_wait4
18236 eval $inlibc
18237
18238 : see if waitpid exists
18239 set waitpid d_waitpid
18240 eval $inlibc
18241
18242 : see if wcstombs exists
18243 set wcstombs d_wcstombs
18244 eval $inlibc
18245
18246 : see if wctomb exists
18247 set wctomb d_wctomb
18248 eval $inlibc
18249
18250 : see if writev exists
18251 set writev d_writev
18252 eval $inlibc
18253
18254 : preserve RCS keywords in files with variable substitution, grrr
18255 Date='$Date'
18256 Id='$Id'
18257 Log='$Log'
18258 RCSfile='$RCSfile'
18259 Revision='$Revision'
18260
18261 : check for alignment requirements
18262 echo " "
18263 case "$usecrosscompile$multiarch" in
18264 *$define*)
18265         $cat <<EOM
18266 You seem to be either cross-compiling or doing a multiarchitecture build,
18267 skipping the memory alignment check.
18268
18269 EOM
18270         case "$alignbytes" in
18271         '') alignbytes=8 ;;
18272         esac
18273         ;;
18274 *)
18275         case "$alignbytes" in
18276         '') echo "Checking alignment constraints..." >&4
18277                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18278                         $cat >try.c <<'EOCP'
18279 typedef long double NV;
18280 EOCP
18281                 else
18282                         $cat >try.c <<'EOCP'
18283 typedef double NV;
18284 EOCP
18285                 fi
18286                 $cat >>try.c <<'EOCP'
18287 #include <stdio.h>
18288 struct foobar {
18289         char foo;
18290         NV bar;
18291 } try_algn;
18292 int main()
18293 {
18294     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18295     return(0);
18296 }
18297 EOCP
18298                 set try
18299                 if eval $compile_ok; then
18300                         dflt=`$run ./try`
18301                 else
18302                         dflt='8'
18303                         echo "(I can't seem to compile the test program...)"
18304                 fi
18305                 ;;
18306         *) dflt="$alignbytes"
18307                 ;;
18308         esac
18309         rp="Doubles must be aligned on a how-many-byte boundary?"
18310         . ./myread
18311         alignbytes="$ans"
18312         $rm_try
18313         ;;
18314 esac
18315
18316
18317 : set the base revision
18318 baserev=5.0
18319
18320 : how do we concatenate cpp tokens here?
18321 echo " "
18322 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18323 $cat >cpp_stuff.c <<'EOCP'
18324 #define RCAT(a,b)a/**/b
18325 #define ACAT(a,b)a ## b
18326 RCAT(Rei,ser)
18327 ACAT(Cir,cus)
18328 EOCP
18329 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18330 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18331         echo "Oh!  Smells like ANSI's been here." >&4
18332         echo "We can catify or stringify, separately or together!"
18333         cpp_stuff=42
18334 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18335         echo "Ah, yes!  The good old days!" >&4
18336         echo "However, in the good old days we don't know how to stringify and"
18337         echo "catify at the same time."
18338         cpp_stuff=1
18339 else
18340         $cat >&4 <<EOM
18341 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18342 You're going to have to edit the values of CAT[2-5] in config.h...
18343 EOM
18344         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18345 fi
18346 $rm -f cpp_stuff.*
18347
18348 : see if this is a db.h system
18349 set db.h i_db
18350 eval $inhdr
18351
18352 case "$i_db" in
18353 $define)
18354         : Check db version.
18355         echo " "
18356         echo "Checking Berkeley DB version ..." >&4
18357         $cat >try.c <<EOCP
18358 #$d_const HASCONST
18359 #ifndef HASCONST
18360 #define const
18361 #endif
18362 #include <sys/types.h>
18363 #include <stdio.h>
18364 #$i_stdlib I_STDLIB
18365 #ifdef I_STDLIB
18366 #include <stdlib.h>
18367 #endif
18368 #include <db.h>
18369 int main(int argc, char *argv[])
18370 {
18371 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18372     int Major, Minor, Patch ;
18373     unsigned long Version ;
18374     (void)db_version(&Major, &Minor, &Patch) ;
18375     if (argc == 2) {
18376         printf("%d %d %d %d %d %d\n",
18377                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18378                Major, Minor, Patch);
18379         exit(0);
18380     }
18381     printf("You have Berkeley DB Version 2 or greater.\n");
18382
18383     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18384                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18385     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18386                 Major, Minor, Patch) ;
18387
18388     /* check that db.h & libdb are compatible */
18389     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18390         printf("db.h and libdb are incompatible.\n") ;
18391         exit(3);
18392     }
18393
18394     printf("db.h and libdb are compatible.\n") ;
18395
18396     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18397                 + DB_VERSION_PATCH ;
18398
18399     /* needs to be >= 2.3.4 */
18400     if (Version < 2003004) {
18401     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18402         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18403         exit(2);
18404     }
18405
18406     exit(0);
18407 #else
18408 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18409     if (argc == 2) {
18410         printf("1 0 0\n");
18411         exit(0);
18412     }
18413     printf("You have Berkeley DB Version 1.\n");
18414     exit(0);    /* DB version < 2: the coast is clear. */
18415 #else
18416     exit(1);    /* <db.h> not Berkeley DB? */
18417 #endif
18418 #endif
18419 }
18420 EOCP
18421         set try
18422         if eval $compile_ok && $run ./try; then
18423                 echo 'Looks OK.' >&4
18424                 set `$run ./try 1`
18425                 db_version_major=$1
18426                 db_version_minor=$2
18427                 db_version_patch=$3
18428         else
18429                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18430                 i_db=$undef
18431                 case " $libs " in
18432                 *"-ldb "*)
18433                         : Remove db from list of libraries to use
18434                         echo "Removing unusable -ldb from library list" >&4
18435                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18436                         shift
18437                         libs="$*"
18438                         echo "libs = $libs" >&4
18439                         ;;
18440                 esac
18441         fi
18442         $rm_try
18443         ;;
18444 esac
18445
18446 case "$i_db" in
18447 define)
18448         : Check the return type needed for hash
18449         echo " "
18450         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18451         $cat >try.c <<EOCP
18452 #$d_const HASCONST
18453 #ifndef HASCONST
18454 #define const
18455 #endif
18456 #include <sys/types.h>
18457 #include <db.h>
18458
18459 #ifndef DB_VERSION_MAJOR
18460 u_int32_t hash_cb (ptr, size)
18461 const void *ptr;
18462 size_t size;
18463 {
18464 }
18465 HASHINFO info;
18466 int main()
18467 {
18468         info.hash = hash_cb;
18469 }
18470 #endif
18471 EOCP
18472         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18473                 if $contains warning try.out >>/dev/null 2>&1 ; then
18474                         db_hashtype='int'
18475                 else
18476                         db_hashtype='u_int32_t'
18477                 fi
18478         else
18479                 : XXX Maybe we should just give up here.
18480                 db_hashtype=u_int32_t
18481                 $cat try.out >&4
18482                 echo "Help:  I can't seem to compile the db test program." >&4
18483                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18484         fi
18485         $rm_try
18486         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18487         ;;
18488 *)      db_hashtype=u_int32_t
18489         ;;
18490 esac
18491 case "$i_db" in
18492 define)
18493         : Check the return type needed for prefix
18494         echo " "
18495         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18496         cat >try.c <<EOCP
18497 #$d_const HASCONST
18498 #ifndef HASCONST
18499 #define const
18500 #endif
18501 #include <sys/types.h>
18502 #include <db.h>
18503
18504 #ifndef DB_VERSION_MAJOR
18505 size_t prefix_cb (key1, key2)
18506 const DBT *key1;
18507 const DBT *key2;
18508 {
18509 }
18510 BTREEINFO info;
18511 int main()
18512 {
18513         info.prefix = prefix_cb;
18514 }
18515 #endif
18516 EOCP
18517         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18518                 if $contains warning try.out >>/dev/null 2>&1 ; then
18519                         db_prefixtype='int'
18520                 else
18521                         db_prefixtype='size_t'
18522                 fi
18523         else
18524                 db_prefixtype='size_t'
18525                 : XXX Maybe we should just give up here.
18526                 $cat try.out >&4
18527                 echo "Help:  I can't seem to compile the db test program." >&4
18528                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18529         fi
18530         $rm_try
18531         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18532         ;;
18533 *)      db_prefixtype='size_t'
18534         ;;
18535 esac
18536
18537 : How can we generate normalized random numbers ?
18538 echo " "
18539 echo "Looking for a random number function..." >&4
18540 case "$randfunc" in
18541 '')
18542         if set drand48 val -f; eval $csym; $val; then
18543                 dflt="drand48"
18544                 echo "Good, found drand48()." >&4
18545         elif set random val -f; eval $csym; $val; then
18546                 dflt="random"
18547                 echo "OK, found random()." >&4
18548         else
18549                 dflt="rand"
18550                 echo "Yick, looks like I have to use rand()." >&4
18551         fi
18552         echo " "
18553         ;;
18554 *)
18555         dflt="$randfunc"
18556         ;;
18557 esac
18558 cont=true
18559
18560 case "$ccflags" in
18561 *-Dmy_rand=*|*-Dmy_srand=*)
18562         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18563         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18564         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18565         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18566         ;;
18567 esac
18568
18569 while $test "$cont"; do
18570         rp="Use which function to generate random numbers?"
18571         . ./myread
18572         if $test "$ans" = "$dflt"; then
18573                 : null
18574         else
18575                 randbits=''
18576         fi
18577         randfunc="$ans"
18578         if set $ans val -f; eval $csym; $val; then
18579                 cont=''
18580         else
18581                 dflt=y
18582                 rp="I cannot find function $ans. Use that name anyway?"
18583                 . ./myread
18584                 dflt=rand
18585                 case "$ans" in
18586                         [yY]*) cont='';;
18587                 esac
18588         fi
18589         case "$cont" in
18590         '')
18591                 case "$randfunc" in
18592                 drand48)
18593                         drand01="drand48()"
18594                         seedfunc="srand48"
18595                         randbits=48
18596                         randseedtype=long
18597                         ;;
18598                 rand|random)
18599                         case "$randbits" in
18600                         '')
18601 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18602                                 $cat >try.c <<EOCP
18603 #$i_unistd I_UNISTD
18604 #$i_stdlib I_STDLIB
18605 #include <stdio.h>
18606 #ifdef I_UNISTD
18607 #  include <unistd.h>
18608 #endif
18609 #ifdef I_STDLIB
18610 #  include <stdlib.h>
18611 #endif
18612 int main()
18613 {
18614         register int i;
18615         register unsigned long tmp;
18616         register unsigned long max = 0L;
18617
18618         for (i = 1000; i; i--) {
18619                 tmp = (unsigned long) $randfunc();
18620                 if (tmp > max) max = tmp;
18621         }
18622         for (i = 0; max; i++)
18623                 max /= 2;
18624         printf("%d\n",i);
18625 }
18626 EOCP
18627                                 set try
18628                                 if eval $compile_ok; then
18629                                         dflt=`try`
18630                                 else
18631                                         dflt='?'
18632                                         echo "(I can't seem to compile the test program...)"
18633                                 fi
18634                                 ;;
18635                         *)
18636                                 dflt="$randbits"
18637                                 ;;
18638                         esac
18639                         rp="How many bits does your $randfunc() function produce?"
18640                         . ./myread
18641                         randbits="$ans"
18642                         $rm_try
18643                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18644                         seedfunc="s$randfunc"
18645                         randseedtype=unsigned
18646                         ;;
18647                 *)
18648                         dflt="31"
18649                         rp="How many bits does your $randfunc() function produce?"
18650                         . ./myread
18651                         randbits="$ans"
18652                         seedfunc="s$randfunc"
18653                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18654                         if set $seedfunc val -f; eval $csym; $val; then
18655                                 echo "(Using $seedfunc() to seed random generator)"
18656                         else
18657                                 echo "(Warning: no $seedfunc() to seed random generator)"
18658                                 seedfunc=rand
18659                         fi
18660                         randseedtype=unsigned
18661                         ;;
18662                 esac
18663                 ;;
18664         esac
18665 done
18666
18667 echo " "
18668 echo "Determining whether or not we are on an EBCDIC system..." >&4
18669 $cat >try.c <<'EOM'
18670 int main()
18671 {
18672   if ('M'==0xd4) return 0;
18673   return 1;
18674 }
18675 EOM
18676
18677 val=$undef
18678 set try
18679 if eval $compile_ok; then
18680         if $run ./try; then
18681                 echo "You seem to speak EBCDIC." >&4
18682                 val="$define"
18683         else
18684                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18685         fi
18686 else
18687         echo "I'm unable to compile the test program." >&4
18688         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18689 fi
18690 $rm_try
18691 set ebcdic
18692 eval $setvar
18693
18694 echo " "
18695 $cat >&4 <<EOM
18696 Checking how to flush all pending stdio output...
18697 EOM
18698 # I only know how to find the first 32 possibly open files on SunOS.
18699 # See also hints/sunos_4_1.sh and util.c  --AD
18700 case "$osname" in
18701 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18702 esac
18703 $cat >>try.c <<EOCP
18704 #include <stdio.h>
18705 #$i_stdlib I_STDLIB
18706 #ifdef I_STDLIB
18707 #include <stdlib.h>
18708 #endif
18709 #$i_unistd I_UNISTD
18710 #ifdef I_UNISTD
18711 # include <unistd.h>
18712 #endif
18713 #$d_sysconf HAS_SYSCONF
18714 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18715 #ifdef HAS_STDIO_STREAM_ARRAY
18716 # define STDIO_STREAM_ARRAY $stdio_stream_array
18717 #endif
18718 int main() {
18719   FILE* p;
18720   unlink("try.out");
18721   p = fopen("try.out", "w");
18722 #ifdef TRY_FPUTC
18723   fputc('x', p);
18724 #else
18725 # ifdef TRY_FPRINTF
18726   fprintf(p, "x");
18727 # endif
18728 #endif
18729 #ifdef TRY_FFLUSH_NULL
18730   fflush(NULL);
18731 #endif
18732 #ifdef TRY_FFLUSH_ALL
18733   {
18734     long open_max = -1;
18735 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18736     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18737 # else
18738 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18739     open_max = sysconf(_SC_OPEN_MAX);
18740 #  else
18741 #   ifdef FOPEN_MAX
18742     open_max = FOPEN_MAX;
18743 #   else
18744 #    ifdef OPEN_MAX
18745     open_max = OPEN_MAX;
18746 #    else
18747 #     ifdef _NFILE
18748     open_max = _NFILE;
18749 #     endif
18750 #    endif
18751 #   endif
18752 #  endif
18753 # endif
18754 # ifdef HAS_STDIO_STREAM_ARRAY
18755     if (open_max > 0) {
18756       long i;
18757       for (i = 0; i < open_max; i++)
18758             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18759                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18760                 STDIO_STREAM_ARRAY[i]._flag)
18761                 fflush(&STDIO_STREAM_ARRAY[i]);
18762     }
18763   }
18764 # endif
18765 #endif
18766   _exit(42);
18767 }
18768 EOCP
18769 : first we have to find out how _not_ to flush
18770 $to try.c
18771 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18772     output=''
18773     set try -DTRY_FPUTC
18774     if eval $compile; then
18775             $run ./try 2>/dev/null
18776             code="$?"
18777             $from try.out
18778             if $test ! -s try.out -a "X$code" = X42; then
18779                 output=-DTRY_FPUTC
18780             fi
18781     fi
18782     case "$output" in
18783     '')
18784             set try -DTRY_FPRINTF
18785             if eval $compile; then
18786                     $run ./try 2>/dev/null
18787                     code="$?"
18788                     $from try.out
18789                     if $test ! -s try.out -a "X$code" = X42; then
18790                         output=-DTRY_FPRINTF
18791                     fi
18792             fi
18793         ;;
18794     esac
18795 fi
18796 : check for fflush NULL behaviour
18797 case "$fflushNULL" in
18798 '')     set try -DTRY_FFLUSH_NULL $output
18799         if eval $compile; then
18800                 $run ./try 2>/dev/null
18801                 code="$?"
18802                 $from try.out
18803                 if $test -s try.out -a "X$code" = X42; then
18804                         fflushNULL="`$cat try.out`"
18805                 else
18806                         if $test "X$code" != X42; then
18807                                 $cat >&4 <<EOM
18808 (If this test failed, don't worry, we'll try another method shortly.)
18809 EOM
18810                         fi
18811                 fi
18812         fi
18813         $rm_try
18814         case "$fflushNULL" in
18815         x)      $cat >&4 <<EOM
18816 Your fflush(NULL) works okay for output streams.
18817 Let's see if it clobbers input pipes...
18818 EOM
18819 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18820 # bug that improperly flushes the input end of pipes.  So we avoid the
18821 # autoflush on fork/system/exec support for now. :-(
18822 $cat >tryp.c <<EOCP
18823 #include <stdio.h>
18824 int
18825 main(int argc, char **argv)
18826 {
18827     char buf[1024];
18828     int i;
18829     char *bp = buf;
18830     while (1) {
18831         while ((i = getc(stdin)) != -1
18832                && (*bp++ = i) != '\n'
18833                && bp < &buf[1024])
18834         /* DO NOTHING */ ;
18835         *bp = '\0';
18836         fprintf(stdout, "%s", buf);
18837         fflush(NULL);
18838         if (i == -1)
18839             return 0;
18840         bp = buf;
18841     }
18842 }
18843 EOCP
18844                 fflushNULL="$define"
18845                 set tryp
18846                 if eval $compile; then
18847                     $rm -f tryp.out
18848                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18849                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18850                        $cat >&4 <<EOM
18851 fflush(NULL) seems to behave okay with input streams.
18852 EOM
18853                         fflushNULL="$define"
18854                     else
18855                         $cat >&4 <<EOM
18856 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18857 EOM
18858                         fflushNULL="$undef"
18859                     fi
18860                 fi
18861                 $rm -f core tryp.c tryp.core core.tryp.*
18862                 ;;
18863         '')     $cat >&4 <<EOM
18864 Your fflush(NULL) isn't working (contrary to ANSI C).
18865 EOM
18866                 fflushNULL="$undef"
18867                 ;;
18868         *)      $cat >&4 <<EOM
18869 Cannot figure out whether your fflush(NULL) works or not.
18870 I'm assuming it doesn't (contrary to ANSI C).
18871 EOM
18872                 fflushNULL="$undef"
18873                 ;;
18874         esac
18875         ;;
18876 $define|true|[yY]*)
18877         fflushNULL="$define"
18878         ;;
18879 *)
18880         fflushNULL="$undef"
18881         ;;
18882 esac
18883 : check explicit looping only if NULL did not work, and if the pipe
18884 : bug does not show up on an explicit flush too
18885 case "$fflushNULL" in
18886 "$undef")
18887         $cat >tryp.c <<EOCP
18888 #include <stdio.h>
18889 int
18890 main(int argc, char **argv)
18891 {
18892     char buf[1024];
18893     int i;
18894     char *bp = buf;
18895     while (1) {
18896         while ((i = getc(stdin)) != -1
18897                && (*bp++ = i) != '\n'
18898                && bp < &buf[1024])
18899         /* DO NOTHING */ ;
18900         *bp = '\0';
18901         fprintf(stdout, "%s", buf);
18902         fflush(stdin);
18903         if (i == -1)
18904             return 0;
18905         bp = buf;
18906     }
18907 }
18908 EOCP
18909         set tryp
18910         if eval $compile; then
18911             $rm -f tryp.out
18912             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18913             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18914                $cat >&4 <<EOM
18915 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18916 EOM
18917                 : now check for fflushall behaviour
18918                 case "$fflushall" in
18919                 '')     set try -DTRY_FFLUSH_ALL $output
18920                         if eval $compile; then
18921                                 $cat >&4 <<EOM
18922 (Now testing the other method--but note that this also may fail.)
18923 EOM
18924                                 $run ./try 2>/dev/null
18925                                 code=$?
18926                                 $from try.out
18927                                 if $test -s try.out -a "X$code" = X42; then
18928                                         fflushall="`$cat try.out`"
18929                                 fi
18930                         fi
18931                         $rm_try
18932                         case "$fflushall" in
18933                         x)      $cat >&4 <<EOM
18934 Whew. Flushing explicitly all the stdio streams works.
18935 EOM
18936                                 fflushall="$define"
18937                                 ;;
18938                         '')     $cat >&4 <<EOM
18939 Sigh. Flushing explicitly all the stdio streams doesn't work.
18940 EOM
18941                                 fflushall="$undef"
18942                                 ;;
18943                         *)      $cat >&4 <<EOM
18944 Cannot figure out whether flushing stdio streams explicitly works or not.
18945 I'm assuming it doesn't.
18946 EOM
18947                                 fflushall="$undef"
18948                                 ;;
18949                         esac
18950                         ;;
18951                 "$define"|true|[yY]*)
18952                         fflushall="$define"
18953                         ;;
18954                 *)
18955                         fflushall="$undef"
18956                         ;;
18957                 esac
18958             else
18959                 $cat >&4 <<EOM
18960 All is futile.  Even fflush(stdin) clobbers input pipes!
18961 EOM
18962                 fflushall="$undef"
18963             fi
18964         else
18965             fflushall="$undef"
18966         fi
18967         $rm -f core tryp.c tryp.core core.tryp.*
18968         ;;
18969 *)      fflushall="$undef"
18970         ;;
18971 esac
18972
18973 case "$fflushNULL$fflushall" in
18974 undefundef)
18975         $cat <<EOM
18976 OK, I give up.  I cannot figure out how to flush pending stdio output.
18977 We won't be flushing handles at all before fork/exec/popen.
18978 EOM
18979         ;;
18980 esac
18981 $rm_try
18982
18983 : Store the full pathname to the ar program for use in the C program
18984 : Respect a hint or command line value for full_ar.
18985 case "$full_ar" in
18986 '') full_ar=$ar ;;
18987 esac
18988
18989 : Store the full pathname to the sed program for use in the C program
18990 full_sed=$sed
18991
18992 : see what type gids are declared as in the kernel
18993 echo " "
18994 echo "Looking for the type for group ids returned by getgid()."
18995 set gid_t gidtype xxx stdio.h sys/types.h
18996 eval $typedef
18997 case "$gidtype" in
18998 xxx)
18999         xxx=`./findhdr sys/user.h`
19000         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19001         case $1 in
19002         unsigned) dflt="$1 $2" ;;
19003         *) dflt="$1" ;;
19004         esac
19005         ;;
19006 *) dflt="$gidtype";;
19007 esac
19008 case "$gidtype" in
19009 gid_t) echo "gid_t found." ;;
19010 *)      rp="What is the type for group ids returned by getgid()?"
19011         . ./myread
19012         gidtype="$ans"
19013         ;;
19014 esac
19015
19016 echo " "
19017 case "$gidtype" in
19018 *_t) zzz="$gidtype"     ;;
19019 *)   zzz="gid"          ;;
19020 esac
19021 echo "Checking the size of $zzz..." >&4 
19022 cat > try.c <<EOCP
19023 #include <sys/types.h>
19024 #include <stdio.h>
19025 #$i_stdlib I_STDLIB
19026 #ifdef I_STDLIB
19027 #include <stdlib.h>
19028 #endif
19029 int main() {
19030     printf("%d\n", (int)sizeof($gidtype));
19031     exit(0);
19032 }
19033 EOCP
19034 set try
19035 if eval $compile_ok; then
19036         yyy=`$run ./try`
19037         case "$yyy" in
19038         '')     gidsize=4
19039                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19040                 ;;
19041         *)      gidsize=$yyy
19042                 echo "Your $zzz is $gidsize bytes long."
19043                 ;;
19044         esac
19045 else
19046         gidsize=4
19047         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19048 fi
19049
19050
19051 echo " "
19052 case "$gidtype" in
19053 *_t) zzz="$gidtype"     ;;
19054 *)   zzz="gid"          ;;
19055 esac
19056 echo "Checking the sign of $zzz..." >&4 
19057 cat > try.c <<EOCP
19058 #include <sys/types.h>
19059 #include <stdio.h>
19060 int main() {
19061         $gidtype foo = -1;
19062         if (foo < 0)
19063                 printf("-1\n");
19064         else
19065                 printf("1\n");
19066 }
19067 EOCP
19068 set try
19069 if eval $compile; then
19070         yyy=`$run ./try`
19071         case "$yyy" in
19072         '')     gidsign=1
19073                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19074                 ;;
19075         *)      gidsign=$yyy
19076                 case "$gidsign" in
19077                  1) echo "Your $zzz is unsigned." ;;
19078                 -1) echo "Your $zzz is signed."   ;;
19079                 esac
19080                 ;;
19081         esac
19082 else
19083         gidsign=1
19084         echo "(I can't compile the test program--guessing unsigned.)" >&4
19085 fi
19086
19087
19088 echo " "
19089
19090 if $test X"$quadtype" != X; then
19091
19092 echo "Checking how to print 64-bit integers..." >&4
19093
19094 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19095         $cat >try.c <<'EOCP'
19096 #include <sys/types.h>
19097 #include <stdio.h>
19098 int main() {
19099   int q = 12345678901;
19100   printf("%ld\n", q);
19101 }
19102 EOCP
19103         set try
19104         if eval $compile; then
19105                 yyy=`$run ./try`
19106                 case "$yyy" in
19107                 12345678901)
19108                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19109                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19110                         echo "We will use %d."
19111                         ;;
19112                 esac
19113         fi
19114 fi
19115
19116 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19117         $cat >try.c <<'EOCP'
19118 #include <sys/types.h>
19119 #include <stdio.h>
19120 int main() {
19121   long q = 12345678901;
19122   printf("%ld\n", q);
19123 }
19124 EOCP
19125         set try
19126         if eval $compile; then
19127                 yyy=`$run ./try`
19128                 case "$yyy" in
19129                 12345678901)
19130                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19131                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19132                         echo "We will use %ld."
19133                         ;;
19134                 esac
19135         fi
19136 fi
19137
19138 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19139         $cat >try.c <<'EOCP'
19140 #include <sys/types.h>
19141 #include <inttypes.h>
19142 #include <stdio.h>
19143 int main() {
19144   int64_t q = 12345678901;
19145   printf("%" PRId64 "\n", q);
19146 }
19147 EOCP
19148         set try
19149         if eval $compile; then
19150                 yyy=`$run ./try`
19151                 case "$yyy" in
19152                 12345678901)
19153                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19154                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19155                         echo "We will use the C9X style."
19156                         ;;
19157                 esac
19158         fi
19159 fi
19160
19161 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19162         $cat >try.c <<EOCP
19163 #include <sys/types.h>
19164 #include <stdio.h>
19165 int main() {
19166   $quadtype q = 12345678901;
19167   printf("%Ld\n", q);
19168 }
19169 EOCP
19170         set try
19171         if eval $compile; then
19172                 yyy=`$run ./try`
19173                 case "$yyy" in
19174                 12345678901)
19175                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19176                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19177                         echo "We will use %Ld."
19178                         ;;
19179                 esac
19180         fi
19181 fi
19182
19183 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19184         $cat >try.c <<'EOCP'
19185 #include <sys/types.h>
19186 #include <stdio.h>
19187 int main() {
19188   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19189   printf("%lld\n", q);
19190 }
19191 EOCP
19192         set try
19193         if eval $compile; then
19194                 yyy=`$run ./try`
19195                 case "$yyy" in
19196                 12345678901)
19197                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19198                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19199                         echo "We will use the %lld style."
19200                         ;;
19201                 esac
19202         fi
19203 fi
19204
19205 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19206         $cat >try.c <<EOCP
19207 #include <sys/types.h>
19208 #include <stdio.h>
19209 int main() {
19210   $quadtype q = 12345678901;
19211   printf("%qd\n", q);
19212 }
19213 EOCP
19214         set try
19215         if eval $compile; then
19216                 yyy=`$run ./try`
19217                 case "$yyy" in
19218                 12345678901)
19219                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19220                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19221                         echo "We will use %qd."
19222                         ;;
19223                 esac
19224         fi
19225 fi
19226
19227 if $test X"$sPRId64" = X; then
19228         echo "Cannot figure out how to print 64-bit integers." >&4
19229 fi
19230 $rm_try
19231
19232 fi
19233
19234 case "$sPRId64" in
19235 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19236         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19237         ;;
19238 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19239         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19240         ;;
19241 esac
19242
19243
19244 echo " "
19245 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19246
19247 if $test X"$ivsize" = X8; then
19248         ivdformat="$sPRId64"
19249         uvuformat="$sPRIu64"
19250         uvoformat="$sPRIo64"
19251         uvxformat="$sPRIx64"
19252         uvXUformat="$sPRIXU64"
19253 else
19254         if $test X"$ivsize" = X"$longsize"; then
19255                 ivdformat='"ld"'
19256                 uvuformat='"lu"'
19257                 uvoformat='"lo"'
19258                 uvxformat='"lx"'
19259                 uvXUformat='"lX"'
19260         else
19261                 if $test X"$ivsize" = X"$intsize"; then
19262                         ivdformat='"d"'
19263                         uvuformat='"u"'
19264                         uvoformat='"o"'
19265                         uvxformat='"x"'
19266                         uvXUformat='"X"'
19267                 else
19268                         : far out
19269                         if $test X"$ivsize" = X"$shortsize"; then
19270                                 ivdformat='"hd"'
19271                                 uvuformat='"hu"'
19272                                 uvoformat='"ho"'
19273                                 uvxformat='"hx"'
19274                                 uvXUformat='"hX"'
19275                         fi
19276                 fi
19277         fi
19278 fi
19279
19280 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19281         nveformat="$sPRIeldbl"
19282         nvfformat="$sPRIfldbl"
19283         nvgformat="$sPRIgldbl"
19284         nvEUformat="$sPRIEUldbl"
19285         nvFUformat="$sPRIFUldbl"
19286         nvGUformat="$sPRIGUldbl"
19287 else
19288         nveformat='"e"'
19289         nvfformat='"f"'
19290         nvgformat='"g"'
19291         nvEUformat='"E"'
19292         nvFUformat='"F"'
19293         nvGUformat='"G"'
19294 fi
19295
19296 case "$ivdformat" in
19297 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19298     exit 1
19299     ;;
19300 esac
19301
19302
19303 echo " "
19304 $echo "Checking the format string to be used for gids..." >&4
19305
19306 case "$gidsign" in
19307 -1)     if $test X"$gidsize" = X"$ivsize"; then
19308                 gidformat="$ivdformat"
19309         else
19310                 if $test X"$gidsize" = X"$longsize"; then
19311                         gidformat='"ld"'
19312                 else
19313                         if $test X"$gidsize" = X"$intsize"; then
19314                                 gidformat='"d"'
19315                         else
19316                                 if $test X"$gidsize" = X"$shortsize"; then
19317                                         gidformat='"hd"'
19318                                 fi
19319                         fi
19320                 fi
19321         fi
19322         ;;
19323 *)      if $test X"$gidsize" = X"$uvsize"; then
19324                 gidformat="$uvuformat"
19325         else
19326                 if $test X"$gidsize" = X"$longsize"; then
19327                         gidformat='"lu"'
19328                 else
19329                         if $test X"$gidsize" = X"$intsize"; then
19330                                 gidformat='"u"'
19331                         else
19332                                 if $test X"$gidsize" = X"$shortsize"; then
19333                                         gidformat='"hu"'
19334                                 fi
19335                         fi
19336                 fi
19337         fi
19338         ;;
19339 esac
19340
19341 : see if getgroups exists
19342 set getgroups d_getgrps
19343 eval $inlibc
19344
19345 : see if setgroups exists
19346 set setgroups d_setgrps
19347 eval $inlibc
19348
19349
19350 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19351 echo " "
19352 case "$d_getgrps$d_setgrps" in
19353 *define*)
19354         case "$groupstype" in
19355         '') dflt="$gidtype" ;;
19356         *)  dflt="$groupstype" ;;
19357         esac
19358         $cat <<EOM
19359 What type of pointer is the second argument to getgroups() and setgroups()?
19360 Usually this is the same as group ids, $gidtype, but not always.
19361
19362 EOM
19363         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19364         . ./myread
19365         groupstype="$ans"
19366         ;;
19367 *)  groupstype="$gidtype";;
19368 esac
19369
19370
19371 if $test $patchlevel -lt 9; then
19372 : MAD is not available in 5.8.x or earlier.
19373     ans=n;
19374 else
19375     case "$mad" in
19376     $define|true|[yY]*) dflt='y' ;;
19377     *)                  dflt='n' ;;
19378     esac
19379     cat <<EOM
19380
19381 Would you like to build with Misc Attribute Decoration? This is development
19382 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19383 overhead on the interpreter.
19384
19385 If this doesn't make any sense to you, just accept the default '$dflt'.
19386 EOM
19387     rp='Build Perl with MAD?'
19388     . ./myread
19389 fi
19390 case "$ans" in
19391 y|Y)    val="$define"
19392         madlyh='madly.h madly.act madly.tab'
19393         madlysrc='madly.c'
19394         madlyobj="madly$_o" ;;
19395 *)      val="$undef"
19396         madlyh=''
19397         madlysrc=''
19398         madlyobj='' ;;
19399 esac
19400 set mad
19401 eval $setvar
19402
19403 echo " "
19404 echo "Checking if your $make program sets \$(MAKE)..." >&4
19405 case "$make_set_make" in
19406 '')
19407         $sed 's/^X //' > testmake.mak << 'EOF'
19408 Xall:
19409 X       @echo 'maketemp="$(MAKE)"'
19410 EOF
19411         case "`$make -f testmake.mak 2>/dev/null`" in
19412         *maketemp=*) make_set_make='#' ;;
19413         *)      make_set_make="MAKE=$make" ;;
19414         esac
19415         $rm -f testmake.mak
19416         ;;
19417 esac
19418 case "$make_set_make" in
19419 '#') echo "Yup, it does.";;
19420 *) echo "Nope, it doesn't.";;
19421 esac
19422
19423 : see what type is used for mode_t
19424 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19425 set mode_t modetype int stdio.h sys/types.h
19426 eval $typedef_ask
19427
19428 : see if we need va_copy
19429 echo " "
19430 case "$i_stdarg" in
19431 "$define")
19432         $cat >try.c <<EOCP
19433 #include <stdarg.h>
19434 #include <stdio.h>
19435 #$i_stdlib I_STDLIB
19436 #ifdef I_STDLIB
19437 #include <stdlib.h>
19438 #endif
19439 #include <signal.h>
19440
19441 int
19442 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19443 {
19444   return vfprintf(f, fmt, *valp);
19445 }
19446
19447 int
19448 myvfprintf(FILE *f, const  char *fmt, va_list val)
19449 {
19450   return ivfprintf(f, fmt, &val);
19451 }
19452
19453 int
19454 myprintf(char *fmt, ...)
19455 {
19456   va_list val;
19457   va_start(val, fmt);
19458   return myvfprintf(stdout, fmt, val);
19459 }
19460
19461 int
19462 main(int ac, char **av)
19463 {
19464   signal(SIGSEGV, exit);
19465
19466   myprintf("%s%cs all right, then\n", "that", '\'');
19467   exit(0);
19468 }
19469 EOCP
19470         set try
19471         if eval $compile && $run ./try 2>&1 >/dev/null; then
19472                 case "`$run ./try`" in
19473                 "that's all right, then")
19474                         okay=yes
19475                         ;;
19476                 esac
19477         fi
19478         case "$okay" in
19479         yes)    echo "It seems that you don't need va_copy()." >&4
19480                 need_va_copy="$undef"
19481                 ;;
19482         *)      echo "It seems that va_copy() or similar will be needed." >&4
19483                 need_va_copy="$define"
19484                 ;;
19485         esac
19486         $rm_try
19487         ;;
19488 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19489         ;;
19490 esac
19491
19492 : see what type is used for size_t
19493 rp="What is the type used for the length parameter for string functions?"
19494 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19495 eval $typedef_ask
19496
19497 : check for type of arguments to gethostbyaddr. 
19498 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19499         case "$d_gethbyaddr" in
19500         $define)
19501                 $cat <<EOM
19502
19503 Checking to see what type of arguments are accepted by gethostbyaddr().
19504 EOM
19505                 hdrs="$define sys/types.h
19506                         $d_socket sys/socket.h 
19507                         $i_niin netinet/in.h 
19508                         $i_netdb netdb.h
19509                         $i_unistd unistd.h"
19510                 : The first arg can 'char *' or 'void *'
19511                 : The second arg is some of integral type
19512                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19513                         for yyy in size_t long int; do
19514                                 case "$netdb_host_type" in
19515                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19516                                         if ./protochk "$try" $hdrs; then
19517                                                 echo "Your system accepts $xxx for the first arg."
19518                                                 echo "...and $yyy for the second arg."
19519                                                 netdb_host_type="$xxx"
19520                                                 netdb_hlen_type="$yyy"
19521                                         fi
19522                                         ;;
19523                                 esac
19524                         done
19525                 done
19526                 : In case none of those worked, prompt the user.
19527                 case "$netdb_host_type" in
19528                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19529                         dflt='char *'
19530                         . ./myread
19531                         netdb_host_type=$ans
19532                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19533                         dflt="$sizetype"
19534                         . ./myread
19535                         netdb_hlen_type=$ans
19536                         ;;
19537                 esac
19538                 ;;
19539         *)      : no gethostbyaddr, so pick harmless defaults
19540                 netdb_host_type='char *'
19541                 netdb_hlen_type="$sizetype"
19542                 ;;
19543         esac
19544         # Remove the "const" if needed. -- but then we'll have a 
19545         # prototype clash!
19546         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19547 fi
19548
19549 : check for type of argument to gethostbyname. 
19550 if test "X$netdb_name_type" = X ; then
19551         case "$d_gethbyname" in
19552         $define)
19553                 $cat <<EOM
19554
19555 Checking to see what type of argument is accepted by gethostbyname().
19556 EOM
19557                 hdrs="$define sys/types.h
19558                         $d_socket sys/socket.h 
19559                         $i_niin netinet/in.h 
19560                         $i_netdb netdb.h
19561                         $i_unistd unistd.h"
19562                 for xxx in "const char *" "char *"; do
19563                         case "$netdb_name_type" in
19564                         '')     try="extern struct hostent *gethostbyname($xxx);"
19565                                 if ./protochk "$try" $hdrs; then
19566                                         echo "Your system accepts $xxx."
19567                                         netdb_name_type="$xxx"
19568                                 fi
19569                                 ;;
19570                         esac
19571                 done
19572                 : In case none of those worked, prompt the user.
19573                 case "$netdb_name_type" in
19574                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19575                         dflt='char *'
19576                         . ./myread
19577                         netdb_name_type=$ans
19578                         ;;
19579                 esac
19580                 ;;
19581         *)      : no gethostbyname, so pick harmless default
19582                 netdb_name_type='char *'
19583                 ;;
19584         esac
19585 fi
19586
19587 : check for type of 1st argument to getnetbyaddr. 
19588 if test "X$netdb_net_type" = X ; then
19589         case "$d_getnbyaddr" in
19590         $define)
19591                 $cat <<EOM
19592
19593 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19594 EOM
19595                 hdrs="$define sys/types.h
19596                         $d_socket sys/socket.h 
19597                         $i_niin netinet/in.h 
19598                         $i_netdb netdb.h
19599                         $i_unistd unistd.h"
19600                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19601                         case "$netdb_net_type" in
19602                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19603                                 if ./protochk "$try" $hdrs; then
19604                                         echo "Your system accepts $xxx."
19605                                         netdb_net_type="$xxx"
19606                                 fi
19607                                 ;;
19608                         esac
19609                 done
19610                 : In case none of those worked, prompt the user.
19611                 case "$netdb_net_type" in
19612                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19613                         dflt='long'
19614                         . ./myread
19615                         netdb_net_type=$ans
19616                         ;;
19617                 esac
19618                 ;;
19619         *)      : no getnetbyaddr, so pick harmless default
19620                 netdb_net_type='long'
19621                 ;;
19622         esac
19623 fi
19624 : locate the preferred pager for this system
19625 fn=f/
19626 case "$pager" in
19627 '')
19628         dflt=''
19629         case "$pg" in
19630         /*) dflt=$pg;;
19631         [a-zA-Z]:/*) dflt=$pg;;
19632         esac
19633         case "$more" in
19634         /*) dflt=$more;;
19635         [a-zA-Z]:/*) dflt=$more;;
19636         esac
19637         case "$less" in
19638         /*) dflt=$less;;
19639         [a-zA-Z]:/*) dflt=$less;;
19640         esac
19641         case "$dflt" in
19642         '') dflt=/usr/ucb/more;;
19643         esac
19644         ;;
19645 *)      dflt="$pager"
19646         : Instruct ./getfile to trust the hinted or previous pager value,
19647         : even if it does not begin with a slash.  For example, on os2,
19648         : pager might be cmd /c more.  See comments in UU/getfile.
19649         fn="f/($pager)"
19650         ;;
19651 esac
19652 echo " "
19653 rp='What pager is used on your system?'
19654 . ./getfile
19655 pager="$ans"
19656
19657 : see what type pids are declared as in the kernel
19658 rp="What is the type of process ids on this system?"
19659 set pid_t pidtype int stdio.h sys/types.h
19660 eval $typedef_ask
19661
19662 : see if ar generates random libraries by itself
19663 echo " "
19664 echo "Checking how to generate random libraries on your machine..." >&4
19665 echo 'int bar1() { return bar2(); }' > bar1.c
19666 echo 'int bar2() { return 2; }' > bar2.c
19667 $cat > foo.c <<EOP
19668 #$i_stdlib I_STDLIB
19669 #ifdef I_STDLIB
19670 #include <stdlib.h>
19671 #endif
19672 int main() { printf("%d\n", bar1()); exit(0); }
19673 EOP
19674 $cc $ccflags -c bar1.c >/dev/null 2>&1
19675 $cc $ccflags -c bar2.c >/dev/null 2>&1
19676 $cc $ccflags -c foo.c >/dev/null 2>&1
19677 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19678 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19679         $run ./foobar >/dev/null 2>&1; then
19680         echo "$ar appears to generate random libraries itself."
19681         orderlib=false
19682         if [ "X$ranlib" = "X" ]; then
19683             ranlib=":"
19684         fi
19685 elif $ar s bar$_a >/dev/null 2>&1 &&
19686         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19687         $run ./foobar >/dev/null 2>&1; then
19688                 echo "a table of contents needs to be added with '$ar s'."
19689                 orderlib=false
19690                 ranlib="$ar s"
19691 elif $ar ts bar$_a >/dev/null 2>&1 &&
19692         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19693         $run ./foobar >/dev/null 2>&1; then
19694                 echo "a table of contents needs to be added with '$ar ts'."
19695                 orderlib=false
19696                 ranlib="$ar ts"
19697 else
19698         case "$ranlib" in
19699         :) ranlib='';;
19700         '')
19701                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19702                 $test -f $ranlib || ranlib=''
19703                 ;;
19704         esac
19705         if $test -n "$ranlib"; then
19706                 echo "your system has '$ranlib'; we'll use that."
19707                 orderlib=false
19708         else
19709                 echo "your system doesn't seem to support random libraries"
19710                 echo "so we'll use lorder and tsort to order the libraries."
19711                 orderlib=true
19712                 ranlib=":"
19713         fi
19714 fi
19715 $rm -f foo* bar*
19716
19717 : check for type of arguments to select. 
19718 case "$selecttype" in
19719 '') case "$d_select" in
19720         $define)
19721                 echo " "
19722                 $cat <<EOM
19723 Checking to see what type of arguments are accepted by select().
19724 EOM
19725                 hdrs="$define sys/types.h
19726                         $i_systime sys/time.h 
19727                         $i_sysselct sys/select.h
19728                         $d_socket sys/socket.h"
19729                 : The first arg can be int, unsigned, or size_t
19730                 : The last arg may or may not be 'const'
19731                 val=''
19732                 : void pointer has been seen but using that
19733                 : breaks the selectminbits test
19734                 for xxx in 'fd_set *' 'int *'; do
19735                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19736                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19737                                         case "$val" in
19738                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19739                                                 if ./protochk "$try" $hdrs; then
19740                                                         echo "Your system accepts $xxx."
19741                                                         val="$xxx"
19742                                                 fi
19743                                                 ;;
19744                                         esac
19745                                 done
19746                         done
19747                 done
19748                 case "$val" in
19749                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19750                         case "$d_fd_set" in
19751                                 $define) dflt="fd_set *" ;;
19752                                 *)              dflt="int *" ;;
19753                         esac
19754                         . ./myread
19755                         val=$ans
19756                         ;;
19757                 esac
19758                 selecttype="$val"
19759                 ;;
19760         *)      : no select, so pick a harmless default
19761                 selecttype='int *'
19762                 ;;
19763         esac
19764         ;;
19765 esac
19766
19767 : check for the select 'width'
19768 case "$selectminbits" in
19769 '') safebits=`expr $ptrsize \* 8`
19770     case "$d_select" in
19771         $define)
19772                 $cat <<EOM
19773
19774 Checking to see on how many bits at a time your select() operates...
19775 EOM
19776                 $cat >try.c <<EOCP
19777 #include <sys/types.h>
19778 #$i_time I_TIME
19779 #$i_systime I_SYS_TIME
19780 #$i_systimek I_SYS_TIME_KERNEL
19781 #ifdef I_TIME
19782 #   include <time.h>
19783 #endif
19784 #ifdef I_SYS_TIME
19785 #   ifdef I_SYS_TIME_KERNEL
19786 #       define KERNEL
19787 #   endif
19788 #   include <sys/time.h>
19789 #   ifdef I_SYS_TIME_KERNEL
19790 #       undef KERNEL
19791 #   endif
19792 #endif
19793 #$i_sysselct I_SYS_SELECT
19794 #ifdef I_SYS_SELECT
19795 #include <sys/select.h>
19796 #endif
19797 #$d_socket HAS_SOCKET
19798 #ifdef HAS_SOCKET
19799 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19800 #endif
19801 #include <stdio.h>
19802 #$i_stdlib I_STDLIB
19803 #ifdef I_STDLIB
19804 #include <stdlib.h>
19805 #endif
19806 $selecttype b;
19807 #define S sizeof(*(b))
19808 #define MINBITS 64
19809 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19810 #define NBITS  (NBYTES * 8)
19811 int main() {
19812     char *s = (char *)malloc(NBYTES);
19813     struct timeval t;
19814     int i;
19815     FILE* fp;
19816     int fd;
19817
19818     if (!s)
19819         exit(1);
19820     fclose(stdin);
19821     fp = fopen("try.c", "r");
19822     if (fp == 0)
19823       exit(2);
19824     fd = fileno(fp);
19825     if (fd < 0)
19826       exit(3);
19827     b = ($selecttype)s;
19828     for (i = 0; i < NBITS; i++)
19829         FD_SET(i, b);
19830     t.tv_sec  = 0;
19831     t.tv_usec = 0;
19832     select(fd + 1, b, 0, 0, &t);
19833     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19834     free(s);
19835     printf("%d\n", i + 1);
19836     return 0;
19837 }
19838 EOCP
19839                 set try
19840                 if eval $compile_ok; then
19841                         selectminbits=`$run ./try`
19842                         case "$selectminbits" in
19843                         '')     cat >&4 <<EOM
19844 Cannot figure out on how many bits at a time your select() operates.
19845 I'll play safe and guess it is $safebits bits.
19846 EOM
19847                                 selectminbits=$safebits
19848                                 bits="$safebits bits"
19849                                 ;;
19850                         1)      bits="1 bit" ;;
19851                         *)      bits="$selectminbits bits" ;;
19852                         esac
19853                         echo "Your select() operates on $bits at a time." >&4
19854                 else
19855                         rp='What is the minimum number of bits your select() operates on?'
19856                         case "$byteorder" in
19857                         12345678)       dflt=64 ;;
19858                         1234)           dflt=32 ;;
19859                         *)              dflt=1  ;;
19860                         esac
19861                         . ./myread
19862                         val=$ans
19863                         selectminbits="$val"
19864                 fi
19865                 $rm_try
19866                 ;;
19867         *)      : no select, so pick a harmless default
19868                 selectminbits=$safebits
19869                 ;;
19870         esac
19871         ;;
19872 esac
19873
19874 : Trace out the files included by signal.h, then look for SIGxxx names.
19875 : Remove SIGARRAYSIZE used by HPUX.
19876 : Remove SIGSTKSIZE used by Linux.
19877 : Remove SIGSTKSZ used by Posix.
19878 : Remove SIGTYP void lines used by OS2.
19879 : Some cpps, like os390, dont give the file name anywhere
19880 if [ "X$fieldn" = X ]; then
19881         : Just make some guesses.  We check them later.
19882         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19883 else
19884         xxx=`echo '#include <signal.h>' |
19885         $cppstdin $cppminus $cppflags 2>/dev/null |
19886         $grep '^[       ]*#.*include' | 
19887         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19888 fi
19889 : Check this list of files to be sure we have parsed the cpp output ok.
19890 : This will also avoid potentially non-existent files, such 
19891 : as ../foo/bar.h
19892 xxxfiles=''
19893 for xx in $xxx /dev/null ; do
19894         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19895 done
19896 : If we have found no files, at least try signal.h
19897 case "$xxxfiles" in
19898 '')     xxxfiles=`./findhdr signal.h` ;;
19899 esac
19900 xxx=`awk '
19901 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19902         print substr($2, 4, 20)
19903 }
19904 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19905         print substr($3, 4, 20)
19906 }' $xxxfiles`
19907 : Append some common names just in case the awk scan failed.
19908 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19909 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19910 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19911 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19912 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19913
19914 : generate a few handy files for later
19915 $cat > signal.c <<EOCP
19916 #include <sys/types.h>
19917 #include <signal.h>
19918 #$i_stdlib I_STDLIB
19919 #ifdef I_STDLIB
19920 #include <stdlib.h>
19921 #endif
19922 #include <stdio.h>
19923 int main() {
19924
19925 /* Strange style to avoid deeply-nested #if/#else/#endif */
19926 #ifndef NSIG
19927 #  ifdef _NSIG
19928 #    define NSIG (_NSIG)
19929 #  endif
19930 #endif
19931
19932 #ifndef NSIG
19933 #  ifdef SIGMAX
19934 #    define NSIG (SIGMAX+1)
19935 #  endif
19936 #endif
19937
19938 #ifndef NSIG
19939 #  ifdef SIG_MAX
19940 #    define NSIG (SIG_MAX+1)
19941 #  endif
19942 #endif
19943
19944 #ifndef NSIG
19945 #  ifdef _SIG_MAX
19946 #    define NSIG (_SIG_MAX+1)
19947 #  endif
19948 #endif
19949
19950 #ifndef NSIG
19951 #  ifdef MAXSIG
19952 #    define NSIG (MAXSIG+1)
19953 #  endif
19954 #endif
19955
19956 #ifndef NSIG
19957 #  ifdef MAX_SIG
19958 #    define NSIG (MAX_SIG+1)
19959 #  endif
19960 #endif
19961
19962 #ifndef NSIG
19963 #  ifdef SIGARRAYSIZE
19964 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19965 #  endif
19966 #endif
19967
19968 #ifndef NSIG
19969 #  ifdef _sys_nsig
19970 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19971 #  endif
19972 #endif
19973
19974 /* Default to some arbitrary number that's big enough to get most
19975    of the common signals.
19976 */
19977 #ifndef NSIG
19978 #    define NSIG 50
19979 #endif
19980
19981 printf("NSIG %d\n", NSIG);
19982
19983 #ifndef JUST_NSIG
19984
19985 EOCP
19986
19987 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19988 {
19989         printf "#ifdef SIG"; printf $1; printf "\n"
19990         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19991         printf $1; printf ");\n"
19992         printf "#endif\n"
19993 }
19994 END {
19995         printf "#endif /* JUST_NSIG */\n";
19996         printf "exit(0);\n}\n";
19997 }
19998 ' >>signal.c
19999 $cat >signal.awk <<'EOP'
20000 BEGIN { ndups = 0 }
20001 $1 ~ /^NSIG$/ { nsig = $2 }
20002 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20003     if ($2 > maxsig) { maxsig = $2 }
20004     if (sig_name[$2]) {
20005         dup_name[ndups] = $1
20006         dup_num[ndups] = $2
20007         ndups++ 
20008     }
20009     else {
20010         sig_name[$2] = $1
20011         sig_num[$2] = $2
20012     }
20013 }
20014 END { 
20015     if (nsig == 0) {
20016         nsig = maxsig + 1
20017     }
20018     printf("NSIG %d\n", nsig);
20019     for (n = 1; n < nsig; n++) {
20020         if (sig_name[n]) {
20021             printf("%s %d\n", sig_name[n], sig_num[n])
20022         }
20023         else {
20024             printf("NUM%d %d\n", n, n) 
20025         }
20026     }
20027     for (n = 0; n < ndups; n++) {
20028         printf("%s %d\n", dup_name[n], dup_num[n])
20029     }
20030 }
20031 EOP
20032 $cat >signal_cmd <<EOS
20033 $startsh
20034 if $test -s signal.lst; then
20035     echo "Using your existing signal.lst file"
20036         exit 0
20037 fi
20038 xxx="$xxx"
20039 EOS
20040 $cat >>signal_cmd <<'EOS'
20041
20042 set signal
20043 if eval $compile_ok; then
20044         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20045 else
20046         echo "(I can't seem be able to compile the whole test program)" >&4
20047         echo "(I'll try it in little pieces.)" >&4
20048         set signal -DJUST_NSIG
20049         if eval $compile_ok; then
20050                 $run ./signal$_exe > signal.nsg
20051                 $cat signal.nsg
20052         else
20053                 echo "I can't seem to figure out how many signals you have." >&4
20054                 echo "Guessing 50." >&4
20055                 echo 'NSIG 50' > signal.nsg
20056         fi
20057         : Now look at all the signal names, one at a time.
20058         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20059                 $cat > signal.c <<EOCP
20060 #include <sys/types.h>
20061 #include <signal.h>
20062 #include <stdio.h>
20063 int main() {
20064 printf("$xx %d\n", SIG${xx});
20065 return 0;
20066 }
20067 EOCP
20068                 set signal
20069                 if eval $compile; then
20070                         echo "SIG${xx} found."
20071                         $run ./signal$_exe  >> signal.ls1
20072                 else
20073                         echo "SIG${xx} NOT found."
20074                 fi
20075         done
20076         if $test -s signal.ls1; then
20077                 $cat signal.nsg signal.ls1 |
20078                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20079         fi
20080
20081 fi
20082 if $test -s signal.lst; then
20083         :
20084 else
20085         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20086         echo 'kill -l' >signal
20087         set X `csh -f <signal`
20088         $rm -f signal
20089         shift
20090         case $# in
20091         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20092         esac
20093         echo $@ | $tr ' ' $trnl | \
20094             $awk '{ printf "%s %d\n", $1, ++s; }
20095                   END { printf "NSIG %d\n", ++s }' >signal.lst
20096 fi
20097 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20098 EOS
20099 chmod a+x signal_cmd
20100 $eunicefix signal_cmd
20101
20102 : generate list of signal names
20103 echo " "
20104 case "$sig_name_init" in
20105 '') doinit=yes ;;
20106 *)  case "$sig_num_init" in
20107     ''|*,*) doinit=yes ;;
20108     esac ;;
20109 esac
20110 case "$doinit" in
20111 yes)
20112         echo "Generating a list of signal names and numbers..." >&4
20113         . ./signal_cmd
20114         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20115         sig_name=`$awk 'BEGIN { printf "ZERO " }
20116                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20117         sig_num=`$awk  'BEGIN { printf "0 " }
20118                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20119         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20120                              !/^NSIG/   { printf "\"%s\", ", $1 }
20121                              END        { printf "0\n" }' signal.lst`
20122         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20123                              !/^NSIG/   { printf "%d, ", $2}
20124                              END        { printf "0\n"}' signal.lst`
20125         ;;
20126 esac
20127 echo "The following $sig_count signals are available:"
20128 echo " "
20129 echo $sig_name | $awk \
20130 'BEGIN { linelen = 0 }
20131 {
20132         for (i = 1; i <= NF; i++) {
20133                 name = "SIG" $i " "
20134                 linelen = linelen + length(name)
20135                 if (linelen > 70) {
20136                         printf "\n"
20137                         linelen = length(name)
20138                 }
20139                 printf "%s", name
20140         }
20141         printf "\n"
20142 }'
20143 sig_size=`echo $sig_name | awk '{print NF}'`
20144 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20145
20146 echo " "
20147 case "$sizetype" in
20148 *_t) zzz="$sizetype"    ;;
20149 *)   zzz="filesize"     ;;
20150 esac
20151 echo "Checking the size of $zzz..." >&4 
20152 cat > try.c <<EOCP
20153 #include <sys/types.h>
20154 #include <stdio.h>
20155 #$i_stdlib I_STDLIB
20156 #ifdef I_STDLIB
20157 #include <stdlib.h>
20158 #endif
20159 int main() {
20160     printf("%d\n", (int)sizeof($sizetype));
20161     exit(0);
20162 }
20163 EOCP
20164 set try
20165 if eval $compile_ok; then
20166         yyy=`$run ./try`
20167         case "$yyy" in
20168         '')     sizesize=4
20169                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20170                 ;;
20171         *)      sizesize=$yyy
20172                 echo "Your $zzz size is $sizesize bytes."
20173                 ;;
20174         esac
20175 else
20176         sizesize=4
20177         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20178 fi
20179
20180
20181 : check for socklen_t
20182 echo " "
20183 echo "Checking to see if you have socklen_t..." >&4
20184 $cat >try.c <<EOCP
20185 #include <sys/types.h>
20186 #$d_socket HAS_SOCKET
20187 #ifdef HAS_SOCKET
20188 #include <sys/socket.h>
20189 #endif
20190 int main() { socklen_t x = 16; }
20191 EOCP
20192 set try
20193 if eval $compile; then
20194         val="$define"
20195         echo "You have socklen_t."
20196 else
20197         val="$undef"
20198         echo "You do not have socklen_t."
20199         case "$sizetype" in
20200         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20201         esac
20202 fi
20203 $rm_try
20204 set d_socklen_t
20205 eval $setvar
20206
20207 : see if this is a socks.h system
20208 set socks.h i_socks
20209 eval $inhdr
20210
20211 : check for type of the size argument to socket calls
20212 case "$d_socket" in
20213 "$define")
20214         $cat <<EOM
20215
20216 Checking to see what type is the last argument of accept().
20217 EOM
20218         yyy=''
20219         case "$d_socklen_t" in
20220         "$define") yyy="$yyy socklen_t"
20221         esac
20222         yyy="$yyy $sizetype int long unsigned"
20223         for xxx in $yyy; do
20224                 case "$socksizetype" in
20225                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20226                         case "$usesocks" in
20227                         "$define")
20228                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20229                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20230                                         socksizetype="$xxx"
20231                                 fi
20232                                 ;;
20233                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20234                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20235                                         socksizetype="$xxx"
20236                                 fi
20237                                 ;;
20238                         esac
20239                         ;;
20240                 esac
20241         done
20242 : In case none of those worked, prompt the user.
20243         case "$socksizetype" in
20244         '')     rp='What is the type for socket address structure sizes?'
20245                 dflt='int'
20246                 . ./myread
20247                 socksizetype=$ans
20248                 ;;
20249         esac
20250         ;;
20251 *)      : no sockets, so pick relatively harmless default
20252         socksizetype='int'
20253         ;;
20254 esac
20255
20256 : see what type is used for signed size_t
20257 set ssize_t ssizetype int stdio.h sys/types.h
20258 eval $typedef
20259 dflt="$ssizetype"
20260 $cat > try.c <<EOM
20261 #include <stdio.h>
20262 #$i_stdlib I_STDLIB
20263 #ifdef I_STDLIB
20264 #include <stdlib.h>
20265 #endif
20266 #include <sys/types.h>
20267 #define Size_t $sizetype
20268 #define SSize_t $dflt
20269 int main()
20270 {
20271         if (sizeof(Size_t) == sizeof(SSize_t))
20272                 printf("$dflt\n");
20273         else if (sizeof(Size_t) == sizeof(int))
20274                 printf("int\n");
20275         else
20276                 printf("long\n");
20277         exit(0);
20278 }
20279 EOM
20280 echo " "
20281 set try
20282 if eval $compile_ok && $run ./try > /dev/null; then
20283         ssizetype=`$run ./try`
20284         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20285 else
20286         $cat >&4 <<EOM
20287 Help! I can't compile and run the ssize_t test program: please enlighten me!
20288 (This is probably a misconfiguration in your system or libraries, and
20289 you really ought to fix it.  Still, I'll try anyway.)
20290
20291 I need a type that is the same size as $sizetype, but is guaranteed to
20292 be signed.  Common values are ssize_t, int and long.
20293
20294 EOM
20295         rp="What signed type is the same size as $sizetype?"
20296         . ./myread
20297         ssizetype="$ans"
20298 fi
20299 $rm_try
20300
20301 : see what type of char stdio uses.
20302 echo " "
20303 echo '#include <stdio.h>' > stdio.c
20304 $cppstdin $cppminus < stdio.c > stdioh
20305 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20306         echo "Your stdio uses unsigned chars." >&4
20307         stdchar="unsigned char"
20308 else
20309         echo "Your stdio uses signed chars." >&4
20310         stdchar="char"
20311 fi
20312 $rm -f stdio.* stdioh
20313
20314 : see what type uids are declared as in the kernel
20315 echo " "
20316 echo "Looking for the type for user ids returned by getuid()."
20317 set uid_t uidtype xxx stdio.h sys/types.h
20318 eval $typedef
20319 case "$uidtype" in
20320 xxx)
20321         xxx=`./findhdr sys/user.h`
20322         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20323         case $1 in
20324         unsigned) dflt="$1 $2" ;;
20325         *) dflt="$1" ;;
20326         esac
20327         ;;
20328 *) dflt="$uidtype";;
20329 esac
20330 case "$uidtype" in
20331 uid_t)  echo "uid_t found." ;;
20332 *)      rp="What is the type for user ids returned by getuid()?"
20333         . ./myread
20334         uidtype="$ans"
20335         ;;
20336 esac
20337
20338 echo " "
20339 case "$uidtype" in
20340 *_t) zzz="$uidtype"     ;;
20341 *)   zzz="uid"          ;;
20342 esac
20343 echo "Checking the size of $zzz..." >&4 
20344 cat > try.c <<EOCP
20345 #include <sys/types.h>
20346 #include <stdio.h>
20347 #$i_stdlib I_STDLIB
20348 #ifdef I_STDLIB
20349 #include <stdlib.h>
20350 #endif
20351 int main() {
20352     printf("%d\n", (int)sizeof($uidtype));
20353     exit(0);
20354 }
20355 EOCP
20356 set try
20357 if eval $compile_ok; then
20358         yyy=`$run ./try`
20359         case "$yyy" in
20360         '')     uidsize=4
20361                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20362                 ;;
20363         *)      uidsize=$yyy
20364                 echo "Your $zzz is $uidsize bytes long."
20365                 ;;
20366         esac
20367 else
20368         uidsize=4
20369         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20370 fi
20371
20372 echo " "
20373 case "$uidtype" in
20374 *_t) zzz="$uidtype"     ;;
20375 *)   zzz="uid"          ;;
20376 esac
20377 echo "Checking the sign of $zzz..." >&4
20378 cat > try.c <<EOCP
20379 #include <sys/types.h>
20380 #include <stdio.h>
20381 int main() {
20382         $uidtype foo = -1;
20383         if (foo < 0)
20384                 printf("-1\n");
20385         else
20386                 printf("1\n");
20387 }
20388 EOCP
20389 set try
20390 if eval $compile; then
20391         yyy=`$run ./try`
20392         case "$yyy" in
20393         '')     uidsign=1
20394                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20395                 ;;
20396         *)      uidsign=$yyy
20397                 case "$uidsign" in
20398                  1) echo "Your $zzz is unsigned." ;;
20399                 -1) echo "Your $zzz is signed."   ;;
20400                 esac
20401                 ;;
20402         esac
20403 else
20404         uidsign=1
20405         echo "(I can't compile the test program--guessing unsigned.)" >&4
20406 fi
20407
20408
20409
20410 echo " "
20411 $echo "Checking the format string to be used for uids..." >&4
20412
20413 case "$uidsign" in
20414 -1)     if $test X"$uidsize" = X"$ivsize"; then
20415                 uidformat="$ivdformat"
20416         else
20417                 if $test X"$uidsize" = X"$longsize"; then
20418                         uidformat='"ld"'
20419                 else
20420                         if $test X"$uidsize" = X"$intsize"; then
20421                                 uidformat='"d"'
20422                         else
20423                                 if $test X"$uidsize" = X"$shortsize"; then
20424                                         uidformat='"hd"'
20425                                 fi
20426                         fi
20427                 fi
20428         fi
20429         ;;
20430 *)      if $test X"$uidsize" = X"$uvsize"; then
20431                 uidformat="$uvuformat"
20432         else
20433                 if $test X"$uidsize" = X"$longsize"; then
20434                         uidformat='"lu"'
20435                 else
20436                         if $test X"$uidsize" = X"$intsize"; then
20437                                 uidformat='"u"'
20438                         else
20439                                 if $test X"$uidsize" = X"$shortsize"; then
20440                                         uidformat='"hu"'
20441                                 fi
20442                         fi
20443                 fi
20444         fi
20445         ;;
20446 esac
20447
20448
20449 case "$usesitecustomize" in
20450     $define|true|[Yy]*)
20451         usesitecustomize="$define"
20452         ;;
20453     *)
20454         usesitecustomize="$undef"
20455         ;;
20456     esac
20457
20458 : determine compiler compiler
20459 case "$yacc" in
20460 '')
20461         dflt=yacc;;
20462 *)
20463         dflt="$yacc";;
20464 esac
20465 echo " "
20466 comp='yacc'
20467 if $test -f "$byacc$_exe"; then
20468         dflt="$byacc"
20469         comp="byacc or $comp"
20470 fi
20471 if $test -f "$bison$_exe"; then
20472         comp="$comp or bison -y"
20473 fi
20474 rp="Which compiler compiler ($comp) shall I use?"
20475 . ./myread
20476 yacc="$ans"
20477 case "$yacc" in
20478 *bis*)
20479         case "$yacc" in
20480         *-y*) ;;
20481         *)
20482                 yacc="$yacc -y"
20483                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20484                 ;;
20485         esac
20486         ;;
20487 esac
20488
20489 : see if this is a fp.h system
20490 set fp.h i_fp
20491 eval $inhdr
20492
20493 : see if this is a fp_class.h system
20494 set fp_class.h i_fp_class
20495 eval $inhdr
20496
20497 : see if gdbm.h is available
20498 set gdbm.h t_gdbm
20499 eval $inhdr
20500 case "$t_gdbm" in
20501 $define)
20502         : see if gdbm_open exists
20503         set gdbm_open d_gdbm_open
20504         eval $inlibc
20505         case "$d_gdbm_open" in
20506         $undef)
20507                 t_gdbm="$undef"
20508                 echo "We won't be including <gdbm.h>"
20509                 ;;
20510         esac
20511         ;;
20512 esac
20513 val="$t_gdbm"
20514 set i_gdbm
20515 eval $setvar
20516
20517 : see if this is a ieeefp.h system
20518 case "$i_ieeefp" in
20519 '' ) set ieeefp.h i_ieeefp
20520      eval $inhdr
20521      ;;
20522 esac
20523
20524 : see if this is a libutil.h system
20525 set libutil.h i_libutil
20526 eval $inhdr
20527
20528 : see if mach cthreads are available
20529 if test "X$usethreads" = "X$define"; then
20530         set mach/cthreads.h i_machcthr
20531         eval $inhdr
20532 else
20533         i_machcthr="$undef"
20534 fi
20535
20536
20537
20538 : see if this is a mntent.h system
20539 set mntent.h i_mntent
20540 eval $inhdr
20541
20542 : see if ndbm.h is available
20543 set ndbm.h t_ndbm
20544 eval $inhdr
20545
20546 case "$t_ndbm" in
20547 $undef)
20548     # Some Linux distributions such as RedHat 7.1 put the
20549     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20550     if $test -f /usr/include/gdbm/ndbm.h; then
20551         echo '<gdbm/ndbm.h> found.'
20552         ccflags="$ccflags -I/usr/include/gdbm"
20553         cppflags="$cppflags -I/usr/include/gdbm"
20554         t_ndbm=$define
20555     fi
20556     ;;
20557 esac
20558
20559 case "$t_ndbm" in
20560 $define)
20561         : see if dbm_open exists
20562         set dbm_open d_dbm_open
20563         eval $inlibc
20564         case "$d_dbm_open" in
20565         $undef)
20566                 t_ndbm="$undef"
20567                 echo "We won't be including <ndbm.h>"
20568                 ;;
20569         esac
20570         ;;
20571 esac
20572 val="$t_ndbm"
20573 set i_ndbm
20574 eval $setvar
20575
20576 : see if net/errno.h is available
20577 val=''
20578 set net/errno.h val
20579 eval $inhdr
20580
20581 : Unfortunately, it causes problems on some systems.  Arrgh.
20582 case "$val" in
20583 $define)
20584         cat > try.c <<'EOM'
20585 #include <stdio.h>
20586 #include <errno.h>
20587 #include <net/errno.h>
20588 int func()
20589 {
20590         return ENOTSOCK;
20591 }
20592 EOM
20593         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20594                 echo "We'll be including <net/errno.h>." >&4
20595         else
20596                 echo "We won't be including <net/errno.h>." >&4
20597                 val="$undef"
20598         fi
20599         $rm_try
20600         ;;
20601 esac
20602 set i_neterrno
20603 eval $setvar
20604
20605 : see if netinet/tcp.h is available
20606 set netinet/tcp.h i_netinettcp
20607 eval $inhdr
20608
20609 : see if this is a poll.h system
20610 set poll.h i_poll
20611 eval $inhdr
20612
20613 : see if this is a prot.h system
20614 set prot.h i_prot
20615 eval $inhdr
20616
20617 echo " "
20618 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20619 $cat <<'EOSH' > Cppsym.know
20620 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20621 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20622 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20623 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20624 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20625 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20626 bull c cadmus clipper CMU COFF COMPILER_VERSION
20627 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20628 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20629 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20630 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20631 GLIBC GLIBC_MINOR
20632 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20633 H3050R H3050RX hbullx20 hcx host_mips
20634 hp200 hp300 hp700 HP700 hp800 hp9000
20635 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20636 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20637 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20638 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20639 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20640 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20641 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20642 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20643 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20644 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20645 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20646 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20647 MATH_HAS_NO_SIDE_EFFECTS
20648 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20649 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20650 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20651 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20652 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20653 NetBSD news1500 news1700 news1800 news1900 news3700
20654 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20655 ns32016 ns32332 ns32k nsc32000
20656 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20657 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20658 pc532 pdp11 PGC PIC plexus PORTAR posix
20659 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20660 POSIX_C_SOURCE POSIX_SOURCE POWER
20661 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20662 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20663 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20664 sony sony_news sonyrisc sparc sparclite spectrum
20665 stardent stdc STDC_EXT stratos sun sun3 sun386
20666 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20667 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20668 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20669 sysV68 sysV88 Tek4132 Tek4300 titan
20670 TM3200 TM5400 TM5600
20671 tower tower32 tower32_200 tower32_600 tower32_700
20672 tower32_800 tower32_850 tss
20673 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20674 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20675 unix UNIX95 UNIX99 unixpc unos
20676 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20677 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20678 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20679 USGr4 USGr4_2
20680 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20681 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20682 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20683 z8000
20684 EOSH
20685 # Maybe put other stuff here too.
20686 cat <<EOSH >>Cppsym.know
20687 $osname
20688 EOSH
20689 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20690 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20691 $cat Cppsym.know > Cppsym.c
20692 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20693 $rm -f Cppsym.a Cppsym.b Cppsym.c
20694 cat <<EOSH > Cppsym
20695 $startsh
20696 if $test \$# -gt 0; then
20697     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20698     if $test -s Cppsym.got; then
20699         $rm -f Cppsym.got
20700         exit 0
20701     fi
20702     $rm -f Cppsym.got
20703     exit 1
20704 else
20705     $tr " " "$trnl" | ./Cppsym.try
20706     exit 0
20707 fi
20708 EOSH
20709 chmod +x Cppsym
20710 $eunicefix Cppsym
20711 cat <<EOSH > Cppsym.try
20712 $startsh
20713 cat <<'EOCP' > try.c
20714 #include <stdio.h>
20715 #if cpp_stuff == 1
20716 #define STRINGIFY(a)    "a"
20717 #endif
20718 #if cpp_stuff == 42
20719 #define StGiFy(a)  #a
20720 #define STRINGIFY(a)    StGiFy(a)
20721 #endif
20722 #if $cpp_stuff != 1 && $cpp_stuff != 42
20723 #   include "Bletch: How does this C preprocessor stringify macros?"
20724 #endif
20725 int main() {
20726 EOCP
20727 $awk \\
20728 EOSH
20729 cat <<'EOSH' >> Cppsym.try
20730 'length($1) > 0 {
20731     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20732     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20733     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20734     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20735 }'       >> try.c
20736 echo 'return 0;}' >> try.c
20737 EOSH
20738 cat <<EOSH >> Cppsym.try
20739 ccflags="$ccflags"
20740 case "$osname-$gccversion" in
20741 irix-) ccflags="\$ccflags -woff 1178" ;;
20742 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20743 esac
20744 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20745 EOSH
20746 chmod +x Cppsym.try
20747 $eunicefix Cppsym.try
20748 ./Cppsym < Cppsym.know > Cppsym.true
20749 : Add in any linux cpp "predefined macros":
20750 case "$osname::$gccversion" in
20751   *linux*::*.*)
20752     tHdrH=_tmpHdr
20753     rm -f $tHdrH'.h' $tHdrH
20754     touch $tHdrH'.h'
20755     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20756        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20757        if [ -s $tHdrH'_cppsym.real' ]; then
20758           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20759        fi
20760     fi
20761     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20762   ;;
20763 esac
20764 : now check the C compiler for additional symbols
20765 postprocess_cc_v=''
20766 case "$osname" in
20767 aix) postprocess_cc_v="|$tr , ' '" ;;
20768 esac
20769 $cat >ccsym <<EOS
20770 $startsh
20771 $cat >tmp.c <<EOF
20772 extern int foo;
20773 EOF
20774 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20775 do
20776         case "\$i" in
20777         -D*) echo "\$i" | $sed 's/^-D//';;
20778         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20779         esac
20780 done
20781 $rm_try
20782 EOS
20783 postprocess_cc_v=''
20784 chmod +x ccsym
20785 $eunicefix ccsym
20786 ./ccsym > ccsym1.raw
20787 if $test -s ccsym1.raw; then
20788        $sort ccsym1.raw | $uniq >ccsym.raw
20789 else
20790        mv ccsym1.raw ccsym.raw
20791 fi
20792
20793 $awk '/\=/ { print $0; next }
20794         { print $0"=1" }' ccsym.raw >ccsym.list
20795 $comm -13 Cppsym.true ccsym.list >ccsym.own
20796 $comm -12 Cppsym.true ccsym.list >ccsym.com
20797 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20798 also=''
20799 if $test -z ccsym.raw; then
20800         echo "Your C compiler doesn't seem to define any symbols!" >&4
20801         echo " "
20802         echo "However, your C preprocessor defines the following symbols:"
20803         $cat Cppsym.true
20804         ccsymbols=''
20805         cppsymbols=`$cat Cppsym.true`
20806         cppsymbols=`echo $cppsymbols`
20807         cppccsymbols="$cppsymbols"
20808 else
20809         if $test -s ccsym.com; then
20810                 echo "Your C compiler and pre-processor define these symbols:"
20811                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20812                 also='also '
20813                 symbols='ones'
20814                 cppccsymbols=`$cat ccsym.com`
20815                 cppccsymbols=`echo $cppccsymbols`
20816                 $test "$silent" || sleep 1
20817         fi
20818         if $test -s ccsym.cpp; then
20819                 $test "$also" && echo " "
20820                 echo "Your C pre-processor ${also}defines the following symbols:"
20821                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20822                 also='further '
20823                 cppsymbols=`$cat ccsym.cpp`
20824                 cppsymbols=`echo $cppsymbols`
20825                 $test "$silent" || sleep 1
20826         fi
20827         if $test -s ccsym.own; then
20828                 $test "$also" && echo " "
20829                 echo "Your C compiler ${also}defines the following cpp symbols:"
20830                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20831                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20832                 ccsymbols=`$cat ccsym.own`
20833                 ccsymbols=`echo $ccsymbols`
20834                 $test "$silent" || sleep 1
20835         fi
20836 fi
20837
20838 : see if this is a termio system
20839 val="$undef"
20840 val2="$undef"
20841 val3="$undef"
20842 if $test `./findhdr termios.h`; then
20843         set tcsetattr i_termios
20844         eval $inlibc
20845         val3="$i_termios"
20846 fi
20847 echo " "
20848 case "$val3" in
20849 "$define") echo "You have POSIX termios.h... good!" >&4;;
20850 *) if ./Cppsym pyr; then
20851                 case "`/bin/universe`" in
20852                 ucb) if $test `./findhdr sgtty.h`; then
20853                                 val2="$define"
20854                                 echo "<sgtty.h> found." >&4
20855                         else
20856                                 echo "System is pyramid with BSD universe."
20857                                 echo "<sgtty.h> not found--you could have problems." >&4
20858                         fi;;
20859                 *) if $test `./findhdr termio.h`; then
20860                                 val="$define"
20861                                 echo "<termio.h> found." >&4
20862                         else
20863                                 echo "System is pyramid with USG universe."
20864                                 echo "<termio.h> not found--you could have problems." >&4
20865                         fi;;
20866                 esac
20867         elif ./usg; then
20868                 if $test `./findhdr termio.h`; then
20869                         echo "<termio.h> found." >&4
20870                         val="$define"
20871                 elif $test `./findhdr sgtty.h`; then
20872                         echo "<sgtty.h> found." >&4
20873                         val2="$define"
20874                 else
20875 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20876                 fi
20877         else
20878                 if $test `./findhdr sgtty.h`; then
20879                         echo "<sgtty.h> found." >&4
20880                         val2="$define"
20881                 elif $test `./findhdr termio.h`; then
20882                         echo "<termio.h> found." >&4
20883                         val="$define"
20884                 else
20885 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20886                 fi
20887         fi;;
20888 esac
20889 set i_termio; eval $setvar
20890 val=$val2; set i_sgtty; eval $setvar
20891 val=$val3; set i_termios; eval $setvar
20892
20893 : see if stddef is available
20894 set stddef.h i_stddef
20895 eval $inhdr
20896
20897 : see if sys/access.h is available
20898 set sys/access.h i_sysaccess
20899 eval $inhdr
20900
20901 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20902 set sys/filio.h i_sysfilio
20903 eval $inhdr
20904 echo " "
20905 if $test `./findhdr sys/ioctl.h`; then
20906         val="$define"
20907         echo '<sys/ioctl.h> found.' >&4
20908 else
20909         val="$undef"
20910         if $test $i_sysfilio = "$define"; then
20911             echo '<sys/ioctl.h> NOT found.' >&4
20912         else
20913                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20914                 $test $i_termio = "$define" && xxx="termio.h"
20915                 $test $i_termios = "$define" && xxx="termios.h"
20916 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20917         fi
20918 fi
20919 set i_sysioctl
20920 eval $setvar
20921
20922 : see if socket ioctl defs are in sys/sockio.h
20923 echo " "
20924 xxx=`./findhdr sys/sockio.h`
20925 if $test "$xxx"; then
20926         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20927                 val="$define"
20928                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20929         else
20930                 val="$undef"
20931                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20932         fi
20933 else
20934         val="$undef"
20935         $cat <<EOM
20936 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20937 EOM
20938 fi
20939 set i_syssockio
20940 eval $setvar
20941
20942
20943 : see if this is a syslog.h system
20944 set syslog.h i_syslog
20945 eval $inhdr
20946
20947
20948 : see if this is a sys/mode.h system
20949 set sys/mode.h i_sysmode
20950 eval $inhdr
20951
20952 : see if sys/resource.h has to be included
20953 set sys/resource.h i_sysresrc
20954 eval $inhdr
20955
20956 : see if sys/security.h is available
20957 set sys/security.h i_syssecrt
20958 eval $inhdr
20959
20960 : see if this is a sys/statvfs.h system
20961 set sys/statvfs.h i_sysstatvfs
20962 eval $inhdr
20963
20964 : see if this is a sys/un.h system
20965 set sys/un.h i_sysun
20966 eval $inhdr
20967
20968
20969 : see if this is a sys/utsname.h system
20970 set sys/utsname.h i_sysutsname
20971 eval $inhdr
20972
20973 : see if this is a syswait system
20974 set sys/wait.h i_syswait
20975 eval $inhdr
20976
20977 : see if this is a ustat.h system
20978 set ustat.h i_ustat
20979 eval $inhdr
20980
20981 : see if this is an utime system
20982 set utime.h i_utime
20983 eval $inhdr
20984
20985 : see if this is a values.h system
20986 set values.h i_values
20987 eval $inhdr
20988
20989 : see if this is a vfork system
20990 case "$d_vfork" in
20991 "$define")
20992         set vfork.h i_vfork
20993         eval $inhdr
20994         ;;
20995 *)
20996         i_vfork="$undef"
20997         ;;
20998 esac
20999
21000 echo " "
21001 echo "Looking for extensions..." >&4
21002 : If we are using the old config.sh, known_extensions may contain
21003 : old or inaccurate or duplicate values.
21004 known_extensions=''
21005 nonxs_extensions=''
21006 : We do not use find because it might not be available.
21007 : We do not just use MANIFEST because the user may have dropped
21008 : some additional extensions into the source tree and expect them
21009 : to be built.
21010
21011 : Function to recursively find available extensions, ignoring DynaLoader
21012 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21013 find_extensions='
21014     for xxx in *; do
21015         case "$xxx" in
21016             DynaLoader|dynaload) ;;
21017             *)
21018             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21019                 known_extensions="$known_extensions $1$xxx";
21020             elif $test -f $xxx/Makefile.PL; then
21021                 nonxs_extensions="$nonxs_extensions $1$xxx";
21022             else
21023                 if $test -d $xxx -a $# -lt 10; then
21024                     set $1$xxx/ $*;
21025                     cd "$xxx";
21026                     eval $find_extensions;
21027                     cd ..;
21028                     shift;
21029                 fi;
21030             fi
21031             ;;
21032         esac;
21033     done'
21034 tdir=`pwd`
21035 cd "$rsrc/ext"
21036 set X
21037 shift
21038 eval $find_extensions
21039 # Special case:  Add in threads/shared since it is not picked up by the
21040 # recursive find above (and adding in general recursive finding breaks
21041 # SDBM_File/sdbm).  A.D.  10/25/2001.
21042 known_extensions="$known_extensions threads/shared"
21043 set X $known_extensions
21044 shift
21045 known_extensions="$*"
21046 set X $nonxs_extensions
21047 shift
21048 nonxs_extensions="$*"
21049 cd "$tdir"
21050
21051 : Now see which are supported on this system.
21052 avail_ext=''
21053 for xxx in $known_extensions ; do
21054         case "$xxx" in
21055         DB_File|db_file)
21056                 case "$i_db" in
21057                 $define) avail_ext="$avail_ext $xxx" ;;
21058                 esac
21059                 ;;
21060         GDBM_File|gdbm_fil)
21061                 case "$i_gdbm" in
21062                 $define) avail_ext="$avail_ext $xxx" ;;
21063                 esac
21064                 ;;
21065         I18N/Langinfo|i18n_lan)
21066                 case "$i_langinfo$d_nl_langinfo" in
21067                 $define$define) avail_ext="$avail_ext $xxx" ;;
21068                 esac
21069                 ;;
21070         NDBM_File|ndbm_fil)
21071                 case "$i_ndbm" in
21072                 $define)
21073                     case "$osname-$use64bitint" in
21074                     hpux-define)
21075                         case "$libs" in
21076                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21077                         esac
21078                         ;;
21079                     *) avail_ext="$avail_ext $xxx" ;;
21080                     esac
21081                     ;;
21082                 esac
21083                 ;;
21084         ODBM_File|odbm_fil)
21085                 case "${i_dbm}${i_rpcsvcdbm}" in
21086                 *"${define}"*)
21087                     case "$osname-$use64bitint" in
21088                     hpux-define)
21089                         case "$libs" in
21090                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21091                         esac
21092                         ;;
21093                     *) avail_ext="$avail_ext $xxx" ;;
21094                     esac
21095                     ;;
21096                 esac
21097                 ;;
21098         POSIX|posix)
21099                 case "$useposix" in
21100                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21101                 esac
21102                 ;;
21103         Opcode|opcode)
21104                 case "$useopcode" in
21105                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21106                 esac
21107                 ;;
21108         Socket|socket)
21109                 case "$d_socket" in
21110                 true|$define|y)
21111                     case "$osname" in
21112                     beos) ;; # not unless BONE
21113                     *) avail_ext="$avail_ext $xxx" ;;
21114                     esac
21115                     ;;
21116                 esac
21117                 ;;
21118         Sys/Syslog|sys/syslog)
21119                 : XXX syslog requires socket
21120                 case "$d_socket" in
21121                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21122                 esac
21123                 ;;
21124         Thread|thread)
21125                 case "$usethreads" in
21126                 true|$define|y)
21127                         case "$use5005threads" in
21128                             $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21129                         esac
21130                 esac
21131                 ;;
21132         Win32*)
21133                 case "$osname" in
21134                 cygwin) avail_ext="$avail_ext $xxx" ;;
21135                 esac
21136                 ;;
21137         XS/APItest|xs/apitest)
21138                 # This is just for testing.  Skip it unless we have dynamic loading.
21139
21140                 case "$usedl" in
21141                 $define) avail_ext="$avail_ext $xxx" ;;
21142                 esac
21143                 ;;
21144         XS/Typemap|xs/typemap)
21145                 # This is just for testing.  Skip it unless we have dynamic loading.
21146                 case "$usedl" in
21147                 $define) avail_ext="$avail_ext $xxx" ;;
21148                 esac
21149                 ;;
21150         threads|threads/shared)
21151                 # threads and threads::shared are special cases.
21152                 # To stop people from asking "Perl 5.8.0 was supposed
21153                 # to have this new fancy threads implementation but my
21154                 # perl doesn't have it" and from people trying to
21155                 # (re)install the threads module using CPAN.pm and
21156                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21157                 # the threads.pm and threads/shared.pm will always be
21158                 # there, croaking informatively ("you need to rebuild
21159                 # all of Perl with threads, sorry") when threads haven't
21160                 # been compiled in.
21161                 # --jhi
21162                 avail_ext="$avail_ext $xxx"
21163                 ;;
21164         IPC/SysV|ipc/sysv)
21165                 : XXX Do we need a useipcsysv variable here
21166                 case "${d_msg}${d_sem}${d_shm}" in
21167                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21168                 esac
21169                 ;;
21170         *)      avail_ext="$avail_ext $xxx"
21171                 ;;
21172         esac
21173 done
21174
21175 set X $avail_ext
21176 shift
21177 avail_ext="$*"
21178
21179 case "$onlyextensions" in
21180 '') ;;
21181 *)  keepextensions=''
21182     echo "You have requested that only certains extensions be included..." >&4
21183     for i in $onlyextensions; do
21184         case " $avail_ext " in
21185         *" $i "*)
21186             echo "Keeping extension $i."
21187             keepextensions="$keepextensions $i"
21188             ;;
21189         *) echo "Ignoring extension $i." ;;
21190         esac
21191     done
21192     avail_ext="$keepextensions"
21193     ;;
21194 esac
21195
21196 case "$noextensions" in
21197 '') ;;
21198 *)  keepextensions=''
21199     echo "You have requested that certain extensions be ignored..." >&4
21200     for i in $avail_ext; do
21201         case " $noextensions " in
21202         *" $i "*) echo "Ignoring extension $i." ;;
21203         *) echo "Keeping extension $i.";
21204            keepextensions="$keepextensions $i"
21205            ;;
21206         esac
21207     done
21208     avail_ext="$keepextensions"
21209     ;;
21210 esac
21211
21212 : Now see which nonxs extensions are supported on this system.
21213 : For now assume all are.
21214 nonxs_ext=''
21215 for xxx in $nonxs_extensions ; do
21216         case "$xxx" in
21217         *)      nonxs_ext="$nonxs_ext $xxx"
21218                 ;;
21219         esac
21220 done
21221
21222 set X $nonxs_ext
21223 shift
21224 nonxs_ext="$*"
21225
21226 case $usedl in
21227 $define)
21228         $cat <<EOM
21229 A number of extensions are supplied with $package.  You may choose to
21230 compile these extensions for dynamic loading (the default), compile
21231 them into the $package executable (static loading), or not include
21232 them at all.  Answer "none" to include no extensions.
21233 Note that DynaLoader is always built and need not be mentioned here.
21234
21235 EOM
21236         case "$dynamic_ext" in
21237         '')
21238                 : Exclude those listed in static_ext
21239                 dflt=''
21240                 for xxx in $avail_ext; do
21241                         case " $static_ext " in
21242                         *" $xxx "*) ;;
21243                         *) dflt="$dflt $xxx" ;;
21244                         esac
21245                 done
21246                 set X $dflt
21247                 shift
21248                 dflt="$*"
21249                 ;;
21250         *)      dflt="$dynamic_ext"
21251                 # Perhaps we are reusing an old out-of-date config.sh.
21252                 case "$hint" in
21253                 previous)
21254                         if test X"$dynamic_ext" != X"$avail_ext"; then
21255                                 $cat <<EOM
21256 NOTICE:  Your previous config.sh list may be incorrect.
21257 The extensions now available to you are
21258         ${avail_ext}
21259 but the default list from your previous config.sh is
21260         ${dynamic_ext}
21261
21262 EOM
21263                         fi
21264                         ;;
21265                 esac
21266                 ;;
21267         esac
21268         case "$dflt" in
21269         '')     dflt=none;;
21270         esac
21271         rp="What extensions do you wish to load dynamically?"
21272         . ./myread
21273         case "$ans" in
21274         none) dynamic_ext=' ' ;;
21275         *) dynamic_ext="$ans" ;;
21276         esac
21277
21278         case "$static_ext" in
21279         '')
21280                 : Exclude those already listed in dynamic linking
21281                 dflt=''
21282                 for xxx in $avail_ext; do
21283                         case " $dynamic_ext " in
21284                         *" $xxx "*) ;;
21285                         *) dflt="$dflt $xxx" ;;
21286                         esac
21287                 done
21288                 set X $dflt
21289                 shift
21290                 dflt="$*"
21291                 ;;
21292         *)  dflt="$static_ext"
21293                 ;;
21294         esac
21295
21296         case "$dflt" in
21297         '')     dflt=none;;
21298         esac
21299         rp="What extensions do you wish to load statically?"
21300         . ./myread
21301         case "$ans" in
21302         none) static_ext=' ' ;;
21303         *) static_ext="$ans" ;;
21304         esac
21305         ;;
21306 *)
21307         $cat <<EOM
21308 A number of extensions are supplied with $package.  Answer "none"
21309 to include no extensions.
21310 Note that DynaLoader is always built and need not be mentioned here.
21311
21312 EOM
21313         case "$static_ext" in
21314         '') dflt="$avail_ext" ;;
21315         *)      dflt="$static_ext"
21316                 # Perhaps we are reusing an old out-of-date config.sh.
21317                 case "$hint" in
21318                 previous)
21319                         if test X"$static_ext" != X"$avail_ext"; then
21320                                 $cat <<EOM
21321 NOTICE:  Your previous config.sh list may be incorrect.
21322 The extensions now available to you are
21323         ${avail_ext}
21324 but the default list from your previous config.sh is
21325         ${static_ext}
21326
21327 EOM
21328                         fi
21329                         ;;
21330                 esac
21331                 ;;
21332         esac
21333         : Exclude those that are not xs extensions
21334         case "$dflt" in
21335         '')     dflt=none;;
21336         esac
21337         rp="What extensions do you wish to include?"
21338         . ./myread
21339         case "$ans" in
21340         none) static_ext=' ' ;;
21341         *) static_ext="$ans" ;;
21342         esac
21343         ;;
21344 esac
21345 #
21346 # Encode is a special case.  If we are building Encode as a static
21347 # extension, we need to explicitly list its subextensions as well.
21348 # For other nested extensions, this is handled automatically by
21349 # the appropriate Makefile.PL.
21350 case " $static_ext " in
21351         *" Encode "*) # Add the subextensions of Encode
21352         cd "$rsrc/ext"
21353         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21354                 static_ext="$static_ext Encode/$xxx"
21355         done
21356         cd "$tdir"
21357         ;;
21358 esac
21359
21360 set X $dynamic_ext $static_ext $nonxs_ext
21361 shift
21362 extensions="$*"
21363
21364 # Sanity check:  We require an extension suitable for use with
21365 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21366 # should show up as failures in the test suite, but it's helpful to
21367 # catch them now.) The 'extensions' list is normally sorted
21368 # alphabetically, so we need to accept either
21369 #    DB_File ... Fcntl ... IO  ....
21370 # or something like
21371 #    Fcntl ... NDBM_File ... IO  ....
21372 case " $extensions"  in
21373 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21374 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21375 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21376 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21377    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21378    ;;
21379 esac
21380
21381 : Remove libraries needed only for extensions
21382 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21383 : The exception is SunOS 4.x, which needs them.
21384 case "${osname}X${osvers}" in
21385 sunos*X4*)
21386     perllibs="$libs"
21387     ;;
21388 *) case "$usedl" in
21389     $define|true|[yY]*)
21390             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21391             shift
21392             perllibs="$*"
21393             ;;
21394     *)  perllibs="$libs"
21395             ;;
21396     esac
21397     ;;
21398 esac
21399
21400 : Remove build directory name from cppstdin so it can be used from
21401 : either the present location or the final installed location.
21402 echo " "
21403 : Get out of the UU directory to get correct path name.
21404 cd ..
21405 case "$cppstdin" in
21406 `pwd`/cppstdin)
21407         echo "Stripping down cppstdin path name"
21408         cppstdin=cppstdin
21409         ;;
21410 esac
21411 cd UU
21412
21413 : end of configuration questions
21414 echo " "
21415 echo "End of configuration questions."
21416 echo " "
21417
21418 : back to where it started
21419 if test -d ../UU; then
21420         cd ..
21421 fi
21422
21423 : configuration may be patched via a 'config.arch' file
21424 if $test -f config.arch; then
21425         echo "I see a config.arch file, loading it."
21426         . ./config.arch
21427 fi
21428
21429 : configuration may be patched via a 'config.over' file
21430 if $test -f config.over; then
21431         echo " "
21432         dflt=y
21433         rp='I see a config.over file.  Do you wish to load it?'
21434         . UU/myread
21435         case "$ans" in
21436         n*) echo "OK, I'll ignore it.";;
21437         *)      . ./config.over
21438                 echo "Configuration override changes have been loaded."
21439                 ;;
21440         esac
21441 fi
21442
21443 : in case they want portability, strip down executable paths
21444 case "$d_portable" in
21445 "$define")
21446         echo " "
21447         echo "Stripping down executable paths..." >&4
21448         for file in $loclist $trylist; do
21449                 eval temp=\$$file
21450                 eval $file=`basename $temp`
21451         done
21452         ;;
21453 esac
21454
21455 : create config.sh file
21456 echo " "
21457 echo "Creating config.sh..." >&4
21458 $spitshell <<EOT >config.sh
21459 $startsh
21460 #
21461 # This file was produced by running the Configure script. It holds all the
21462 # definitions figured out by Configure. Should you modify one of these values,
21463 # do not forget to propagate your changes by running "Configure -der". You may
21464 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21465 #
21466
21467 # Package name      : $package
21468 # Source directory  : $src
21469 # Configuration time: $cf_time
21470 # Configured by     : $cf_by
21471 # Target system     : $myuname
21472
21473 Author='$Author'
21474 Date='$Date'
21475 Header='$Header'
21476 Id='$Id'
21477 Locker='$Locker'
21478 Log='$Log'
21479 Mcc='$Mcc'
21480 RCSfile='$RCSfile'
21481 Revision='$Revision'
21482 Source='$Source'
21483 State='$State'
21484 _a='$_a'
21485 _exe='$_exe'
21486 _o='$_o'
21487 afs='$afs'
21488 afsroot='$afsroot'
21489 alignbytes='$alignbytes'
21490 ansi2knr='$ansi2knr'
21491 aphostname='$aphostname'
21492 api_revision='$api_revision'
21493 api_subversion='$api_subversion'
21494 api_version='$api_version'
21495 api_versionstring='$api_versionstring'
21496 ar='$ar'
21497 archlib='$archlib'
21498 archlibexp='$archlibexp'
21499 archname64='$archname64'
21500 archname='$archname'
21501 archobjs='$archobjs'
21502 asctime_r_proto='$asctime_r_proto'
21503 awk='$awk'
21504 baserev='$baserev'
21505 bash='$bash'
21506 bin='$bin'
21507 binexp='$binexp'
21508 bison='$bison'
21509 byacc='$byacc'
21510 byteorder='$byteorder'
21511 c='$c'
21512 castflags='$castflags'
21513 cat='$cat'
21514 cc='$cc'
21515 cccdlflags='$cccdlflags'
21516 ccdlflags='$ccdlflags'
21517 ccflags='$ccflags'
21518 ccflags_uselargefiles='$ccflags_uselargefiles'
21519 ccname='$ccname'
21520 ccsymbols='$ccsymbols'
21521 ccversion='$ccversion'
21522 cf_by='$cf_by'
21523 cf_email='$cf_email'
21524 cf_time='$cf_time'
21525 charsize='$charsize'
21526 chgrp='$chgrp'
21527 chmod='$chmod'
21528 chown='$chown'
21529 clocktype='$clocktype'
21530 comm='$comm'
21531 compress='$compress'
21532 contains='$contains'
21533 cp='$cp'
21534 cpio='$cpio'
21535 cpp='$cpp'
21536 cpp_stuff='$cpp_stuff'
21537 cppccsymbols='$cppccsymbols'
21538 cppflags='$cppflags'
21539 cpplast='$cpplast'
21540 cppminus='$cppminus'
21541 cpprun='$cpprun'
21542 cppstdin='$cppstdin'
21543 cppsymbols='$cppsymbols'
21544 crypt_r_proto='$crypt_r_proto'
21545 cryptlib='$cryptlib'
21546 csh='$csh'
21547 ctermid_r_proto='$ctermid_r_proto'
21548 ctime_r_proto='$ctime_r_proto'
21549 d_Gconvert='$d_Gconvert'
21550 d_PRIEUldbl='$d_PRIEUldbl'
21551 d_PRIFUldbl='$d_PRIFUldbl'
21552 d_PRIGUldbl='$d_PRIGUldbl'
21553 d_PRIXU64='$d_PRIXU64'
21554 d_PRId64='$d_PRId64'
21555 d_PRIeldbl='$d_PRIeldbl'
21556 d_PRIfldbl='$d_PRIfldbl'
21557 d_PRIgldbl='$d_PRIgldbl'
21558 d_PRIi64='$d_PRIi64'
21559 d_PRIo64='$d_PRIo64'
21560 d_PRIu64='$d_PRIu64'
21561 d_PRIx64='$d_PRIx64'
21562 d_SCNfldbl='$d_SCNfldbl'
21563 d__fwalk='$d__fwalk'
21564 d_access='$d_access'
21565 d_accessx='$d_accessx'
21566 d_aintl='$d_aintl'
21567 d_alarm='$d_alarm'
21568 d_archlib='$d_archlib'
21569 d_asctime_r='$d_asctime_r'
21570 d_atolf='$d_atolf'
21571 d_atoll='$d_atoll'
21572 d_attribute_format='$d_attribute_format'
21573 d_attribute_malloc='$d_attribute_malloc'
21574 d_attribute_nonnull='$d_attribute_nonnull'
21575 d_attribute_noreturn='$d_attribute_noreturn'
21576 d_attribute_pure='$d_attribute_pure'
21577 d_attribute_unused='$d_attribute_unused'
21578 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21579 d_bcmp='$d_bcmp'
21580 d_bcopy='$d_bcopy'
21581 d_bsd='$d_bsd'
21582 d_bsdgetpgrp='$d_bsdgetpgrp'
21583 d_bsdsetpgrp='$d_bsdsetpgrp'
21584 d_builtin_choose_expr='$d_builtin_choose_expr'
21585 d_builtin_expect='$d_builtin_expect'
21586 d_bzero='$d_bzero'
21587 d_c99_variadic_macros='$d_c99_variadic_macros'
21588 d_casti32='$d_casti32'
21589 d_castneg='$d_castneg'
21590 d_charvspr='$d_charvspr'
21591 d_chown='$d_chown'
21592 d_chroot='$d_chroot'
21593 d_chsize='$d_chsize'
21594 d_class='$d_class'
21595 d_clearenv='$d_clearenv'
21596 d_closedir='$d_closedir'
21597 d_cmsghdr_s='$d_cmsghdr_s'
21598 d_const='$d_const'
21599 d_copysignl='$d_copysignl'
21600 d_cplusplus='$d_cplusplus'
21601 d_crypt='$d_crypt'
21602 d_crypt_r='$d_crypt_r'
21603 d_csh='$d_csh'
21604 d_ctermid='$d_ctermid'
21605 d_ctermid_r='$d_ctermid_r'
21606 d_ctime_r='$d_ctime_r'
21607 d_cuserid='$d_cuserid'
21608 d_dbl_dig='$d_dbl_dig'
21609 d_dbminitproto='$d_dbminitproto'
21610 d_difftime='$d_difftime'
21611 d_dir_dd_fd='$d_dir_dd_fd'
21612 d_dirfd='$d_dirfd'
21613 d_dirnamlen='$d_dirnamlen'
21614 d_dlerror='$d_dlerror'
21615 d_dlopen='$d_dlopen'
21616 d_dlsymun='$d_dlsymun'
21617 d_dosuid='$d_dosuid'
21618 d_drand48_r='$d_drand48_r'
21619 d_drand48proto='$d_drand48proto'
21620 d_dup2='$d_dup2'
21621 d_eaccess='$d_eaccess'
21622 d_endgrent='$d_endgrent'
21623 d_endgrent_r='$d_endgrent_r'
21624 d_endhent='$d_endhent'
21625 d_endhostent_r='$d_endhostent_r'
21626 d_endnent='$d_endnent'
21627 d_endnetent_r='$d_endnetent_r'
21628 d_endpent='$d_endpent'
21629 d_endprotoent_r='$d_endprotoent_r'
21630 d_endpwent='$d_endpwent'
21631 d_endpwent_r='$d_endpwent_r'
21632 d_endsent='$d_endsent'
21633 d_endservent_r='$d_endservent_r'
21634 d_eofnblk='$d_eofnblk'
21635 d_eunice='$d_eunice'
21636 d_faststdio='$d_faststdio'
21637 d_fchdir='$d_fchdir'
21638 d_fchmod='$d_fchmod'
21639 d_fchown='$d_fchown'
21640 d_fcntl='$d_fcntl'
21641 d_fcntl_can_lock='$d_fcntl_can_lock'
21642 d_fd_macros='$d_fd_macros'
21643 d_fd_set='$d_fd_set'
21644 d_fds_bits='$d_fds_bits'
21645 d_fgetpos='$d_fgetpos'
21646 d_finite='$d_finite'
21647 d_finitel='$d_finitel'
21648 d_flexfnam='$d_flexfnam'
21649 d_flock='$d_flock'
21650 d_flockproto='$d_flockproto'
21651 d_fork='$d_fork'
21652 d_fp_class='$d_fp_class'
21653 d_fpathconf='$d_fpathconf'
21654 d_fpclass='$d_fpclass'
21655 d_fpclassify='$d_fpclassify'
21656 d_fpclassl='$d_fpclassl'
21657 d_fpos64_t='$d_fpos64_t'
21658 d_frexpl='$d_frexpl'
21659 d_fs_data_s='$d_fs_data_s'
21660 d_fseeko='$d_fseeko'
21661 d_fsetpos='$d_fsetpos'
21662 d_fstatfs='$d_fstatfs'
21663 d_fstatvfs='$d_fstatvfs'
21664 d_fsync='$d_fsync'
21665 d_ftello='$d_ftello'
21666 d_ftime='$d_ftime'
21667 d_futimes='$d_futimes'
21668 d_getcwd='$d_getcwd'
21669 d_getespwnam='$d_getespwnam'
21670 d_getfsstat='$d_getfsstat'
21671 d_getgrent='$d_getgrent'
21672 d_getgrent_r='$d_getgrent_r'
21673 d_getgrgid_r='$d_getgrgid_r'
21674 d_getgrnam_r='$d_getgrnam_r'
21675 d_getgrps='$d_getgrps'
21676 d_gethbyaddr='$d_gethbyaddr'
21677 d_gethbyname='$d_gethbyname'
21678 d_gethent='$d_gethent'
21679 d_gethname='$d_gethname'
21680 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21681 d_gethostbyname_r='$d_gethostbyname_r'
21682 d_gethostent_r='$d_gethostent_r'
21683 d_gethostprotos='$d_gethostprotos'
21684 d_getitimer='$d_getitimer'
21685 d_getlogin='$d_getlogin'
21686 d_getlogin_r='$d_getlogin_r'
21687 d_getmnt='$d_getmnt'
21688 d_getmntent='$d_getmntent'
21689 d_getnbyaddr='$d_getnbyaddr'
21690 d_getnbyname='$d_getnbyname'
21691 d_getnent='$d_getnent'
21692 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21693 d_getnetbyname_r='$d_getnetbyname_r'
21694 d_getnetent_r='$d_getnetent_r'
21695 d_getnetprotos='$d_getnetprotos'
21696 d_getpagsz='$d_getpagsz'
21697 d_getpbyname='$d_getpbyname'
21698 d_getpbynumber='$d_getpbynumber'
21699 d_getpent='$d_getpent'
21700 d_getpgid='$d_getpgid'
21701 d_getpgrp2='$d_getpgrp2'
21702 d_getpgrp='$d_getpgrp'
21703 d_getppid='$d_getppid'
21704 d_getprior='$d_getprior'
21705 d_getprotobyname_r='$d_getprotobyname_r'
21706 d_getprotobynumber_r='$d_getprotobynumber_r'
21707 d_getprotoent_r='$d_getprotoent_r'
21708 d_getprotoprotos='$d_getprotoprotos'
21709 d_getprpwnam='$d_getprpwnam'
21710 d_getpwent='$d_getpwent'
21711 d_getpwent_r='$d_getpwent_r'
21712 d_getpwnam_r='$d_getpwnam_r'
21713 d_getpwuid_r='$d_getpwuid_r'
21714 d_getsbyname='$d_getsbyname'
21715 d_getsbyport='$d_getsbyport'
21716 d_getsent='$d_getsent'
21717 d_getservbyname_r='$d_getservbyname_r'
21718 d_getservbyport_r='$d_getservbyport_r'
21719 d_getservent_r='$d_getservent_r'
21720 d_getservprotos='$d_getservprotos'
21721 d_getspnam='$d_getspnam'
21722 d_getspnam_r='$d_getspnam_r'
21723 d_gettimeod='$d_gettimeod'
21724 d_gmtime_r='$d_gmtime_r'
21725 d_gnulibc='$d_gnulibc'
21726 d_grpasswd='$d_grpasswd'
21727 d_hasmntopt='$d_hasmntopt'
21728 d_htonl='$d_htonl'
21729 d_ilogbl='$d_ilogbl'
21730 d_inc_version_list='$d_inc_version_list'
21731 d_index='$d_index'
21732 d_inetaton='$d_inetaton'
21733 d_int64_t='$d_int64_t'
21734 d_isascii='$d_isascii'
21735 d_isfinite='$d_isfinite'
21736 d_isinf='$d_isinf'
21737 d_isnan='$d_isnan'
21738 d_isnanl='$d_isnanl'
21739 d_killpg='$d_killpg'
21740 d_lchown='$d_lchown'
21741 d_ldbl_dig='$d_ldbl_dig'
21742 d_libm_lib_version='$d_libm_lib_version'
21743 d_link='$d_link'
21744 d_localtime_r='$d_localtime_r'
21745 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21746 d_locconv='$d_locconv'
21747 d_lockf='$d_lockf'
21748 d_longdbl='$d_longdbl'
21749 d_longlong='$d_longlong'
21750 d_lseekproto='$d_lseekproto'
21751 d_lstat='$d_lstat'
21752 d_madvise='$d_madvise'
21753 d_malloc_good_size='$d_malloc_good_size'
21754 d_malloc_size='$d_malloc_size'
21755 d_mblen='$d_mblen'
21756 d_mbstowcs='$d_mbstowcs'
21757 d_mbtowc='$d_mbtowc'
21758 d_memchr='$d_memchr'
21759 d_memcmp='$d_memcmp'
21760 d_memcpy='$d_memcpy'
21761 d_memmove='$d_memmove'
21762 d_memset='$d_memset'
21763 d_mkdir='$d_mkdir'
21764 d_mkdtemp='$d_mkdtemp'
21765 d_mkfifo='$d_mkfifo'
21766 d_mkstemp='$d_mkstemp'
21767 d_mkstemps='$d_mkstemps'
21768 d_mktime='$d_mktime'
21769 d_mmap='$d_mmap'
21770 d_modfl='$d_modfl'
21771 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21772 d_modflproto='$d_modflproto'
21773 d_mprotect='$d_mprotect'
21774 d_msg='$d_msg'
21775 d_msg_ctrunc='$d_msg_ctrunc'
21776 d_msg_dontroute='$d_msg_dontroute'
21777 d_msg_oob='$d_msg_oob'
21778 d_msg_peek='$d_msg_peek'
21779 d_msg_proxy='$d_msg_proxy'
21780 d_msgctl='$d_msgctl'
21781 d_msgget='$d_msgget'
21782 d_msghdr_s='$d_msghdr_s'
21783 d_msgrcv='$d_msgrcv'
21784 d_msgsnd='$d_msgsnd'
21785 d_msync='$d_msync'
21786 d_munmap='$d_munmap'
21787 d_mymalloc='$d_mymalloc'
21788 d_nice='$d_nice'
21789 d_nl_langinfo='$d_nl_langinfo'
21790 d_nv_preserves_uv='$d_nv_preserves_uv'
21791 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21792 d_off64_t='$d_off64_t'
21793 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21794 d_oldpthreads='$d_oldpthreads'
21795 d_oldsock='$d_oldsock'
21796 d_open3='$d_open3'
21797 d_pathconf='$d_pathconf'
21798 d_pause='$d_pause'
21799 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21800 d_phostname='$d_phostname'
21801 d_pipe='$d_pipe'
21802 d_poll='$d_poll'
21803 d_portable='$d_portable'
21804 d_printf_format_null='$d_printf_format_null'
21805 d_procselfexe='$d_procselfexe'
21806 d_pseudofork='$d_pseudofork'
21807 d_pthread_atfork='$d_pthread_atfork'
21808 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21809 d_pthread_yield='$d_pthread_yield'
21810 d_pwage='$d_pwage'
21811 d_pwchange='$d_pwchange'
21812 d_pwclass='$d_pwclass'
21813 d_pwcomment='$d_pwcomment'
21814 d_pwexpire='$d_pwexpire'
21815 d_pwgecos='$d_pwgecos'
21816 d_pwpasswd='$d_pwpasswd'
21817 d_pwquota='$d_pwquota'
21818 d_qgcvt='$d_qgcvt'
21819 d_quad='$d_quad'
21820 d_random_r='$d_random_r'
21821 d_readdir64_r='$d_readdir64_r'
21822 d_readdir='$d_readdir'
21823 d_readdir_r='$d_readdir_r'
21824 d_readlink='$d_readlink'
21825 d_readv='$d_readv'
21826 d_recvmsg='$d_recvmsg'
21827 d_rename='$d_rename'
21828 d_rewinddir='$d_rewinddir'
21829 d_rmdir='$d_rmdir'
21830 d_safebcpy='$d_safebcpy'
21831 d_safemcpy='$d_safemcpy'
21832 d_sanemcmp='$d_sanemcmp'
21833 d_sbrkproto='$d_sbrkproto'
21834 d_scalbnl='$d_scalbnl'
21835 d_sched_yield='$d_sched_yield'
21836 d_scm_rights='$d_scm_rights'
21837 d_seekdir='$d_seekdir'
21838 d_select='$d_select'
21839 d_sem='$d_sem'
21840 d_semctl='$d_semctl'
21841 d_semctl_semid_ds='$d_semctl_semid_ds'
21842 d_semctl_semun='$d_semctl_semun'
21843 d_semget='$d_semget'
21844 d_semop='$d_semop'
21845 d_sendmsg='$d_sendmsg'
21846 d_setegid='$d_setegid'
21847 d_seteuid='$d_seteuid'
21848 d_setgrent='$d_setgrent'
21849 d_setgrent_r='$d_setgrent_r'
21850 d_setgrps='$d_setgrps'
21851 d_sethent='$d_sethent'
21852 d_sethostent_r='$d_sethostent_r'
21853 d_setitimer='$d_setitimer'
21854 d_setlinebuf='$d_setlinebuf'
21855 d_setlocale='$d_setlocale'
21856 d_setlocale_r='$d_setlocale_r'
21857 d_setnent='$d_setnent'
21858 d_setnetent_r='$d_setnetent_r'
21859 d_setpent='$d_setpent'
21860 d_setpgid='$d_setpgid'
21861 d_setpgrp2='$d_setpgrp2'
21862 d_setpgrp='$d_setpgrp'
21863 d_setprior='$d_setprior'
21864 d_setproctitle='$d_setproctitle'
21865 d_setprotoent_r='$d_setprotoent_r'
21866 d_setpwent='$d_setpwent'
21867 d_setpwent_r='$d_setpwent_r'
21868 d_setregid='$d_setregid'
21869 d_setresgid='$d_setresgid'
21870 d_setresuid='$d_setresuid'
21871 d_setreuid='$d_setreuid'
21872 d_setrgid='$d_setrgid'
21873 d_setruid='$d_setruid'
21874 d_setsent='$d_setsent'
21875 d_setservent_r='$d_setservent_r'
21876 d_setsid='$d_setsid'
21877 d_setvbuf='$d_setvbuf'
21878 d_sfio='$d_sfio'
21879 d_shm='$d_shm'
21880 d_shmat='$d_shmat'
21881 d_shmatprototype='$d_shmatprototype'
21882 d_shmctl='$d_shmctl'
21883 d_shmdt='$d_shmdt'
21884 d_shmget='$d_shmget'
21885 d_sigaction='$d_sigaction'
21886 d_signbit='$d_signbit'
21887 d_sigprocmask='$d_sigprocmask'
21888 d_sigsetjmp='$d_sigsetjmp'
21889 d_sitearch='$d_sitearch'
21890 d_snprintf='$d_snprintf'
21891 d_sockatmark='$d_sockatmark'
21892 d_sockatmarkproto='$d_sockatmarkproto'
21893 d_socket='$d_socket'
21894 d_socklen_t='$d_socklen_t'
21895 d_sockpair='$d_sockpair'
21896 d_socks5_init='$d_socks5_init'
21897 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21898 d_sqrtl='$d_sqrtl'
21899 d_srand48_r='$d_srand48_r'
21900 d_srandom_r='$d_srandom_r'
21901 d_sresgproto='$d_sresgproto'
21902 d_sresuproto='$d_sresuproto'
21903 d_statblks='$d_statblks'
21904 d_statfs_f_flags='$d_statfs_f_flags'
21905 d_statfs_s='$d_statfs_s'
21906 d_statvfs='$d_statvfs'
21907 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21908 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21909 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21910 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21911 d_stdio_stream_array='$d_stdio_stream_array'
21912 d_stdiobase='$d_stdiobase'
21913 d_stdstdio='$d_stdstdio'
21914 d_strchr='$d_strchr'
21915 d_strcoll='$d_strcoll'
21916 d_strctcpy='$d_strctcpy'
21917 d_strerrm='$d_strerrm'
21918 d_strerror='$d_strerror'
21919 d_strerror_r='$d_strerror_r'
21920 d_strftime='$d_strftime'
21921 d_strlcat='$d_strlcat'
21922 d_strlcpy='$d_strlcpy'
21923 d_strtod='$d_strtod'
21924 d_strtol='$d_strtol'
21925 d_strtold='$d_strtold'
21926 d_strtoll='$d_strtoll'
21927 d_strtoq='$d_strtoq'
21928 d_strtoul='$d_strtoul'
21929 d_strtoull='$d_strtoull'
21930 d_strtouq='$d_strtouq'
21931 d_strxfrm='$d_strxfrm'
21932 d_suidsafe='$d_suidsafe'
21933 d_symlink='$d_symlink'
21934 d_syscall='$d_syscall'
21935 d_syscallproto='$d_syscallproto'
21936 d_sysconf='$d_sysconf'
21937 d_sysernlst='$d_sysernlst'
21938 d_syserrlst='$d_syserrlst'
21939 d_system='$d_system'
21940 d_tcgetpgrp='$d_tcgetpgrp'
21941 d_tcsetpgrp='$d_tcsetpgrp'
21942 d_telldir='$d_telldir'
21943 d_telldirproto='$d_telldirproto'
21944 d_time='$d_time'
21945 d_times='$d_times'
21946 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21947 d_tm_tm_zone='$d_tm_tm_zone'
21948 d_tmpnam_r='$d_tmpnam_r'
21949 d_truncate='$d_truncate'
21950 d_ttyname_r='$d_ttyname_r'
21951 d_tzname='$d_tzname'
21952 d_u32align='$d_u32align'
21953 d_ualarm='$d_ualarm'
21954 d_umask='$d_umask'
21955 d_uname='$d_uname'
21956 d_union_semun='$d_union_semun'
21957 d_unordered='$d_unordered'
21958 d_unsetenv='$d_unsetenv'
21959 d_usleep='$d_usleep'
21960 d_usleepproto='$d_usleepproto'
21961 d_ustat='$d_ustat'
21962 d_vendorarch='$d_vendorarch'
21963 d_vendorbin='$d_vendorbin'
21964 d_vendorlib='$d_vendorlib'
21965 d_vendorscript='$d_vendorscript'
21966 d_vfork='$d_vfork'
21967 d_void_closedir='$d_void_closedir'
21968 d_voidsig='$d_voidsig'
21969 d_voidtty='$d_voidtty'
21970 d_volatile='$d_volatile'
21971 d_vprintf='$d_vprintf'
21972 d_vsnprintf='$d_vsnprintf'
21973 d_wait4='$d_wait4'
21974 d_waitpid='$d_waitpid'
21975 d_wcstombs='$d_wcstombs'
21976 d_wctomb='$d_wctomb'
21977 d_writev='$d_writev'
21978 d_xenix='$d_xenix'
21979 date='$date'
21980 db_hashtype='$db_hashtype'
21981 db_prefixtype='$db_prefixtype'
21982 db_version_major='$db_version_major'
21983 db_version_minor='$db_version_minor'
21984 db_version_patch='$db_version_patch'
21985 defvoidused='$defvoidused'
21986 direntrytype='$direntrytype'
21987 dlext='$dlext'
21988 dlsrc='$dlsrc'
21989 doublesize='$doublesize'
21990 drand01='$drand01'
21991 drand48_r_proto='$drand48_r_proto'
21992 dynamic_ext='$dynamic_ext'
21993 eagain='$eagain'
21994 ebcdic='$ebcdic'
21995 echo='$echo'
21996 egrep='$egrep'
21997 emacs='$emacs'
21998 endgrent_r_proto='$endgrent_r_proto'
21999 endhostent_r_proto='$endhostent_r_proto'
22000 endnetent_r_proto='$endnetent_r_proto'
22001 endprotoent_r_proto='$endprotoent_r_proto'
22002 endpwent_r_proto='$endpwent_r_proto'
22003 endservent_r_proto='$endservent_r_proto'
22004 eunicefix='$eunicefix'
22005 exe_ext='$exe_ext'
22006 expr='$expr'
22007 extensions='$extensions'
22008 extras='$extras'
22009 fflushNULL='$fflushNULL'
22010 fflushall='$fflushall'
22011 find='$find'
22012 firstmakefile='$firstmakefile'
22013 flex='$flex'
22014 fpossize='$fpossize'
22015 fpostype='$fpostype'
22016 freetype='$freetype'
22017 from='$from'
22018 full_ar='$full_ar'
22019 full_csh='$full_csh'
22020 full_sed='$full_sed'
22021 gccansipedantic='$gccansipedantic'
22022 gccosandvers='$gccosandvers'
22023 gccversion='$gccversion'
22024 getgrent_r_proto='$getgrent_r_proto'
22025 getgrgid_r_proto='$getgrgid_r_proto'
22026 getgrnam_r_proto='$getgrnam_r_proto'
22027 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22028 gethostbyname_r_proto='$gethostbyname_r_proto'
22029 gethostent_r_proto='$gethostent_r_proto'
22030 getlogin_r_proto='$getlogin_r_proto'
22031 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22032 getnetbyname_r_proto='$getnetbyname_r_proto'
22033 getnetent_r_proto='$getnetent_r_proto'
22034 getprotobyname_r_proto='$getprotobyname_r_proto'
22035 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22036 getprotoent_r_proto='$getprotoent_r_proto'
22037 getpwent_r_proto='$getpwent_r_proto'
22038 getpwnam_r_proto='$getpwnam_r_proto'
22039 getpwuid_r_proto='$getpwuid_r_proto'
22040 getservbyname_r_proto='$getservbyname_r_proto'
22041 getservbyport_r_proto='$getservbyport_r_proto'
22042 getservent_r_proto='$getservent_r_proto'
22043 getspnam_r_proto='$getspnam_r_proto'
22044 gidformat='$gidformat'
22045 gidsign='$gidsign'
22046 gidsize='$gidsize'
22047 gidtype='$gidtype'
22048 glibpth='$glibpth'
22049 gmake='$gmake'
22050 gmtime_r_proto='$gmtime_r_proto'
22051 gnulibc_version='$gnulibc_version'
22052 grep='$grep'
22053 groupcat='$groupcat'
22054 groupstype='$groupstype'
22055 gzip='$gzip'
22056 h_fcntl='$h_fcntl'
22057 h_sysfile='$h_sysfile'
22058 hint='$hint'
22059 hostcat='$hostcat'
22060 html1dir='$html1dir'
22061 html1direxp='$html1direxp'
22062 html3dir='$html3dir'
22063 html3direxp='$html3direxp'
22064 i16size='$i16size'
22065 i16type='$i16type'
22066 i32size='$i32size'
22067 i32type='$i32type'
22068 i64size='$i64size'
22069 i64type='$i64type'
22070 i8size='$i8size'
22071 i8type='$i8type'
22072 i_arpainet='$i_arpainet'
22073 i_bsdioctl='$i_bsdioctl'
22074 i_crypt='$i_crypt'
22075 i_db='$i_db'
22076 i_dbm='$i_dbm'
22077 i_dirent='$i_dirent'
22078 i_dld='$i_dld'
22079 i_dlfcn='$i_dlfcn'
22080 i_fcntl='$i_fcntl'
22081 i_float='$i_float'
22082 i_fp='$i_fp'
22083 i_fp_class='$i_fp_class'
22084 i_gdbm='$i_gdbm'
22085 i_grp='$i_grp'
22086 i_ieeefp='$i_ieeefp'
22087 i_inttypes='$i_inttypes'
22088 i_langinfo='$i_langinfo'
22089 i_libutil='$i_libutil'
22090 i_limits='$i_limits'
22091 i_locale='$i_locale'
22092 i_machcthr='$i_machcthr'
22093 i_malloc='$i_malloc'
22094 i_math='$i_math'
22095 i_memory='$i_memory'
22096 i_mntent='$i_mntent'
22097 i_ndbm='$i_ndbm'
22098 i_netdb='$i_netdb'
22099 i_neterrno='$i_neterrno'
22100 i_netinettcp='$i_netinettcp'
22101 i_niin='$i_niin'
22102 i_poll='$i_poll'
22103 i_prot='$i_prot'
22104 i_pthread='$i_pthread'
22105 i_pwd='$i_pwd'
22106 i_rpcsvcdbm='$i_rpcsvcdbm'
22107 i_sfio='$i_sfio'
22108 i_sgtty='$i_sgtty'
22109 i_shadow='$i_shadow'
22110 i_socks='$i_socks'
22111 i_stdarg='$i_stdarg'
22112 i_stddef='$i_stddef'
22113 i_stdlib='$i_stdlib'
22114 i_string='$i_string'
22115 i_sunmath='$i_sunmath'
22116 i_sysaccess='$i_sysaccess'
22117 i_sysdir='$i_sysdir'
22118 i_sysfile='$i_sysfile'
22119 i_sysfilio='$i_sysfilio'
22120 i_sysin='$i_sysin'
22121 i_sysioctl='$i_sysioctl'
22122 i_syslog='$i_syslog'
22123 i_sysmman='$i_sysmman'
22124 i_sysmode='$i_sysmode'
22125 i_sysmount='$i_sysmount'
22126 i_sysndir='$i_sysndir'
22127 i_sysparam='$i_sysparam'
22128 i_sysresrc='$i_sysresrc'
22129 i_syssecrt='$i_syssecrt'
22130 i_sysselct='$i_sysselct'
22131 i_syssockio='$i_syssockio'
22132 i_sysstat='$i_sysstat'
22133 i_sysstatfs='$i_sysstatfs'
22134 i_sysstatvfs='$i_sysstatvfs'
22135 i_systime='$i_systime'
22136 i_systimek='$i_systimek'
22137 i_systimes='$i_systimes'
22138 i_systypes='$i_systypes'
22139 i_sysuio='$i_sysuio'
22140 i_sysun='$i_sysun'
22141 i_sysutsname='$i_sysutsname'
22142 i_sysvfs='$i_sysvfs'
22143 i_syswait='$i_syswait'
22144 i_termio='$i_termio'
22145 i_termios='$i_termios'
22146 i_time='$i_time'
22147 i_unistd='$i_unistd'
22148 i_ustat='$i_ustat'
22149 i_utime='$i_utime'
22150 i_values='$i_values'
22151 i_varargs='$i_varargs'
22152 i_varhdr='$i_varhdr'
22153 i_vfork='$i_vfork'
22154 ignore_versioned_solibs='$ignore_versioned_solibs'
22155 inc_version_list='$inc_version_list'
22156 inc_version_list_init='$inc_version_list_init'
22157 incpath='$incpath'
22158 inews='$inews'
22159 initialinstalllocation='$initialinstalllocation'
22160 installarchlib='$installarchlib'
22161 installbin='$installbin'
22162 installhtml1dir='$installhtml1dir'
22163 installhtml3dir='$installhtml3dir'
22164 installman1dir='$installman1dir'
22165 installman3dir='$installman3dir'
22166 installprefix='$installprefix'
22167 installprefixexp='$installprefixexp'
22168 installprivlib='$installprivlib'
22169 installscript='$installscript'
22170 installsitearch='$installsitearch'
22171 installsitebin='$installsitebin'
22172 installsitehtml1dir='$installsitehtml1dir'
22173 installsitehtml3dir='$installsitehtml3dir'
22174 installsitelib='$installsitelib'
22175 installsiteman1dir='$installsiteman1dir'
22176 installsiteman3dir='$installsiteman3dir'
22177 installsitescript='$installsitescript'
22178 installstyle='$installstyle'
22179 installusrbinperl='$installusrbinperl'
22180 installvendorarch='$installvendorarch'
22181 installvendorbin='$installvendorbin'
22182 installvendorhtml1dir='$installvendorhtml1dir'
22183 installvendorhtml3dir='$installvendorhtml3dir'
22184 installvendorlib='$installvendorlib'
22185 installvendorman1dir='$installvendorman1dir'
22186 installvendorman3dir='$installvendorman3dir'
22187 installvendorscript='$installvendorscript'
22188 intsize='$intsize'
22189 issymlink='$issymlink'
22190 ivdformat='$ivdformat'
22191 ivsize='$ivsize'
22192 ivtype='$ivtype'
22193 known_extensions='$known_extensions'
22194 ksh='$ksh'
22195 ld='$ld'
22196 lddlflags='$lddlflags'
22197 ldflags='$ldflags'
22198 ldflags_uselargefiles='$ldflags_uselargefiles'
22199 ldlibpthname='$ldlibpthname'
22200 less='$less'
22201 lib_ext='$lib_ext'
22202 libc='$libc'
22203 libperl='$libperl'
22204 libpth='$libpth'
22205 libs='$libs'
22206 libsdirs='$libsdirs'
22207 libsfiles='$libsfiles'
22208 libsfound='$libsfound'
22209 libspath='$libspath'
22210 libswanted='$libswanted'
22211 libswanted_uselargefiles='$libswanted_uselargefiles'
22212 line='$line'
22213 lint='$lint'
22214 lkflags='$lkflags'
22215 ln='$ln'
22216 lns='$lns'
22217 localtime_r_proto='$localtime_r_proto'
22218 locincpth='$locincpth'
22219 loclibpth='$loclibpth'
22220 longdblsize='$longdblsize'
22221 longlongsize='$longlongsize'
22222 longsize='$longsize'
22223 lp='$lp'
22224 lpr='$lpr'
22225 ls='$ls'
22226 lseeksize='$lseeksize'
22227 lseektype='$lseektype'
22228 mad='$mad'
22229 madlyh='$madlyh'
22230 madlyobj='$madlyobj'
22231 madlysrc='$madlysrc'
22232 mail='$mail'
22233 mailx='$mailx'
22234 make='$make'
22235 make_set_make='$make_set_make'
22236 mallocobj='$mallocobj'
22237 mallocsrc='$mallocsrc'
22238 malloctype='$malloctype'
22239 man1dir='$man1dir'
22240 man1direxp='$man1direxp'
22241 man1ext='$man1ext'
22242 man3dir='$man3dir'
22243 man3direxp='$man3direxp'
22244 man3ext='$man3ext'
22245 mips_type='$mips_type'
22246 mistrustnm='$mistrustnm'
22247 mkdir='$mkdir'
22248 mmaptype='$mmaptype'
22249 modetype='$modetype'
22250 more='$more'
22251 multiarch='$multiarch'
22252 mv='$mv'
22253 myarchname='$myarchname'
22254 mydomain='$mydomain'
22255 myhostname='$myhostname'
22256 myuname='$myuname'
22257 n='$n'
22258 need_va_copy='$need_va_copy'
22259 netdb_hlen_type='$netdb_hlen_type'
22260 netdb_host_type='$netdb_host_type'
22261 netdb_name_type='$netdb_name_type'
22262 netdb_net_type='$netdb_net_type'
22263 nm='$nm'
22264 nm_opt='$nm_opt'
22265 nm_so_opt='$nm_so_opt'
22266 nonxs_ext='$nonxs_ext'
22267 nroff='$nroff'
22268 nvEUformat='$nvEUformat'
22269 nvFUformat='$nvFUformat'
22270 nvGUformat='$nvGUformat'
22271 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22272 nveformat='$nveformat'
22273 nvfformat='$nvfformat'
22274 nvgformat='$nvgformat'
22275 nvsize='$nvsize'
22276 nvtype='$nvtype'
22277 o_nonblock='$o_nonblock'
22278 obj_ext='$obj_ext'
22279 old_pthread_create_joinable='$old_pthread_create_joinable'
22280 optimize='$optimize'
22281 orderlib='$orderlib'
22282 osname='$osname'
22283 osvers='$osvers'
22284 otherlibdirs='$otherlibdirs'
22285 package='$package'
22286 pager='$pager'
22287 passcat='$passcat'
22288 patchlevel='$patchlevel'
22289 path_sep='$path_sep'
22290 perl5='$perl5'
22291 perl='$perl'
22292 perl_patchlevel='$perl_patchlevel'
22293 perladmin='$perladmin'
22294 perllibs='$perllibs'
22295 perlpath='$perlpath'
22296 pg='$pg'
22297 phostname='$phostname'
22298 pidtype='$pidtype'
22299 plibpth='$plibpth'
22300 pmake='$pmake'
22301 pr='$pr'
22302 prefix='$prefix'
22303 prefixexp='$prefixexp'
22304 privlib='$privlib'
22305 privlibexp='$privlibexp'
22306 procselfexe='$procselfexe'
22307 prototype='$prototype'
22308 ptrsize='$ptrsize'
22309 quadkind='$quadkind'
22310 quadtype='$quadtype'
22311 randbits='$randbits'
22312 randfunc='$randfunc'
22313 random_r_proto='$random_r_proto'
22314 randseedtype='$randseedtype'
22315 ranlib='$ranlib'
22316 rd_nodata='$rd_nodata'
22317 readdir64_r_proto='$readdir64_r_proto'
22318 readdir_r_proto='$readdir_r_proto'
22319 revision='$revision'
22320 rm='$rm'
22321 rm_try='$rm_try'
22322 rmail='$rmail'
22323 run='$run'
22324 runnm='$runnm'
22325 sPRIEUldbl='$sPRIEUldbl'
22326 sPRIFUldbl='$sPRIFUldbl'
22327 sPRIGUldbl='$sPRIGUldbl'
22328 sPRIXU64='$sPRIXU64'
22329 sPRId64='$sPRId64'
22330 sPRIeldbl='$sPRIeldbl'
22331 sPRIfldbl='$sPRIfldbl'
22332 sPRIgldbl='$sPRIgldbl'
22333 sPRIi64='$sPRIi64'
22334 sPRIo64='$sPRIo64'
22335 sPRIu64='$sPRIu64'
22336 sPRIx64='$sPRIx64'
22337 sSCNfldbl='$sSCNfldbl'
22338 sched_yield='$sched_yield'
22339 scriptdir='$scriptdir'
22340 scriptdirexp='$scriptdirexp'
22341 sed='$sed'
22342 seedfunc='$seedfunc'
22343 selectminbits='$selectminbits'
22344 selecttype='$selecttype'
22345 sendmail='$sendmail'
22346 setgrent_r_proto='$setgrent_r_proto'
22347 sethostent_r_proto='$sethostent_r_proto'
22348 setlocale_r_proto='$setlocale_r_proto'
22349 setnetent_r_proto='$setnetent_r_proto'
22350 setprotoent_r_proto='$setprotoent_r_proto'
22351 setpwent_r_proto='$setpwent_r_proto'
22352 setservent_r_proto='$setservent_r_proto'
22353 sh='$sh'
22354 shar='$shar'
22355 sharpbang='$sharpbang'
22356 shmattype='$shmattype'
22357 shortsize='$shortsize'
22358 shrpenv='$shrpenv'
22359 shsharp='$shsharp'
22360 sig_count='$sig_count'
22361 sig_name='$sig_name'
22362 sig_name_init='$sig_name_init'
22363 sig_num='$sig_num'
22364 sig_num_init='$sig_num_init'
22365 sig_size='$sig_size'
22366 signal_t='$signal_t'
22367 sitearch='$sitearch'
22368 sitearchexp='$sitearchexp'
22369 sitebin='$sitebin'
22370 sitebinexp='$sitebinexp'
22371 sitehtml1dir='$sitehtml1dir'
22372 sitehtml1direxp='$sitehtml1direxp'
22373 sitehtml3dir='$sitehtml3dir'
22374 sitehtml3direxp='$sitehtml3direxp'
22375 sitelib='$sitelib'
22376 sitelib_stem='$sitelib_stem'
22377 sitelibexp='$sitelibexp'
22378 siteman1dir='$siteman1dir'
22379 siteman1direxp='$siteman1direxp'
22380 siteman3dir='$siteman3dir'
22381 siteman3direxp='$siteman3direxp'
22382 siteprefix='$siteprefix'
22383 siteprefixexp='$siteprefixexp'
22384 sitescript='$sitescript'
22385 sitescriptexp='$sitescriptexp'
22386 sizesize='$sizesize'
22387 sizetype='$sizetype'
22388 sleep='$sleep'
22389 smail='$smail'
22390 so='$so'
22391 sockethdr='$sockethdr'
22392 socketlib='$socketlib'
22393 socksizetype='$socksizetype'
22394 sort='$sort'
22395 spackage='$spackage'
22396 spitshell='$spitshell'
22397 srand48_r_proto='$srand48_r_proto'
22398 srandom_r_proto='$srandom_r_proto'
22399 src='$src'
22400 ssizetype='$ssizetype'
22401 startperl='$startperl'
22402 startsh='$startsh'
22403 static_ext='$static_ext'
22404 stdchar='$stdchar'
22405 stdio_base='$stdio_base'
22406 stdio_bufsiz='$stdio_bufsiz'
22407 stdio_cnt='$stdio_cnt'
22408 stdio_filbuf='$stdio_filbuf'
22409 stdio_ptr='$stdio_ptr'
22410 stdio_stream_array='$stdio_stream_array'
22411 strerror_r_proto='$strerror_r_proto'
22412 strings='$strings'
22413 submit='$submit'
22414 subversion='$subversion'
22415 sysman='$sysman'
22416 tail='$tail'
22417 tar='$tar'
22418 targetarch='$targetarch'
22419 tbl='$tbl'
22420 tee='$tee'
22421 test='$test'
22422 timeincl='$timeincl'
22423 timetype='$timetype'
22424 tmpnam_r_proto='$tmpnam_r_proto'
22425 to='$to'
22426 touch='$touch'
22427 tr='$tr'
22428 trnl='$trnl'
22429 troff='$troff'
22430 ttyname_r_proto='$ttyname_r_proto'
22431 u16size='$u16size'
22432 u16type='$u16type'
22433 u32size='$u32size'
22434 u32type='$u32type'
22435 u64size='$u64size'
22436 u64type='$u64type'
22437 u8size='$u8size'
22438 u8type='$u8type'
22439 uidformat='$uidformat'
22440 uidsign='$uidsign'
22441 uidsize='$uidsize'
22442 uidtype='$uidtype'
22443 uname='$uname'
22444 uniq='$uniq'
22445 uquadtype='$uquadtype'
22446 use5005threads='$use5005threads'
22447 use64bitall='$use64bitall'
22448 use64bitint='$use64bitint'
22449 usecrosscompile='$usecrosscompile'
22450 usedl='$usedl'
22451 usefaststdio='$usefaststdio'
22452 useithreads='$useithreads'
22453 uselargefiles='$uselargefiles'
22454 uselongdouble='$uselongdouble'
22455 usemallocwrap='$usemallocwrap'
22456 usemorebits='$usemorebits'
22457 usemultiplicity='$usemultiplicity'
22458 usemymalloc='$usemymalloc'
22459 usenm='$usenm'
22460 useopcode='$useopcode'
22461 useperlio='$useperlio'
22462 useposix='$useposix'
22463 usereentrant='$usereentrant'
22464 userelocatableinc='$userelocatableinc'
22465 usesfio='$usesfio'
22466 useshrplib='$useshrplib'
22467 usesitecustomize='$usesitecustomize'
22468 usesocks='$usesocks'
22469 usethreads='$usethreads'
22470 usevendorprefix='$usevendorprefix'
22471 usevfork='$usevfork'
22472 usrinc='$usrinc'
22473 uuname='$uuname'
22474 uvXUformat='$uvXUformat'
22475 uvoformat='$uvoformat'
22476 uvsize='$uvsize'
22477 uvtype='$uvtype'
22478 uvuformat='$uvuformat'
22479 uvxformat='$uvxformat'
22480 vendorarch='$vendorarch'
22481 vendorarchexp='$vendorarchexp'
22482 vendorbin='$vendorbin'
22483 vendorbinexp='$vendorbinexp'
22484 vendorhtml1dir='$vendorhtml1dir'
22485 vendorhtml1direxp='$vendorhtml1direxp'
22486 vendorhtml3dir='$vendorhtml3dir'
22487 vendorhtml3direxp='$vendorhtml3direxp'
22488 vendorlib='$vendorlib'
22489 vendorlib_stem='$vendorlib_stem'
22490 vendorlibexp='$vendorlibexp'
22491 vendorman1dir='$vendorman1dir'
22492 vendorman1direxp='$vendorman1direxp'
22493 vendorman3dir='$vendorman3dir'
22494 vendorman3direxp='$vendorman3direxp'
22495 vendorprefix='$vendorprefix'
22496 vendorprefixexp='$vendorprefixexp'
22497 vendorscript='$vendorscript'
22498 vendorscriptexp='$vendorscriptexp'
22499 version='$version'
22500 version_patchlevel_string='$version_patchlevel_string'
22501 versiononly='$versiononly'
22502 vi='$vi'
22503 voidflags='$voidflags'
22504 xlibpth='$xlibpth'
22505 yacc='$yacc'
22506 yaccflags='$yaccflags'
22507 zcat='$zcat'
22508 zip='$zip'
22509 EOT
22510
22511 : Add in command line options if available
22512 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22513
22514 : add special variables
22515 $test -f $src/patchlevel.h && \
22516 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22517 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22518 echo "PERL_CONFIG_SH=true" >>config.sh
22519
22520 : propagate old symbols
22521 if $test -f UU/config.sh; then
22522         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22523         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22524         $sort | $uniq -u >UU/oldsyms
22525         set X `cat UU/oldsyms`
22526         shift
22527         case $# in
22528         0) ;;
22529         *)
22530                 cat <<EOM
22531 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22532 EOM
22533                 echo "# Variables propagated from previous config.sh file." >>config.sh
22534                 for sym in `cat UU/oldsyms`; do
22535                         echo "    Propagating $hint variable "'$'"$sym..."
22536                         eval 'tmp="$'"${sym}"'"'
22537                         echo "$tmp" | \
22538                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22539                 done
22540                 ;;
22541         esac
22542 fi
22543
22544 : Finish up by extracting the .SH files
22545 case "$alldone" in
22546 exit)
22547         $rm -rf UU
22548         echo "Extraction done."
22549         exit 0
22550         ;;
22551 cont)
22552         ;;
22553 '')
22554         dflt=''
22555         nostick=true
22556         $cat <<EOM
22557
22558 If you'd like to make any changes to the config.sh file before I begin
22559 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22560
22561 EOM
22562         rp="Press return or use a shell escape to edit config.sh:"
22563         . UU/myread
22564         nostick=''
22565         case "$ans" in
22566         '') ;;
22567         *) : in case they cannot read
22568                 sh 1>&4 -c "$ans";;
22569         esac
22570         ;;
22571 esac
22572
22573 : if this fails, just run all the .SH files by hand
22574 . ./config.sh
22575
22576 echo " "
22577 exec 1>&4
22578 pwd=`pwd`
22579 . ./UU/extract
22580 cd "$pwd"
22581
22582 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22583         dflt=y
22584         case "$silent" in
22585         true) ;;
22586         *)
22587                 $cat <<EOM
22588
22589 Now you need to generate make dependencies by running "$make depend".
22590 You might prefer to run it in background: "$make depend > makedepend.out &"
22591 It can take a while, so you might not want to run it right now.
22592
22593 EOM
22594                 ;;
22595         esac
22596         rp="Run $make depend now?"
22597         . UU/myread
22598         case "$ans" in
22599         y*)
22600                 $make depend && echo "Now you must run '$make'."
22601                 ;;
22602         *)
22603                 echo "You must run '$make depend' then '$make'."
22604                 ;;
22605         esac
22606 elif test -f [Mm]akefile; then
22607         echo " "
22608         echo "Now you must run a $make."
22609 else
22610         echo "Configure done."
22611 fi
22612
22613 if $test -f Policy.sh; then
22614     $cat <<EOM
22615
22616 If you compile $package on a different machine or from a different object
22617 directory, copy the Policy.sh file from this object directory to the
22618 new one before you run Configure -- this will help you with most of
22619 the policy defaults.
22620
22621 EOM
22622 fi
22623 if $test -f config.msg; then
22624     echo "Hmm.  I also noted the following information while running:"
22625     echo " "
22626     $cat config.msg >&4
22627     $rm -f config.msg
22628 fi
22629 $rm -f kit*isdone ark*isdone
22630 $rm -rf UU
22631
22632 : End of Configure
22633