Fix the compile for -DPERL_OLD_COPY_ON_WRITE (apart from the tenacious
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Tue Jan  1 21:34:35 CET 2008 [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 test -x "${newsh}" || unset newsh
185
186 : if needed set CDPATH to a harmless value that is not chatty
187 : avoid bash 2.02 problems with empty CDPATH.
188 case "$CDPATH" in
189 '')     ;;
190 *)      case "$SHELL" in
191         *bash*) CDPATH='.' ;;
192         *)              CDPATH='' ;;
193         esac
194         ;;
195 esac
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 Mcc=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
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_assert=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_sysresrc=''
917 i_syssecrt=''
918 i_sysselct=''
919 i_sysstat=''
920 i_sysstatfs=''
921 i_sysstatvfs=''
922 i_systimes=''
923 i_systypes=''
924 i_sysuio=''
925 i_sysun=''
926 i_sysutsname=''
927 i_sysvfs=''
928 i_syswait=''
929 i_sgtty=''
930 i_termio=''
931 i_termios=''
932 d_tm_tm_gmtoff=''
933 d_tm_tm_zone=''
934 i_systime=''
935 i_systimek=''
936 i_time=''
937 timeincl=''
938 i_unistd=''
939 i_ustat=''
940 i_utime=''
941 i_values=''
942 i_stdarg=''
943 i_varargs=''
944 i_varhdr=''
945 i_vfork=''
946 d_inc_version_list=''
947 inc_version_list=''
948 inc_version_list_init=''
949 installprefix=''
950 installprefixexp=''
951 installstyle=''
952 installusrbinperl=''
953 intsize=''
954 longsize=''
955 shortsize=''
956 issymlink=''
957 libc=''
958 ldlibpthname=''
959 libperl=''
960 shrpenv=''
961 useshrplib=''
962 glibpth=''
963 libpth=''
964 loclibpth=''
965 plibpth=''
966 xlibpth=''
967 ignore_versioned_solibs=''
968 libs=''
969 libsdirs=''
970 libsfiles=''
971 libsfound=''
972 libspath=''
973 lns=''
974 d_PRIEUldbl=''
975 d_PRIFUldbl=''
976 d_PRIGUldbl=''
977 d_PRIeldbl=''
978 d_PRIfldbl=''
979 d_PRIgldbl=''
980 d_SCNfldbl=''
981 sPRIEUldbl=''
982 sPRIFUldbl=''
983 sPRIGUldbl=''
984 sPRIeldbl=''
985 sPRIfldbl=''
986 sPRIgldbl=''
987 sSCNfldbl=''
988 lseeksize=''
989 lseektype=''
990 mad=''
991 madlyh=''
992 madlyobj=''
993 madlysrc=''
994 make_set_make=''
995 d_mymalloc=''
996 freetype=''
997 mallocobj=''
998 mallocsrc=''
999 malloctype=''
1000 usemallocwrap=''
1001 usemymalloc=''
1002 installman1dir=''
1003 man1dir=''
1004 man1direxp=''
1005 man1ext=''
1006 installman3dir=''
1007 man3dir=''
1008 man3direxp=''
1009 man3ext=''
1010 modetype=''
1011 multiarch=''
1012 mydomain=''
1013 myhostname=''
1014 phostname=''
1015 c=''
1016 n=''
1017 d_eofnblk=''
1018 eagain=''
1019 o_nonblock=''
1020 rd_nodata=''
1021 need_va_copy=''
1022 netdb_hlen_type=''
1023 netdb_host_type=''
1024 netdb_name_type=''
1025 netdb_net_type=''
1026 groupcat=''
1027 hostcat=''
1028 passcat=''
1029 orderlib=''
1030 ranlib=''
1031 d_perl_otherlibdirs=''
1032 otherlibdirs=''
1033 package=''
1034 spackage=''
1035 pager=''
1036 api_revision=''
1037 api_subversion=''
1038 api_version=''
1039 api_versionstring=''
1040 patchlevel=''
1041 perl_patchlevel=''
1042 revision=''
1043 subversion=''
1044 version=''
1045 version_patchlevel_string=''
1046 perl5=''
1047 perladmin=''
1048 perlpath=''
1049 d_nv_preserves_uv=''
1050 d_nv_zero_is_allbits_zero=''
1051 i16size=''
1052 i16type=''
1053 i32size=''
1054 i32type=''
1055 i64size=''
1056 i64type=''
1057 i8size=''
1058 i8type=''
1059 ivsize=''
1060 ivtype=''
1061 nv_preserves_uv_bits=''
1062 nvsize=''
1063 nvtype=''
1064 u16size=''
1065 u16type=''
1066 u32size=''
1067 u32type=''
1068 u64size=''
1069 u64type=''
1070 u8size=''
1071 u8type=''
1072 uvsize=''
1073 uvtype=''
1074 ivdformat=''
1075 nvEUformat=''
1076 nvFUformat=''
1077 nvGUformat=''
1078 nveformat=''
1079 nvfformat=''
1080 nvgformat=''
1081 uvXUformat=''
1082 uvoformat=''
1083 uvuformat=''
1084 uvxformat=''
1085 pidtype=''
1086 prefix=''
1087 prefixexp=''
1088 installprivlib=''
1089 privlib=''
1090 privlibexp=''
1091 prototype=''
1092 ptrsize=''
1093 d_PRIXU64=''
1094 d_PRId64=''
1095 d_PRIi64=''
1096 d_PRIo64=''
1097 d_PRIu64=''
1098 d_PRIx64=''
1099 sPRIXU64=''
1100 sPRId64=''
1101 sPRIi64=''
1102 sPRIo64=''
1103 sPRIu64=''
1104 sPRIx64=''
1105 d_quad=''
1106 quadkind=''
1107 quadtype=''
1108 uquadtype=''
1109 drand01=''
1110 randbits=''
1111 randfunc=''
1112 randseedtype=''
1113 seedfunc=''
1114 installscript=''
1115 scriptdir=''
1116 scriptdirexp=''
1117 selectminbits=''
1118 selecttype=''
1119 sh=''
1120 sig_count=''
1121 sig_name=''
1122 sig_name_init=''
1123 sig_num=''
1124 sig_num_init=''
1125 sig_size=''
1126 d_sitearch=''
1127 installsitearch=''
1128 sitearch=''
1129 sitearchexp=''
1130 installsitebin=''
1131 sitebin=''
1132 sitebinexp=''
1133 installsitehtml1dir=''
1134 sitehtml1dir=''
1135 sitehtml1direxp=''
1136 installsitehtml3dir=''
1137 sitehtml3dir=''
1138 sitehtml3direxp=''
1139 installsitelib=''
1140 sitelib=''
1141 sitelib_stem=''
1142 sitelibexp=''
1143 installsiteman1dir=''
1144 siteman1dir=''
1145 siteman1direxp=''
1146 installsiteman3dir=''
1147 siteman3dir=''
1148 siteman3direxp=''
1149 siteprefix=''
1150 siteprefixexp=''
1151 installsitescript=''
1152 sitescript=''
1153 sitescriptexp=''
1154 sizesize=''
1155 sizetype=''
1156 so=''
1157 socksizetype=''
1158 sharpbang=''
1159 shsharp=''
1160 spitshell=''
1161 src=''
1162 ssizetype=''
1163 startperl=''
1164 startsh=''
1165 stdchar=''
1166 d_stdio_stream_array=''
1167 stdio_stream_array=''
1168 sysman=''
1169 trnl=''
1170 uidformat=''
1171 uidsign=''
1172 uidsize=''
1173 uidtype=''
1174 archname64=''
1175 use64bitall=''
1176 use64bitint=''
1177 usefaststdio=''
1178 ccflags_uselargefiles=''
1179 ldflags_uselargefiles=''
1180 libswanted_uselargefiles=''
1181 uselargefiles=''
1182 uselongdouble=''
1183 usemorebits=''
1184 usemultiplicity=''
1185 nm_opt=''
1186 nm_so_opt=''
1187 runnm=''
1188 usenm=''
1189 useperlio=''
1190 usesocks=''
1191 d_oldpthreads=''
1192 use5005threads=''
1193 useithreads=''
1194 usereentrant=''
1195 usethreads=''
1196 incpath=''
1197 mips_type=''
1198 usrinc=''
1199 d_vendorarch=''
1200 installvendorarch=''
1201 vendorarch=''
1202 vendorarchexp=''
1203 d_vendorbin=''
1204 installvendorbin=''
1205 vendorbin=''
1206 vendorbinexp=''
1207 installvendorhtml1dir=''
1208 vendorhtml1dir=''
1209 vendorhtml1direxp=''
1210 installvendorhtml3dir=''
1211 vendorhtml3dir=''
1212 vendorhtml3direxp=''
1213 d_vendorlib=''
1214 installvendorlib=''
1215 vendorlib=''
1216 vendorlib_stem=''
1217 vendorlibexp=''
1218 installvendorman1dir=''
1219 vendorman1dir=''
1220 vendorman1direxp=''
1221 installvendorman3dir=''
1222 vendorman3dir=''
1223 vendorman3direxp=''
1224 usevendorprefix=''
1225 vendorprefix=''
1226 vendorprefixexp=''
1227 d_vendorscript=''
1228 installvendorscript=''
1229 vendorscript=''
1230 vendorscriptexp=''
1231 versiononly=''
1232 defvoidused=''
1233 voidflags=''
1234 yacc=''
1235 yaccflags=''
1236 CONFIG=''
1237
1238 define='define'
1239 undef='undef'
1240 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1241 rmlist=''
1242
1243 : We must find out about Eunice early
1244 eunicefix=':'
1245 if test -f /etc/unixtovms; then
1246         eunicefix=/etc/unixtovms
1247 fi
1248 if test -f /etc/unixtovms.exe; then
1249         eunicefix=/etc/unixtovms.exe
1250 fi
1251
1252 : Set executable suffix now -- needed before hints available
1253 if test -f "/libs/version.library"; then
1254 : Amiga OS
1255     _exe=""
1256 elif test -f "/system/gnu_library/bin/ar.pm"; then
1257 : Stratus VOS
1258     _exe=".pm"
1259 elif test -n "$DJGPP"; then
1260 : DOS DJGPP
1261     _exe=".exe"
1262 elif test -d c:/. -o -n "$is_os2" ; then
1263 : OS/2 or cygwin
1264     _exe=".exe"
1265 fi
1266
1267 i_whoami=''
1268 : Trailing extension.  Override this in a hint file, if needed.
1269 : Extra object files, if any, needed on this platform.
1270 archobjs=''
1271 archname=''
1272 groupstype=''
1273 libnames=''
1274 : change the next line if compiling for Xenix/286 on Xenix/386
1275 xlibpth='/usr/lib/386 /lib/386'
1276 : Possible local library directories to search.
1277 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1278 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1279
1280 : general looking path for locating libraries
1281 glibpth="/lib /usr/lib $xlibpth"
1282 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1283 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1284 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1285 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1286
1287 : Private path used by Configure to find libraries.  Its value
1288 : is prepended to libpth. This variable takes care of special
1289 : machines, like the mips.  Usually, it should be empty.
1290 plibpth=''
1291
1292 : default library list
1293 libswanted=''
1294 : some systems want to use only the non-versioned libso:s
1295 ignore_versioned_solibs=''
1296 siteman1dir=''
1297 siteman3dir=''
1298 sitescript=''
1299 : set usethreads on the Configure command line to enable threads.
1300 usereentrant='undef'
1301 : full support for void wanted by default
1302 defvoidused=15
1303
1304 : Possible local include directories to search.
1305 : Set locincpth to "" in a hint file to defeat local include searches.
1306 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1307 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1308 :
1309 : no include file wanted by default
1310 inclwanted=''
1311
1312 : Enable -DEBUGGING and -DDEBUGGING from the command line
1313 EBUGGING=''
1314 DEBUGGING=old
1315
1316 ccname=''
1317 ccversion=''
1318 perllibs=''
1319 : set useposix=false in your hint file to disable the POSIX extension.
1320 useposix=true
1321 : set useopcode=false in your hint file to disable the Opcode extension.
1322 useopcode=true
1323 archname64=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 : set usemultiplicity on the Configure command line to enable multiplicity.
1328 : set usesocks on the Configure command line to enable socks.
1329 : List of libraries we want.
1330 : If anyone needs extra -lxxx, put those in a hint file.
1331 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1332 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1333 : We probably want to search /usr/shlib before most other libraries.
1334 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1335 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1336 glibpth="/usr/shlib $glibpth"
1337 : Do not use vfork unless overridden by a hint file.
1338 usevfork=false
1339
1340 : Find the basic shell for Bourne shell scripts
1341 case "$sh" in
1342 '')
1343         case "$SYSTYPE" in
1344         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1345         *) xxx='/bin/sh';;
1346         esac
1347         if test -f "$xxx"; then
1348                 sh="$xxx"
1349         else
1350                 : Build up a list and do a single loop so we can 'break' out.
1351                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1352                 for xxx in sh bash ksh pdksh ash; do
1353                         for p in $pth; do
1354                                 try="$try ${p}/${xxx}"
1355                         done
1356                 done
1357                 for xxx in $try; do
1358                         if test -f "$xxx"; then
1359                                 sh="$xxx";
1360                                 break
1361                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1362                                 sh="$xxx";
1363                                 break
1364                         elif test -f "$xxx.exe"; then
1365                                 sh="$xxx";
1366                                 break
1367                         fi
1368                 done
1369         fi
1370         ;;
1371 esac
1372
1373 case "$sh" in
1374 '')     cat >&2 <<EOM
1375 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1376
1377 Usually it's in /bin/sh.  How did you even get this far?
1378 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1379 we'll try to straighten this all out.
1380 EOM
1381         exit 1
1382         ;;
1383 esac
1384
1385 : see if sh knows # comments
1386 if `$sh -c '#' >/dev/null 2>&1`; then
1387         shsharp=true
1388         spitshell=cat
1389         xcat=/bin/cat
1390         test -f $xcat$_exe || xcat=/usr/bin/cat
1391         if test ! -f $xcat$_exe; then
1392                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1393                         if test -f $p/cat$_exe; then
1394                                 xcat=$p/cat
1395                                 break
1396                         fi
1397                 done
1398                 if test ! -f $xcat$_exe; then
1399                         echo "Can't find cat anywhere!"
1400                         exit 1
1401                 fi
1402         fi
1403         echo "#!$xcat" >sharp
1404         $eunicefix sharp
1405         chmod +x sharp
1406         ./sharp > today
1407         if test -s today; then
1408                 sharpbang='#!'
1409         else
1410                 echo "#! $xcat" > sharp
1411                 $eunicefix sharp
1412                 chmod +x sharp
1413                 ./sharp > today
1414                 if test -s today; then
1415                         sharpbang='#! '
1416                 else
1417                         sharpbang=': use '
1418                 fi
1419         fi
1420 else
1421         echo " "
1422         echo "Your $sh doesn't grok # comments--I will strip them later on."
1423         shsharp=false
1424         cd ..
1425         echo "exec grep -v '^[  ]*#'" >spitshell
1426         chmod +x spitshell
1427         $eunicefix spitshell
1428         spitshell=`pwd`/spitshell
1429         cd UU
1430         echo "I presume that if # doesn't work, #! won't work either!"
1431         sharpbang=': use '
1432 fi
1433 rm -f sharp today
1434
1435 : figure out how to guarantee sh startup
1436 case "$startsh" in
1437 '') startsh=${sharpbang}${sh} ;;
1438 *)
1439 esac
1440 cat >sharp <<EOSS
1441 $startsh
1442 set abc
1443 test "$?abc" != 1
1444 EOSS
1445
1446 chmod +x sharp
1447 $eunicefix sharp
1448 if ./sharp; then
1449         : echo "Yup, it does."
1450 else
1451         echo "Hmm... '$startsh' does not guarantee sh startup..."
1452         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1453 fi
1454 rm -f sharp
1455
1456
1457 : Save command line options in file UU/cmdline.opt for later use in
1458 : generating config.sh.
1459 cat > cmdline.opt <<EOSH
1460 # Configure command line arguments.
1461 config_arg0='$0'
1462 config_args='$*'
1463 config_argc=$#
1464 EOSH
1465 argn=1
1466 args_exp=''
1467 args_sep=''
1468 for arg in "$@"; do
1469         cat >>cmdline.opt <<EOSH
1470 config_arg$argn='$arg'
1471 EOSH
1472         # Extreme backslashitis: replace each ' by '"'"'
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1482 # used by ./hints/os2.sh
1483 rm -f cmdl.opt
1484
1485 : produce awk script to parse command line options
1486 cat >options.awk <<'EOF'
1487 BEGIN {
1488         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1489
1490         len = length(optstr);
1491         for (i = 1; i <= len; i++) {
1492                 c = substr(optstr, i, 1);
1493                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1494                 if (a == ":") {
1495                         arg[c] = 1;
1496                         i++;
1497                 }
1498                 opt[c] = 1;
1499         }
1500 }
1501 {
1502         expect = 0;
1503         str = $0;
1504         if (substr(str, 1, 1) != "-") {
1505                 printf("'%s'\n", str);
1506                 next;
1507         }
1508         len = length($0);
1509         for (i = 2; i <= len; i++) {
1510                 c = substr(str, i, 1);
1511                 if (!opt[c]) {
1512                         printf("-%s\n", substr(str, i));
1513                         next;
1514                 }
1515                 printf("-%s\n", c);
1516                 if (arg[c]) {
1517                         if (i < len)
1518                                 printf("'%s'\n", substr(str, i + 1));
1519                         else
1520                                 expect = 1;
1521                         next;
1522                 }
1523         }
1524 }
1525 END {
1526         if (expect)
1527                 print "?";
1528 }
1529 EOF
1530
1531 : process the command line options
1532 set X `for arg in "$@"; do echo "X$arg"; done |
1533         sed -e s/X// | awk -f options.awk`
1534 eval "set $*"
1535 shift
1536 rm -f options.awk
1537
1538 : set up default values
1539 fastread=''
1540 reuseval=false
1541 config_sh=''
1542 alldone=''
1543 error=''
1544 silent=''
1545 extractsh=''
1546 override=''
1547 knowitall=''
1548 rm -f optdef.sh posthint.sh
1549 cat >optdef.sh <<EOS
1550 $startsh
1551 EOS
1552
1553
1554 : option parsing
1555 while test $# -gt 0; do
1556         case "$1" in
1557         -d) shift; fastread=yes;;
1558         -e) shift; alldone=cont;;
1559         -f)
1560                 shift
1561                 cd ..
1562                 if test -r "$1"; then
1563                         config_sh="$1"
1564                 else
1565                         echo "$me: cannot read config file $1." >&2
1566                         error=true
1567                 fi
1568                 cd UU
1569                 shift;;
1570         --help|\
1571         -h) shift; error=true;;
1572         -r) shift; reuseval=true;;
1573         -s) shift; silent=true; realsilent=true;;
1574         -E) shift; alldone=exit;;
1575         -K) shift; knowitall=true;;
1576         -O) shift; override=true;;
1577         -S) shift; silent=true; extractsh=true;;
1578         -D)
1579                 shift
1580                 case "$1" in
1581                 *=)
1582                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1583                         echo "$me: ignoring -D $1" >&2
1584                         ;;
1585                 *=*) echo "$1" | \
1586                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1587                 *) echo "$1='define'" >> optdef.sh;;
1588                 esac
1589                 shift
1590                 ;;
1591         -U)
1592                 shift
1593                 case "$1" in
1594                 *=) echo "$1" >> optdef.sh;;
1595                 *=*)
1596                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1597                         echo "$me: ignoring -U $1" >&2
1598                         ;;
1599                 *) echo "$1='undef'" >> optdef.sh;;
1600                 esac
1601                 shift
1602                 ;;
1603         -A)
1604             shift
1605             xxx=''
1606             yyy="$1"
1607             zzz=''
1608             uuu=undef
1609             case "$yyy" in
1610             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1611                  case "$zzz" in
1612                  *:*) zzz='' ;;
1613                  *)   xxx=append
1614                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1615                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1616                  esac
1617                  ;;
1618             esac
1619             case "$xxx" in
1620             '')  case "$yyy" in
1621                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1622                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1623                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1624                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1625                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1626                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1627                  esac
1628                  ;;       
1629             esac
1630             case "$xxx" in
1631             append)
1632                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1633             clear)
1634                 echo "$yyy=''"                  >> posthint.sh ;;
1635             define)
1636                 case "$zzz" in
1637                 '') zzz=define ;;
1638                 esac
1639                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1640             eval)
1641                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1642             prepend)
1643                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1644             undef)
1645                 case "$zzz" in
1646                 '') zzz="$uuu" ;;
1647                 esac
1648                 echo "$yyy=$zzz"                >> posthint.sh ;;
1649             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1650             esac
1651             shift
1652             ;;
1653         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1654             exit 0;;
1655         --) break;;
1656         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1657         *) break;;
1658         esac
1659 done
1660
1661 case "$error" in
1662 true)
1663         cat >&2 <<EOM
1664 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1665                  [-U symbol] [-U symbol=] [-A command:symbol...]
1666   -d : use defaults for all answers.
1667   -e : go on without questioning past the production of config.sh.
1668   -f : specify an alternate default configuration file.
1669   -h : print this help message and exit (with an error status).
1670   -r : reuse C symbols value if possible (skips costly nm extraction).
1671   -s : silent mode, only echoes questions and essential information.
1672   -D : define symbol to have some value:
1673          -D symbol         symbol gets the value 'define'
1674          -D symbol=value   symbol gets the value 'value'
1675        common used examples (see INSTALL for more info):
1676          -Duse64bitint            use 64bit integers
1677          -Duse64bitall            use 64bit integers and pointers
1678          -Dusethreads             use thread support
1679          -Dinc_version_list=none  do not include older perl trees in @INC
1680          -DEBUGGING=none          DEBUGGING options
1681          -Dcc=gcc                 choose your compiler
1682          -Dprefix=/opt/perl5      choose your destination
1683   -E : stop at the end of questions, after having produced config.sh.
1684   -K : do not use unless you know what you are doing.
1685   -O : let -D and -U override definitions from loaded configuration file.
1686   -S : perform variable substitutions on all .SH files (can mix with -f)
1687   -U : undefine symbol:
1688          -U symbol    symbol gets the value 'undef'
1689          -U symbol=   symbol gets completely empty
1690        e.g.:  -Uversiononly
1691   -A : manipulate symbol after the platform specific hints have been applied:
1692          -A append:symbol=value   append value to symbol
1693          -A symbol=value          like append:, but with a separating space
1694          -A define:symbol=value   define symbol to have value
1695          -A clear:symbol          define symbol to be ''
1696          -A define:symbol         define symbol to be 'define'
1697          -A eval:symbol=value     define symbol to be eval of value
1698          -A prepend:symbol=value  prepend value to symbol
1699          -A undef:symbol          define symbol to be 'undef'
1700          -A undef:symbol=         define symbol to be ''
1701        e.g.:  -A prepend:libswanted='cl pthread '
1702               -A ccflags=-DSOME_MACRO
1703   -V : print version number and exit (with a zero status).
1704 EOM
1705         exit 1
1706         ;;
1707 esac
1708
1709 : Sanity checks
1710 case "$fastread$alldone" in
1711 yescont|yesexit) ;;
1712 *)
1713         case "$extractsh" in
1714         true) ;;
1715         *)
1716                 if test ! -t 0; then
1717                         echo "Say 'sh Configure', not 'sh <Configure'"
1718                         exit 1
1719                 fi
1720                 ;;
1721         esac
1722         ;;
1723 esac
1724
1725 exec 4>&1
1726 case "$silent" in
1727 true) exec 1>/dev/null;;
1728 esac
1729
1730 : run the defines and the undefines, if any, but leave the file out there...
1731 touch optdef.sh
1732 . ./optdef.sh
1733 : create the posthint manipulation script and leave the file out there...
1734 touch posthint.sh
1735
1736 : set package name
1737 package=perl5
1738 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1739 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1740 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1741 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1742 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1743 esac
1744
1745 : Some greps do not return status, grrr.
1746 echo "grimblepritz" >grimble
1747 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1748         contains=contains
1749 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1750         contains=grep
1751 else
1752         contains=contains
1753 fi
1754 rm -f grimble
1755 : the following should work in any shell
1756 case "$contains" in
1757 contains*)
1758         echo " "
1759         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1760         cat >contains <<'EOSS'
1761 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1762 EOSS
1763 chmod +x contains
1764 esac
1765
1766 : Find the path to the source tree
1767 case "$src" in
1768 '') case "$0" in
1769     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1770          case "$src" in
1771          /*)    ;;
1772          .)     ;;
1773          *)     src=`cd ../$src && pwd` ;;
1774          esac
1775          ;;
1776     *)   src='.';;
1777     esac;;
1778 esac
1779 case "$src" in
1780 '')     src=/
1781         rsrc=/
1782         ;;
1783 /*) rsrc="$src";;
1784 *) rsrc="../$src";;
1785 esac
1786 if test -f $rsrc/Configure && \
1787         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1788 then
1789    : found it, so we are ok.
1790 else
1791         rsrc=''
1792         for src in . .. ../.. ../../.. ../../../..; do
1793                 if test -f ../$src/Configure && \
1794                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1795                 then
1796                         rsrc=../$src
1797                         break
1798                 fi
1799         done
1800 fi
1801 case "$rsrc" in
1802 '')
1803         cat <<EOM >&4
1804
1805 Sorry, I can't seem to locate the source dir for $package.  Please start
1806 Configure with an explicit path -- i.e. /some/path/Configure.
1807
1808 EOM
1809         exit 1
1810         ;;
1811 ../.)   rsrc='..';;
1812 *)
1813         echo " "
1814         echo "Sources for $package found in \"$src\"." >&4
1815         ;;
1816 esac
1817
1818 : script used to extract .SH files with variable substitutions
1819 cat >extract <<'EOS'
1820 PERL_CONFIG_SH=true
1821 echo "Doing variable substitutions on .SH files..."
1822 if test -f MANIFEST; then
1823         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1824 else
1825         echo "(Looking for .SH files under the source directory.)"
1826         set x `(cd "$src"; find . -name "*.SH" -print)`
1827 fi
1828 shift
1829 case $# in
1830 0) set x `(cd "$src"; echo *.SH)`; shift;;
1831 esac
1832 if test ! -f "$src/$1"; then
1833         shift
1834 fi
1835 mkdir_p='
1836 name=$1;
1837 create="";
1838 while test $name; do
1839         if test ! -d "$name"; then
1840                 create="$name $create";
1841                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1842                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1843         else
1844                 name="";
1845         fi;
1846 done;
1847 for file in $create; do
1848         mkdir $file;
1849 done
1850 '
1851 for file in $*; do
1852         case "$src" in
1853         ".")
1854                 case "$file" in
1855                 */*)
1856                         dir=`expr X$file : 'X\(.*\)/'`
1857                         file=`expr X$file : 'X.*/\(.*\)'`
1858                         (cd "$dir" && . ./$file)
1859                         ;;
1860                 *)
1861                         . ./$file
1862                         ;;
1863                 esac
1864                 ;;
1865         *)
1866                 case "$file" in
1867                 */*)
1868                         dir=`expr X$file : 'X\(.*\)/'`
1869                         file=`expr X$file : 'X.*/\(.*\)'`
1870                         (set x $dir; shift; eval $mkdir_p)
1871                         sh <"$src/$dir/$file"
1872                         ;;
1873                 *)
1874                         sh <"$src/$file"
1875                         ;;
1876                 esac
1877                 ;;
1878         esac
1879 done
1880 if test -f "$src/config_h.SH"; then
1881         if test ! -f config.h; then
1882         : oops, they left it out of MANIFEST, probably, so do it anyway.
1883         . "$src/config_h.SH"
1884         fi
1885 fi
1886 EOS
1887
1888 : extract files and exit if asked to do so
1889 case "$extractsh" in
1890 true)
1891         case "$realsilent" in
1892         true) ;;
1893         *) exec 1>&4;;
1894         esac
1895         case "$config_sh" in
1896         '') config_sh='config.sh';;
1897         esac
1898         echo " "
1899         echo "Fetching answers from $config_sh..."
1900         cd ..
1901         . $config_sh
1902         test "$override" && . ./optdef.sh
1903         echo " "
1904         . UU/extract
1905         rm -rf UU
1906         echo "Extraction done."
1907         exit 0
1908         ;;
1909 esac
1910
1911 : Eunice requires " " instead of "", can you believe it
1912 echo " "
1913 : Here we go...
1914 echo "Beginning of configuration questions for $package."
1915
1916 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1917
1918 : first determine how to suppress newline on echo command
1919 echo " "
1920 echo "Checking echo to see how to suppress newlines..."
1921 (echo "hi there\c" ; echo " ") >.echotmp
1922 if $contains c .echotmp >/dev/null 2>&1 ; then
1923         echo "...using -n."
1924         n='-n'
1925         c=''
1926 else
1927         cat <<'EOM'
1928 ...using \c
1929 EOM
1930         n=''
1931         c='\c'
1932 fi
1933 echo $n "The star should be here-->$c"
1934 echo '*'
1935 rm -f .echotmp
1936
1937 : Now test for existence of everything in MANIFEST
1938 echo " "
1939 if test -f "$rsrc/MANIFEST"; then
1940         echo "First let's make sure your kit is complete.  Checking..." >&4
1941         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1942         rm -f missing
1943         tmppwd=`pwd`
1944         for filelist in x??; do
1945                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1946         done
1947         if test -s missing; then
1948                 cat missing >&4
1949                 cat >&4 <<'EOM'
1950
1951 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1952
1953 You have the option of continuing the configuration process, despite the
1954 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1955 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1956 and contact the author (perlbug@perl.org).
1957
1958 EOM
1959                 echo $n "Continue? [n] $c" >&4
1960                 read ans
1961                 case "$ans" in
1962                 y*)
1963                         echo "Continuing..." >&4
1964                         rm -f missing
1965                         ;;
1966                 *)
1967                         echo "ABORTING..." >&4
1968                         kill $$
1969                         ;;
1970                 esac
1971         else
1972                 echo "Looks good..."
1973         fi
1974 else
1975         echo "There is no MANIFEST file.  I hope your kit is complete !"
1976 fi
1977 rm -f missing x??
1978
1979 echo " "
1980 : Find the appropriate value for a newline for tr
1981 if test -n "$DJGPP"; then
1982        trnl='\012'
1983 fi
1984 if test X"$trnl" = X; then
1985         case "`echo foo|tr '\n' x 2>/dev/null`" in
1986         foox) trnl='\n' ;;
1987         esac
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\012' x 2>/dev/null`" in
1991         foox) trnl='\012' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1996        fooxy) trnl='\n\r' ;;
1997        esac
1998 fi
1999 if test X"$trnl" = X; then
2000         cat <<EOM >&2
2001
2002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2003
2004 EOM
2005         exit 1
2006 fi
2007
2008 : compute the number of columns on the terminal for proper question formatting
2009 case "$COLUMNS" in
2010 '') COLUMNS='80';;
2011 esac
2012
2013 : set up the echo used in my read
2014 myecho="case \"\$xxxm\" in
2015 '') echo $n \"\$rp $c\" >&4;;
2016 *) case \"\$rp\" in
2017         '') echo $n \"[\$xxxm] $c\";;
2018         *)
2019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2020                         echo \"\$rp\" >&4
2021                         echo $n \"[\$xxxm] $c\" >&4
2022                 else
2023                         echo $n \"\$rp [\$xxxm] $c\" >&4
2024                 fi
2025                 ;;
2026         esac;;
2027 esac"
2028
2029 : now set up to do reads with possible shell escape and default assignment
2030 cat <<EOSC >myread
2031 $startsh
2032 xxxm=\$dflt
2033 $myecho
2034 ans='!'
2035 case "\$fastread" in
2036 yes) case "\$dflt" in
2037         '') ;;
2038         *) ans='';
2039                 case "\$silent-\$rp" in
2040                 true-) ;;
2041                 *) echo " " >&4;;
2042                 esac;;
2043         esac;;
2044 *) case "\$silent" in
2045         true) case "\$rp" in
2046                 '') ans='';;
2047                 esac;;
2048         esac;;
2049 esac
2050 while expr "X\$ans" : "X!" >/dev/null; do
2051         read answ
2052         set x \$xxxm
2053         shift
2054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2055         case  "\$answ" in
2056         "!")
2057                 sh 1>&4
2058                 echo " "
2059                 $myecho
2060                 ;;
2061         !*)
2062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2063                 shift
2064                 sh 1>&4 -c "\$*"
2065                 echo " "
2066                 $myecho
2067                 ;;
2068         "\$ans")
2069                 case "\$ans" in
2070                 \\&*)
2071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2072                         shift
2073                         case "\$1" in
2074                         -d)
2075                                 fastread=yes
2076                                 echo "(OK, I'll run with -d after this question.)" >&4
2077                                 ;;
2078                         -*)
2079                                 echo "*** Sorry, \$1 not supported yet." >&4
2080                                 ;;
2081                         esac
2082                         $myecho
2083                         ans=!
2084                         ;;
2085                 esac;;
2086         *)
2087                 case "\$aok" in
2088                 y)
2089                         echo "*** Substitution done -- please confirm."
2090                         xxxm="\$ans"
2091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2092                         xxxm="\$ans"
2093                         ans=!
2094                         ;;
2095                 *)
2096                         echo "*** Error -- try again."
2097                         ans=!
2098                         ;;
2099                 esac
2100                 $myecho
2101                 ;;
2102         esac
2103         case "\$ans\$xxxm\$nostick" in
2104         '')
2105                 ans=!
2106                 $myecho
2107                 ;;
2108         esac
2109 done
2110 case "\$ans" in
2111 '') ans="\$xxxm";;
2112 esac
2113 EOSC
2114
2115 : create .config dir to save info across Configure sessions
2116 test -d ../.config || mkdir ../.config
2117 cat >../.config/README <<EOF
2118 This directory created by Configure to save information that should
2119 persist across sessions for $package.
2120
2121 You may safely delete it if you wish.
2122 EOF
2123
2124 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2125 case "$usedevel" in
2126 $define|true|[yY]*) ;;
2127 *) case "$xversion" in
2128    *[13579])
2129         cat >&4 <<EOH
2130 *** WHOA THERE!!! ***
2131
2132     This is an UNSTABLE DEVELOPMENT release.
2133     The version of this $package distribution is $xversion, that is, odd,
2134     (as opposed to even) and that signifies a development release.
2135     If you want a maintenance release, you want an even-numbered version.
2136
2137     Do ***NOT*** install this into production use.
2138     Data corruption and crashes are possible.
2139
2140     It is most seriously suggested that you do not continue any further
2141     unless you want to help in developing and debugging Perl.
2142
2143     If you *still* want to build perl, you can answer 'y' now,
2144     or pass -Dusedevel to Configure.
2145
2146 EOH
2147         rp='Do you really want to continue?'
2148         dflt='n'
2149         . ./myread
2150         case "$ans" in
2151         [yY]) echo >&4 "Okay, continuing."
2152               usedevel="$define" ;;
2153         *) echo >&4 "Okay, bye."
2154            exit 1
2155            ;;
2156         esac
2157         ;;
2158     esac
2159     ;;
2160 esac
2161 case "$usedevel" in
2162 $define|true|[yY]*)
2163         case "$versiononly" in
2164         '') versiononly="$define" ;;
2165         esac
2166         case "$installusrbinperl" in
2167         '') installusrbinperl="$undef" ;;
2168         esac
2169         ;;
2170 esac
2171
2172 : general instructions
2173 needman=true
2174 firsttime=true
2175 user=`(logname) 2>/dev/null`
2176 case "$user" in
2177 '') user=`whoami 2>&1`;;
2178 esac
2179 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2180         firsttime=false
2181         echo " "
2182         rp='Would you like to see the instructions?'
2183         dflt=n
2184         . ./myread
2185         case "$ans" in
2186         [yY]*) ;;
2187         *) needman=false;;
2188         esac
2189 fi
2190 if $needman; then
2191         cat <<EOH
2192
2193 This installation shell script will examine your system and ask you questions
2194 to determine how the perl5 package should be installed. If you get
2195 stuck on a question, you may use a ! shell escape to start a subshell or
2196 execute a command.  Many of the questions will have default answers in square
2197 brackets; typing carriage return will give you the default.
2198
2199 On some of the questions which ask for file or directory names you are allowed
2200 to use the ~name construct to specify the login directory belonging to "name",
2201 even if you don't have a shell which knows about that.  Questions where this is
2202 allowed will be marked "(~name ok)".
2203
2204 EOH
2205         rp=''
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         cat <<'EOH'
2209
2210 The prompter used in this script allows you to use shell variables and
2211 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2212 in the default answer, as if the default line was a set of arguments given to a
2213 script shell.  This means you may also use $* to repeat the whole default line,
2214 so you do not have to re-type everything to add something to the default.
2215
2216 Everytime there is a substitution, you will have to confirm.  If there is an
2217 error (e.g. an unmatched backtick), the default answer will remain unchanged
2218 and you will be prompted again.
2219
2220 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2221 the questions and use the computed defaults (or the previous answers if there
2222 was already a config.sh file). Type 'Configure -h' for a list of options.
2223 You may also start interactively and then answer '& -d' at any prompt to turn
2224 on the non-interactive behaviour for the remainder of the execution.
2225
2226 EOH
2227         . ./myread
2228         cat <<EOH
2229
2230 Much effort has been expended to ensure that this shell script will run on any
2231 Unix system.  If despite that it blows up on yours, your best bet is to edit
2232 Configure and run it again.  If you can't run Configure for some reason,
2233 you'll have to generate a config.sh file by hand.  Whatever problems you
2234 have, let me (perlbug@perl.org) know how I blew it.
2235
2236 This installation script affects things in two ways:
2237
2238 1) it may do direct variable substitutions on some of the files included
2239    in this kit.
2240 2) it builds a config.h file for inclusion in C programs.  You may edit
2241    any of these files as the need arises after running this script.
2242
2243 If you make a mistake on a question, there is no easy way to back up to it
2244 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2245 files.  Configure will offer to let you do this before it runs the SH files.
2246
2247 EOH
2248         dflt='Type carriage return to continue'
2249         . ./myread
2250         case "$firsttime" in
2251         true) echo $user >>../.config/instruct;;
2252         esac
2253 fi
2254
2255 : find out where common programs are
2256 echo " "
2257 echo "Locating common programs..." >&4
2258 cat <<EOSC >loc
2259 $startsh
2260 case \$# in
2261 0) exit 1;;
2262 esac
2263 thing=\$1
2264 shift
2265 dflt=\$1
2266 shift
2267 for dir in \$*; do
2268         case "\$thing" in
2269         .)
2270         if test -d \$dir/\$thing; then
2271                 echo \$dir
2272                 exit 0
2273         fi
2274         ;;
2275         *)
2276         for thisthing in \$dir/\$thing; do
2277                 : just loop through to pick last item
2278         done
2279         if test -f \$thisthing; then
2280                 echo \$thisthing
2281                 exit 0
2282         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2283                 echo \$thisthing
2284                 exit 0
2285         elif test -f \$dir/\$thing.exe; then
2286                 if test -n "$DJGPP"; then
2287                         echo \$dir/\$thing.exe
2288                 elif test "$eunicefix" != ":"; then
2289                         : on Eunice apparently
2290                         echo \$dir/\$thing
2291                         exit 0
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 Mcc
2323 ar
2324 bison
2325 byacc
2326 cpp
2327 csh
2328 date
2329 egrep
2330 gmake
2331 gzip
2332 less
2333 ln
2334 make
2335 more
2336 nm
2337 nroff
2338 pg
2339 test
2340 uname
2341 zip
2342 "
2343 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2344 pth="$pth /lib /usr/lib"
2345 for file in $loclist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't know where '$file' is, and my life depends on it." >&4
2370                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2371                 exit 1
2372                 ;;
2373         esac
2374 done
2375 echo " "
2376 echo "Don't worry if any of the following aren't found..."
2377 say=offhand
2378 for file in $trylist; do
2379         eval xxx=\$$file
2380         case "$xxx" in
2381         /*|?:[\\/]*)
2382                 if test -f "$xxx"; then
2383                         : ok
2384                 else
2385                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2386                         xxx=`./loc $file $file $pth`
2387                 fi
2388                 ;;
2389         '') xxx=`./loc $file $file $pth`;;
2390         *) xxx=`./loc $xxx $xxx $pth`;;
2391         esac
2392         eval $file=$xxx$_exe
2393         eval _$file=$xxx
2394         case "$xxx" in
2395         /*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         ?:[\\/]*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         *)
2402                 echo "I don't see $file out there, $say."
2403                 say=either
2404                 ;;
2405         esac
2406 done
2407 case "$egrep" in
2408 egrep)
2409         echo "Substituting grep for egrep."
2410         egrep=$grep
2411         _egrep=$grep
2412         ;;
2413 esac
2414 case "$ln" in
2415 ln)
2416         echo "Substituting cp for ln."
2417         ln=$cp
2418         _ln=$cp
2419         ;;
2420 esac
2421 case "$make" in
2422 make)   
2423         case "$gmake" in
2424         gmake)
2425         echo "I can't find make or gmake, and my life depends on it." >&4
2426         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2427         exit 1
2428         ;;
2429         esac
2430         ;;
2431 esac    
2432 case "$gmake" in
2433 gmake)  ;;
2434 *)      # We can't have osname yet.
2435         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2436                 # Assume that gmake, if found, is definitely GNU make
2437                 # and prefer it over the system make.
2438                 echo "Substituting gmake for make."
2439                 make=$gmake
2440                 _make=$gmake
2441         fi
2442         ;;
2443 esac
2444 case "$test" in
2445 test)
2446         echo "Hopefully test is built into your sh."
2447         ;;
2448 *)
2449         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2450                 echo "Using the test built into your sh."
2451                 test=test
2452                 _test=test
2453         fi
2454         ;;
2455 esac
2456 case "$echo" in
2457 echo)
2458         echo "Hopefully echo is built into your sh."
2459         ;;
2460 '') ;;
2461 *)
2462         echo " "
2463 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2464         $echo $n "hi there$c" >foo1
2465         echo $n "hi there$c" >foo2
2466         if cmp foo1 foo2 >/dev/null 2>&1; then
2467                 echo "They are compatible.  In fact, they may be identical."
2468         else
2469                 case "$n" in
2470                 '-n') n='' c='\c';;
2471                 *) n='-n' c='';;
2472                 esac
2473                 cat <<FOO
2474 They are not compatible!  You are probably running ksh on a non-USG system.
2475 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2476 have echo built in and we may have to run some Bourne shell scripts.  That
2477 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2478
2479 FOO
2480                 $echo $n "The star should be here-->$c"
2481                 $echo "*"
2482         fi
2483         $rm -f foo1 foo2
2484         ;;
2485 esac
2486
2487 # This question was auctioned at YAPC::Europe-2007 in Vienna
2488 # I never promised you could answer it. I only auctioned the question.
2489 cat <<FOO
2490 The following message is sponsored by
2491
2492   Dresden.pm<--The stars should be here.
2493
2494 Dear Perl user, system administrator or package
2495 maintainer, the Perl community sends greetings to
2496 you. Do you (emblematical) greet back [Y/n]? n
2497
2498 FOO
2499
2500 cat <<EOS >trygcc
2501 $startsh
2502 EOS
2503 cat <<'EOSC' >>trygcc
2504 case "$cc" in
2505 '') ;;
2506 *)  $rm -f try try.*
2507     $cat >try.c <<EOM
2508 int main(int argc, char *argv[]) {
2509   return 0;
2510 }
2511 EOM
2512     if $cc -o try $ccflags $ldflags try.c; then
2513        :
2514     else
2515         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         despair=yes
2517         trygcc=yes
2518         case "$cc" in
2519         *gcc*) trygcc=no ;;
2520         esac
2521         # Skip this test because it gives a false match on output like:
2522         #    ./trygcc: line 23: cc: command not found
2523         # case "`$cc -v -c try.c 2>&1`" in
2524         # *gcc*) trygcc=no ;;
2525         # esac
2526         if $test X"$trygcc" = Xyes; then
2527             if gcc -o try -c try.c; then
2528                 echo " "
2529                 echo "You seem to have a working gcc, though." >&4
2530                 # Switching compilers may undo the work of hints files.
2531                 # The most common problem is -D_REENTRANT for threads.
2532                 # This heuristic catches that case, but gets false positives
2533                 # if -Dusethreads was not actually specified.  Better to
2534                 # bail out here with a useful message than fail 
2535                 # mysteriously later. Should we perhaps just try to
2536                 # re-invoke Configure -Dcc=gcc config_args ?
2537                 if $test -f usethreads.cbu; then
2538                         $cat >&4 <<EOM 
2539
2540 *** However, any setting of the C compiler flags (e.g. for thread support)
2541 *** will be lost.  It may be necessary for you to restart Configure and
2542 *** add -Dcc=gcc to your Configure command line.
2543
2544 EOM
2545                         rp="Would you like to go ahead and try gcc anyway?"
2546                         dflt=n
2547                 else
2548                         rp="Would you like to use it?"
2549                         dflt=y
2550                 fi
2551                 if $test -f myread; then
2552                     . ./myread
2553                 else
2554                     if $test -f UU/myread; then
2555                         . ./UU/myread
2556                     else
2557                         echo "Cannot find myread, sorry.  Aborting." >&2
2558                         exit 1
2559                     fi
2560                 fi  
2561                 case "$ans" in
2562                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2563                 esac
2564             fi
2565         fi
2566     fi
2567     $rm -f try try.*
2568     ;;
2569 esac
2570 EOSC
2571
2572 cat <<EOS >checkcc
2573 $startsh
2574 EOS
2575 cat <<'EOSC' >>checkcc
2576 case "$cc" in        
2577 '') ;;
2578 *)  $rm -f try try.*              
2579     $cat >try.c <<EOM
2580 int main(int argc, char *argv[]) {
2581   return 0;
2582 }
2583 EOM
2584     if $cc -o try $ccflags $ldflags try.c; then
2585        :
2586     else
2587         if $test X"$despair" = Xyes; then
2588            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2589         fi
2590         $cat >&4 <<EOM         
2591 You need to find a working C compiler.
2592 Either (purchase and) install the C compiler supplied by your OS vendor,
2593 or for a free C compiler try http://gcc.gnu.org/
2594 I cannot continue any further, aborting.
2595 EOM
2596         exit 1
2597     fi
2598     $rm -f try try.*
2599     ;;
2600 esac
2601 EOSC
2602
2603 : determine whether symbolic links are supported
2604 echo " "
2605 $touch blurfl
2606 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2607         echo "Symbolic links are supported." >&4
2608         lns="$ln -s"
2609 else
2610         echo "Symbolic links are NOT supported." >&4
2611         lns="$ln"
2612 fi
2613 $rm -f blurfl sym
2614
2615 : determine whether symbolic links are supported
2616 echo " "
2617 case "$lns" in
2618 *"ln"*" -s")
2619         echo "Checking how to test for symbolic links..." >&4
2620         $lns blurfl sym
2621         if $test "X$issymlink" = X; then
2622                 case "$newsh" in
2623                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 esac
2626                 if test $? = 0; then
2627                         issymlink="test -h"
2628                 else
2629                         echo "Your builtin 'test -h' may be broken." >&4
2630                         case "$test" in
2631                         /*)     ;;
2632                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2633                                 for p in $pth
2634                                 do
2635                                         if test -f "$p/$test"; then
2636                                                 test="$p/$test"
2637                                                 break
2638                                         fi
2639                                 done
2640                                 ;;
2641                         esac
2642                         case "$test" in
2643                         /*)
2644                                 echo "Trying external '$test -h'." >&4
2645                                 issymlink="$test -h"
2646                                 if $test ! -h sym >/dev/null 2>&1; then
2647                                         echo "External '$test -h' is broken, too." >&4
2648                                         issymlink=''
2649                                 fi
2650                                 ;;
2651                         *)      issymlink='' ;;
2652                         esac
2653                 fi              
2654         fi
2655         if $test "X$issymlink" = X; then
2656                 if $test -L sym 2>/dev/null; then
2657                         issymlink="$test -L"
2658                         echo "The builtin '$test -L' worked." >&4
2659                 fi
2660         fi
2661         if $test "X$issymlink" != X; then
2662                 echo "You can test for symbolic links with '$issymlink'." >&4
2663         else
2664                 echo "I do not know how you can test for symbolic links." >&4
2665         fi
2666         $rm -f blurfl sym
2667         ;;
2668 *)      echo "No symbolic links, so not testing for their testing..." >&4
2669         ;;
2670 esac
2671 echo " "
2672
2673
2674 case "$mksymlinks" in
2675 $define|true|[yY]*)
2676         case "$src" in
2677         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2678                 exit 1
2679                 ;;
2680         *)      case "$lns:$issymlink" in
2681                 *"ln"*" -s:"*"test -"?)
2682                         echo "Creating the symbolic links..." >&4
2683                         echo "(First creating the subdirectories...)" >&4
2684                         cd ..
2685                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2686                                 read directory
2687                                 test -z "$directory" && break
2688                                 mkdir -p $directory
2689                         done
2690                         # Sanity check 1.
2691                         if test ! -d t/base; then
2692                                 echo "Failed to create the subdirectories.  Aborting." >&4
2693                                 exit 1
2694                         fi
2695                         echo "(Then creating the symlinks...)" >&4
2696                         awk '{print $1}' $src/MANIFEST | while true; do
2697                                 read filename
2698                                 test -z "$filename" && break
2699                                 if test -f $filename; then
2700                                         if $issymlink $filename; then
2701                                                 rm -f $filename
2702                                         fi
2703                                 fi
2704                                 if test -f $filename; then
2705                                         echo "$filename already exists, not symlinking."
2706                                 else
2707                                         ln -s $src/$filename $filename
2708                                 fi
2709                         done
2710                         # Sanity check 2.
2711                         if test ! -f t/base/lex.t; then
2712                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2713                                 exit 1
2714                         fi
2715                         cd UU
2716                         ;;
2717                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2718                         ;;
2719                 esac
2720                 ;;
2721         esac
2722         ;;
2723 esac
2724
2725
2726 case "$usecrosscompile" in
2727 $define|true|[yY]*)
2728         $echo "Cross-compiling..."
2729         croak=''
2730         case "$cc" in
2731         *-*-gcc) # A cross-compiling gcc, probably.
2732             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2733             ar=$targetarch-ar
2734             # leave out ld, choosing it is more complex
2735             nm=$targetarch-nm
2736             ranlib=$targetarch-ranlib
2737             $echo 'extern int foo;' > try.c
2738             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2739             shift
2740             if $test $# -gt 0; then
2741                 incpth="$incpth $*"
2742                 incpth="`$echo $incpth|$sed 's/^ //'`"
2743                 echo "Guessing incpth '$incpth'." >&4
2744                 for i in $*; do
2745                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2746                     if $test -d $j; then
2747                         libpth="$libpth $j"
2748                     fi
2749                 done   
2750                 libpth="`$echo $libpth|$sed 's/^ //'`"
2751                 echo "Guessing libpth '$libpth'." >&4
2752             fi
2753             $rm -f try.c
2754             ;;
2755         esac
2756         case "$targetarch" in
2757         '') echo "Targetarch not defined." >&4; croak=y ;;
2758         *)  echo "Using targetarch $targetarch." >&4 ;;
2759         esac
2760         case "$incpth" in
2761         '') echo "Incpth not defined." >&4; croak=y ;;
2762         *)  echo "Using incpth '$incpth'." >&4 ;;
2763         esac
2764         case "$libpth" in
2765         '') echo "Libpth not defined." >&4; croak=y ;;
2766         *)  echo "Using libpth '$libpth'." >&4 ;;
2767         esac
2768         case "$usrinc" in
2769         '') for i in $incpth; do
2770                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2771                     usrinc=$i
2772                     echo "Guessing usrinc $usrinc." >&4
2773                     break
2774                 fi
2775             done
2776             case "$usrinc" in
2777             '') echo "Usrinc not defined." >&4; croak=y ;;
2778             esac
2779             ;;
2780         *)  echo "Using usrinc $usrinc." >&4 ;;
2781         esac
2782         case "$targethost" in
2783         '') echo "Targethost not defined." >&4; croak=y ;;
2784         *)  echo "Using targethost $targethost." >&4
2785         esac
2786         locincpth=' '
2787         loclibpth=' '
2788         case "$croak" in
2789         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2790         esac
2791         case "$src" in
2792         /*) run=$src/Cross/run
2793             targetmkdir=$src/Cross/mkdir
2794             to=$src/Cross/to
2795             from=$src/Cross/from
2796             ;;
2797         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2798             run=$pwd/Cross/run
2799             targetmkdir=$pwd/Cross/mkdir
2800             to=$pwd/Cross/to
2801             from=$pwd/Cross/from
2802             ;;
2803         esac
2804         case "$targetrun" in
2805         '') targetrun=ssh ;;
2806         esac
2807         case "$targetto" in
2808         '') targetto=scp ;;
2809         esac
2810         case "$targetfrom" in
2811         '') targetfrom=scp ;;
2812         esac
2813         run=$run-$targetrun
2814         to=$to-$targetto
2815         from=$from-$targetfrom
2816         case "$targetdir" in
2817         '')  targetdir=/tmp
2818              echo "Guessing targetdir $targetdir." >&4
2819              ;;
2820         esac
2821         case "$targetuser" in
2822         '')  targetuser=root
2823              echo "Guessing targetuser $targetuser." >&4
2824              ;;
2825         esac
2826         case "$targetfrom" in
2827         scp)    q=-q ;;
2828         *)      q='' ;;
2829         esac
2830         case "$targetrun" in
2831         ssh|rsh)
2832             cat >$run <<EOF
2833 #!/bin/sh
2834 case "\$1" in
2835 -cwd)
2836   shift
2837   cwd=\$1
2838   shift
2839   ;;
2840 esac
2841 case "\$cwd" in
2842 '') cwd=$targetdir ;;
2843 esac
2844 exe=\$1
2845 shift
2846 if $test ! -f \$exe.xok; then
2847   $to \$exe
2848   $touch \$exe.xok
2849 fi
2850 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2851 EOF
2852             ;;
2853         *)  echo "Unknown targetrun '$targetrun'" >&4
2854             exit 1
2855             ;;
2856         esac
2857         case "$targetmkdir" in
2858         */Cross/mkdir)
2859             cat >$targetmkdir <<EOF
2860 #!/bin/sh
2861 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2862 EOF
2863             $chmod a+rx $targetmkdir
2864             ;;
2865         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetto" in
2870         scp|rcp)
2871             cat >$to <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   case "\$f" in
2876   /*)
2877     $targetmkdir \`dirname \$f\`
2878     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2879     ;;
2880   *)
2881     $targetmkdir $targetdir/\`dirname \$f\`
2882     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2883     ;;
2884   esac
2885 done
2886 exit 0
2887 EOF
2888             ;;
2889         cp) cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $mkdir -p $targetdir/\`dirname \$f\`
2896     $cp \$f $targetdir/\$f || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $cp \$f $targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetto '$targetto'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetfrom" in
2912         scp|rcp)
2913           cat >$from <<EOF
2914 #!/bin/sh
2915 for f in \$@
2916 do
2917   $rm -f \$f
2918   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$from <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   $rm -f \$f
2928   cp $targetdir/\$f . || exit 1
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         if $test ! -f $run; then
2938             echo "Target 'run' script '$run' not found." >&4
2939         else
2940             $chmod a+rx $run
2941         fi
2942         if $test ! -f $to; then
2943             echo "Target 'to' script '$to' not found." >&4
2944         else
2945             $chmod a+rx $to
2946         fi
2947         if $test ! -f $from; then
2948             echo "Target 'from' script '$from' not found." >&4
2949         else
2950             $chmod a+rx $from
2951         fi
2952         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2953             exit 1
2954         fi
2955         cat >&4 <<EOF
2956 Using '$run' for remote execution,
2957 and '$from' and '$to'
2958 for remote file transfer.
2959 EOF
2960         ;;
2961 *)      run=''
2962         to=:
2963         from=:
2964         usecrosscompile='undef'
2965         targetarch=''
2966         ;;
2967 esac
2968
2969 : see whether [:lower:] and [:upper:] are supported character classes
2970 echo " "
2971 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2972 ABYZ)
2973         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2974         up='[:upper:]'
2975         low='[:lower:]'
2976         ;;
2977 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2978         # (0xd9 and 0xe2), therefore that is a nice testing point.
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2981             rs) up='[A-Z]'
2982                 low='[a-z]'
2983                 ;;
2984             esac
2985         fi
2986         if test "X$up" = X -o "X$low" = X; then
2987             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2988             rs) up='A-Z'
2989                 low='a-z'
2990                 ;;
2991             esac
2992         fi
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | od -x 2>/dev/null`" in
2995             *D9E2*|*d9e2*)
2996                 echo "Hey, this might be EBCDIC." >&4
2997                 if test "X$up" = X -o "X$low" = X; then
2998                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2999                     rs) up='[A-IJ-RS-Z]'
3000                         low='[a-ij-rs-z]'
3001                         ;;
3002                     esac
3003                 fi
3004                 if test "X$up" = X -o "X$low" = X; then
3005                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3006                     rs) up='A-IJ-RS-Z'
3007                         low='a-ij-rs-z'
3008                         ;;
3009                     esac
3010                 fi
3011                 ;;
3012             esac
3013         fi
3014 esac
3015 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3016 rs)
3017     echo "Using $up and $low to convert case." >&4
3018     ;;
3019 *)
3020     echo "I don't know how to translate letters from upper to lower case." >&4
3021     echo "Your tr is not acting any way I know of." >&4
3022     exit 1
3023     ;;
3024 esac
3025 : set up the translation script tr, must be called with ./tr of course
3026 cat >tr <<EOSC
3027 $startsh
3028 case "\$1\$2" in
3029 '[A-Z][a-z]') exec $tr '$up' '$low';;
3030 '[a-z][A-Z]') exec $tr '$low' '$up';;
3031 esac
3032 exec $tr "\$@"
3033 EOSC
3034 chmod +x tr
3035 $eunicefix tr
3036
3037 : Try to determine whether config.sh was made on this system
3038 case "$config_sh" in
3039 '')
3040 myuname=`$uname -a 2>/dev/null`
3041 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3042 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3043 # because the A-Z/a-z are not consecutive.
3044 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3045         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3046 newmyuname="$myuname"
3047 dflt=n
3048 case "$knowitall" in
3049 '')
3050         if test -f ../config.sh; then
3051                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3052                         eval "`grep myuname= ../config.sh`"
3053                 fi
3054                 if test "X$myuname" = "X$newmyuname"; then
3055                         dflt=y
3056                 fi
3057         fi
3058         ;;
3059 *) dflt=y;;
3060 esac
3061
3062 : Get old answers from old config file if Configure was run on the
3063 : same system, otherwise use the hints.
3064 hint=default
3065 cd ..
3066 if test -f config.sh; then
3067         echo " "
3068         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3069         . UU/myread
3070         case "$ans" in
3071         n*|N*) echo "OK, I'll ignore it."
3072                 mv config.sh config.sh.old
3073                 myuname="$newmyuname"
3074                 ;;
3075         *)  echo "Fetching default answers from your old config.sh file..." >&4
3076                 tmp_n="$n"
3077                 tmp_c="$c"
3078                 tmp_sh="$sh"
3079                 . ./config.sh
3080                 cp config.sh UU
3081                 n="$tmp_n"
3082                 c="$tmp_c"
3083                 : Older versions did not always set $sh.  Catch re-use of such
3084                 : an old config.sh.
3085                 case "$sh" in
3086                 '') sh="$tmp_sh" ;;
3087                 esac
3088                 hint=previous
3089                 ;;
3090         esac
3091 fi
3092 . ./UU/checkcc
3093 if test ! -f config.sh; then
3094         $cat <<EOM
3095
3096 First time through, eh?  I have some defaults handy for some systems
3097 that need some extra help getting the Configure answers right:
3098
3099 EOM
3100         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3101         dflt=''
3102         : Half the following guesses are probably wrong... If you have better
3103         : tests or hints, please send them to perlbug@perl.org
3104         : The metaconfig authors would also appreciate a copy...
3105         $test -f /irix && osname=irix
3106         $test -f /xenix && osname=sco_xenix
3107         $test -f /dynix && osname=dynix
3108         $test -f /dnix && osname=dnix
3109         $test -f /lynx.os && osname=lynxos
3110         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3111         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /bin/mips && /bin/mips && osname=mips
3114         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3115                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3116         $test -d /usr/apollo/bin && osname=apollo
3117         $test -f /etc/saf/_sactab && osname=svr4
3118         $test -d /usr/include/minix && osname=minix
3119         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3120         if $test -d /MachTen -o -d /MachTen_Folder; then
3121                 osname=machten
3122                 if $test -x /sbin/version; then
3123                         osvers=`/sbin/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 elif $test -x /usr/etc/version; then
3126                         osvers=`/usr/etc/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 else
3129                         osvers="$2.$3"
3130                 fi
3131         fi
3132
3133         $test -f /sys/posix.dll &&
3134                 $test -f /usr/bin/what &&
3135                 set X `/usr/bin/what /sys/posix.dll` &&
3136                 $test "$3" = UWIN &&
3137                 osname=uwin &&
3138                 osvers="$5"
3139
3140         if $test -f $uname; then
3141                 set X $myuname
3142                 shift
3143
3144                 case "$5" in
3145                 fps*) osname=fps ;;
3146                 mips*)
3147                         case "$4" in
3148                         umips) osname=umips ;;
3149                         *) osname=mips ;;
3150                         esac;;
3151                 [23]100) osname=mips ;;
3152                 next*) osname=next ;;
3153                 i386*)
3154                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3155                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3156                                 osname='sco'
3157                                 osvers=$tmp
3158                         elif $test -f /etc/kconfig; then
3159                                 osname=isc
3160                                 if test "$lns" = "$ln -s"; then
3161                                         osvers=4
3162                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=3
3164                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3165                                         osvers=2
3166                                 fi
3167                         fi
3168                         tmp=''
3169                         ;;
3170                 pc*)
3171                         if test -n "$DJGPP"; then
3172                                 osname=dos
3173                                 osvers=djgpp
3174                         fi
3175                         ;;
3176                 esac
3177
3178                 case "$1" in
3179                 aix) osname=aix
3180                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3181                         case "$tmp" in
3182                         # oslevel can fail with:
3183                         # oslevel: Unable to acquire lock.
3184                         *not\ found) osvers="$4"."$3" ;;
3185                         '<3240'|'<>3240') osvers=3.2.0 ;;
3186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3187                         '=3250'|'>3250') osvers=3.2.5 ;;
3188                         *) osvers=$tmp;;
3189                         esac
3190                         ;;
3191                 bsd386) osname=bsd386
3192                         osvers=`$uname -r`
3193                         ;;
3194                 cygwin*) osname=cygwin
3195                         osvers="$3"
3196                         ;;
3197                 *dc.osx) osname=dcosx
3198                         osvers="$3"
3199                         ;;
3200                 dnix) osname=dnix
3201                         osvers="$3"
3202                         ;;
3203                 domainos) osname=apollo
3204                         osvers="$3"
3205                         ;;
3206                 dgux)   osname=dgux
3207                         osvers="$3"
3208                         ;;
3209                 dragonfly) osname=dragonfly
3210                         osvers="$3"
3211                         ;;
3212                 dynixptx*) osname=dynixptx
3213                         osvers=`echo "$4"|sed 's/^v//'`
3214                         ;;
3215                 freebsd) osname=freebsd
3216                         osvers="$3" ;;
3217                 genix)  osname=genix ;;
3218                 gnu)    osname=gnu
3219                         osvers="$3" ;;
3220                 hp*)    osname=hpux
3221                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3222                         ;;
3223                 irix*)  osname=irix
3224                         case "$3" in
3225                         4*) osvers=4 ;;
3226                         5*) osvers=5 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 linux)  osname=linux
3231                         case "$3" in
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 MiNT)   osname=mint
3236                         ;;
3237                 netbsd*) osname=netbsd
3238                         osvers="$3"
3239                         ;;
3240                 news-os) osvers="$3"
3241                         case "$3" in
3242                         4*) osname=newsos4 ;;
3243                         *) osname=newsos ;;
3244                         esac
3245                         ;;
3246                 next*) osname=next ;;
3247                 nonstop-ux) osname=nonstopux ;;
3248                 openbsd) osname=openbsd
3249                         osvers="$3"
3250                         ;;
3251                 os2)    osname=os2
3252                         osvers="$4"
3253                         ;;
3254                 POSIX-BC | posix-bc ) osname=posix-bc
3255                         osvers="$3"
3256                         ;;
3257                 powerux | power_ux | powermax_os | powermaxos | \
3258                 powerunix | power_unix) osname=powerux
3259                         osvers="$3"
3260                         ;;
3261                 qnx) osname=qnx
3262                         osvers="$4"
3263                         ;;
3264                 solaris) osname=solaris
3265                         case "$3" in
3266                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 sunos) osname=sunos
3271                         case "$3" in
3272                         5*) osname=solaris
3273                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3274                         *)      osvers="$3" ;;
3275                         esac
3276                         ;;
3277                 titanos) osname=titanos
3278                         case "$3" in
3279                         1*) osvers=1 ;;
3280                         2*) osvers=2 ;;
3281                         3*) osvers=3 ;;
3282                         4*) osvers=4 ;;
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 ultrix) osname=ultrix
3287                         osvers="$3"
3288                         ;;
3289                 osf1|mls+)      case "$5" in
3290                                 alpha)
3291                                         osname=dec_osf
3292                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3293                                         case "$osvers" in
3294                                         [1-9].[0-9]*) ;;
3295                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3296                                         esac
3297                                         ;;
3298                         hp*)    osname=hp_osf1  ;;
3299                         mips)   osname=mips_osf1 ;;
3300                         esac
3301                         ;;
3302                 # UnixWare 7.1.2 is known as Open UNIX 8
3303                 openunix|unixware) osname=svr5
3304                         osvers="$4"
3305                         ;;
3306                 uts)    osname=uts
3307                         osvers="$3"
3308                         ;;
3309                 vos) osvers="$3"
3310                         ;;
3311                 $2) case "$osname" in
3312                         *isc*) ;;
3313                         *freebsd*) ;;
3314                         svr*)
3315                                 : svr4.x or possibly later
3316                                 case "svr$3" in
3317                                 ${osname}*)
3318                                         osname=svr$3
3319                                         osvers=$4
3320                                         ;;
3321                                 esac
3322                                 case "$osname" in
3323                                 svr4.0)
3324                                         : Check for ESIX
3325                                         if test -f /stand/boot ; then
3326                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3327                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3328                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3329                                                         if test -n "$isesix"; then
3330                                                                 osname=esix4
3331                                                         fi
3332                                                 fi
3333                                         fi
3334                                         ;;
3335                                 esac
3336                                 ;;
3337                         *)      if test -f /etc/systemid; then
3338                                         osname=sco
3339                                         set `echo $3 | $sed 's/\./ /g'` $4
3340                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3341                                                 osvers=$1.$2.$3
3342                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3343                                                 osvers=$1.$2
3344                                         elif $test -f $src/hints/sco_$1.sh; then
3345                                                 osvers=$1
3346                                         fi
3347                                 else
3348                                         case "$osname" in
3349                                         '') : Still unknown.  Probably a generic Sys V.
3350                                                 osname="sysv"
3351                                                 osvers="$3"
3352                                                 ;;
3353                                         esac
3354                                 fi
3355                                 ;;
3356                         esac
3357                         ;;
3358                 *)      case "$osname" in
3359                         '') : Still unknown.  Probably a generic BSD.
3360                                 osname="$1"
3361                                 osvers="$3"
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366         else
3367                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3368                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3369                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3370                                 osname=news_os
3371                         fi
3372                         $rm -f UU/kernel.what
3373                 elif test -d c:/. -o -n "$is_os2" ; then
3374                         set X $myuname
3375                         osname=os2
3376                         osvers="$5"
3377                 fi
3378         fi
3379
3380         case "$targetarch" in
3381         '') ;;
3382         *)  hostarch=$osname
3383             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3384             osvers=''
3385             ;;
3386         esac
3387
3388         : Now look for a hint file osname_osvers, unless one has been
3389         : specified already.
3390         case "$hintfile" in
3391         ''|' ')
3392                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3393                 : Also try without trailing minor version numbers.
3394                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3395                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3398                 case "$file" in
3399                 '') dflt=none ;;
3400                 *)  case "$osvers" in
3401                         '') dflt=$file
3402                                 ;;
3403                         *)  if $test -f $src/hints/$file.sh ; then
3404                                         dflt=$file
3405                                 elif $test -f $src/hints/$xfile.sh ; then
3406                                         dflt=$xfile
3407                                 elif $test -f $src/hints/$xxfile.sh ; then
3408                                         dflt=$xxfile
3409                                 elif $test -f $src/hints/$xxxfile.sh ; then
3410                                         dflt=$xxxfile
3411                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3412                                         dflt=$xxxxfile
3413                                 elif $test -f "$src/hints/${osname}.sh" ; then
3414                                         dflt="${osname}"
3415                                 else
3416                                         dflt=none
3417                                 fi
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 if $test -f Policy.sh ; then
3423                         case "$dflt" in
3424                         *Policy*) ;;
3425                         none) dflt="Policy" ;;
3426                         *) dflt="Policy $dflt" ;;
3427                         esac
3428                 fi
3429                 ;;
3430         *)
3431                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3432                 ;;
3433         esac
3434
3435         if $test -f Policy.sh ; then
3436                 $cat <<EOM
3437
3438 There's also a Policy hint file available, which should make the
3439 site-specific (policy) questions easier to answer.
3440 EOM
3441
3442         fi
3443
3444         $cat <<EOM
3445
3446 You may give one or more space-separated answers, or "none" if appropriate.
3447 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3448 previous run of Configure, you may specify it as well as or instead of
3449 OS-specific hints.  If hints are provided for your OS, you should use them:
3450 although Perl can probably be built without hints on many platforms, using
3451 hints often improve performance and may enable features that Configure can't
3452 set up on its own. If there are no hints that match your OS, specify "none";
3453 DO NOT give a wrong version or a wrong OS.
3454
3455 EOM
3456
3457         rp="Which of these apply, if any?"
3458         . UU/myread
3459         tans=$ans
3460         for file in $tans; do
3461                 if $test X$file = XPolicy -a -f Policy.sh; then
3462                         . Policy.sh
3463                         $cat Policy.sh >> UU/config.sh
3464                 elif $test -f $src/hints/$file.sh; then
3465                         . $src/hints/$file.sh
3466                         $cat $src/hints/$file.sh >> UU/config.sh
3467                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3468                         : nothing
3469                 else
3470                         : Give one chance to correct a possible typo.
3471                         echo "$file.sh does not exist"
3472                         dflt=$file
3473                         rp="hint to use instead?"
3474                         . UU/myread
3475                         for file in $ans; do
3476                                 if $test -f "$src/hints/$file.sh"; then
3477                                         . $src/hints/$file.sh
3478                                         $cat $src/hints/$file.sh >> UU/config.sh
3479                                 elif $test X$ans = X -o X$ans = Xnone ; then
3480                                         : nothing
3481                                 else
3482                                         echo "$file.sh does not exist -- ignored."
3483                                 fi
3484                         done
3485                 fi
3486         done
3487
3488         hint=recommended
3489         : Remember our hint file for later.
3490         if $test -f "$src/hints/$file.sh" ; then
3491                 hintfile="$file"
3492         else
3493                 hintfile=''
3494         fi
3495 fi
3496 cd UU
3497 ;;
3498 *)
3499         echo " "
3500         echo "Fetching default answers from $config_sh..." >&4
3501         tmp_n="$n"
3502         tmp_c="$c"
3503         cd ..
3504         cp $config_sh config.sh 2>/dev/null
3505         chmod +w config.sh
3506         . ./config.sh
3507         cd UU
3508         cp ../config.sh .
3509         n="$tmp_n"
3510         c="$tmp_c"
3511         hint=previous
3512         ;;
3513 esac
3514 test "$override" && . ./optdef.sh
3515
3516 : Restore computed paths
3517 for file in $loclist $trylist; do
3518         eval $file="\$_$file"
3519 done
3520
3521 cat << EOM
3522
3523 Configure uses the operating system name and version to set some defaults.
3524 The default value is probably right if the name rings a bell. Otherwise,
3525 since spelling matters for me, either accept the default or answer "none"
3526 to leave it blank.
3527
3528 EOM
3529 case "$osname" in
3530         ''|' ')
3531                 case "$hintfile" in
3532                 ''|' '|none) dflt=none ;;
3533                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3534                 esac
3535                 ;;
3536         *) dflt="$osname" ;;
3537 esac
3538 rp="Operating system name?"
3539 . ./myread
3540 case "$ans" in
3541 none)  osname='' ;;
3542 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3543 esac
3544 echo " "
3545 case "$osvers" in
3546         ''|' ')
3547                 case "$hintfile" in
3548                 ''|' '|none) dflt=none ;;
3549                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3550                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3551                         case "$dflt" in
3552                         ''|' ') dflt=none ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osvers" ;;
3558 esac
3559 rp="Operating system version?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osvers='' ;;
3563 *) osvers="$ans" ;;
3564 esac
3565
3566
3567 . ./posthint.sh
3568
3569 : who configured the system
3570 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3571 case "$cf_by" in
3572 "")
3573         cf_by=`(logname) 2>/dev/null`
3574         case "$cf_by" in
3575         "")
3576                 cf_by=`(whoami) 2>/dev/null`
3577                 case "$cf_by" in
3578                 "") cf_by=unknown ;;
3579                 esac ;;
3580         esac ;;
3581 esac
3582
3583 : decide how portable to be.  Allow command line overrides.
3584 case "$d_portable" in
3585 "$undef") ;;
3586 *)      d_portable="$define" ;;
3587 esac
3588
3589 : set up shell script to do ~ expansion
3590 cat >filexp <<EOSS
3591 $startsh
3592 : expand filename
3593 case "\$1" in
3594  ~/*|~)
3595         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3596         ;;
3597  ~*)
3598         if $test -f /bin/csh; then
3599                 /bin/csh -f -c "glob \$1"
3600                 failed=\$?
3601                 echo ""
3602                 exit \$failed
3603         else
3604                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3605                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3606                 if $test ! -d "\$dir"; then
3607                         me=\`basename \$0\`
3608                         echo "\$me: can't locate home directory for: \$name" >&2
3609                         exit 1
3610                 fi
3611                 case "\$1" in
3612                 */*)
3613                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3614                         ;;
3615                 *)
3616                         echo \$dir
3617                         ;;
3618                 esac
3619         fi
3620         ;;
3621 *)
3622         echo \$1
3623         ;;
3624 esac
3625 EOSS
3626 chmod +x filexp
3627 $eunicefix filexp
3628
3629 : now set up to get a file name
3630 cat <<EOS >getfile
3631 $startsh
3632 EOS
3633 cat <<'EOSC' >>getfile
3634 tilde=''
3635 fullpath=''
3636 already=''
3637 skip=''
3638 none_ok=''
3639 exp_file=''
3640 nopath_ok=''
3641 orig_rp="$rp"
3642 orig_dflt="$dflt"
3643 case "$gfpth" in
3644 '') gfpth='.' ;;
3645 esac
3646
3647 case "$fn" in
3648 *\(*)
3649         : getfile will accept an answer from the comma-separated list
3650         : enclosed in parentheses even if it does not meet other criteria.
3651         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3652         fn=`echo $fn | sed 's/(.*)//'`
3653         ;;
3654 esac
3655
3656 case "$fn" in
3657 *:*)
3658         loc_file=`expr $fn : '.*:\(.*\)'`
3659         fn=`expr $fn : '\(.*\):.*'`
3660         ;;
3661 esac
3662
3663 case "$fn" in
3664 *~*) tilde=true;;
3665 esac
3666 case "$fn" in
3667 */*) fullpath=true;;
3668 esac
3669 case "$fn" in
3670 *+*) skip=true;;
3671 esac
3672 case "$fn" in
3673 *n*) none_ok=true;;
3674 esac
3675 case "$fn" in
3676 *e*) exp_file=true;;
3677 esac
3678 case "$fn" in
3679 *p*) nopath_ok=true;;
3680 esac
3681
3682 case "$fn" in
3683 *f*) type='File';;
3684 *d*) type='Directory';;
3685 *l*) type='Locate';;
3686 esac
3687
3688 what="$type"
3689 case "$what" in
3690 Locate) what='File';;
3691 esac
3692
3693 case "$exp_file" in
3694 '')
3695         case "$d_portable" in
3696         "$define") ;;
3697         *) exp_file=true;;
3698         esac
3699         ;;
3700 esac
3701
3702 cd ..
3703 while test "$type"; do
3704         redo=''
3705         rp="$orig_rp"
3706         dflt="$orig_dflt"
3707         case "$tilde" in
3708         true) rp="$rp (~name ok)";;
3709         esac
3710         . UU/myread
3711         if test -f UU/getfile.ok && \
3712                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3713         then
3714                 value="$ans"
3715                 ansexp="$ans"
3716                 break
3717         fi
3718         case "$ans" in
3719         none)
3720                 value=''
3721                 ansexp=''
3722                 case "$none_ok" in
3723                 true) type='';;
3724                 esac
3725                 ;;
3726         *)
3727                 case "$tilde" in
3728                 '') value="$ans"
3729                         ansexp="$ans";;
3730                 *)
3731                         value=`UU/filexp $ans`
3732                         case $? in
3733                         0)
3734                                 if test "$ans" != "$value"; then
3735                                         echo "(That expands to $value on this system.)"
3736                                 fi
3737                                 ;;
3738                         *) value="$ans";;
3739                         esac
3740                         ansexp="$value"
3741                         case "$exp_file" in
3742                         '') value="$ans";;
3743                         esac
3744                         ;;
3745                 esac
3746                 case "$fullpath" in
3747                 true)
3748                         case "$ansexp" in
3749                         /*) value="$ansexp" ;;
3750                         [a-zA-Z]:/*) value="$ansexp" ;;
3751                         *)
3752                                 redo=true
3753                                 case "$already" in
3754                                 true)
3755                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3756                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3757                                         ;;
3758                                 *)
3759                                 echo "Please give a full path name, starting with slash." >&4
3760                                         case "$tilde" in
3761                                         true)
3762                                 echo "Note that using ~name is ok provided it expands well." >&4
3763                                                 already=true
3764                                                 ;;
3765                                         esac
3766                                 esac
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 case "$redo" in
3772                 '')
3773                         case "$type" in
3774                         File)
3775                                 for fp in $gfpth; do
3776                                         if test "X$fp" = X.; then
3777                                             pf="$ansexp"
3778                                         else    
3779                                             pf="$fp/$ansexp"
3780                                         fi
3781                                         if test -f "$pf"; then
3782                                                 type=''
3783                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3784                                         then
3785                                                 echo "($value is not a plain file, but that's ok.)"
3786                                                 type=''
3787                                         fi
3788                                         if test X"$type" = X; then
3789                                             value="$pf"
3790                                             break
3791                                         fi
3792                                 done
3793                                 ;;
3794                         Directory)
3795                                 for fp in $gfpth; do
3796                                         if test "X$fp" = X.; then
3797                                             dir="$ans"
3798                                             direxp="$ansexp"
3799                                         else    
3800                                             dir="$fp/$ansexp"
3801                                             direxp="$fp/$ansexp"
3802                                         fi
3803                                         if test -d "$direxp"; then
3804                                                 type=''
3805                                                 value="$dir"
3806                                                 break
3807                                         fi
3808                                 done
3809                                 ;;
3810                         Locate)
3811                                 if test -d "$ansexp"; then
3812                                         echo "(Looking for $loc_file in directory $value.)"
3813                                         value="$value/$loc_file"
3814                                         ansexp="$ansexp/$loc_file"
3815                                 fi
3816                                 if test -f "$ansexp"; then
3817                                         type=''
3818                                 fi
3819                                 case "$nopath_ok" in
3820                                 true)   case "$value" in
3821                                         */*) ;;
3822                                         *)      echo "Assuming $value will be in people's path."
3823                                                 type=''
3824                                                 ;;
3825                                         esac
3826                                         ;;
3827                                 esac
3828                                 ;;
3829                         esac
3830
3831                         case "$skip" in
3832                         true) type='';
3833                         esac
3834
3835                         case "$type" in
3836                         '') ;;
3837                         *)
3838                                 if test "$fastread" = yes; then
3839                                         dflt=y
3840                                 else
3841                                         dflt=n
3842                                 fi
3843                                 rp="$what $value doesn't exist.  Use that name anyway?"
3844                                 . UU/myread
3845                                 dflt=''
3846                                 case "$ans" in
3847                                 y*) type='';;
3848                                 *) echo " ";;
3849                                 esac
3850                                 ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         esac
3856 done
3857 cd UU
3858 ans="$value"
3859 rp="$orig_rp"
3860 dflt="$orig_dflt"
3861 rm -f getfile.ok
3862 test "X$gfpthkeep" != Xy && gfpth=""
3863 EOSC
3864
3865 : determine root of directory hierarchy where package will be installed.
3866 case "$prefix" in
3867 '')
3868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3869         ;;
3870 *?/)
3871         dflt=`echo "$prefix" | sed 's/.$//'`
3872         ;;
3873 *)
3874         dflt="$prefix"
3875         ;;
3876 esac
3877 $cat <<EOM
3878
3879 By default, $package will be installed in $dflt/bin, manual pages
3880 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3881 installation directories. Typically this is something like /usr/local.
3882 If you wish to have binaries under /usr/bin but other parts of the
3883 installation under /usr/local, that's ok: you will be prompted
3884 separately for each of the installation directories, the prefix being
3885 only used to set the defaults.
3886
3887 EOM
3888 fn=d~
3889 rp='Installation prefix to use?'
3890 . ./getfile
3891 oldprefix=''
3892 case "$prefix" in
3893 '') ;;
3894 *)
3895         case "$ans" in
3896         "$prefix") ;;
3897         *) oldprefix="$prefix";;
3898         esac
3899         ;;
3900 esac
3901 prefix="$ans"
3902 prefixexp="$ansexp"
3903
3904 case "$afsroot" in
3905 '')     afsroot=/afs ;;
3906 *)      afsroot=$afsroot ;;
3907 esac
3908
3909 : is AFS running?
3910 echo " "
3911 case "$afs" in
3912 $define|true)   afs=true ;;
3913 $undef|false)   afs=false ;;
3914 *)      if test -d $afsroot; then
3915                 afs=true
3916         else
3917                 afs=false
3918         fi
3919         ;;
3920 esac
3921 if $afs; then
3922         echo "AFS may be running... I'll be extra cautious then..." >&4
3923 else
3924         echo "AFS does not seem to be running..." >&4
3925 fi
3926
3927 : determine installation prefix for where package is to be installed.
3928 if $afs; then 
3929 $cat <<EOM
3930
3931 Since you are running AFS, I need to distinguish the directory in which
3932 files will reside from the directory in which they are installed (and from
3933 which they are presumably copied to the former directory by occult means).
3934
3935 EOM
3936         case "$installprefix" in
3937         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3938         *) dflt="$installprefix";;
3939         esac
3940 else
3941 $cat <<EOM
3942
3943 In some special cases, particularly when building $package for distribution,
3944 it is convenient to distinguish the directory in which files should be
3945 installed from the directory ($prefix) in which they will
3946 eventually reside.  For most users, these two directories are the same.
3947
3948 EOM
3949         case "$installprefix" in
3950         '') dflt=$prefix ;;
3951         *) dflt=$installprefix;;
3952         esac
3953 fi
3954 fn=d~
3955 rp='What installation prefix should I use for installing files?'
3956 . ./getfile
3957 installprefix="$ans"
3958 installprefixexp="$ansexp"
3959
3960 : Perform the prefixexp/installprefixexp correction if necessary
3961 cat <<EOS >installprefix
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>installprefix
3965 : Change installation prefix, if necessary.
3966 if $test X"$prefix" != X"$installprefix"; then
3967     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3968 else
3969     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3970 fi
3971 EOSC
3972 chmod +x installprefix
3973 $eunicefix installprefix
3974
3975 : Set variables such as privlib and privlibexp from the output of ./getfile
3976 : performing the prefixexp/installprefixexp correction if necessary.
3977 cat <<EOS >setprefixvar
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>setprefixvar
3981 eval "${prefixvar}=\"\$ans\""
3982 eval "${prefixvar}exp=\"\$ansexp\""
3983 . ./installprefix
3984 EOSC
3985 chmod +x setprefixvar
3986 $eunicefix setprefixvar
3987
3988 : set up the script used to warn in case of inconsistency
3989 cat <<EOS >whoa
3990 $startsh
3991 EOS
3992 cat <<'EOSC' >>whoa
3993 dflt=y
3994 case "$hint" in
3995     recommended)
3996         case "$hintfile" in
3997         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3998                 ;;
3999         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4000                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4001                 ;;
4002         esac
4003         ;;
4004     *)  echo " "
4005         echo "*** WHOA THERE!!! ***" >&4
4006         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4007         ;;
4008 esac
4009 rp="    Keep the $hint value?"
4010 . ./myread
4011 case "$ans" in
4012 y) td=$was; tu=$was;;
4013 esac
4014 EOSC
4015
4016 : function used to set $1 to $val
4017 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4018 case "$val$was" in
4019 $define$undef) . ./whoa; eval "$var=\$td";;
4020 $undef$define) . ./whoa; eval "$var=\$tu";;
4021 *) eval "$var=$val";;
4022 esac'
4023
4024 case "$usesocks" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *) dflt='n';;
4027 esac
4028 cat <<EOM
4029
4030 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4031 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4032 to use the PerlIO abstraction layer, this will be implicitly selected.
4033
4034 If this doesn't make any sense to you, just accept the default '$dflt'.
4035 EOM
4036 rp='Build Perl for SOCKS?'
4037 . ./myread
4038 case "$ans" in
4039 y|Y)    val="$define" ;;     
4040 *)      val="$undef" ;;
4041 esac
4042 set usesocks
4043 eval $setvar
4044
4045 case "$usesocks" in
4046 $define|true|[yY]*) useperlio="$define";;
4047 esac
4048
4049 case "$useperlio" in
4050 $define|true|[yY]*|'')  dflt='y';;
4051 *) dflt='n';;
4052 esac
4053 cat <<EOM
4054
4055 Previous version of $package used the standard IO mechanisms as
4056 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4057 alternate IO mechanisms via the PerlIO abstraction layer, but the
4058 stdio mechanism is still available if needed.  The abstraction layer
4059 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4060 Using PerlIO with sfio may cause problems with some extension modules.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Use the PerlIO abstraction layer?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y) 
4068         val="$define"
4069         ;;
4070 *)      
4071         echo "Ok, doing things the stdio way."
4072         val="$undef"
4073         ;;
4074 esac
4075 set useperlio
4076 eval $setvar 
4077
4078 case "$usesocks" in
4079 $define|true|[yY]*)
4080         case "$useperlio" in
4081         $define|true|[yY]*) ;;
4082         *)      cat >&4 <<EOM
4083
4084 You are using the SOCKS proxy protocol library which means that you
4085 should also use the PerlIO layer.  You may be headed for trouble.
4086
4087 EOM
4088                 ;;
4089         esac
4090         ;;
4091 esac
4092
4093         
4094 : get the patchlevel
4095 echo " "
4096 echo "Getting the current patchlevel..." >&4
4097 if $test -r $rsrc/patchlevel.h;then
4098         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4099         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4100         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4102         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4104         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4105 else
4106         revision=0
4107         patchlevel=0
4108         subversion=0
4109         api_revision=0
4110         api_version=0
4111         api_subversion=0
4112         perl_patchlevel=0
4113         $echo "(You do not have patchlevel.h.  Eek.)"
4114 fi
4115 if $test -r $rsrc/.patch ; then
4116         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4117                 perl_patchlevel=`cat $rsrc/.patch`
4118         fi
4119 fi
4120 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4121 version_patchlevel_string="version $patchlevel subversion $subversion"
4122 case "$perl_patchlevel" in
4123 0|'') ;;
4124 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4125 esac
4126
4127 $echo "(You have $package $version_patchlevel_string.)"
4128
4129 case "$osname" in
4130 dos|vms)
4131         : XXX Should be a Configure test for double-dots in filenames.
4132         version=`echo $revision $patchlevel $subversion | \
4133                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4134         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         ;;
4137 *)
4138         version=`echo $revision $patchlevel $subversion | \
4139                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4140         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         ;;
4143 esac
4144 : Special case the 5.005_xx maintenance series, which used 5.005
4145 : without any subversion label as a subdirectory in $sitelib
4146 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4147         api_versionstring='5.005'
4148 fi
4149
4150 case "$usethreads" in
4151 $define|true|[yY]*)     dflt='y';;
4152 *)     # Catch case where user specified ithreads or 5005threads but
4153        # forgot -Dusethreads (A.D. 4/2002)
4154        case "$useithreads$use5005threads" in
4155        *$define*)      
4156                 case "$useperlio" in
4157                 "$define")      dflt='y' ;;
4158                 *)              dflt='n' ;;
4159                 esac
4160                 ;;
4161        *)       dflt='n';;
4162        esac
4163        ;;
4164 esac
4165 cat <<EOM
4166
4167 Perl can be built to take advantage of threads on some systems.
4168 To do so, Configure can be run with -Dusethreads.
4169
4170 Note that Perl built with threading support runs slightly slower
4171 and uses more memory than plain Perl. The current implementation
4172 is believed to be stable, but it is fairly new, and so should be
4173 treated with caution.
4174
4175 If this doesn't make any sense to you, just accept the default '$dflt'.
4176 EOM
4177 rp='Build a threading Perl?'
4178 . ./myread
4179 case "$ans" in
4180 y|Y)    val="$define" ;;
4181 *)      val="$undef" ;;
4182 esac
4183 set usethreads
4184 eval $setvar
4185
4186 if $test $patchlevel -lt 9; then
4187     case "$usethreads" in
4188     $define)
4189         $cat <<EOM
4190
4191 Since release 5.6, Perl has had two different threading implementations,
4192 the newer interpreter-based version (ithreads) with one interpreter per
4193 thread, and the older 5.005 version (5005threads).
4194 The 5005threads version is effectively unmaintained and will probably be
4195 removed in Perl 5.10, so there should be no need to build a Perl using it
4196 unless needed for backwards compatibility with some existing 5.005threads
4197 code.
4198
4199 EOM
4200         : Default to ithreads unless overridden on command line or with
4201         : old config.sh
4202         dflt='y'
4203         case "$use5005threads" in
4204                 $define|true|[yY]*) dflt='n';;
4205         esac
4206         case "$useithreads" in
4207                 $undef|false|[nN]*) dflt='n';;
4208         esac
4209         rp='Use the newer interpreter-based ithreads?'
4210         . ./myread
4211         case "$ans" in
4212         y|Y)    val="$define" ;;
4213         *)      val="$undef" ;;
4214         esac
4215         set useithreads
4216         eval $setvar
4217         : Now set use5005threads to the opposite value.
4218         case "$useithreads" in
4219         $define) val="$undef" ;;
4220         *) val="$define" ;;
4221         esac
4222         set use5005threads
4223         eval $setvar
4224         ;;
4225     *)
4226         useithreads="$undef"
4227         use5005threads="$undef"
4228         ;;
4229     esac
4230
4231     case "$useithreads$use5005threads" in
4232     "$define$define")
4233         $cat >&4 <<EOM
4234
4235 You cannot have both the ithreads and the 5.005 threads enabled
4236 at the same time.  Disabling the 5.005 threads since they are
4237 much less stable than the ithreads.
4238
4239 EOM
4240         use5005threads="$undef"
4241         ;;
4242     esac
4243
4244 else
4245 : perl-5.9.x and later
4246
4247     if test X"$usethreads" = "X$define"; then
4248         case "$use5005threads" in
4249             $define|true|[yY]*)
4250                 $cat >&4 <<EOM
4251
4252 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4253
4254 EOM
4255             ;;
4256         esac
4257     fi
4258
4259     use5005threads="$undef"
4260     useithreads="$usethreads"
4261 fi
4262
4263 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4264         cat >&4 <<EOF
4265 ***
4266 *** To build with ithreads you must also use the PerlIO layer.
4267 *** Cannot continue, aborting.
4268 ***
4269 EOF
4270         exit 1
4271 fi
4272
4273 case "$d_oldpthreads" in
4274 '')     : Configure tests would be welcome here.  For now, assume undef.
4275         val="$undef" ;;
4276 *)      val="$d_oldpthreads" ;;
4277 esac
4278 set d_oldpthreads
4279 eval $setvar
4280
4281
4282 : Look for a hint-file generated 'call-back-unit'.  If the
4283 : user has specified that a threading perl is to be built,
4284 : we may need to set or change some other defaults.
4285 if $test -f usethreads.cbu; then
4286     echo "Your platform has some specific hints regarding threaded builds, using them..."
4287     . ./usethreads.cbu
4288 else
4289     case "$usethreads" in
4290         "$define"|true|[yY]*)
4291                 $cat <<EOM
4292 (Your platform does not have any specific hints for threaded builds.
4293  Assuming POSIX threads, then.)
4294 EOM
4295         ;;
4296     esac
4297 fi
4298
4299 cat <<EOM
4300
4301 Perl can be built so that multiple Perl interpreters can coexist
4302 within the same Perl executable.
4303 EOM
4304
4305 case "$useithreads" in
4306 $define)
4307         cat <<EOM
4308 This multiple interpreter support is required for interpreter-based threads.
4309 EOM
4310         val="$define"
4311         ;;
4312 *)      case "$usemultiplicity" in
4313         $define|true|[yY]*)     dflt='y';;
4314         *) dflt='n';;
4315         esac
4316         echo " "
4317         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4318         rp='Build Perl for multiplicity?'
4319         . ./myread
4320         case "$ans" in
4321         y|Y)    val="$define" ;;
4322         *)      val="$undef" ;;
4323         esac
4324         ;;
4325 esac
4326 set usemultiplicity
4327 eval $setvar
4328
4329
4330 case "$usemorebits" in
4331 "$define"|true|[yY]*)
4332         use64bitint="$define"
4333         uselongdouble="$define"
4334         usemorebits="$define"
4335         ;;
4336 *)      usemorebits="$undef"
4337         ;;
4338 esac
4339
4340 : make some quick guesses about what we are up against
4341 echo " "
4342 $echo $n "Hmm...  $c"
4343 echo exit 1 >bsd
4344 echo exit 1 >usg
4345 echo exit 1 >v7
4346 echo exit 1 >osf1
4347 echo exit 1 >eunice
4348 echo exit 1 >xenix
4349 echo exit 1 >venix
4350 echo exit 1 >os2
4351 d_bsd="$undef"
4352 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4353 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4354 then
4355         echo "Looks kind of like an OSF/1 system, but we'll see..."
4356         echo exit 0 >osf1
4357 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4358         xxx=`./loc addbib blurfl $pth`
4359         if $test -f $xxx; then
4360         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4361                 echo exit 0 >bsd
4362                 echo exit 0 >usg
4363         else
4364                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4365                         echo "Looks kind of like an extended USG system, but we'll see..."
4366                 else
4367                         echo "Looks kind of like a USG system, but we'll see..."
4368                 fi
4369                 echo exit 0 >usg
4370         fi
4371 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4372         echo "Looks kind of like a BSD system, but we'll see..."
4373         d_bsd="$define"
4374         echo exit 0 >bsd
4375 else
4376         echo "Looks kind of like a Version 7 system, but we'll see..."
4377         echo exit 0 >v7
4378 fi
4379 case "$eunicefix" in
4380 *unixtovms*)
4381         $cat <<'EOI'
4382 There is, however, a strange, musty smell in the air that reminds me of
4383 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4384 EOI
4385         echo exit 0 >eunice
4386         d_eunice="$define"
4387 : it so happens the Eunice I know will not run shell scripts in Unix format
4388         ;;
4389 *)
4390         echo " "
4391         echo "Congratulations.  You aren't running Eunice."
4392         d_eunice="$undef"
4393         ;;
4394 esac
4395 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4396 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4397 : semicolon as a patch separator
4398 case "$p_" in
4399 :) ;;
4400 *)
4401         $cat <<'EOI'
4402 I have the feeling something is not exactly right, however...don't tell me...
4403 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4404 (Or you may be running DOS with DJGPP.)
4405 EOI
4406         echo exit 0 >os2
4407         ;;
4408 esac
4409 if test -f /xenix; then
4410         echo "Actually, this looks more like a XENIX system..."
4411         echo exit 0 >xenix
4412         d_xenix="$define"
4413 else
4414         echo " "
4415         echo "It's not Xenix..."
4416         d_xenix="$undef"
4417 fi
4418 chmod +x xenix
4419 $eunicefix xenix
4420 if test -f /venix; then
4421         echo "Actually, this looks more like a VENIX system..."
4422         echo exit 0 >venix
4423 else
4424         echo " "
4425         if ./xenix; then
4426                 : null
4427         else
4428                 echo "Nor is it Venix..."
4429         fi
4430 fi
4431 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4432 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4433 $rm -f foo
4434
4435 case "$cc" in
4436 '') dflt=cc;;
4437 *) dflt="$cc";;
4438 esac
4439 rp="Use which C compiler?"
4440 . ./myread
4441 cc="$ans"
4442
4443 : See if they have not cc but they do have gcc
4444 . ./trygcc
4445 : Look for a hint-file generated 'call-back-unit'.  Now that the
4446 : user has specified the compiler, we may need to set or change some
4447 : other defaults.
4448 if $test -f cc.cbu; then
4449     . ./cc.cbu
4450 fi
4451 . ./checkcc
4452
4453 echo " "
4454 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4455 $cat >try.c <<EOM
4456 #include <stdio.h>
4457 int main() {
4458 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4459 #ifdef __VERSION__
4460         printf("%s\n", __VERSION__);
4461 #else
4462         printf("%s\n", "1");
4463 #endif
4464 #endif
4465         return(0);
4466 }
4467 EOM
4468 if $cc -o try $ccflags $ldflags try.c; then
4469         gccversion=`$run ./try`
4470         case "$gccversion" in
4471         '') echo "You are not using GNU cc." ;;
4472         *)  echo "You are using GNU cc $gccversion."
4473             ccname=gcc
4474             ;;
4475         esac
4476 else
4477         echo " "
4478         echo "*** WHOA THERE!!! ***" >&4
4479         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4480         case "$knowitall" in
4481         '')
4482         echo "    You'd better start hunting for one and let me know about it." >&4
4483                 exit 1
4484                 ;;
4485         esac
4486 fi
4487 $rm -f try try.*
4488 case "$gccversion" in
4489 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4490 esac
4491 case "$gccversion" in
4492 '') gccosandvers='' ;;
4493 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4494    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4495    gccshortvers=''
4496    case "$gccosandvers" in
4497    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4498    $osname$osvers) ;; # looking good
4499    $osname*) cat <<EOM >&4
4500
4501 *** WHOA THERE!!! ***
4502
4503     Your gcc has not been compiled for the exact release of
4504     your operating system ($gccosandvers versus $osname$osvers).
4505
4506     In general it is a good idea to keep gcc synchronized with
4507     the operating system because otherwise serious problems
4508     may ensue when trying to compile software, like Perl.
4509
4510     I'm trying to be optimistic here, though, and will continue.
4511     If later during the configuration and build icky compilation
4512     problems appear (headerfile conflicts being the most common
4513     manifestation), I suggest reinstalling the gcc to match
4514     your operating system release.
4515
4516 EOM
4517       ;;
4518    *) gccosandvers='' ;; # failed to parse, better be silent
4519    esac
4520    ;;
4521 esac
4522 case "$ccname" in
4523 '') ccname="$cc" ;;
4524 esac
4525
4526 # gcc 3.* complain about adding -Idirectories that they already know about,
4527 # so we will take those off from locincpth.
4528 case "$gccversion" in
4529 3*)
4530     echo "main(){}">try.c
4531     for incdir in $locincpth; do
4532        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4533              grep '^c[cp]p*[01]: warning: changing search order '`
4534        if test "X$warn" != X; then
4535            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4536        fi
4537     done
4538     $rm -f try try.*
4539 esac
4540
4541 : What should the include directory be ?
4542 echo " "
4543 $echo $n "Hmm...  $c"
4544 dflt='/usr/include'
4545 incpath=''
4546 mips_type=''
4547 if $test -f /bin/mips && /bin/mips; then
4548         echo "Looks like a MIPS system..."
4549         $cat >usr.c <<'EOCP'
4550 #ifdef SYSTYPE_BSD43
4551 /bsd43
4552 #endif
4553 EOCP
4554         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4555                 dflt='/bsd43/usr/include'
4556                 incpath='/bsd43'
4557                 mips_type='BSD 4.3'
4558         else
4559                 mips_type='System V'
4560         fi
4561         $rm -f usr.c usr.out
4562         echo "and you're compiling with the $mips_type compiler and libraries."
4563         xxx_prompt=y
4564         echo "exit 0" >mips
4565 else
4566         echo "Doesn't look like a MIPS system."
4567         xxx_prompt=n
4568         echo "exit 1" >mips
4569 fi
4570 chmod +x mips
4571 $eunicefix mips
4572 case "$usrinc" in
4573 '') ;;
4574 *) dflt="$usrinc";;
4575 esac
4576 case "$xxx_prompt" in
4577 y)      fn=d/
4578         echo " "
4579         rp='Where are the include files you want to use?'
4580         . ./getfile
4581         usrinc="$ans"
4582         ;;
4583 *)      usrinc="$dflt"
4584         ;;
4585 esac
4586
4587 : see how we invoke the C preprocessor
4588 echo " "
4589 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4590 cat <<'EOT' >testcpp.c
4591 #define ABC abc
4592 #define XYZ xyz
4593 ABC.XYZ
4594 EOT
4595 cd ..
4596 if test ! -f cppstdin; then
4597         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4598                 # AIX cc -E doesn't show the absolute headerfile
4599                 # locations but we'll cheat by using the -M flag.
4600                 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
4601         else
4602                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4603         fi
4604 else
4605         echo "Keeping your $hint cppstdin wrapper."
4606 fi
4607 chmod 755 cppstdin
4608 wrapper=`pwd`/cppstdin
4609 ok='false'
4610 cd UU
4611
4612 if $test "X$cppstdin" != "X" && \
4613         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4614         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4615 then
4616         echo "You used to use $cppstdin $cppminus so we'll use that again."
4617         case "$cpprun" in
4618         '') echo "But let's see if we can live without a wrapper..." ;;
4619         *)
4620                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4621                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4622                 then
4623                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4624                         ok='true'
4625                 else
4626                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4627                 fi
4628                 ;;
4629         esac
4630 else
4631         case "$cppstdin" in
4632         '') ;;
4633         *)
4634                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4635                 ;;
4636         esac
4637 fi
4638
4639 if $ok; then
4640         : nothing
4641 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4642         $cc -E <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Yup, it does."
4645         x_cpp="$cc -E"
4646         x_minus='';
4647 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4648         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "Yup, it does."
4651         x_cpp="$cc -E"
4652         x_minus='-';
4653 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4654         $cc -P <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Yipee, that works!"
4657         x_cpp="$cc -P"
4658         x_minus='';
4659 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4660         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         echo "At long last!"
4663         x_cpp="$cc -P"
4664         x_minus='-';
4665 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4666         $cpp <testcpp.c >testcpp.out 2>&1; \
4667         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668         echo "It works!"
4669         x_cpp="$cpp"
4670         x_minus='';
4671 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4672         $cpp - <testcpp.c >testcpp.out 2>&1; \
4673         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4674         echo "Hooray, it works!  I was beginning to wonder."
4675         x_cpp="$cpp"
4676         x_minus='-';
4677 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4678         $wrapper <testcpp.c >testcpp.out 2>&1; \
4679         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4680         x_cpp="$wrapper"
4681         x_minus=''
4682         echo "Eureka!"
4683 else
4684         dflt=''
4685         rp="No dice.  I can't find a C preprocessor.  Name one:"
4686         . ./myread
4687         x_cpp="$ans"
4688         x_minus=''
4689         $x_cpp <testcpp.c >testcpp.out 2>&1
4690         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4691                 echo "OK, that will do." >&4
4692         else
4693 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4694                 exit 1
4695         fi
4696 fi
4697
4698 case "$ok" in
4699 false)
4700         cppstdin="$x_cpp"
4701         cppminus="$x_minus"
4702         cpprun="$x_cpp"
4703         cpplast="$x_minus"
4704         set X $x_cpp
4705         shift
4706         case "$1" in
4707         "$cpp")
4708                 echo "Perhaps can we force $cc -E using a wrapper..."
4709                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4710                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4711                 then
4712                         echo "Yup, we can."
4713                         cppstdin="$wrapper"
4714                         cppminus='';
4715                 else
4716                         echo "Nope, we'll have to live without it..."
4717                 fi
4718                 ;;
4719         esac
4720         case "$cpprun" in
4721         "$wrapper")
4722                 cpprun=''
4723                 cpplast=''
4724                 ;;
4725         esac
4726         ;;
4727 esac
4728
4729 case "$cppstdin" in
4730 "$wrapper"|'cppstdin') ;;
4731 *) $rm -f $wrapper;;
4732 esac
4733 $rm -f testcpp.c testcpp.out
4734
4735 : Set private lib path
4736 case "$plibpth" in
4737 '') if ./mips; then
4738                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4739         fi;;
4740 esac
4741 case "$libpth" in
4742 ' ') dlist='';;
4743 '') dlist="$loclibpth $plibpth $glibpth";;
4744 *) dlist="$libpth";;
4745 esac
4746
4747 : Now check and see which directories actually exist, avoiding duplicates
4748 libpth=''
4749 for xxx in $dlist
4750 do
4751     if $test -d $xxx; then
4752                 case " $libpth " in
4753                 *" $xxx "*) ;;
4754                 *) libpth="$libpth $xxx";;
4755                 esac
4756     fi
4757 done
4758 $cat <<'EOM'
4759
4760 Some systems have incompatible or broken versions of libraries.  Among
4761 the directories listed in the question below, please remove any you
4762 know not to be holding relevant libraries, and add any that are needed.
4763 Say "none" for none.
4764
4765 EOM
4766 case "$libpth" in
4767 '') dflt='none';;
4768 *)
4769         set X $libpth
4770         shift
4771         dflt=${1+"$@"}
4772         ;;
4773 esac
4774 rp="Directories to use for library searches?"
4775 . ./myread
4776 case "$ans" in
4777 none) libpth=' ';;
4778 *) libpth="$ans";;
4779 esac
4780
4781 : compute shared library extension
4782 case "$so" in
4783 '')
4784         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4785                 dflt='sl'
4786         else
4787                 dflt='so'
4788         fi
4789         ;;
4790 *) dflt="$so";;
4791 esac
4792 $cat <<EOM
4793
4794 On some systems, shared libraries may be available.  Answer 'none' if
4795 you want to suppress searching of shared libraries for the remainder
4796 of this configuration.
4797
4798 EOM
4799 rp='What is the file extension used for shared libraries?'
4800 . ./myread
4801 so="$ans"
4802
4803 : Define several unixisms.
4804 : Hints files or command line option can be used to override them.
4805 : The convoluted testing is in case hints files set either the old
4806 : or the new name.
4807 case "$_exe" in
4808 '')     case "$exe_ext" in
4809         '')     ;;
4810         *)      _exe="$exe_ext" ;;
4811         esac
4812         ;;
4813 esac
4814 case "$_a" in
4815 '')     case "$lib_ext" in
4816     '') _a='.a';;
4817         *)      _a="$lib_ext" ;;
4818         esac
4819         ;;
4820 esac
4821 case "$_o" in
4822 '') case "$obj_ext" in
4823         '')     _o='.o';;
4824         *)      _o="$obj_ext";;
4825         esac
4826         ;;
4827 esac
4828 case "$p_" in
4829 '') case "$path_sep" in
4830         '')     p_=':';;
4831         *)      p_="$path_sep";;
4832         esac
4833         ;;
4834 esac
4835 exe_ext=$_exe
4836 lib_ext=$_a
4837 obj_ext=$_o
4838 path_sep=$p_
4839
4840 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4841
4842 : Which makefile gets called first.  This is used by make depend.
4843 case "$firstmakefile" in
4844 '') firstmakefile='makefile';;
4845 esac
4846
4847 case "$ccflags" in
4848 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4849 esac
4850
4851 case "$uselongdouble" in
4852 $define|true|[yY]*)     dflt='y';;
4853 *) dflt='n';;
4854 esac
4855 cat <<EOM
4856
4857 Perl can be built to take advantage of long doubles which
4858 (if available) may give more accuracy and range for floating point numbers.
4859
4860 If this doesn't make any sense to you, just accept the default '$dflt'.
4861 EOM
4862 rp='Try to use long doubles if available?'
4863 . ./myread
4864 case "$ans" in
4865 y|Y)    val="$define"   ;;
4866 *)      val="$undef"    ;;
4867 esac
4868 set uselongdouble
4869 eval $setvar
4870
4871 case "$uselongdouble" in
4872 true|[yY]*) uselongdouble="$define" ;;
4873 esac
4874
4875 : Look for a hint-file generated 'call-back-unit'.  If the
4876 : user has specified that long doubles should be used,
4877 : we may need to set or change some other defaults.
4878 if $test -f uselongdouble.cbu; then
4879     echo "Your platform has some specific hints regarding long doubles, using them..."
4880     . ./uselongdouble.cbu
4881 else
4882     case "$uselongdouble" in
4883         $define)
4884                 $cat <<EOM
4885 (Your platform does not have any specific hints for long doubles.)
4886 EOM
4887         ;;
4888     esac
4889 fi
4890
4891 : Looking for optional libraries
4892 echo " "
4893 echo "Checking for optional libraries..." >&4
4894 case "$libs" in
4895 ' '|'') dflt='';;
4896 *) dflt="$libs";;
4897 esac
4898 case "$libswanted" in
4899 '') libswanted='c_s';;
4900 esac
4901 case "$usesocks" in
4902 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4903 esac
4904 libsfound=''
4905 libsfiles=''
4906 libsdirs=''
4907 libspath=''
4908 for thisdir in $libpth $xlibpth; do
4909   test -d $thisdir && libspath="$libspath $thisdir"
4910 done
4911 for thislib in $libswanted; do
4912         for thisdir in $libspath; do
4913             xxx=''
4914             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4915                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=shared
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib$thislib.$so
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi  
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/lib${thislib}_s$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938                 $test -f "$xxx" && thislib=${thislib}_s
4939             fi
4940             if test ! -f "$xxx"; then
4941                 xxx=$thisdir/Slib$thislib$_a
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=static
4944             fi
4945             if $test -f "$xxx"; then
4946                 case "$libstyle" in
4947                 shared) echo "Found -l$thislib (shared)." ;;
4948                 static) echo "Found -l$thislib." ;;
4949                 *)      echo "Found -l$thislib ($libstyle)." ;;
4950                 esac
4951                 case " $dflt " in
4952                 *"-l$thislib "*);;
4953                 *) dflt="$dflt -l$thislib"
4954                    libsfound="$libsfound $xxx"
4955                    yyy=`basename $xxx`
4956                    libsfiles="$libsfiles $yyy"
4957                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4958                    case " $libsdirs " in
4959                    *" $yyy "*) ;;
4960                    *) libsdirs="$libsdirs $yyy" ;;
4961                    esac
4962                    ;;
4963                 esac
4964                 break
4965             fi  
4966         done
4967         if $test ! -f "$xxx"; then
4968             echo "No -l$thislib."
4969         fi
4970 done
4971 set X $dflt
4972 shift
4973 dflt="$*"
4974 case "$libs" in
4975 '') dflt="$dflt";;
4976 *) dflt="$libs";;
4977 esac
4978 case "$dflt" in
4979 ' '|'') dflt='none';;
4980 esac
4981
4982 $cat <<EOM
4983
4984 In order to compile $package on your machine, a number of libraries
4985 are usually needed.  Include any other special libraries here as well.
4986 Say "none" for none.  The default list is almost always right.
4987 EOM
4988
4989 echo " "
4990 rp="What libraries to use?"
4991 . ./myread
4992 case "$ans" in
4993 none) libs=' ';;
4994 *) libs="$ans";;
4995 esac
4996
4997 : determine optimization, if desired, or use for debug flag also
4998 case "$optimize" in
4999 ' '|$undef) dflt='none';;
5000 '') dflt='-O';;
5001 *) dflt="$optimize";;
5002 esac
5003 $cat <<EOH
5004
5005 By default, $package compiles with the -O flag to use the optimizer.
5006 Alternately, you might want to use the symbolic debugger, which uses
5007 the -g flag (on traditional Unix systems).  Either flag can be
5008 specified here.  To use neither flag, specify the word "none".
5009
5010 EOH
5011 rp="What optimizer/debugger flag should be used?"
5012 . ./myread
5013 optimize="$ans"
5014 case "$optimize" in
5015 'none') optimize=" ";;
5016 esac
5017
5018 : Check what DEBUGGING is required from the command line
5019 : -DEBUGGING      or -DDEBUGGING or
5020 : -DEBUGGING=both                       = -g + -DDEBUGGING
5021 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5022 : -DEBUGGING=none or -UDEBUGGING        =
5023 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5024 case "$EBUGGING" in
5025 '')     ;;
5026 *)      DEBUGGING=$EBUGGING ;;
5027 esac
5028
5029 case "$DEBUGGING" in
5030 -g|both|$define)
5031     case "$optimize" in
5032         *-g*) ;;
5033         *)    optimize="$optimize -g" ;;
5034     esac ;;
5035 none|$undef)
5036     case "$optimize" in
5037         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5038                 shift
5039                 optimize="$*"
5040                 ;;
5041     esac ;;
5042 esac
5043
5044 dflt=''
5045 case "$DEBUGGING" in
5046 both|$define) dflt='-DDEBUGGING'
5047 esac
5048
5049 : argument order is deliberate, as the flag will start with - which set could
5050 : think is an option
5051 checkccflag='check=$1; flag=$2; callback=$3;
5052 echo " ";
5053 echo "Checking if your compiler accepts $flag" 2>&1;
5054 echo "int main(void) { return 0; }" > gcctest.c;
5055 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5056     echo "Yes, it does." 2>&1;
5057     if $test -s gcctest.out ; then
5058         echo "But your platform does not like it:";
5059         cat gcctest.out;
5060     else
5061         case "$ccflags" in
5062         *$check*)
5063             echo "Leaving current flags $ccflags alone." 2>&1
5064             ;;
5065         *) dflt="$dflt $flag";
5066             eval $callback
5067             ;;
5068         esac
5069     fi
5070 else
5071     echo "Nope, it does not, but that is ok." 2>&1;
5072 fi
5073 '
5074
5075 : We will not override a previous value, but we might want to
5076 : augment a hint file
5077 case "$hint" in
5078 default|recommended)
5079         case "$gccversion" in
5080         1*) dflt="$dflt -fpcc-struct-return" ;;
5081         esac
5082         case "$optimize:$DEBUGGING" in
5083         *-g*:old) dflt="$dflt -DDEBUGGING";;
5084         esac
5085         case "$gccversion" in
5086         2*) if $test -d /etc/conf/kconfig.d &&
5087                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5088                 then
5089                         # Interactive Systems (ISC) POSIX mode.
5090                         dflt="$dflt -posix"
5091                 fi
5092                 ;;
5093         esac
5094         case "$gccversion" in
5095         1*) ;;
5096         2.[0-8]*) ;;
5097         ?*)     set strict-aliasing -fno-strict-aliasing
5098                 eval $checkccflag
5099                 ;;
5100         esac
5101         # For gcc, adding -pipe speeds up compilations for some, but apparently
5102         # some assemblers can't read from stdin.  (It also slows down compilations
5103         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5104         case "$gccversion" in
5105         ?*)     set pipe -pipe
5106                 eval $checkccflag
5107                 ;;
5108         esac
5109
5110         # on x86_64 (at least) we require an extra library (libssp) in the
5111         # link command line. This library is not named, so I infer that it is
5112         # an implementation detail that may change. Hence the safest approach
5113         # is to add the flag to the flags passed to the compiler at link time,
5114         # as that way the compiler can do the right implementation dependant
5115         # thing. (NWC)
5116         case "$gccversion" in
5117         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5118                 eval $checkccflag
5119                 ;;
5120         esac
5121         ;;
5122 esac
5123
5124 case "$mips_type" in
5125 *BSD*|'') inclwanted="$locincpth $usrinc";;
5126 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5127 esac
5128 for thisincl in $inclwanted; do
5129         if $test -d $thisincl; then
5130                 if $test x$thisincl != x$usrinc; then
5131                         case "$dflt" in
5132                         *" -I$thisincl "*);;
5133                         *) dflt="$dflt -I$thisincl ";;
5134                         esac
5135                 fi
5136         fi
5137 done
5138
5139 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5140         xxx=true;
5141 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5142         xxx=true;
5143 else
5144         xxx=false;
5145 fi;
5146 if $xxx; then
5147         case "$dflt" in
5148         *$2*);;
5149         *) dflt="$dflt -D$2";;
5150         esac;
5151 fi'
5152
5153 set signal.h LANGUAGE_C; eval $inctest
5154
5155 case "$usesocks" in
5156 $define)
5157         ccflags="$ccflags -DSOCKS"
5158         ;;
5159 esac
5160
5161 case "$hint" in
5162 default|recommended) dflt="$ccflags $dflt" ;;
5163 *) dflt="$ccflags";;
5164 esac
5165
5166 case "$dflt" in
5167 ''|' ') dflt=none;;
5168 esac
5169
5170 $cat <<EOH
5171
5172 Your C compiler may want other flags.  For this question you should include
5173 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5174 but you should NOT include libraries or ld flags like -lwhatever.  If you
5175 want $package to honor its debug switch, you should include -DDEBUGGING here.
5176 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5177
5178 To use no flags, specify the word "none".
5179
5180 EOH
5181 set X $dflt
5182 shift
5183 dflt=${1+"$@"}
5184 rp="Any additional cc flags?"
5185 . ./myread
5186 case "$ans" in
5187 none) ccflags='';;
5188 *) ccflags="$ans";;
5189 esac
5190
5191 : the following weeds options from ccflags that are of no interest to cpp
5192 case "$cppflags" in
5193 '') cppflags="$ccflags" ;;
5194 *)  cppflags="$cppflags $ccflags" ;;
5195 esac
5196 case "$gccversion" in
5197 1*) cppflags="$cppflags -D__GNUC__"
5198 esac
5199 case "$mips_type" in
5200 '');;
5201 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5202 esac
5203 case "$cppflags" in
5204 '');;
5205 *)
5206         echo " "
5207         echo "Let me guess what the preprocessor flags are..." >&4
5208         set X $cppflags
5209         shift
5210         cppflags=''
5211         $cat >cpp.c <<'EOM'
5212 #define BLURFL foo
5213
5214 BLURFL xx LFRULB
5215 EOM
5216         previous=''
5217         for flag in $*
5218         do
5219                 case "$flag" in
5220                 -*) ftry="$flag";;
5221                 *) ftry="$previous $flag";;
5222                 esac
5223                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5224                         >cpp1.out 2>/dev/null && \
5225                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5226                         >cpp2.out 2>/dev/null && \
5227                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5228                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5229                 then
5230                         cppflags="$cppflags $ftry"
5231                         previous=''
5232                 else
5233                         previous="$flag"
5234                 fi
5235         done
5236         set X $cppflags
5237         shift
5238         cppflags=${1+"$@"}
5239         case "$cppflags" in
5240         *-*)  echo "They appear to be: $cppflags";;
5241         esac
5242         $rm -f cpp.c cpp?.out
5243         ;;
5244 esac
5245
5246 : flags used in final linking phase
5247 case "$ldflags" in
5248 '') if ./venix; then
5249                 dflt='-i -z'
5250         else
5251                 dflt=''
5252         fi
5253         case "$ccflags" in
5254         *-posix*) dflt="$dflt -posix" ;;
5255         esac
5256         ;;
5257 *) dflt="$ldflags";;
5258 esac
5259
5260 : Try to guess additional flags to pick up local libraries.
5261 for thislibdir in $libpth; do
5262         case " $loclibpth " in
5263         *" $thislibdir "*)
5264                 case "$dflt " in
5265                 *"-L$thislibdir "*) ;;
5266                 *)  dflt="$dflt -L$thislibdir" ;;
5267                 esac
5268                 ;;
5269         esac
5270 done
5271
5272 case "$dflt" in
5273 '') dflt='none' ;;
5274 esac
5275
5276 $cat <<EOH
5277
5278 Your C linker may need flags.  For this question you should
5279 include -L/whatever and any other flags used by the C linker, but you
5280 should NOT include libraries like -lwhatever.
5281
5282 Make sure you include the appropriate -L/path flags if your C linker
5283 does not normally search all of the directories you specified above,
5284 namely
5285         $libpth
5286 To use no flags, specify the word "none".
5287
5288 EOH
5289
5290 rp="Any additional ld flags (NOT including libraries)?"
5291 . ./myread
5292 case "$ans" in
5293 none) ldflags='';;
5294 *) ldflags="$ans";;
5295 esac
5296 rmlist="$rmlist pdp11"
5297
5298 : coherency check
5299 echo " "
5300 echo "Checking your choice of C compiler and flags for coherency..." >&4
5301 $cat > try.c <<'EOF'
5302 #include <stdio.h>
5303 int main() { printf("Ok\n"); return(0); }
5304 EOF
5305 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5306 shift
5307 $cat >try.msg <<'EOM'
5308 I've tried to compile and run the following simple program:
5309
5310 EOM
5311 $cat try.c >> try.msg
5312
5313 $cat >> try.msg <<EOM
5314
5315 I used the command:
5316
5317         $*
5318         $run ./try
5319
5320 and I got the following output:
5321
5322 EOM
5323 dflt=y
5324 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5325         if $sh -c "$run ./try" >>try.msg 2>&1; then
5326                 xxx=`$run ./try`
5327                 case "$xxx" in
5328                 "Ok") dflt=n ;;
5329                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5330                         case " $libs " in
5331                         *" -lsfio "*)
5332                                 cat >> try.msg <<'EOQS'
5333 If $libs contains -lsfio, and sfio is mis-configured, then it
5334 sometimes (apparently) runs and exits with a 0 status, but with no
5335 output!  It may have to do with sfio's use of _exit vs. exit.
5336
5337 EOQS
5338                                 rp="You have a big problem.  Shall I abort Configure"
5339                                 dflt=y
5340                                 ;;
5341                         esac
5342                         ;;
5343                 esac
5344         else
5345                 echo "The program compiled OK, but exited with status $?." >>try.msg
5346                 rp="You have a problem.  Shall I abort Configure"
5347                 dflt=y
5348         fi
5349 else
5350         echo "I can't compile the test program." >>try.msg
5351         rp="You have a BIG problem.  Shall I abort Configure"
5352         dflt=y
5353 fi
5354 case "$dflt" in
5355 y)
5356         $cat try.msg >&4
5357         case "$knowitall" in
5358         '')
5359                 echo "(The supplied flags or libraries might be incorrect.)"
5360                 ;;
5361         *) dflt=n;;
5362         esac
5363         echo " "
5364         . ./myread
5365         case "$ans" in
5366         n*|N*) ;;
5367         *)      echo "Ok.  Stopping Configure." >&4
5368                 exit 1
5369                 ;;
5370         esac
5371         ;;
5372 n) echo "OK, that should do.";;
5373 esac
5374 $rm_try gcctest.out
5375
5376 : define a shorthand compile call
5377 compile='
5378 mc_file=$1;
5379 shift;
5380 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5381 : define a shorthand compile call for compilations that should be ok.
5382 compile_ok='
5383 mc_file=$1;
5384 shift;
5385 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5386
5387 : determine filename position in cpp output
5388 echo " "
5389 echo "Computing filename position in cpp output for #include directives..." >&4
5390 case "$osname" in
5391 vos) testaccess=-e ;;
5392 *)   testaccess=-r ;;
5393 esac
5394 echo '#include <stdio.h>' > foo.c
5395 $cat >fieldn <<EOF
5396 $startsh
5397 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5398 $grep '^[       ]*#.*stdio\.h' | \
5399 while read cline; do
5400         pos=1
5401         set \$cline
5402         while $test \$# -gt 0; do
5403                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5404                         echo "\$pos"
5405                         exit 0
5406                 fi
5407                 shift
5408                 pos=\`expr \$pos + 1\`
5409         done
5410 done
5411 EOF
5412 chmod +x fieldn
5413 fieldn=`./fieldn`
5414 $rm -f foo.c fieldn
5415 case $fieldn in
5416 '') pos='???';;
5417 1) pos=first;;
5418 2) pos=second;;
5419 3) pos=third;;
5420 *) pos="${fieldn}th";;
5421 esac
5422 echo "Your cpp writes the filename in the $pos field of the line."
5423
5424 case "$osname" in
5425 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5426 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5427 *)   cppfilter='' ;;
5428 esac
5429 : locate header file
5430 $cat >findhdr <<EOF
5431 $startsh
5432 wanted=\$1
5433 name=''
5434 for usrincdir in $usrinc
5435 do
5436         if test -f \$usrincdir/\$wanted; then
5437                 echo "\$usrincdir/\$wanted"
5438                 exit 0
5439         fi
5440 done
5441 awkprg='{ print \$$fieldn }'
5442 echo "#include <\$wanted>" > foo\$\$.c
5443 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5444 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5445 while read cline; do
5446         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5447         case "\$name" in
5448         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5449         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5450         *) exit 2;;
5451         esac;
5452 done;
5453 #
5454 # status = 0: grep returned 0 lines, case statement not executed
5455 # status = 1: headerfile found
5456 # status = 2: while loop executed, no headerfile found
5457 #
5458 status=\$?
5459 $rm -f foo\$\$.c;
5460 if test \$status -eq 1; then
5461         exit 0;
5462 fi
5463 exit 1
5464 EOF
5465 chmod +x findhdr
5466
5467 : define an alternate in-header-list? function
5468 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5469 cont=true; xxf="echo \"<\$1> found.\" >&4";
5470 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5471 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5472 esac;
5473 case $# in 4) instead=instead;; *) instead="at last";; esac;
5474 while $test "$cont"; do
5475         xxx=`./findhdr $1`
5476         var=$2; eval "was=\$$2";
5477         if $test "$xxx" && $test -r "$xxx";
5478         then eval $xxf;
5479         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5480                 cont="";
5481         else eval $xxnf;
5482         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5483         set $yyy; shift; shift; yyy=$@;
5484         case $# in 0) cont="";;
5485         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5486                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5487         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5488                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5489         esac;
5490 done;
5491 while $test "$yyy";
5492 do set $yyy; var=$2; eval "was=\$$2";
5493         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5494         set $yyy; shift; shift; yyy=$@;
5495 done'
5496
5497 : see if stdlib is available
5498 set stdlib.h i_stdlib
5499 eval $inhdr
5500
5501 : check for lengths of integral types
5502 echo " "
5503 case "$intsize" in
5504 '')
5505         echo "Checking to see how big your integers are..." >&4
5506         $cat >try.c <<EOCP
5507 #include <stdio.h>
5508 #$i_stdlib I_STDLIB
5509 #ifdef I_STDLIB
5510 #include <stdlib.h>
5511 #endif
5512 int main()
5513 {
5514         printf("intsize=%d;\n", (int)sizeof(int));
5515         printf("longsize=%d;\n", (int)sizeof(long));
5516         printf("shortsize=%d;\n", (int)sizeof(short));
5517         exit(0);
5518 }
5519 EOCP
5520         set try
5521         if eval $compile_ok && $run ./try > /dev/null; then
5522                 eval `$run ./try`
5523                 echo "Your integers are $intsize bytes long."
5524                 echo "Your long integers are $longsize bytes long."
5525                 echo "Your short integers are $shortsize bytes long."
5526         else
5527                 $cat >&4 <<EOM
5528 !
5529 Help! I can't compile and run the intsize test program: please enlighten me!
5530 (This is probably a misconfiguration in your system or libraries, and
5531 you really ought to fix it.  Still, I'll try anyway.)
5532 !
5533 EOM
5534                 dflt=4
5535                 rp="What is the size of an integer (in bytes)?"
5536                 . ./myread
5537                 intsize="$ans"
5538                 dflt=$intsize
5539                 rp="What is the size of a long integer (in bytes)?"
5540                 . ./myread
5541                 longsize="$ans"
5542                 dflt=2
5543                 rp="What is the size of a short integer (in bytes)?"
5544                 . ./myread
5545                 shortsize="$ans"
5546         fi
5547         ;;
5548 esac
5549 $rm_try
5550
5551 : check for long long
5552 echo " "
5553 echo "Checking to see if you have long long..." >&4
5554 echo 'int main() { long long x = 7; return 0; }' > try.c
5555 set try
5556 if eval $compile; then
5557         val="$define"
5558         echo "You have long long."
5559 else
5560         val="$undef"
5561         echo "You do not have long long."
5562 fi
5563 $rm_try
5564 set d_longlong
5565 eval $setvar
5566
5567 : check for length of long long
5568 case "${d_longlong}${longlongsize}" in
5569 $define)
5570         echo " "
5571         echo "Checking to see how big your long longs are..." >&4
5572         $cat >try.c <<'EOCP'
5573 #include <stdio.h>
5574 int main()
5575 {
5576     printf("%d\n", (int)sizeof(long long));
5577     return(0);
5578 }
5579 EOCP
5580         set try
5581         if eval $compile_ok; then
5582                 longlongsize=`$run ./try`
5583                 echo "Your long longs are $longlongsize bytes long."
5584         else
5585                 dflt='8'
5586                 echo " "
5587                 echo "(I can't seem to compile the test program.  Guessing...)"
5588                 rp="What is the size of a long long (in bytes)?"
5589                 . ./myread
5590                 longlongsize="$ans"
5591         fi
5592         if $test "X$longsize" = "X$longlongsize"; then
5593                 echo "(That isn't any different from an ordinary long.)"
5594         fi
5595         ;;
5596 esac
5597 $rm_try
5598
5599 : see if inttypes.h is available
5600 : we want a real compile instead of Inhdr because some systems
5601 : have an inttypes.h which includes non-existent headers
5602 echo " "
5603 $cat >try.c <<EOCP
5604 #include <inttypes.h>
5605 int main() {
5606         static int32_t foo32 = 0x12345678;
5607 }
5608 EOCP
5609 set try
5610 if eval $compile; then
5611         echo "<inttypes.h> found." >&4
5612         val="$define"
5613 else
5614         echo "<inttypes.h> NOT found." >&4
5615         val="$undef"
5616 fi
5617 $rm_try
5618 set i_inttypes
5619 eval $setvar
5620
5621 : check for int64_t
5622 echo " "
5623 echo "Checking to see if you have int64_t..." >&4
5624 $cat >try.c <<EOCP
5625 #include <sys/types.h>
5626 #$i_inttypes I_INTTYPES
5627 #ifdef I_INTTYPES
5628 #include <inttypes.h>
5629 #endif
5630 int main() { int64_t x = 7; }
5631 EOCP
5632 set try
5633 if eval $compile; then
5634         val="$define"
5635         echo "You have int64_t."
5636 else
5637         val="$undef"
5638         echo "You do not have int64_t."
5639 fi
5640 $rm_try
5641 set d_int64_t
5642 eval $setvar
5643
5644
5645 echo " "
5646 echo "Checking which 64-bit integer type we could use..." >&4
5647
5648 case "$intsize" in
5649 8) val=int
5650    set quadtype
5651    eval $setvar
5652    val='"unsigned int"'
5653    set uquadtype
5654    eval $setvar
5655    quadkind=1
5656    ;;
5657 *) case "$longsize" in
5658    8) val=long
5659       set quadtype
5660       eval $setvar
5661       val='"unsigned long"'
5662       set uquadtype
5663       eval $setvar
5664       quadkind=2
5665       ;;
5666    *) case "$d_longlong:$longlongsize" in
5667       define:8)
5668         val='"long long"'
5669         set quadtype
5670         eval $setvar
5671         val='"unsigned long long"'
5672         set uquadtype
5673         eval $setvar
5674         quadkind=3
5675         ;;
5676       *) case "$d_int64_t" in
5677          define)
5678            val=int64_t
5679            set quadtype
5680            eval $setvar
5681            val=uint64_t
5682            set uquadtype
5683            eval $setvar
5684            quadkind=4
5685            ;;
5686          esac
5687          ;;
5688       esac
5689       ;;
5690    esac
5691    ;;
5692 esac
5693
5694 case "$quadtype" in
5695 '')     echo "Alas, no 64-bit integer types in sight." >&4
5696         d_quad="$undef"
5697         ;;
5698 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5699         d_quad="$define"
5700         ;;
5701 esac
5702
5703
5704 case "$uselonglong" in
5705 "$define"|true|[yY]*)
5706         cat <<EOM >&4
5707
5708 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5709 EOM
5710         use64bitint="$define"
5711         ;;
5712 esac                          
5713 case "$use64bits" in
5714 "$define"|true|[yY]*)
5715         cat <<EOM >&4
5716
5717 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5718 EOM
5719         use64bitint="$define"
5720         ;;
5721 esac                          
5722 case "$use64bitints" in
5723 "$define"|true|[yY]*)
5724         cat <<EOM >&4
5725
5726 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5727 EOM
5728         use64bitint="$define"
5729         ;;
5730 esac                          
5731 case "$use64bitsint" in
5732 "$define"|true|[yY]*)
5733         cat <<EOM >&4
5734
5735 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5736 EOM
5737         use64bitint="$define"
5738         ;;
5739 esac                          
5740 case "$uselonglongs" in
5741 "$define"|true|[yY]*)
5742         cat <<EOM >&4
5743
5744 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5745 EOM
5746         use64bitint="$define"
5747         ;;
5748 esac                          
5749 case "$use64bitsall" in
5750 "$define"|true|[yY]*)
5751         cat <<EOM >&4
5752
5753 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5754 EOM
5755         use64bitall="$define"
5756         ;;
5757 esac                          
5758
5759 case "$ccflags" in
5760 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5761 esac
5762 case "$use64bitall" in
5763 "$define"|true|[yY]*) use64bitint="$define" ;;
5764 esac
5765
5766 case "$longsize" in
5767 8) cat <<EOM
5768
5769 You have natively 64-bit long integers.
5770 EOM
5771    val="$define"
5772    ;;
5773 *) case "$use64bitint" in
5774    "$define"|true|[yY]*) dflt='y';;
5775    *) dflt='n';;
5776    esac
5777    case "$d_quad" in
5778    "$define") ;;
5779    *) dflt='n' ;;
5780    esac
5781    cat <<EOM
5782
5783 Perl can be built to take advantage of 64-bit integer types
5784 on some systems.  To do so, Configure can be run with -Duse64bitint.
5785 Choosing this option will most probably introduce binary incompatibilities.
5786
5787 If this doesn't make any sense to you, just accept the default '$dflt'.
5788 (The default has been chosen based on your configuration.)
5789 EOM
5790    rp='Try to use 64-bit integers, if available?'
5791    . ./myread
5792    case "$ans" in
5793    [yY]*) val="$define" ;;
5794    *)     val="$undef"  ;;
5795    esac
5796    ;;
5797 esac
5798 set use64bitint
5799 eval $setvar
5800
5801 case "$use64bitall" in
5802 "$define"|true|[yY]*) dflt='y' ;;
5803 *) case "$longsize" in
5804    8) dflt='y' ;;
5805    *) dflt='n' ;;
5806    esac
5807    ;;
5808 esac    
5809 cat <<EOM
5810
5811 You may also choose to try maximal 64-bitness.  It means using as much
5812 64-bitness as possible on the platform.  This in turn means even more
5813 binary incompatibilities.  On the other hand, your platform may not
5814 have any more 64-bitness available than what you already have chosen.
5815
5816 If this doesn't make any sense to you, just accept the default '$dflt'.
5817 (The default has been chosen based on your configuration.)
5818 EOM
5819 rp='Try to use maximal 64-bit support, if available?'
5820 . ./myread
5821 case "$ans" in
5822 [yY]*) val="$define" ;;
5823 *)     val="$undef"  ;;
5824 esac
5825 set use64bitall
5826 eval $setvar
5827 case "$use64bitall" in
5828 "$define")
5829         case "$use64bitint" in
5830         "$undef")
5831                 cat <<EOM
5832
5833 Since you have chosen a maximally 64-bit build, I'm also turning on
5834 the use of 64-bit integers.
5835 EOM
5836                 use64bitint="$define" ;;
5837         esac
5838         ;;
5839 esac
5840
5841 : Look for a hint-file generated 'call-back-unit'.  If the
5842 : user has specified that a 64-bit perl is to be built,
5843 : we may need to set or change some other defaults.
5844 if $test -f use64bitint.cbu; then
5845         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5846         . ./use64bitint.cbu
5847 fi
5848 case "$use64bitint" in
5849 "$define"|true|[yY]*)
5850         case "$longsize" in
5851         4) case "$archname64" in
5852            '') archname64=64int ;;
5853            esac
5854            ;;
5855         esac
5856         ;;
5857 esac
5858
5859 : Look for a hint-file generated 'call-back-unit'.  If the
5860 : user has specified that a maximally 64-bit perl is to be built,
5861 : we may need to set or change some other defaults.
5862 if $test -f use64bitall.cbu; then
5863         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5864         . ./use64bitall.cbu
5865 fi
5866 case "$use64bitall" in
5867 "$define"|true|[yY]*)
5868         case "$longsize" in
5869         4) case "$archname64" in
5870            ''|64int) archname64=64all ;;
5871            esac
5872            ;;
5873         esac
5874         ;;
5875 esac
5876
5877 case "$d_quad:$use64bitint" in
5878 $undef:$define)
5879         cat >&4 <<EOF
5880
5881 *** You have chosen to use 64-bit integers,
5882 *** but none can be found.
5883 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5884 *** Cannot continue, aborting.
5885
5886 EOF
5887         exit 1
5888         ;;
5889 esac
5890
5891 : check for length of double
5892 echo " "
5893 case "$doublesize" in
5894 '')
5895         echo "Checking to see how big your double precision numbers are..." >&4
5896         $cat >try.c <<EOCP
5897 #include <stdio.h>
5898 #$i_stdlib I_STDLIB
5899 #ifdef I_STDLIB
5900 #include <stdlib.h>
5901 #endif
5902 int main()
5903 {
5904     printf("%d\n", (int)sizeof(double));
5905     exit(0);
5906 }
5907 EOCP
5908         set try
5909         if eval $compile_ok; then
5910                 doublesize=`$run ./try`
5911                 echo "Your double is $doublesize bytes long."
5912         else
5913                 dflt='8'
5914                 echo "(I can't seem to compile the test program.  Guessing...)"
5915                 rp="What is the size of a double precision number (in bytes)?"
5916                 . ./myread
5917                 doublesize="$ans"
5918         fi
5919         ;;
5920 esac
5921 $rm_try
5922
5923 : check for long doubles
5924 echo " "
5925 echo "Checking to see if you have long double..." >&4
5926 echo 'int main() { long double x = 7.0; }' > try.c
5927 set try
5928 if eval $compile; then
5929         val="$define"
5930         echo "You have long double."
5931 else
5932         val="$undef"
5933         echo "You do not have long double."
5934 fi
5935 $rm_try
5936 set d_longdbl
5937 eval $setvar
5938
5939 : check for length of long double
5940 case "${d_longdbl}${longdblsize}" in
5941 $define)
5942         echo " "
5943         echo "Checking to see how big your long doubles are..." >&4
5944         $cat >try.c <<'EOCP'
5945 #include <stdio.h>
5946 int main()
5947 {
5948         printf("%d\n", sizeof(long double));
5949 }
5950 EOCP
5951         set try
5952         set try
5953         if eval $compile; then
5954                 longdblsize=`$run ./try`
5955                 echo "Your long doubles are $longdblsize bytes long."
5956         else
5957                 dflt='8'
5958                 echo " "
5959                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5960                 rp="What is the size of a long double (in bytes)?"
5961                 . ./myread
5962                 longdblsize="$ans"
5963         fi
5964         if $test "X$doublesize" = "X$longdblsize"; then
5965                 echo "That isn't any different from an ordinary double."
5966                 echo "I'll keep your setting anyway, but you may see some"
5967                 echo "harmless compilation warnings."
5968         fi
5969         ;;
5970 esac
5971 $rm_try
5972
5973 : determine the architecture name
5974 echo " "
5975 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5976         tarch=`arch`"-$osname"
5977 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5978         if uname -m > tmparch 2>&1 ; then
5979                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5980                         -e 's/$/'"-$osname/" tmparch`
5981         else
5982                 tarch="$osname"
5983         fi
5984         $rm -f tmparch
5985 else
5986         tarch="$osname"
5987 fi
5988 case "$myarchname" in
5989 ''|"$tarch") ;;
5990 *)
5991         echo "(Your architecture name used to be $myarchname.)"
5992         archname=''
5993         ;;
5994 esac
5995 case "$targetarch" in
5996 '') ;;
5997 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5998 esac
5999 myarchname="$tarch"
6000 case "$archname" in
6001 '') dflt="$tarch";;
6002 *) dflt="$archname";;
6003 esac
6004 rp='What is your architecture name'
6005 . ./myread
6006 archname="$ans"
6007 case "$usethreads" in
6008 $define)
6009         echo "Threads selected." >&4
6010         case "$archname" in
6011         *-thread*) echo "...and architecture name already has -thread." >&4
6012                 ;;
6013         *)      archname="$archname-thread"
6014                 echo "...setting architecture name to $archname." >&4
6015                 ;;
6016         esac
6017         ;;
6018 esac
6019 case "$usemultiplicity" in
6020 $define)
6021         echo "Multiplicity selected." >&4
6022         case "$archname" in
6023         *-multi*) echo "...and architecture name already has -multi." >&4
6024                 ;;
6025         *)      archname="$archname-multi"
6026                 echo "...setting architecture name to $archname." >&4
6027                 ;;
6028         esac
6029         ;;
6030 esac
6031 case "$use64bitint$use64bitall" in
6032 *"$define"*)
6033         case "$archname64" in
6034         '')
6035                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6036                 ;;
6037         *)
6038                 case "$use64bitint" in
6039                 "$define") echo "64 bit integers selected." >&4 ;;
6040                 esac
6041                 case "$use64bitall" in
6042                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6043                 esac
6044                 case "$archname" in
6045                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6046                         ;;
6047                 *)      archname="$archname-$archname64"
6048                         echo "...setting architecture name to $archname." >&4
6049                         ;;
6050                 esac
6051                 ;;
6052         esac
6053 esac
6054 case "$uselongdouble" in
6055 $define)
6056         echo "Long doubles selected." >&4
6057         case "$longdblsize" in
6058         $doublesize)
6059                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6060                 ;;
6061         *)
6062                 case "$archname" in
6063                 *-ld*) echo "...and architecture name already has -ld." >&4
6064                         ;;
6065                 *)      archname="$archname-ld"
6066                         echo "...setting architecture name to $archname." >&4
6067                         ;;
6068                 esac
6069                 ;;
6070         esac
6071         ;;
6072 esac
6073 case "$useperlio" in
6074 $define)
6075         echo "Perlio selected." >&4
6076         ;;
6077 *)
6078         echo "Perlio not selected, using stdio." >&4
6079         case "$archname" in
6080         *-stdio*) echo "...and architecture name already has -stdio." >&4
6081                 ;;
6082         *)      archname="$archname-stdio"
6083                 echo "...setting architecture name to $archname." >&4
6084                 ;;
6085         esac
6086         ;;
6087 esac
6088 if $test -f archname.cbu; then
6089         echo "Your platform has some specific hints for architecture name, using them..."
6090         . ./archname.cbu
6091 fi
6092
6093 : set the prefixit variable, to compute a suitable default value
6094 prefixit='case "$3" in
6095 ""|none)
6096         case "$oldprefix" in
6097         "") eval "$1=\"\$$2\"";;
6098         *)
6099                 case "$3" in
6100                 "") eval "$1=";;
6101                 none)
6102                         eval "tp=\"\$$2\"";
6103                         case "$tp" in
6104                         ""|" ") eval "$1=\"\$$2\"";;
6105                         *) eval "$1=";;
6106                         esac;;
6107                 esac;;
6108         esac;;
6109 *)
6110         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6111         case "$tp" in
6112         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6113         /*-$oldprefix/*|\~*-$oldprefix/*)
6114                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6115         *) eval "$1=\"\$$2\"";;
6116         esac;;
6117 esac'
6118
6119 : determine installation style
6120 : For now, try to deduce it from prefix unless it is already set.
6121 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6122 case "$installstyle" in
6123 '')     case "$prefix" in
6124                 *perl*) dflt='lib';;
6125                 *) dflt='lib/perl5' ;;
6126         esac
6127         ;;
6128 *)      dflt="$installstyle" ;;
6129 esac
6130 : Probably not worth prompting for this since we prompt for all
6131 : the directories individually, and the prompt would be too long and
6132 : confusing anyway.
6133 installstyle=$dflt
6134
6135 : determine where public executables go
6136 echo " "
6137 set dflt bin bin
6138 eval $prefixit
6139 fn=d~
6140 rp='Pathname where the public executables will reside?'
6141 . ./getfile
6142 if $test "X$ansexp" != "X$binexp"; then
6143         installbin=''
6144 fi
6145 prefixvar=bin
6146 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6147 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6148 :     this via initialinstalllocation
6149 . ./setprefixvar
6150
6151 case "$userelocatableinc" in
6152 $define|true|[yY]*)     dflt='y' ;;
6153 *)                      dflt='n' ;;
6154 esac
6155 cat <<EOM
6156
6157 Would you like to build Perl so that the installation is relocatable, so that
6158 library paths in @INC are determined relative to the path of the perl binary?
6159 This is not advised for system Perl installs, or if you need to run setid
6160 scripts or scripts under taint mode.
6161
6162 If this doesn't make any sense to you, just accept the default '$dflt'.
6163 EOM
6164 rp='Use relocatable @INC?'
6165 . ./myread
6166 case "$ans" in
6167 y|Y)    val="$define" ;;
6168 *)      val="$undef"  ;;
6169 esac
6170 set userelocatableinc
6171 eval $setvar
6172
6173 initialinstalllocation="$binexp"
6174 : Default prefix is now "up one level from where the binaries are"
6175 case "$userelocatableinc" in
6176 $define|true|[yY]*)
6177     bin=".../"
6178     binexp=".../"
6179     prefix=".../.."
6180     prefixexp=".../.."
6181     installprefixexp=".../.."
6182     ;;
6183 esac
6184
6185 : determine where private library files go
6186 : Usual default is /usr/local/lib/perl5/$version.
6187 : Also allow things like /opt/perl/lib/$version, since
6188 : /opt/perl/lib/perl5... would be redundant.
6189 : The default "style" setting is made in installstyle.U
6190 case "$installstyle" in
6191 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6192 *)       set dflt privlib lib/$version ;;
6193 esac
6194 eval $prefixit
6195 $cat <<EOM
6196
6197 There are some auxiliary files for $package that need to be put into a
6198 private library directory that is accessible by everyone.
6199
6200 EOM
6201 fn=$binexp
6202 fn=d~+
6203 rp='Pathname where the private library files will reside?'
6204 . ./getfile
6205 prefixvar=privlib
6206 . ./setprefixvar
6207
6208 : set the prefixup variable, to restore leading tilda escape
6209 prefixup='case "$prefixexp" in
6210 "$prefix") ;;
6211 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6212 esac'
6213
6214 : determine where public architecture dependent libraries go
6215 set archlib archlib
6216 eval $prefixit
6217 : privlib default is /usr/local/lib/$package/$version
6218 : archlib default is /usr/local/lib/$package/$version/$archname
6219 : privlib may have an optional trailing /share.
6220 tdflt=`echo $privlib | $sed 's,/share$,,'`
6221 tdflt=$tdflt/$archname
6222 case "$archlib" in
6223 '')     dflt=$tdflt
6224         ;;
6225 *)      dflt="$archlib"
6226     ;;
6227 esac
6228 $cat <<EOM
6229
6230 $spackage contains architecture-dependent library files.  If you are
6231 sharing libraries in a heterogeneous environment, you might store
6232 these files in a separate location.  Otherwise, you can just include
6233 them with the rest of the public library files.
6234
6235 EOM
6236 fn=$binexp
6237 fn=d+~
6238 rp='Where do you want to put the public architecture-dependent libraries?'
6239 . ./getfile
6240 prefixvar=archlib
6241 . ./setprefixvar
6242 if $test X"$archlib" = X"$privlib"; then
6243         d_archlib="$undef"
6244 else
6245         d_archlib="$define"
6246 fi
6247
6248 : see if setuid scripts can be secure
6249 $cat <<EOM
6250
6251 Some kernels have a bug that prevents setuid #! scripts from being
6252 secure.  Some sites have disabled setuid #! scripts because of this.
6253
6254 First let's decide if your kernel supports secure setuid #! scripts.
6255 (If setuid #! scripts would be secure but have been disabled anyway,
6256 don't say that they are secure if asked.)
6257
6258 EOM
6259
6260 val="$undef"
6261 if $test -d /dev/fd; then
6262         echo "#!$ls" >reflect
6263         chmod +x,u+s reflect
6264         ./reflect >flect 2>&1
6265         if $contains "/dev/fd" flect >/dev/null; then
6266                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6267                 val="$define"
6268         else
6269                 $cat <<EOM
6270 If you are not sure if they are secure, I can check but I'll need a
6271 username and password different from the one you are using right now.
6272 If you don't have such a username or don't want me to test, simply
6273 enter 'none'.
6274
6275 EOM
6276                 rp='Other username to test security of setuid scripts with?'
6277                 dflt='none'
6278                 . ./myread
6279                 case "$ans" in
6280                 n|none)
6281                         case "$d_suidsafe" in
6282                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6283                                 dflt=n;;
6284                         "$undef")
6285                                 echo "Well, the $hint value is *not* secure." >&4
6286                                 dflt=n;;
6287                         *)      echo "Well, the $hint value *is* secure." >&4
6288                                 dflt=y;;
6289                         esac
6290                         ;;
6291                 *)
6292                         $rm -f reflect flect
6293                         echo "#!$ls" >reflect
6294                         chmod +x,u+s reflect
6295                         echo >flect
6296                         chmod a+w flect
6297                         echo '"su" will (probably) prompt you for '"$ans's password."
6298                         su $ans -c './reflect >flect'
6299                         if $contains "/dev/fd" flect >/dev/null; then
6300                                 echo "Okay, it looks like setuid scripts are secure." >&4
6301                                 dflt=y
6302                         else
6303                                 echo "I don't think setuid scripts are secure." >&4
6304                                 dflt=n
6305                         fi
6306                         ;;
6307                 esac
6308                 rp='Does your kernel have *secure* setuid scripts?'
6309                 . ./myread
6310                 case "$ans" in
6311                 [yY]*)  val="$define";;
6312                 *)      val="$undef";;
6313                 esac
6314         fi
6315 else
6316         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6317         echo "(That's for file descriptors, not floppy disks.)"
6318         val="$undef"
6319 fi
6320 set d_suidsafe
6321 eval $setvar
6322
6323 $rm -f reflect flect
6324
6325 : now see if they want to do setuid emulation
6326 echo " "
6327 val="$undef"
6328 case "$d_suidsafe" in
6329 "$define")
6330         val="$undef"
6331         echo "No need to emulate SUID scripts since they are secure here." >&4
6332         ;;
6333 *)
6334         $cat <<EOM
6335 Some systems have disabled setuid scripts, especially systems where
6336 setuid scripts cannot be secure.  On systems where setuid scripts have
6337 been disabled, the setuid/setgid bits on scripts are currently
6338 useless.  It is possible for $package to detect those bits and emulate
6339 setuid/setgid in a secure fashion.  This emulation will only work if
6340 setuid scripts have been disabled in your kernel.
6341
6342 EOM
6343         case "$d_dosuid" in
6344         "$define") dflt=y ;;
6345         *) dflt=n ;;
6346         esac
6347         rp="Do you want to do setuid/setgid emulation?"
6348         . ./myread
6349         case "$ans" in
6350         [yY]*)  val="$define";;
6351         *)      val="$undef";;
6352         esac
6353         ;;
6354 esac
6355 set d_dosuid
6356 eval $setvar
6357
6358 : Find perl5.005 or later.
6359 echo "Looking for a previously installed perl5.005 or later... "
6360 case "$perl5" in
6361 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6362                 : Check if this perl is recent and can load a simple module
6363                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6364                         perl5=$tdir/perl
6365                         break;
6366                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6367                         perl5=$tdir/perl5
6368                         break;
6369                 fi
6370         done
6371         ;;
6372 *)      perl5="$perl5"
6373         ;;
6374 esac
6375 case "$perl5" in
6376 '')     echo "None found.  That's ok.";;
6377 *)      echo "Using $perl5." ;;
6378 esac
6379
6380 $cat <<EOM
6381
6382 After $package is installed, you may wish to install various
6383 add-on modules and utilities.  Typically, these add-ons will
6384 be installed under $prefix with the rest
6385 of this package.  However, you may wish to install such add-ons
6386 elsewhere under a different prefix.
6387
6388 If you do not wish to put everything under a single prefix, that's
6389 ok.  You will be prompted for the individual locations; this siteprefix
6390 is only used to suggest the defaults.
6391
6392 The default should be fine for most people.
6393
6394 EOM
6395 fn=d~+
6396 rp='Installation prefix to use for add-on modules and utilities?'
6397 : XXX Here might be another good place for an installstyle setting.
6398 case "$siteprefix" in
6399 '') dflt=$prefix ;;
6400 *)  dflt=$siteprefix ;;
6401 esac
6402 . ./getfile
6403 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6404 oldsiteprefix=''
6405 case "$siteprefix" in
6406 '') ;;
6407 *)      case "$ans" in
6408         "$prefix") ;;
6409         *) oldsiteprefix="$prefix";;
6410         esac
6411         ;;
6412 esac
6413 siteprefix="$ans"
6414 siteprefixexp="$ansexp"
6415
6416 : determine where site specific libraries go.
6417 : Usual default is /usr/local/lib/perl5/site_perl/$version
6418 : The default "style" setting is made in installstyle.U
6419 : XXX No longer works with Prefixit stuff.
6420 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6421 case "$sitelib" in
6422 '') case "$installstyle" in
6423         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6424         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6425         esac
6426         ;;
6427 *)      dflt="$sitelib"
6428         ;;
6429 esac
6430 $cat <<EOM
6431
6432 The installation process will create a directory for
6433 site-specific extensions and modules.  Most users find it convenient
6434 to place all site-specific files in this directory rather than in the
6435 main distribution directory.
6436
6437 EOM
6438 fn=d~+
6439 rp='Pathname for the site-specific library files?'
6440 . ./getfile
6441 prefixvar=sitelib
6442 . ./setprefixvar
6443 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6444
6445 : Determine list of previous versions to include in @INC
6446 $cat > getverlist <<EOPL
6447 #!$perl5 -w
6448 use File::Basename;
6449 \$api_versionstring = "$api_versionstring";
6450 \$version = "$version";
6451 \$stem = "$sitelib_stem";
6452 \$archname = "$archname";
6453 EOPL
6454         $cat >> getverlist <<'EOPL'
6455 # The list found is store twice for each entry: the original name, and
6456 # the binary broken down version as pack "sss", so sorting is easy and
6457 # unambiguous. This will work for all versions that have a maximum of
6458 # three digit groups, separate by '.'s or '_'s. Names are extended with
6459 # ".0.0" to ensure at least three elements for the pack.
6460 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6461
6462 # Can't have leading @ because metaconfig interprets it as a command!
6463 ;@inc_version_list=();
6464 # XXX Redo to do opendir/readdir?
6465 if (-d $stem) {
6466     chdir($stem);
6467     ;@candidates = map {
6468         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6469 }
6470 else {
6471     ;@candidates = ();
6472 }
6473
6474 ($pversion, $aversion, $vsn5005) = map {
6475     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6476 foreach $d (@candidates) {
6477     if ($d->[1] lt $pversion) {
6478         if ($d->[1] ge $aversion) {
6479             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6480         }
6481         elsif ($d->[1] ge $vsn5005) {
6482             unshift(@inc_version_list, grep { -d } $d->[0]);
6483         }
6484     }
6485     else {
6486         # Skip newer version.  I.e. don't look in
6487         # 5.7.0 if we're installing 5.6.1.
6488     }
6489 }
6490
6491 if (@inc_version_list) {
6492     print join(' ', @inc_version_list);
6493 }
6494 else {
6495     # Blank space to preserve value for next Configure run.
6496     print " ";
6497 }
6498 EOPL
6499 chmod +x getverlist
6500 case "$inc_version_list" in
6501 '')     if test -x "$perl5$exe_ext"; then
6502                 dflt=`$perl5 getverlist`
6503         else
6504                 dflt='none'
6505         fi
6506         ;;
6507 $undef) dflt='none' ;;
6508 *)  eval dflt=\"$inc_version_list\" ;;
6509 esac
6510 case "$dflt" in
6511 ''|' ') dflt=none ;;
6512 esac
6513 case "$dflt" in
6514 5.005) dflt=none ;;
6515 esac
6516 $cat <<EOM
6517
6518 In order to ease the process of upgrading, this version of perl
6519 can be configured to use modules built and installed with earlier
6520 versions of perl that were installed under $prefix.  Specify here
6521 the list of earlier versions that this version of perl should check.
6522 If Configure detected no earlier versions of perl installed under
6523 $prefix, then the list will be empty.  Answer 'none' to tell perl
6524 to not search earlier versions.
6525
6526 The default should almost always be sensible, so if you're not sure,
6527 just accept the default.
6528 EOM
6529
6530 rp='List of earlier versions to include in @INC?'
6531 . ./myread
6532 case "$ans" in
6533 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6534 *) inc_version_list="$ans" ;;
6535 esac
6536 case "$inc_version_list" in
6537 ''|' ')
6538         inc_version_list_init='0'
6539         d_inc_version_list="$undef"
6540         ;;
6541 *)      inc_version_list_init=`echo $inc_version_list |
6542                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6543         d_inc_version_list="$define"
6544         ;;
6545 esac
6546 $rm -f getverlist
6547
6548 : see if this is a malloc.h system
6549 : we want a real compile instead of Inhdr because some systems have a
6550 : malloc.h that just gives a compile error saying to use stdlib.h instead
6551 echo " "
6552 $cat >try.c <<EOCP
6553 #include <stdlib.h>
6554 #include <malloc.h>
6555 int main () { return 0; }
6556 EOCP
6557 set try
6558 if eval $compile; then
6559     echo "<malloc.h> found." >&4
6560     val="$define"
6561 else
6562     echo "<malloc.h> NOT found." >&4
6563     val="$undef"
6564 fi
6565 $rm_try
6566 set i_malloc
6567 eval $setvar
6568
6569 : check for void type
6570 echo " "
6571 echo "Checking to see how well your C compiler groks the void type..." >&4
6572 case "$voidflags" in
6573 '')
6574         $cat >try.c <<EOCP
6575 #$i_stdlib I_STDLIB
6576 #ifdef I_STDLIB
6577 #include <stdlib.h>
6578 #endif
6579 #if TRY & 1
6580 void sub() {
6581 #else
6582 sub() {
6583 #endif
6584         extern void moo();      /* function returning void */
6585         void (*goo)();          /* ptr to func returning void */
6586 #if TRY & 8
6587         void *hue;              /* generic ptr */
6588 #endif
6589 #if TRY & 2
6590         void (*foo[10])();
6591 #endif
6592
6593 #if TRY & 4
6594         if(goo == moo) {
6595                 exit(0);
6596         }
6597 #endif
6598         exit(0);
6599 }
6600 int main() { sub(); }
6601 EOCP
6602         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6603                 voidflags=$defvoidused
6604         echo "Good.  It appears to support void to the level $package wants.">&4
6605                 if $contains warning .out >/dev/null 2>&1; then
6606                         echo "However, you might get some warnings that look like this:"
6607                         $cat .out
6608                 fi
6609         else
6610 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6611                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6612                         echo "It supports 1..."
6613                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6614                                 echo "It also supports 2..."
6615                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6616                                         voidflags=7
6617                                         echo "And it supports 4 but not 8 definitely."
6618                                 else
6619                                         echo "It doesn't support 4..."
6620                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6621                                                 voidflags=11
6622                                                 echo "But it supports 8."
6623                                         else
6624                                                 voidflags=3
6625                                                 echo "Neither does it support 8."
6626                                         fi
6627                                 fi
6628                         else
6629                                 echo "It does not support 2..."
6630                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6631                                         voidflags=13
6632                                         echo "But it supports 4 and 8."
6633                                 else
6634                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6635                                                 voidflags=5
6636                                                 echo "And it supports 4 but has not heard about 8."
6637                                         else
6638                                                 echo "However it supports 8 but not 4."
6639                                         fi
6640                                 fi
6641                         fi
6642                 else
6643                         echo "There is no support at all for void."
6644                         voidflags=0
6645                 fi
6646         fi
6647 esac
6648 case "$voidflags" in
6649 "$defvoidused") ;;
6650 *)      $cat >&4 <<'EOM'
6651   Support flag bits are:
6652     1: basic void declarations.
6653     2: arrays of pointers to functions returning void.
6654     4: operations between pointers to and addresses of void functions.
6655     8: generic void pointers.
6656 EOM
6657         dflt="$voidflags";
6658         rp="Your void support flags add up to what?"
6659         . ./myread
6660         voidflags="$ans"
6661         ;;
6662 esac
6663 $rm_try
6664
6665 : check for length of pointer
6666 echo " "
6667 case "$ptrsize" in
6668 '')
6669         echo "Checking to see how big your pointers are..." >&4
6670         if test "$voidflags" -gt 7; then
6671                 echo '#define VOID_PTR char *' > try.c
6672         else
6673                 echo '#define VOID_PTR void *' > try.c
6674         fi
6675         $cat >>try.c <<EOCP
6676 #include <stdio.h>
6677 #$i_stdlib I_STDLIB
6678 #ifdef I_STDLIB
6679 #include <stdlib.h>
6680 #endif
6681 int main()
6682 {
6683     printf("%d\n", (int)sizeof(VOID_PTR));
6684     exit(0);
6685 }
6686 EOCP
6687         set try
6688         if eval $compile_ok; then
6689                 ptrsize=`$run ./try`
6690                 echo "Your pointers are $ptrsize bytes long."
6691         else
6692                 dflt='4'
6693                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6694                 rp="What is the size of a pointer (in bytes)?"
6695                 . ./myread
6696                 ptrsize="$ans"
6697         fi
6698         ;;
6699 esac
6700 $rm_try
6701 case "$use64bitall" in
6702 "$define"|true|[yY]*)
6703         case "$ptrsize" in
6704         4)      cat <<EOM >&4
6705
6706 *** You have chosen a maximally 64-bit build,
6707 *** but your pointers are only 4 bytes wide.
6708 *** Please rerun Configure without -Duse64bitall.
6709 EOM
6710                 case "$d_quad" in
6711                 define)
6712                         cat <<EOM >&4
6713 *** Since you have quads, you could possibly try with -Duse64bitint.
6714 EOM
6715                         ;;
6716                 esac
6717                 cat <<EOM >&4
6718 *** Cannot continue, aborting.
6719
6720 EOM
6721
6722                 exit 1
6723                 ;;
6724         esac
6725         ;;
6726 esac
6727
6728
6729 : determine whether to use malloc wrapping
6730 echo " "
6731 case "$usemallocwrap" in
6732 [yY]*|true|$define)     dflt='y' ;;
6733 [nN]*|false|$undef)     dflt='n' ;;
6734 *)      case "$usedevel" in
6735         [yY]*|true|$define)     dflt='y' ;;
6736         *) dflt='n' ;;
6737         esac
6738         ;;
6739 esac
6740 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6741 . ./myread
6742 usemallocwrap="$ans"
6743 case "$ans" in
6744 y*|true)
6745         usemallocwrap="$define" ;;
6746 *)
6747         usemallocwrap="$undef" ;;
6748 esac
6749
6750 : determine which malloc to compile in
6751 echo " "
6752 case "$usemymalloc" in
6753 [yY]*|true|$define)     dflt='y' ;;
6754 [nN]*|false|$undef)     dflt='n' ;;
6755 *)      case "$ptrsize" in
6756         4) dflt='y' ;;
6757         *) dflt='n' ;;
6758         esac
6759         ;;
6760 esac
6761 rp="Do you wish to attempt to use the malloc that comes with $package?"
6762 . ./myread
6763 usemymalloc="$ans"
6764 case "$ans" in
6765 y*|true)
6766         usemymalloc='y'
6767         mallocsrc='malloc.c'
6768         mallocobj="malloc$_o"
6769         d_mymalloc="$define"
6770         case "$libs" in
6771         *-lmalloc*)
6772                 : Remove malloc from list of libraries to use
6773                 echo "Removing unneeded -lmalloc from library list" >&4
6774                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6775                 shift
6776                 libs="$*"
6777                 echo "libs = $libs" >&4
6778                 ;;
6779         esac
6780         ;;
6781 *)
6782         usemymalloc='n'
6783         mallocsrc=''
6784         mallocobj=''
6785         d_mymalloc="$undef"
6786         ;;
6787 esac
6788
6789 : compute the return types of malloc and free
6790 echo " "
6791 $cat >malloc.c <<END
6792 #$i_malloc I_MALLOC
6793 #$i_stdlib I_STDLIB
6794 #include <stdio.h>
6795 #include <sys/types.h>
6796 #ifdef I_MALLOC
6797 #include <malloc.h>
6798 #endif
6799 #ifdef I_STDLIB
6800 #include <stdlib.h>
6801 #endif
6802 #ifdef TRY_MALLOC
6803 void *malloc();
6804 #endif
6805 #ifdef TRY_FREE
6806 void free();
6807 #endif
6808 END
6809 case "$malloctype" in
6810 '')
6811         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6812                 malloctype='void *'
6813         else
6814                 malloctype='char *'
6815         fi
6816         ;;
6817 esac
6818 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6819
6820 case "$freetype" in
6821 '')
6822         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6823                 freetype='void'
6824         else
6825                 freetype='int'
6826         fi
6827         ;;
6828 esac
6829 echo "Your system uses $freetype free(), it would seem." >&4
6830 $rm -f malloc.[co]
6831 : determine where site specific architecture-dependent libraries go.
6832 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6833 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6834 : sitelib may have an optional trailing /share.
6835 case "$sitearch" in
6836 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6837         dflt="$dflt/$archname"
6838         ;;
6839 *)      dflt="$sitearch"
6840         ;;
6841 esac
6842 set sitearch sitearch none
6843 eval $prefixit
6844 $cat <<EOM
6845
6846 The installation process will also create a directory for
6847 architecture-dependent site-specific extensions and modules.
6848
6849 EOM
6850 fn=d~+
6851 rp='Pathname for the site-specific architecture-dependent library files?'
6852 . ./getfile
6853 prefixvar=sitearch
6854 . ./setprefixvar
6855 if $test X"$sitearch" = X"$sitelib"; then
6856         d_sitearch="$undef"
6857 else
6858         d_sitearch="$define"
6859 fi
6860
6861 $cat <<EOM
6862
6863 The installation process will also create a directory for
6864 vendor-supplied add-ons.  Vendors who supply perl with their system
6865 may find it convenient to place all vendor-supplied files in this
6866 directory rather than in the main distribution directory.  This will
6867 ease upgrades between binary-compatible maintenance versions of perl.
6868
6869 Of course you may also use these directories in whatever way you see
6870 fit.  For example, you might use them to access modules shared over a
6871 company-wide network.
6872
6873 The default answer should be fine for most people.
6874 This causes further questions about vendor add-ons to be skipped
6875 and no vendor-specific directories will be configured for perl.
6876
6877 EOM
6878 rp='Do you want to configure vendor-specific add-on directories?'
6879 case "$usevendorprefix" in
6880 define|true|[yY]*) dflt=y ;;
6881 *)      : User may have set vendorprefix directly on Configure command line.
6882         case "$vendorprefix" in
6883         ''|' ') dflt=n ;;
6884         *)      dflt=y ;;
6885         esac
6886         ;;
6887 esac
6888 . ./myread
6889 case "$ans" in
6890 [yY]*)  fn=d~+
6891         rp='Installation prefix to use for vendor-supplied add-ons?'
6892         case "$vendorprefix" in
6893         '') dflt='' ;;
6894         *)  dflt=$vendorprefix ;;
6895         esac
6896         . ./getfile
6897         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6898         oldvendorprefix=''
6899         case "$vendorprefix" in
6900         '') ;;
6901         *)      case "$ans" in
6902                 "$prefix") ;;
6903                 *) oldvendorprefix="$prefix";;
6904                 esac
6905                 ;;
6906         esac
6907         usevendorprefix="$define"
6908         vendorprefix="$ans"
6909         vendorprefixexp="$ansexp"
6910         ;;
6911 *)      usevendorprefix="$undef"
6912         vendorprefix=''
6913         vendorprefixexp=''
6914         ;;
6915 esac
6916
6917 case "$vendorprefix" in
6918 '')     d_vendorlib="$undef"
6919         vendorlib=''
6920         vendorlibexp=''
6921         ;;
6922 *)      d_vendorlib="$define"
6923         : determine where vendor-supplied modules go.
6924         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6925         case "$vendorlib" in
6926         '')
6927                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6928                 case "$installstyle" in
6929                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6930                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6931                 esac
6932                 ;;
6933         *)      dflt="$vendorlib"
6934                 ;;
6935         esac
6936         fn=d~+
6937         rp='Pathname for the vendor-supplied library files?'
6938         . ./getfile
6939         vendorlib="$ans"
6940         vendorlibexp="$ansexp"
6941         ;;
6942 esac
6943 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6944 prefixvar=vendorlib
6945 . ./installprefix
6946
6947 case "$vendorprefix" in
6948 '')     d_vendorarch="$undef"
6949         vendorarch=''
6950         vendorarchexp=''
6951         ;;
6952 *)      d_vendorarch="$define"
6953         : determine where vendor-supplied architecture-dependent libraries go.
6954         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6955         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6956         : vendorlib may have an optional trailing /share.
6957         case "$vendorarch" in
6958         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6959                 dflt="$dflt/$archname"
6960                 ;;
6961         *)      dflt="$vendorarch" ;;
6962         esac
6963         fn=d~+
6964         rp='Pathname for vendor-supplied architecture-dependent files?'
6965         . ./getfile
6966         vendorarch="$ans"
6967         vendorarchexp="$ansexp"
6968         ;;
6969 esac
6970 prefixvar=vendorarch
6971 . ./installprefix
6972
6973 : Final catch-all directories to search
6974 $cat <<EOM
6975
6976 Lastly, you can have perl look in other directories for extensions and
6977 modules in addition to those already specified.
6978 These directories will be searched after 
6979         $sitearch 
6980         $sitelib 
6981 EOM
6982 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6983 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6984 echo ' '
6985 case "$otherlibdirs" in
6986 ''|' ') dflt='none' ;;
6987 *)      dflt="$otherlibdirs" ;;
6988 esac
6989 $cat <<EOM
6990 Enter a colon-separated set of extra paths to include in perl's @INC
6991 search path, or enter 'none' for no extra paths.
6992
6993 EOM
6994
6995 rp='Colon-separated list of additional directories for perl to search?'
6996 . ./myread
6997 case "$ans" in
6998 ' '|''|none)    otherlibdirs=' ' ;;     
6999 *)      otherlibdirs="$ans" ;;
7000 esac
7001 case "$otherlibdirs" in
7002 ' ') val=$undef ;;
7003 *)      val=$define ;;
7004 esac
7005 set d_perl_otherlibdirs
7006 eval $setvar
7007
7008 : Cruising for prototypes
7009 echo " "
7010 echo "Checking out function prototypes..." >&4
7011 $cat >prototype.c <<EOCP
7012 #$i_stdlib I_STDLIB
7013 #ifdef I_STDLIB
7014 #include <stdlib.h>
7015 #endif
7016 int main(int argc, char *argv[]) {
7017         exit(0);}
7018 EOCP
7019 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7020         echo "Your C compiler appears to support function prototypes."
7021         val="$define"
7022 else
7023         echo "Your C compiler doesn't seem to understand function prototypes."
7024         val="$undef"
7025 fi
7026 set prototype
7027 eval $setvar
7028 $rm -f prototype*
7029
7030 case "$prototype" in
7031 "$define") ;;
7032 *)      ansi2knr='ansi2knr'
7033         echo " "
7034         cat <<EOM >&4
7035
7036 $me:  FATAL ERROR:
7037 This version of $package can only be compiled by a compiler that 
7038 understands function prototypes.  Unfortunately, your C compiler 
7039         $cc $ccflags
7040 doesn't seem to understand them.  Sorry about that.
7041
7042 If GNU cc is available for your system, perhaps you could try that instead.  
7043
7044 Eventually, we hope to support building Perl with pre-ANSI compilers.
7045 If you would like to help in that effort, please contact <perlbug@perl.org>.
7046
7047 Aborting Configure now.
7048 EOM
7049         exit 2
7050         ;;
7051 esac
7052
7053 echo " "
7054 case "$extras" in
7055 '') dflt='n';;
7056 *) dflt='y';;
7057 esac
7058 cat <<EOM
7059 Perl can be built with extra modules or bundles of modules which
7060 will be fetched from the CPAN and installed alongside Perl.
7061
7062 Notice that you will need access to the CPAN; either via the Internet,
7063 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7064 be asked later to configure the CPAN.pm module which will in turn do
7065 the installation of the rest of the extra modules or bundles.)
7066
7067 Notice also that if the modules require any external software such as
7068 libraries and headers (the libz library and the zlib.h header for the
7069 Compress::Zlib module, for example) you MUST have any such software
7070 already installed, this configuration process will NOT install such
7071 things for you.
7072
7073 If this doesn't make any sense to you, just accept the default '$dflt'.
7074 EOM
7075 rp='Install any extra modules (y or n)?'
7076 . ./myread
7077 case "$ans" in
7078 y|Y)
7079         cat <<EOM
7080
7081 Please list any extra modules or bundles to be installed from CPAN,
7082 with spaces between the names.  The names can be in any format the
7083 'install' command of CPAN.pm will understand.  (Answer 'none',
7084 without the quotes, to install no extra modules or bundles.)
7085 EOM
7086         rp='Extras?'
7087         dflt="$extras"
7088         . ./myread
7089         extras="$ans"
7090 esac
7091 case "$extras" in
7092 ''|'none')
7093         val=''
7094         $rm -f ../extras.lst
7095         ;;
7096 *)      echo "(Saving the list of extras for later...)"
7097         echo "$extras" > ../extras.lst
7098         val="'$extras'"
7099         ;;
7100 esac
7101 set extras
7102 eval $setvar
7103 echo " "
7104
7105 : determine where html pages for programs go
7106 set html1dir html1dir none
7107 eval $prefixit
7108 $cat <<EOM
7109
7110 If you wish to install html files for programs in $spackage, indicate
7111 the appropriate directory here.  To skip installing html files,
7112 answer "none".
7113 EOM
7114 case "$html1dir" in
7115 ''|none|$undef|' ') dflt=none ;;
7116 *) dflt=$html1dir ;;
7117 esac
7118 fn=dn+~
7119 rp="Directory for the main $spackage html pages?"
7120 . ./getfile
7121 prefixvar=html1dir
7122 . ./setprefixvar
7123 : Use ' ' for none so value is preserved next time through Configure
7124 $test X"$html1dir" = "X" && html1dir=' '
7125
7126 : determine where html pages for libraries and modules go
7127 set html3dir html3dir none
7128 eval $prefixit
7129 $cat <<EOM
7130
7131 If you wish to install html files for modules associated with $spackage,
7132 indicate the appropriate directory here.  To skip installing html files,
7133 answer "none".
7134 EOM
7135 : There is no obvious default.  If they have specified html1dir, then
7136 : try to key off that, possibly changing .../html1 into .../html3.
7137 case "$html3dir" in
7138 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7139 *) dflt=$html3dir ;;
7140 esac
7141 fn=dn+~
7142 rp="Directory for the $spackage module html pages?"
7143 . ./getfile
7144 prefixvar=html3dir
7145 . ./setprefixvar
7146 : Use ' ' for none so value is preserved next time through Configure
7147 $test X"$html3dir" = "X" && html3dir=' '
7148
7149 : determine whether to install perl also as /usr/bin/perl
7150
7151 echo " "
7152 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7153         $cat <<EOM
7154 Many scripts expect perl to be installed as /usr/bin/perl.
7155
7156 If you want to, I can install the perl you are about to compile
7157 as /usr/bin/perl (in addition to $bin/perl).
7158 EOM
7159         if test -f /usr/bin/perl; then
7160             $cat <<EOM
7161
7162 However, please note that because you already have a /usr/bin/perl,
7163 overwriting that with a new Perl would very probably cause problems.
7164 Therefore I'm assuming you don't want to do that (unless you insist).
7165
7166 EOM
7167             case "$installusrbinperl" in
7168             "$define"|[yY]*)    dflt='y';;
7169             *)                  dflt='n';;
7170             esac
7171         else
7172             $cat <<EOM
7173
7174 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7175
7176 EOM
7177             case "$installusrbinperl" in
7178             "$undef"|[nN]*)     dflt='n';;
7179             *)                  dflt='y';;
7180             esac
7181         fi
7182         rp="Do you want to install perl as /usr/bin/perl?"
7183         . ./myread
7184         case "$ans" in
7185         [yY]*)  val="$define";;
7186         *)      val="$undef" ;;
7187         esac
7188 else
7189         val="$undef"
7190 fi
7191 set installusrbinperl
7192 eval $setvar
7193
7194 echo " "
7195 echo "Checking for GNU C Library..." >&4
7196 cat >try.c <<'EOCP'
7197 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7198    alone are insufficient to distinguish different versions, such as
7199    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7200    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7201 */
7202 #include <stdio.h>
7203 int main(void)
7204 {
7205 #ifdef __GLIBC__
7206 #   ifdef __GLIBC_MINOR__
7207 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7208 #           include <gnu/libc-version.h>
7209             printf("%s\n",  gnu_get_libc_version());
7210 #       else
7211             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7212 #       endif
7213 #   else
7214         printf("%d\n",  __GLIBC__);
7215 #   endif
7216     return 0;
7217 #else
7218     return 1;
7219 #endif
7220 }
7221 EOCP
7222 set try
7223 if eval $compile_ok && $run ./try > glibc.ver; then
7224         val="$define"
7225         gnulibc_version=`$cat glibc.ver`
7226         echo "You are using the GNU C Library version $gnulibc_version"
7227 else
7228         val="$undef"
7229         gnulibc_version=''
7230         echo "You are not using the GNU C Library"
7231 fi
7232 $rm_try glibc.ver
7233 set d_gnulibc
7234 eval $setvar
7235
7236 : see if nm is to be used to determine whether a symbol is defined or not
7237 case "$usenm" in
7238 '')
7239         dflt=''
7240         case "$d_gnulibc" in
7241         "$define")
7242                 echo " "
7243                 echo "nm probably won't work on the GNU C Library." >&4
7244                 dflt=n
7245                 ;;
7246         esac
7247         case "$dflt" in
7248         '') 
7249                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7250                         echo " "
7251                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7252                         echo "'nm' won't be sufficient on this sytem." >&4
7253                         dflt=n
7254                 fi
7255                 ;;
7256         esac
7257         case "$dflt" in
7258         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7259                 if $test $dflt -gt 20; then
7260                         dflt=y
7261                 else
7262                         dflt=n
7263                 fi
7264                 ;;
7265         esac
7266         ;;
7267 *)
7268         case "$usenm" in
7269         true|$define) dflt=y;;
7270         *) dflt=n;;
7271         esac
7272         ;;
7273 esac
7274 $cat <<EOM
7275
7276 I can use $nm to extract the symbols from your C libraries. This
7277 is a time consuming task which may generate huge output on the disk (up
7278 to 3 megabytes) but that should make the symbols extraction faster. The
7279 alternative is to skip the 'nm' extraction part and to compile a small
7280 test program instead to determine whether each symbol is present. If
7281 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7282 this may be the best solution.
7283
7284 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7285
7286 EOM
7287 rp="Shall I use $nm to extract C symbols from the libraries?"
7288 . ./myread
7289 case "$ans" in
7290 [Nn]*) usenm=false;;
7291 *) usenm=true;;
7292 esac
7293
7294 runnm=$usenm
7295 case "$reuseval" in
7296 true) runnm=false;;
7297 esac
7298
7299 : nm options which may be necessary
7300 case "$nm_opt" in
7301 '') if $test -f /mach_boot; then
7302                 nm_opt=''       # Mach
7303         elif $test -d /usr/ccs/lib; then
7304                 nm_opt='-p'     # Solaris (and SunOS?)
7305         elif $test -f /dgux; then
7306                 nm_opt='-p'     # DG-UX
7307         elif $test -f /lib64/rld; then
7308                 nm_opt='-p'     # 64-bit Irix
7309         else
7310                 nm_opt=''
7311         fi;;
7312 esac
7313
7314 : nm options which may be necessary for shared libraries but illegal
7315 : for archive libraries.  Thank you, Linux.
7316 case "$nm_so_opt" in
7317 '')     case "$myuname" in
7318         *linux*|gnu*)
7319                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7320                         nm_so_opt='--dynamic'
7321                 fi
7322                 ;;
7323         esac
7324         ;;
7325 esac
7326
7327 case "$runnm" in
7328 true)
7329 : get list of predefined functions in a handy place
7330 echo " "
7331 case "$libc" in
7332 '') libc=unknown
7333         case "$libs" in
7334         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7335         esac
7336         ;;
7337 esac
7338 case "$libs" in
7339 '') ;;
7340 *)  for thislib in $libs; do
7341         case "$thislib" in
7342         -lc|-lc_s)
7343                 : Handle C library specially below.
7344                 ;;
7345         -l*)
7346                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7347                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7348                         :
7349                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7350                         :
7351                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7352                         :
7353                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7354                         :
7355                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7356                         :
7357                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7358                         :
7359                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7360                         :
7361                 else
7362                         try=''
7363                 fi
7364                 libnames="$libnames $try"
7365                 ;;
7366         *) libnames="$libnames $thislib" ;;
7367         esac
7368         done
7369         ;;
7370 esac
7371 xxx=normal
7372 case "$libc" in
7373 unknown)
7374         set /lib/libc.$so
7375         for xxx in $libpth; do
7376                 $test -r $1 || set $xxx/libc.$so
7377                 : The messy sed command sorts on library version numbers.
7378                 $test -r $1 || \
7379                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7380                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7381                                 h
7382                                 s/[0-9][0-9]*/0000&/g
7383                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7384                                 G
7385                                 s/\n/ /' | \
7386                          $sort | $sed -e 's/^.* //'`
7387                 eval set \$$#
7388         done
7389         $test -r $1 || set /usr/ccs/lib/libc.$so
7390         $test -r $1 || set /lib/libsys_s$_a
7391         ;;
7392 *)
7393         set blurfl
7394         ;;
7395 esac
7396 if $test -r "$1"; then
7397         echo "Your (shared) C library seems to be in $1."
7398         libc="$1"
7399 elif $test -r /lib/libc && $test -r /lib/clib; then
7400         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7401         xxx=apollo
7402         libc='/lib/clib /lib/libc'
7403         if $test -r /lib/syslib; then
7404                 echo "(Your math library is in /lib/syslib.)"
7405                 libc="$libc /lib/syslib"
7406         fi
7407 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7408         echo "Your C library seems to be in $libc, as you said before."
7409 elif $test -r $incpath/usr/lib/libc$_a; then
7410         libc=$incpath/usr/lib/libc$_a;
7411         echo "Your C library seems to be in $libc.  That's fine."
7412 elif $test -r /lib/libc$_a; then
7413         libc=/lib/libc$_a;
7414         echo "Your C library seems to be in $libc.  You're normal."
7415 else
7416         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7417                 :
7418         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7419                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7420         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7421                 :
7422         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7423                 :
7424         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7425                 :
7426         else
7427                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7428         fi
7429         if $test -r "$tans"; then
7430                 echo "Your C library seems to be in $tans, of all places."
7431                 libc=$tans
7432         else
7433                 libc='blurfl'
7434         fi
7435 fi
7436 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7437         dflt="$libc"
7438         cat <<EOM
7439
7440 If the guess above is wrong (which it might be if you're using a strange
7441 compiler, or your machine supports multiple models), you can override it here.
7442
7443 EOM
7444 else
7445         dflt=''
7446         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7447         cat >&4 <<EOM
7448 I can't seem to find your C library.  I've looked in the following places:
7449
7450 EOM
7451         $sed 's/^/      /' libpath
7452         cat <<EOM
7453
7454 None of these seems to contain your C library. I need to get its name...
7455
7456 EOM
7457 fi
7458 fn=f
7459 rp='Where is your C library?'
7460 . ./getfile
7461 libc="$ans"
7462
7463 echo " "
7464 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7465 set X `cat libnames`
7466 shift
7467 xxx=files
7468 case $# in 1) xxx=file; esac
7469 echo "Extracting names from the following $xxx for later perusal:" >&4
7470 echo " "
7471 $sed 's/^/      /' libnames >&4
7472 echo " "
7473 $echo $n "This may take a while...$c" >&4
7474
7475 for file in $*; do
7476         case $file in
7477         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7478         *) $nm $nm_opt $file 2>/dev/null;;
7479         esac
7480 done >libc.tmp
7481
7482 $echo $n ".$c"
7483 $grep fprintf libc.tmp > libc.ptf
7484 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7485 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7486 xxx='[ADTSIW]'
7487 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7488         eval $xscan;\
7489         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490                 eval $xrun
7491 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7492         eval $xscan;\
7493         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7494                 eval $xrun
7495 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7496         eval $xscan;\
7497         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7498                 eval $xrun
7499 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7500         eval $xscan;\
7501         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7502                 eval $xrun
7503 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7504         eval $xscan;\
7505         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7506                 eval $xrun
7507 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7508         eval $xscan;\
7509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7510                 eval $xrun
7511 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7512                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7513         eval $xscan;\
7514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7515                 eval $xrun
7516 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7517         eval $xscan;\
7518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7519                 eval $xrun
7520 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7521         eval $xscan;\
7522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7523                 eval $xrun
7524 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7525         eval $xscan;\
7526         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7527                 eval $xrun
7528 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7529         eval $xscan;\
7530         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7531                 eval $xrun
7532 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7533         eval $xscan;\
7534         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7535                 eval $xrun
7536 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7537         eval $xscan;\
7538         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7539                 eval $xrun
7540 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7541         eval $xscan;\
7542         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7543                 eval $xrun
7544 else
7545         $nm -p $* 2>/dev/null >libc.tmp
7546         $grep fprintf libc.tmp > libc.ptf
7547         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7548                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7549         then
7550                 nm_opt='-p'
7551                 eval $xrun
7552         else
7553                 echo " "
7554                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7555                 com=''
7556                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7557                         for thisname in $libnames $libc; do
7558                                 $ar t $thisname >>libc.tmp
7559                         done
7560                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7561                         echo "Ok." >&4
7562                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7563                         # Repeat libc to extract forwarders to DLL entries too
7564                         for thisname in $libnames $libc; do
7565                                 $ar tv $thisname >>libc.tmp
7566                                 # Revision 50 of EMX has bug in $ar.
7567                                 # it will not extract forwarders to DLL entries
7568                                 # Use emximp which will extract exactly them.
7569                                 emximp -o tmp.imp $thisname \
7570                                     2>/dev/null && \
7571                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7572                                     < tmp.imp >>libc.tmp
7573                                 $rm tmp.imp
7574                         done
7575                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7576                         echo "Ok." >&4
7577                 else
7578                         echo "$ar didn't seem to work right." >&4
7579                         echo "Maybe this is a Cray...trying bld instead..." >&4
7580                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7581                         then
7582                                 for thisname in $libnames; do
7583                                         bld t $libnames | \
7584                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7585                                         $ar t $thisname >>libc.tmp
7586                                 done
7587                                 echo "Ok." >&4
7588                         else
7589                                 echo "That didn't work either.  Giving up." >&4
7590                                 exit 1
7591                         fi
7592                 fi
7593         fi
7594 fi
7595 nm_extract="$com"
7596 case "$PASE" in
7597 define)
7598     echo " "
7599     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7600     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7601     ;;
7602 *)  if $test -f /lib/syscalls.exp; then
7603         echo " "
7604         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7605         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7606     fi
7607     ;;
7608 esac
7609 ;;
7610 esac
7611 $rm -f libnames libpath
7612
7613 : see if dld is available
7614 set dld.h i_dld
7615 eval $inhdr
7616
7617
7618 echo " "
7619 echo "Checking for C++..." >&4
7620 $cat >try.c <<'EOCP'
7621 #include <stdio.h>
7622 int main(void)
7623 {
7624 #ifdef __cplusplus
7625     return 0;
7626 #else
7627     return 1;
7628 #endif
7629 }
7630 EOCP
7631 set try
7632 if eval $compile_ok && $run ./try; then
7633         val="$define"
7634         echo "You are using a C++ compiler."
7635 else
7636         val="$undef"
7637         echo "You are not using a C++ compiler."
7638 fi
7639 $rm_try cplusplus$$
7640 set d_cplusplus
7641 eval $setvar
7642
7643 : is a C symbol defined?
7644 csym='tlook=$1;
7645 case "$3" in
7646 -v) tf=libc.tmp; tdc="";;
7647 -a) tf=libc.tmp; tdc="[]";;
7648 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7649 esac;
7650 tx=yes;
7651 case "$reuseval-$4" in
7652 true-) ;;
7653 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7654 esac;
7655 case "$tx" in
7656 yes)
7657         tval=false;
7658         case "$d_cplusplus" in
7659                 $define) extern_C=\"C\";;
7660         esac;
7661         if $test "$runnm" = true; then
7662                 if $contains $tlook $tf >/dev/null 2>&1; then
7663                         tval=true;
7664                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7665                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7666                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7667                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7668                         $rm_try;
7669                 fi;
7670         else
7671                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7672                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7673                 $rm_try;
7674         fi;
7675         ;;
7676 *)
7677         case "$tval" in
7678         $define) tval=true;;
7679         *) tval=false;;
7680         esac;
7681         ;;
7682 esac;
7683 eval "$2=$tval"'
7684
7685 : define an is-in-libc? function
7686 inlibc='echo " "; td=$define; tu=$undef;
7687 sym=$1; var=$2; eval "was=\$$2";
7688 tx=yes;
7689 case "$reuseval$was" in
7690 true) ;;
7691 true*) tx=no;;
7692 esac;
7693 case "$tx" in
7694 yes)
7695         set $sym tres -f;
7696         eval $csym;
7697         case "$tres" in
7698         true)
7699                 echo "$sym() found." >&4;
7700                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7701         *)
7702                 echo "$sym() NOT found." >&4;
7703                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7704         esac;;
7705 *)
7706         case "$was" in
7707         $define) echo "$sym() found." >&4;;
7708         *) echo "$sym() NOT found." >&4;;
7709         esac;;
7710 esac'
7711
7712 : see if dlopen exists
7713 xxx_runnm="$runnm"
7714 xxx_ccflags="$ccflags"
7715 runnm=false
7716 : with g++ one needs -shared to get is-in-libc to work for dlopen
7717 case "$gccversion" in
7718 '')     ;;
7719 *)      case "$d_cplusplus" in
7720         "$define") ccflags="$ccflags -shared" ;;
7721         esac
7722         ;;
7723 esac
7724 set dlopen d_dlopen
7725 eval $inlibc
7726 runnm="$xxx_runnm"
7727 ccflags="$xxx_ccflags"
7728
7729 : see if this is a unistd.h system
7730 set unistd.h i_unistd
7731 eval $inhdr
7732
7733 : determine which dynamic loading, if any, to compile in
7734 echo " "
7735 dldir="ext/DynaLoader"
7736 case "$usedl" in
7737 $define|y|true)
7738         dflt='y'
7739         usedl="$define"
7740         ;;
7741 $undef|n|false)
7742         dflt='n'
7743         usedl="$undef"
7744         ;;
7745 *)
7746         dflt='n'
7747         case "$d_dlopen" in
7748             $define) dflt='y' ;;
7749         esac
7750         case "$i_dld" in
7751             $define) dflt='y' ;;
7752         esac
7753         : Does a dl_xxx.xs file exist for this operating system
7754         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7755         ;;
7756 esac
7757 rp="Do you wish to use dynamic loading?"
7758 . ./myread
7759 usedl="$ans"
7760 case "$ans" in
7761 y*) usedl="$define"
7762         case "$dlsrc" in
7763         '')
7764                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7765                         dflt="$dldir/dl_${osname}.xs"
7766                 elif $test "$d_dlopen" = "$define" ; then
7767                         dflt="$dldir/dl_dlopen.xs"
7768                 elif $test "$i_dld" = "$define" ; then
7769                         dflt="$dldir/dl_dld.xs"
7770                 else
7771                         dflt=''
7772                 fi
7773                 ;;
7774         *)      dflt="$dldir/$dlsrc"
7775                 ;;
7776         esac
7777     echo "The following dynamic loading files are available:"
7778         : Can not go over to $dldir because getfile has path hard-coded in.
7779         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7780         rp="Source file to use for dynamic loading"
7781         fn="fne"
7782         gfpth="$src"
7783         . ./getfile
7784         usedl="$define"
7785         : emulate basename
7786         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7787
7788         $cat << EOM
7789
7790 Some systems may require passing special flags to $cc -c to
7791 compile modules that will be used to create a shared library.
7792 To use no flags, say "none".
7793
7794 EOM
7795     case "$cccdlflags" in
7796     '') case "$gccversion" in
7797                 '') case "$osname" in
7798                         hpux)   dflt='+z' ;;
7799                         next)   dflt='none' ;;
7800                         irix*)  dflt='-KPIC' ;;
7801                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7802                         sunos)  dflt='-pic' ;;
7803                         *)      dflt='none' ;;
7804                     esac
7805                         ;;
7806                 *)  case "$osname" in
7807                         darwin) dflt='none' ;;
7808                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7809                         *)      dflt='-fpic' ;;
7810                     esac ;;
7811             esac ;;
7812         ' ') dflt='none' ;;
7813     *)  dflt="$cccdlflags" ;;
7814     esac
7815     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7816     . ./myread
7817     case "$ans" in
7818     none) cccdlflags=' ' ;;
7819     *) cccdlflags="$ans" ;;
7820     esac
7821
7822     cat << EOM
7823
7824 Some systems use ld to create libraries that can be dynamically loaded,
7825 while other systems (such as those using ELF) use $cc.
7826
7827 EOM
7828         case "$ld" in
7829         '')     $cat >try.c <<EOM
7830 /* Test for whether ELF binaries are produced */
7831 #include <fcntl.h>
7832 #$i_stdlib I_STDLIB
7833 #ifdef I_STDLIB
7834 #include <stdlib.h>
7835 #endif
7836 #$i_unistd I_UNISTD
7837 #ifdef I_UNISTD
7838 #include <unistd.h>
7839 #endif
7840 int main() {
7841         char b[4];
7842         int i = open("a.out",O_RDONLY);
7843         if(i == -1)
7844                 exit(1); /* fail */
7845         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7846                 exit(0); /* succeed (yes, it's ELF) */
7847         else
7848                 exit(1); /* fail */
7849 }
7850 EOM
7851                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7852                         cat <<EOM
7853 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7854 EOM
7855                         dflt="$cc"
7856                 else
7857                         echo "I'll use ld to build dynamic libraries."
7858                         dflt='ld'
7859                 fi
7860                 $rm_try
7861                 ;;
7862         *)      dflt="$ld"
7863                 ;;
7864         esac
7865
7866     rp="What command should be used to create dynamic libraries?"
7867     . ./myread
7868         ld="$ans"
7869
7870     cat << EOM
7871
7872 Some systems may require passing special flags to $ld to create a
7873 library that can be dynamically loaded.  If your ld flags include
7874 -L/other/path options to locate libraries outside your loader's normal
7875 search path, you may need to specify those -L options here as well.  To
7876 use no flags, say "none".
7877
7878 EOM
7879     case "$lddlflags" in
7880     '') case "$osname" in
7881                         beos) dflt='-nostart' ;;
7882                         hpux) dflt='-b';
7883                               case "$gccversion" in
7884                               '') dflt="$dflt +vnocompatwarnings" ;;
7885                               esac
7886                               ;;
7887                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7888                         next)  dflt='none' ;;
7889                         solaris) dflt='-G' ;;
7890                         sunos) dflt='-assert nodefinitions' ;;
7891                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7892                 *)     dflt='none' ;;
7893                         esac
7894                         ;;
7895     *) dflt="$lddlflags" ;;
7896     esac
7897
7898         : Try to guess additional flags to pick up local libraries.
7899         : Be careful not to append to a plain 'none'
7900         case "$dflt" in
7901         none) dflt='' ;;
7902         esac
7903         for thisflag in $ldflags; do
7904                 case "$thisflag" in
7905                 -L*|-R*|-Wl,-R*)
7906                         case " $dflt " in
7907                         *" $thisflag "*) ;;
7908                         *) dflt="$dflt $thisflag" ;;
7909                         esac
7910                         ;;
7911                 esac
7912         done
7913
7914         case "$dflt" in
7915         ''|' ') dflt='none' ;;
7916         esac
7917
7918     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7919     . ./myread
7920     case "$ans" in
7921     none) lddlflags=' ' ;;
7922     *) lddlflags="$ans" ;;
7923     esac
7924
7925         cat <<EOM
7926
7927 Some systems may require passing special flags to $cc to indicate that
7928 the resulting executable will use dynamic linking.  To use no flags,
7929 say "none".
7930
7931 EOM
7932     case "$ccdlflags" in
7933     '') case "$osname" in
7934             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7935             next|sunos) dflt='none' ;;
7936             *)          dflt='none' ;;
7937             esac ;;
7938     ' ')  dflt='none' ;;
7939     *)  dflt="$ccdlflags" ;;
7940     esac
7941     rp="Any special flags to pass to $cc to use dynamic linking?"
7942     . ./myread
7943     case "$ans" in
7944     none) ccdlflags=' ' ;;
7945     *) ccdlflags="$ans" ;;
7946     esac
7947     ;;
7948 *)  usedl="$undef"
7949         ld='ld'
7950     dlsrc='dl_none.xs'
7951     lddlflags=''
7952     ccdlflags=''
7953     ;;
7954 esac
7955
7956 also=''
7957 case "$usedl" in
7958 $undef)
7959         # No dynamic loading being used, so don't bother even to prompt.
7960         useshrplib='false'
7961         ;;
7962 *)      case "$useshrplib" in
7963         '')     case "$osname" in
7964                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7965                         dflt=y
7966                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7967                         ;;
7968                 next*)
7969                         case "$osvers" in
7970                         4*)     dflt=y
7971                                 also='Building a shared libperl is needed for MAB support.'
7972                                 ;;
7973                         *)      dflt=n
7974                                 ;;
7975                         esac
7976                         ;;
7977                 *)      dflt=n
7978                         ;;
7979                 esac
7980                 ;;
7981         $define|true|[Yy]*)
7982                 dflt=y
7983                 ;;
7984         *)      dflt=n
7985                 ;;
7986         esac
7987         $cat << EOM
7988
7989 The perl executable is normally obtained by linking perlmain.c with
7990 libperl${_a}, any static extensions (usually just DynaLoader), and
7991 any other libraries needed on this system (such as -lm, etc.).  Since
7992 your system supports dynamic loading, it is probably possible to build
7993 a shared libperl.$so.  If you will have more than one executable linked
7994 to libperl.$so, this will significantly reduce the size of each
7995 executable, but it may have a noticeable effect on performance.  The
7996 default is probably sensible for your system.
7997 $also
7998
7999 EOM
8000         rp="Build a shared libperl.$so (y/n)"
8001         . ./myread
8002         case "$ans" in
8003         true|$define|[Yy]*)
8004                 useshrplib='true'  ;;
8005         *)      useshrplib='false' ;;
8006         esac
8007         ;;
8008 esac
8009
8010 case "$useshrplib" in
8011 true)
8012         case "$libperl" in
8013         '')
8014                 # Figure out a good name for libperl.so.  Since it gets stored in
8015                 # a version-specific architecture-dependent library, the version
8016                 # number isn't really that important, except for making cc/ld happy.
8017                 #
8018                 # A name such as libperl.so.3.1
8019                 majmin="libperl.$so.$patchlevel.$subversion"
8020                 # A name such as libperl.so.301
8021                 majonly=`echo $patchlevel $subversion |
8022                         $awk '{printf "%d%02d", $1, $2}'`
8023                 majonly=libperl.$so.$majonly
8024                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8025                 # rely on figuring it out from the naming of libc.
8026                 case "${osname}${osvers}" in
8027                 next4*)
8028                         dflt=libperl.5.$so
8029                         # XXX How handle the --version stuff for MAB?
8030                         ;;
8031                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8032                         dflt=libperl.$so
8033                         ;;
8034                 cygwin*) # ld links against an importlib
8035                         dflt=libperl$lib_ext
8036                         ;;
8037                 *)      # Try to guess based on whether libc has major.minor.
8038                         case "$libc" in
8039                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8040                         *libc.$so.[0-9]*) dflt=$majonly ;;
8041                         *)      dflt=libperl.$so ;;
8042                         esac
8043                         ;;
8044                 esac
8045                 ;;
8046         *)      dflt=$libperl
8047                 ;;
8048         esac
8049         cat << EOM
8050
8051 I need to select a good name for the shared libperl.  If your system uses
8052 library names with major and minor numbers, then you might want something
8053 like $majmin.  Alternatively, if your system uses a single version
8054 number for shared libraries, then you might want to use $majonly.
8055 Or, your system might be quite happy with a simple libperl.$so.
8056
8057 Since the shared libperl will get installed into a version-specific
8058 architecture-dependent directory, the version number of the shared perl
8059 library probably isn't important, so the default should be o.k.
8060
8061 EOM
8062         rp='What name do you want to give to the shared libperl?'
8063         . ./myread
8064         libperl=$ans
8065         echo "Ok, I'll use $libperl"
8066         ;;
8067 *)
8068         libperl="libperl${_a}"
8069         ;;
8070 esac
8071
8072 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8073 case "$shrpdir" in
8074 '') ;;
8075 *)      $cat >&4 <<EOM
8076 WARNING:  Use of the shrpdir variable for the installation location of
8077 the shared $libperl is not supported.  It was never documented and
8078 will not work in this version.  Let me (perlbug@perl.org)
8079 know of any problems this may cause.
8080
8081 EOM
8082         case "$shrpdir" in
8083         "$archlibexp/CORE")
8084                 $cat >&4 <<EOM
8085 But your current setting of $shrpdir is
8086 the default anyway, so it's harmless.
8087 EOM
8088                 ;;
8089         *)
8090                 $cat >&4 <<EOM
8091 Further, your current attempted setting of $shrpdir
8092 conflicts with the value of $archlibexp/CORE
8093 that installperl will use.
8094 EOM
8095                 ;;
8096         esac
8097         ;;
8098 esac
8099
8100 # How will the perl executable find the installed shared $libperl?
8101 # Add $xxx to ccdlflags.
8102 # If we can't figure out a command-line option, use $shrpenv to
8103 # set env LD_RUN_PATH.  The main perl makefile uses this.
8104 shrpdir=$archlibexp/CORE
8105 xxx=''
8106 tmp_shrpenv=''
8107 if "$useshrplib"; then
8108     case "$osname" in 
8109         aix)
8110                 # We'll set it in Makefile.SH...
8111                 ;;
8112         solaris)
8113                 xxx="-R $shrpdir"
8114                 ;;
8115         freebsd|netbsd|openbsd|interix|dragonfly)
8116                 xxx="-Wl,-R$shrpdir"
8117                 ;;
8118         bsdos|linux|irix*|dec_osf|gnu*)
8119                 xxx="-Wl,-rpath,$shrpdir"
8120                 ;;
8121         next)
8122                 # next doesn't like the default...
8123                 ;;
8124         beos)
8125                 # beos doesn't like the default, either.
8126                 ;;
8127         hpux*)
8128                 # hpux doesn't like the default, either.
8129                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8130                 ;;
8131         *)
8132                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8133                 ;;
8134         esac
8135         case "$xxx" in
8136         '') ;;
8137         *)      
8138                 # Only add $xxx if it isn't already in ccdlflags.
8139                 case " $ccdlflags " in
8140                 *" $xxx "*)     ;;
8141                 *)      ccdlflags="$ccdlflags $xxx"
8142                         cat <<EOM >&4
8143
8144 Adding $xxx to the flags
8145 passed to $ld so that the perl executable will find the 
8146 installed shared $libperl.
8147
8148 EOM
8149                         ;;
8150                 esac
8151                 ;;
8152         esac
8153 fi
8154 # Fix ccdlflags in AIX for building external extensions.
8155 # (For building Perl itself bare -bE:perl.exp is needed,
8156 #  Makefile.SH takes care of this.)
8157 case "$osname" in
8158 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8159 esac
8160 # Respect a hint or command-line value.
8161 case "$shrpenv" in
8162 '') shrpenv="$tmp_shrpenv" ;;
8163 esac
8164 case "$ldlibpthname" in
8165 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8166 none)   ldlibpthname='' ;;
8167 esac
8168
8169 : determine where manual pages are on this system
8170 echo " "
8171 case "$sysman" in
8172 '') 
8173         syspath='/usr/share/man/man1 /usr/man/man1'
8174         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8175         syspath="$syspath /usr/man/u_man/man1"
8176         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8177         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8178         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8179         sysman=`./loc . /usr/man/man1 $syspath`
8180         ;;
8181 esac
8182 if $test -d "$sysman"; then
8183         echo "System manual is in $sysman." >&4
8184 else
8185         echo "Could not find manual pages in source form." >&4
8186 fi
8187
8188 : determine where manual pages go
8189 set man1dir man1dir none
8190 eval $prefixit
8191 $cat <<EOM
8192
8193 $spackage has manual pages available in source form.
8194 EOM
8195 case "$nroff" in
8196 nroff)
8197         echo "However, you don't have nroff, so they're probably useless to you."
8198         case "$man1dir" in
8199         '') man1dir="none";;
8200         esac;;
8201 esac
8202 echo "If you don't want the manual sources installed, answer 'none'."
8203 case "$man1dir" in
8204 ' ') dflt=none
8205         ;;
8206 '')
8207         lookpath="$prefixexp/share/man/man1"
8208         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8209         lookpath="$lookpath $prefixexp/man/p_man/man1"
8210         lookpath="$lookpath $prefixexp/man/u_man/man1"
8211         lookpath="$lookpath $prefixexp/man/man.1"
8212         case "$sysman" in
8213         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8214         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8215         esac
8216         set dflt
8217         eval $prefixup
8218         ;;
8219 *)  dflt="$man1dir"
8220         ;;
8221 esac
8222 echo " "
8223 fn=dn+~
8224 rp="Where do the main $spackage manual pages (source) go?"
8225 . ./getfile
8226 if $test "X$man1direxp" != "X$ansexp"; then
8227         installman1dir=''
8228 fi
8229 prefixvar=man1dir
8230 . ./setprefixvar
8231
8232 case "$man1dir" in
8233 '')     man1dir=' '
8234         installman1dir='';;
8235 esac
8236
8237 : What suffix to use on installed man pages
8238
8239 case "$man1dir" in
8240 ' ')
8241         man1ext='0'
8242         ;;
8243 *)
8244         rp="What suffix should be used for the main $spackage man pages?"
8245         case "$man1ext" in
8246         '')     case "$man1dir" in
8247                 *1)  dflt=1 ;;
8248                 *1p) dflt=1p ;;
8249                 *1pm) dflt=1pm ;;
8250                 *l) dflt=l;;
8251                 *n) dflt=n;;
8252                 *o) dflt=o;;
8253                 *p) dflt=p;;
8254                 *C) dflt=C;;
8255                 *L) dflt=L;;
8256                 *L1) dflt=L1;;
8257                 *) dflt=1;;
8258                 esac
8259                 ;;
8260         *)      dflt="$man1ext";;
8261         esac
8262         . ./myread
8263         man1ext="$ans"
8264         ;;
8265 esac
8266
8267 : see if we can have long filenames
8268 echo " "
8269 first=123456789abcdef
8270 $rm -f $first
8271 if (echo hi >$first) 2>/dev/null; then
8272         if $test -f 123456789abcde; then
8273                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8274                 val="$undef"
8275         else
8276                 echo 'You can have filenames longer than 14 characters.'>&4
8277                 val="$define"
8278         fi
8279 else
8280         $cat <<'EOM'
8281 You can't have filenames longer than 14 chars.
8282 You can't even think about them!
8283 EOM
8284         val="$undef"
8285 fi 
8286 set d_flexfnam
8287 eval $setvar
8288 $rm -rf 123456789abcde*
8289
8290 : determine where library module manual pages go
8291 set man3dir man3dir none
8292 eval $prefixit
8293 $cat <<EOM
8294
8295 $spackage has manual pages for many of the library modules.
8296 EOM
8297
8298 case "$nroff" in
8299 nroff)
8300         $cat <<'EOM'
8301 However, you don't have nroff, so they're probably useless to you.
8302 EOM
8303         case "$man3dir" in
8304         '') man3dir="none";;
8305         esac;;
8306 esac
8307
8308 case "$d_flexfnam" in
8309 undef)
8310         $cat <<'EOM'
8311 However, your system can't handle the long file names like File::Basename.3.
8312 EOM
8313         case "$man3dir" in
8314         '') man3dir="none";;
8315         esac;;
8316 esac
8317
8318 echo "If you don't want the manual sources installed, answer 'none'."
8319 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8320 case "$man3dir" in
8321 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8322         if $test -d "$privlib/man/man3"; then
8323                 cat <<EOM >&4
8324
8325 WARNING:  Previous versions of perl installed man3 pages into
8326 $privlib/man/man3.  This version will suggest a
8327 new default of $dflt.
8328 EOM
8329                 tdflt=$dflt
8330                 dflt='n'
8331                 rp='Do you wish to preserve the old behavior?(y/n)'
8332                 . ./myread
8333                 case "$ans" in
8334                 y*) dflt="$privlib/man/man3" ;;
8335                 *)  dflt=$tdflt ;;
8336                 esac
8337     fi
8338         ;;
8339 *)      dflt="$man3dir" ;;
8340 esac
8341 case "$dflt" in
8342 ' ') dflt=none ;;
8343 esac
8344 echo " "
8345 fn=dn+~
8346 rp="Where do the $package library man pages (source) go?"
8347 . ./getfile
8348 prefixvar=man3dir
8349 . ./setprefixvar
8350
8351 case "$man3dir" in
8352 '')     man3dir=' '
8353         installman3dir='';;
8354 esac
8355
8356 : What suffix to use on installed man pages
8357 case "$man3dir" in
8358 ' ')
8359         man3ext='0'
8360         ;;
8361 *)
8362         rp="What suffix should be used for the $package library man pages?"
8363         case "$man3ext" in
8364         '')     case "$man3dir" in
8365                 *3)  dflt=3 ;;
8366                 *3p) dflt=3p ;;
8367                 *3pm) dflt=3pm ;;
8368                 *l) dflt=l;;
8369                 *n) dflt=n;;
8370                 *o) dflt=o;;
8371                 *p) dflt=p;;
8372                 *C) dflt=C;;
8373                 *L) dflt=L;;
8374                 *L3) dflt=L3;;
8375                 *) dflt=3;;
8376                 esac
8377                 ;;
8378         *)      dflt="$man3ext";;
8379         esac
8380         . ./myread
8381         man3ext="$ans"
8382         ;;
8383 esac
8384
8385 : see if we have to deal with yellow pages, now NIS.
8386 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8387         if $test -f /usr/etc/nibindd; then
8388                 echo " "
8389                 echo "I'm fairly confident you're on a NeXT."
8390                 echo " "
8391                 rp='Do you get the hosts file via NetInfo?'
8392                 dflt=y
8393                 case "$hostcat" in
8394                 nidump*) ;;
8395                 '') ;;
8396                 *) dflt=n;;
8397                 esac
8398                 . ./myread
8399                 case "$ans" in
8400                 y*) hostcat='nidump hosts .';;
8401                 *)      case "$hostcat" in
8402                         nidump*) hostcat='';;
8403                         esac
8404                         ;;
8405                 esac
8406         fi
8407         case "$hostcat" in
8408         nidump*) ;;
8409         *)
8410                 case "$hostcat" in
8411                 *ypcat*) dflt=y;;
8412                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8413                                 dflt=y
8414                         else
8415                                 dflt=n
8416                         fi;;
8417                 *) dflt=n;;
8418                 esac
8419                 echo " "
8420                 rp='Are you getting the hosts file via yellow pages?'
8421                 . ./myread
8422                 case "$ans" in
8423                 y*) hostcat='ypcat hosts';;
8424                 *) hostcat='cat /etc/hosts';;
8425                 esac
8426                 ;;
8427         esac
8428 fi
8429 case "$hostcat" in
8430 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8431 esac
8432 case "$groupcat" in
8433 '') test -f /etc/group && groupcat='cat /etc/group';;
8434 esac
8435 case "$passcat" in
8436 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8437 esac
8438
8439 : now get the host name
8440 echo " "
8441 echo "Figuring out host name..." >&4
8442 case "$myhostname" in
8443 '') cont=true
8444         echo 'Maybe "hostname" will work...'
8445         if tans=`sh -c hostname 2>&1` ; then
8446                 myhostname=$tans
8447                 phostname=hostname
8448                 cont=''
8449         fi
8450         ;;
8451 *) cont='';;
8452 esac
8453 if $test "$cont"; then
8454         if ./xenix; then
8455                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8456                 if tans=`cat /etc/systemid 2>&1` ; then
8457                         myhostname=$tans
8458                         phostname='cat /etc/systemid'
8459                         echo "Whadyaknow.  Xenix always was a bit strange..."
8460                         cont=''
8461                 fi
8462         elif $test -r /etc/systemid; then
8463                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8464         fi
8465 fi
8466 if $test "$cont"; then
8467         echo 'No, maybe "uuname -l" will work...'
8468         if tans=`sh -c 'uuname -l' 2>&1` ; then
8469                 myhostname=$tans
8470                 phostname='uuname -l'
8471         else
8472                 echo 'Strange.  Maybe "uname -n" will work...'
8473                 if tans=`sh -c 'uname -n' 2>&1` ; then
8474                         myhostname=$tans
8475                         phostname='uname -n'
8476                 else
8477                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8478                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8479                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8480                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8481                         else
8482                                 case "$myhostname" in
8483                                 '') echo "Does this machine have an identity crisis or something?"
8484                                         phostname='';;
8485                                 *)
8486                                         echo "Well, you said $myhostname before..."
8487                                         phostname='echo $myhostname';;
8488                                 esac
8489                         fi
8490                 fi
8491         fi
8492 fi
8493 case "$myhostname" in
8494 '') myhostname=noname ;;
8495 esac
8496 : you do not want to know about this
8497 set $myhostname
8498 myhostname=$1
8499
8500 : verify guess
8501 if $test "$myhostname" ; then
8502         dflt=y
8503         rp='Your host name appears to be "'$myhostname'".'" Right?"
8504         . ./myread
8505         case "$ans" in
8506         y*) ;;
8507         *) myhostname='';;
8508         esac
8509 fi
8510
8511 : bad guess or no guess
8512 while $test "X$myhostname" = X ; do
8513         dflt=''
8514         rp="Please type the (one word) name of your host:"
8515         . ./myread
8516         myhostname="$ans"
8517 done
8518
8519 : translate upper to lower if necessary
8520 case "$myhostname" in
8521 *[A-Z]*)
8522         echo "(Normalizing case in your host name)"
8523         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8524         ;;
8525 esac
8526
8527 case "$myhostname" in
8528 *.*)
8529         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8530         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8531         echo "(Trimming domain name from host name--host name is now $myhostname)"
8532         ;;
8533 *) case "$mydomain" in
8534         '')
8535                 {
8536                         test "X$hostcat" = "Xypcat hosts" &&
8537                         ypmatch "$myhostname" hosts 2>/dev/null |\
8538                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8539                         $test -s hosts
8540                 } || {
8541                         test "X$hostcat" != "X" &&
8542                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8543                                         /[       ]$myhostname[  . ]/p" > hosts
8544                 }
8545                 tmp_re="[       . ]"
8546                 if $test -f hosts; then
8547                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8548                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8549                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8550                                 hosts | $sort | $uniq | \
8551                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8552                         case `$echo X$dflt` in
8553                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8554                                 dflt=.
8555                                 ;;
8556                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8557                                 ;;
8558                         esac
8559                 else
8560                         echo "(I cannot locate a hosts database anywhere)"
8561                         dflt=.
8562                 fi
8563                 case "$dflt" in
8564                 .)
8565                         tans=`./loc resolv.conf X /etc /usr/etc`
8566                         if $test -f "$tans"; then
8567                                 echo "(Attempting domain name extraction from $tans)"
8568                                 dflt=.`$sed -n -e 's/   / /g' \
8569                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8570                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8571                                 case "$dflt" in
8572                                 .) dflt=.`$sed -n -e 's/        / /g' \
8573                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8574                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8575                                         ;;
8576                                 esac
8577                         fi
8578                         ;;
8579                 esac
8580                 case "$dflt" in
8581                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8582                         dflt=.`sh -c domainname 2>/dev/null`
8583                         case "$dflt" in
8584                         '') dflt='.';;
8585                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8586                         esac
8587                         ;;
8588                 esac
8589                 case "$dflt$osname" in
8590                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8591                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8592                         ;;
8593                 esac
8594                 case "$dflt" in
8595                 .) echo "(Lost all hope -- silly guess then)"
8596                         dflt='.nonet'
8597                         ;;
8598                 esac
8599                 $rm -f hosts
8600                 ;;
8601         *) dflt="$mydomain";;
8602         esac;;
8603 esac
8604 echo " "
8605 rp="What is your domain name?"
8606 . ./myread
8607 tans="$ans"
8608 case "$ans" in
8609 '') ;;
8610 .*) ;;
8611 *) tans=".$tans";;
8612 esac
8613 mydomain="$tans"
8614
8615 : translate upper to lower if necessary
8616 case "$mydomain" in
8617 *[A-Z]*)
8618         echo "(Normalizing case in your domain name)"
8619         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8620         ;;
8621 esac
8622
8623 : a little sanity check here
8624 case "$phostname" in
8625 '') ;;
8626 *)
8627         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8628         $myhostname$mydomain|$myhostname) ;;
8629         *)
8630                 case "$phostname" in
8631                 sed*)
8632                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8633                         ;;
8634                 *)
8635                         echo "(That doesn't agree with your $phostname command, by the way.)"
8636                         ;;
8637                 esac
8638         ;;
8639         esac
8640         ;;
8641 esac
8642
8643 $cat <<EOM
8644
8645 I need to get your e-mail address in Internet format if possible, i.e.
8646 something like user@host.domain. Please answer accurately since I have
8647 no easy means to double check it. The default value provided below
8648 is most probably close to reality but may not be valid from outside
8649 your organization...
8650
8651 EOM
8652 cont=x
8653 while test "$cont"; do
8654         case "$cf_email" in
8655         '') dflt="$cf_by@$myhostname$mydomain";;
8656         *) dflt="$cf_email";;
8657         esac
8658         rp='What is your e-mail address?'
8659         . ./myread
8660         cf_email="$ans"
8661         case "$cf_email" in
8662         *@*.*) cont='' ;;
8663         *)
8664                 rp='Address does not look like an Internet one.  Use it anyway?'
8665                 case "$fastread" in
8666                 yes) dflt=y ;;
8667                 *) dflt=n ;;
8668                 esac
8669                 . ./myread
8670                 case "$ans" in
8671                 y*) cont='' ;;
8672                 *) echo " " ;;
8673                 esac
8674                 ;;
8675         esac
8676 done
8677
8678 $cat <<EOM
8679
8680 If you or somebody else will be maintaining perl at your site, please
8681 fill in the correct e-mail address here so that they may be contacted
8682 if necessary. Currently, the "perlbug" program included with perl
8683 will send mail to this address in addition to perlbug@perl.org. You may
8684 enter "none" for no administrator.
8685
8686 EOM
8687 case "$perladmin" in
8688 '') dflt="$cf_email";;
8689 *) dflt="$perladmin";;
8690 esac
8691 rp='Perl administrator e-mail address'
8692 . ./myread
8693 perladmin="$ans"
8694
8695 : determine whether to only install version-specific parts.
8696 echo " "
8697 $cat <<EOM
8698 Do you want to install only the version-specific parts of the perl
8699 distribution?  Usually you do *not* want to do this.
8700 EOM
8701 case "$versiononly" in
8702 "$define"|[Yy]*|true) dflt='y' ;;
8703 *) dflt='n';
8704 esac
8705 rp="Do you want to install only the version-specific parts of perl?"
8706 . ./myread
8707 case "$ans" in
8708 [yY]*)  val="$define";;
8709 *)      val="$undef" ;;
8710 esac
8711 set versiononly
8712 eval $setvar
8713
8714 case "$versiononly" in
8715 "$define") inc_version_list=''
8716            inc_version_list_init=0
8717            ;;
8718 esac
8719
8720 : figure out how to guarantee perl startup
8721 : XXX Note that this currently takes advantage of the bug that binexp ignores
8722 :     the Configure -Dinstallprefix setting, which in turn means that under
8723 :     relocatable @INC, initialinstalllocation is what binexp started as.
8724 case "$startperl" in
8725 '')
8726         case "$sharpbang" in
8727         *!)
8728                 $cat <<EOH
8729
8730 I can use the #! construct to start perl on your system. This will
8731 make startup of perl scripts faster, but may cause problems if you
8732 want to share those scripts and perl is not in a standard place
8733 ($initialinstalllocation/perl) on all your platforms. The alternative
8734 is to force a shell by starting the script with a single ':' character.
8735
8736 EOH
8737                 case "$versiononly" in
8738                 "$define")      dflt="$initialinstalllocation/perl$version";;
8739                 *)              dflt="$initialinstalllocation/perl";;
8740                 esac
8741                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8742                 . ./myread
8743                 case "$ans" in
8744                 none)   startperl=": # use perl";;
8745                 *)      startperl="#!$ans"
8746                         if $test 30 -lt `echo "$ans" | wc -c`; then
8747                                 $cat >&4 <<EOM
8748
8749 WARNING:  Some systems limit the #! command to 32 characters.
8750 If you experience difficulty running Perl scripts with #!, try
8751 installing Perl in a directory with a shorter pathname.
8752
8753 EOM
8754                         fi ;;
8755                 esac
8756                 ;;
8757         *) startperl=": # use perl"
8758                 ;;
8759         esac
8760         ;;
8761 esac
8762 echo "I'll use $startperl to start perl scripts."
8763
8764 : figure best path for perl in scripts
8765 case "$perlpath" in
8766 '')
8767         case "$versiononly" in
8768         "$define")      perlpath="$initialinstalllocation/perl$version";;
8769         *)              perlpath="$initialinstalllocation/perl";;
8770         esac
8771         case "$startperl" in
8772         *!*) ;;
8773         *)
8774                 $cat <<EOH
8775
8776 I will use the "eval 'exec'" idiom to start Perl on your system.
8777 I can use the full path of your Perl binary for this purpose, but
8778 doing so may cause problems if you want to share those scripts and
8779 Perl is not always in a standard place ($initialinstalllocation/perl).
8780
8781 EOH
8782                 dflt="$initialinstalllocation/perl"
8783                 rp="What path shall I use in \"eval 'exec'\"?"
8784                 . ./myread
8785                 perlpath="$ans"
8786                 ;;
8787         esac
8788         ;;
8789 esac
8790 case "$startperl" in
8791 *!*)    ;;
8792 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8793 esac
8794
8795 : determine where public executable scripts go
8796 set scriptdir scriptdir
8797 eval $prefixit
8798 case "$scriptdir" in
8799 '')
8800         dflt="$bin"
8801         : guess some guesses
8802         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8803         $test -d /usr/share/bin     && dflt=/usr/share/bin
8804         $test -d /usr/local/script  && dflt=/usr/local/script
8805         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8806         $test -d $prefixexp/script  && dflt=$prefixexp/script
8807         set dflt
8808         eval $prefixup
8809         ;;
8810 *)  dflt="$scriptdir"
8811         ;;
8812 esac
8813 $cat <<EOM
8814
8815 Some installations have a separate directory just for executable scripts so
8816 that they can mount it across multiple architectures but keep the scripts in
8817 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8818 Or you might just lump your scripts in with all your other executables.
8819
8820 EOM
8821 fn=d~
8822 rp='Where do you keep publicly executable scripts?'
8823 . ./getfile
8824 if $test "X$ansexp" != "X$scriptdirexp"; then
8825         installscript=''
8826 fi
8827 installscriptdir=''
8828 prefixvar=scriptdir
8829 . ./setprefixvar
8830 : A little fix up for an irregularly named variable.
8831 installscript="$installscriptdir"
8832
8833 : determine where add-on public executables go
8834 case "$sitebin" in
8835 '')     dflt=$siteprefix/bin ;;
8836 *)      dflt=$sitebin ;;
8837 esac
8838 fn=d~
8839 rp='Pathname where the add-on public executables should be installed?'
8840 . ./getfile
8841 prefixvar=sitebin
8842 . ./setprefixvar
8843
8844 : determine where add-on html pages go
8845 : There is no standard location, so try to copy the previously-selected
8846 : directory structure for the core html pages.
8847 case "$sitehtml1dir" in
8848 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8849 *)     dflt=$sitehtml1dir ;;
8850 esac
8851 case "$dflt" in
8852 ''|' ') dflt=none ;;
8853 esac
8854 fn=dn+~
8855 rp='Pathname where the site-specific html pages should be installed?'
8856 . ./getfile
8857 prefixvar=sitehtml1dir
8858 . ./setprefixvar
8859
8860 : determine where add-on library html pages go
8861 : There is no standard location, so try to copy the previously-selected
8862 : directory structure for the core html pages.
8863 case "$sitehtml3dir" in
8864 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8865 *)     dflt=$sitehtml3dir ;;
8866 esac
8867 case "$dflt" in
8868 ''|' ') dflt=none ;;
8869 esac
8870 fn=dn+~
8871 rp='Pathname where the site-specific library html pages should be installed?'
8872 . ./getfile
8873 prefixvar=sitehtml3dir
8874 . ./setprefixvar
8875
8876 : determine where add-on manual pages go
8877 case "$siteman1dir" in
8878 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8879 *)      dflt=$siteman1dir ;;
8880 esac
8881 case "$dflt" in
8882 ''|' ') dflt=none ;;
8883 esac
8884 fn=dn+~
8885 rp='Pathname where the site-specific manual pages should be installed?'
8886 . ./getfile
8887 prefixvar=siteman1dir
8888 . ./setprefixvar
8889
8890 : determine where add-on library man pages go
8891 case "$siteman3dir" in
8892 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8893 *)      dflt=$siteman3dir ;;
8894 esac
8895 case "$dflt" in
8896 ''|' ') dflt=none ;;
8897 esac
8898 fn=dn+~
8899 rp='Pathname where the site-specific library manual pages should be installed?'
8900 . ./getfile
8901 prefixvar=siteman3dir
8902 . ./setprefixvar
8903
8904 : determine where add-on public executable scripts go
8905 case "$sitescript" in
8906 '')     dflt=$siteprefix/script
8907         $test -d $dflt || dflt=$sitebin ;;
8908 *)  dflt="$sitescript" ;;
8909 esac
8910 fn=d~+
8911 rp='Pathname where add-on public executable scripts should be installed?'
8912 . ./getfile
8913 prefixvar=sitescript
8914 . ./setprefixvar
8915
8916 case "$usefaststdio" in
8917 $define|true|[yY]*|'')
8918         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8919         case "$xversion" in
8920         [68])   dflt='y' ;;
8921         *)      dflt='n' ;;
8922         esac
8923         ;;
8924 *) dflt='n';;
8925 esac
8926 cat <<EOM
8927
8928 Perl can be built to use 'fast stdio', which means using the stdio
8929 library but also directly manipulating the stdio buffers to enable
8930 faster I/O.  Using stdio is better for backward compatibility (especially
8931 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8932 interface has been preferred instead of stdio.
8933
8934 If this doesn't make any sense to you, just accept the default '$dflt'.
8935 EOM
8936 rp='Use the "fast stdio" if available?'
8937 . ./myread
8938 case "$ans" in
8939 y|Y)    val="$define" ;;     
8940 *)      val="$undef" ;;
8941 esac
8942 set usefaststdio
8943 eval $setvar
8944
8945
8946 : define an is-a-typedef? function
8947 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8948 case "$inclist" in
8949 "") inclist="sys/types.h";;
8950 esac;
8951 eval "varval=\$$var";
8952 case "$varval" in
8953 "")
8954         $rm -f temp.c;
8955         for inc in $inclist; do
8956                 echo "#include <$inc>" >>temp.c;
8957         done;
8958         echo "#ifdef $type" >> temp.c;
8959         echo "printf(\"We have $type\");" >> temp.c;
8960         echo "#endif" >> temp.c;
8961         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8962         if $contains $type temp.E >/dev/null 2>&1; then
8963                 eval "$var=\$type";
8964         else
8965                 eval "$var=\$def";
8966         fi;
8967         $rm -f temp.?;;
8968 *) eval "$var=\$varval";;
8969 esac'
8970
8971 : define an is-a-typedef? function that prompts if the type is not available.
8972 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8973 case "$inclist" in
8974 "") inclist="sys/types.h";;
8975 esac;
8976 eval "varval=\$$var";
8977 case "$varval" in
8978 "")
8979         $rm -f temp.c;
8980         for inc in $inclist; do
8981                 echo "#include <$inc>" >>temp.c;
8982         done;
8983         echo "#ifdef $type" >> temp.c;
8984         echo "printf(\"We have $type\");" >> temp.c;
8985         echo "#endif" >> temp.c;
8986         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8987         echo " " ;
8988         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8989         if $contains $type temp.E >/dev/null 2>&1; then
8990                 echo "$type found." >&4;
8991                 eval "$var=\$type";
8992         else
8993                 echo "$type NOT found." >&4;
8994                 dflt="$def";
8995                 . ./myread ;
8996                 eval "$var=\$ans";
8997         fi;
8998         $rm -f temp.?;;
8999 *) eval "$var=\$varval";;
9000 esac'
9001
9002 : see what type lseek is declared as in the kernel
9003 rp="What is the type used for lseek's offset on this system?"
9004 set off_t lseektype long stdio.h sys/types.h
9005 eval $typedef_ask
9006
9007 echo " "
9008 echo "Checking to see how big your file offsets are..." >&4
9009 $cat >try.c <<EOCP
9010 #include <sys/types.h>
9011 #include <stdio.h>
9012 int main()
9013 {
9014     printf("%d\n", (int)sizeof($lseektype));
9015     return(0);
9016 }
9017 EOCP
9018 set try
9019 if eval $compile_ok; then
9020         lseeksize=`$run ./try`
9021         echo "Your file offsets are $lseeksize bytes long."
9022 else
9023         dflt=$longsize
9024         echo " "
9025         echo "(I can't seem to compile the test program.  Guessing...)"
9026         rp="What is the size of your file offsets (in bytes)?"
9027         . ./myread
9028         lseeksize="$ans"
9029 fi
9030 $rm_try
9031
9032 : see what type file positions are declared as in the library
9033 rp="What is the type for file position used by fsetpos()?"
9034 set fpos_t fpostype long stdio.h sys/types.h
9035 eval $typedef_ask
9036
9037 echo " "
9038 case "$fpostype" in
9039 *_t) zzz="$fpostype"    ;;
9040 *)   zzz="fpos_t"       ;;
9041 esac
9042 echo "Checking the size of $zzz..." >&4 
9043 cat > try.c <<EOCP
9044 #include <sys/types.h>
9045 #include <stdio.h>
9046 #$i_stdlib I_STDLIB
9047 #ifdef I_STDLIB
9048 #include <stdlib.h>
9049 #endif
9050 int main() {
9051     printf("%d\n", (int)sizeof($fpostype));
9052     exit(0);
9053 }
9054 EOCP
9055 set try
9056 if eval $compile_ok; then
9057         yyy=`$run ./try`
9058         case "$yyy" in
9059         '')     fpossize=4
9060                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9061                 ;;
9062         *)      fpossize=$yyy
9063                 echo "Your $zzz is $fpossize bytes long."
9064                 ;;
9065         esac
9066 else
9067         dflt="$longsize"
9068         echo " " >&4
9069         echo "(I can't compile the test program.  Guessing...)" >&4
9070         rp="What is the size of your file positions (in bytes)?"
9071         . ./myread
9072         fpossize="$ans"
9073 fi
9074
9075 # Backward compatibility (uselfs is deprecated).
9076 case "$uselfs" in
9077 "$define"|true|[yY]*)
9078         cat <<EOM >&4
9079
9080 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9081 EOM
9082         uselargefiles="$define"
9083         ;;
9084 esac
9085
9086 case "$lseeksize:$fpossize" in
9087 8:8) cat <<EOM
9088
9089 You can have files larger than 2 gigabytes.
9090 EOM
9091    val="$define" ;;
9092 *)    case "$uselargefiles" in
9093    "$undef"|false|[nN]*) dflt='n' ;;
9094    *)   dflt='y' ;;
9095    esac
9096    cat <<EOM
9097
9098 Perl can be built to understand large files (files larger than 2 gigabytes)
9099 on some systems.  To do so, Configure can be run with -Duselargefiles.
9100
9101 If this doesn't make any sense to you, just accept the default '$dflt'.
9102 EOM
9103    rp='Try to understand large files, if available?'
9104    . ./myread
9105    case "$ans" in
9106    y|Y)         val="$define" ;;
9107    *)           val="$undef"  ;;
9108    esac
9109    ;;
9110 esac
9111 set uselargefiles
9112 eval $setvar
9113 : Look for a hint-file generated 'call-back-unit'.  If the
9114 : user has specified that a large files perl is to be built,
9115 : we may need to set or change some other defaults.
9116 if $test -f uselargefiles.cbu; then
9117         echo "Your platform has some specific hints regarding large file builds, using them..."
9118         . ./uselargefiles.cbu
9119 fi
9120 case "$uselargefiles" in
9121 "$define")
9122         if $test -f uselargefiles.cbu; then
9123                 echo " "
9124                 echo "Rechecking to see how big your file offsets are..." >&4
9125                 $cat >try.c <<EOCP
9126 #include <sys/types.h>
9127 #include <stdio.h>
9128 int main()
9129 {
9130     printf("%d\n", (int)sizeof($lseektype));
9131     return(0);
9132 }
9133 EOCP
9134                 set try
9135                 if eval $compile_ok; then
9136                         lseeksize=`$run ./try`
9137                         $echo "Your file offsets are now $lseeksize bytes long."
9138                 else
9139                         dflt="$lseeksize"
9140                         echo " "
9141                         echo "(I can't seem to compile the test program.  Guessing...)"
9142                         rp="What is the size of your file offsets (in bytes)?"
9143                         . ./myread
9144                         lseeksize="$ans"
9145                 fi
9146                 case "$fpostype" in
9147                 *_t) zzz="$fpostype"    ;;
9148                 *)   zzz="fpos_t"       ;;
9149                 esac
9150                 $echo $n "Rechecking the size of $zzz...$c" >&4
9151                 $cat > try.c <<EOCP
9152 #include <sys/types.h>
9153 #include <stdio.h>
9154 #$i_stdlib I_STDLIB
9155 #ifdef I_STDLIB
9156 #include <stdlib.h>
9157 #endif
9158 int main() {
9159     printf("%d\n", (int)sizeof($fpostype));
9160     return(0);
9161 }
9162 EOCP
9163                 set try
9164                 if eval $compile_ok; then
9165                         yyy=`$run ./try`
9166                         dflt="$lseeksize"
9167                         case "$yyy" in
9168                         '')     echo " "
9169                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9170                                 ;;
9171                         *)      fpossize=$yyy
9172                                 echo " $fpossize bytes." >&4
9173                                 ;;
9174                         esac
9175                 else
9176                         dflt="$fpossize"
9177                         echo " "
9178                         echo "(I can't compile the test program.  Guessing...)" >&4
9179                         rp="What is the size of your file positions (in bytes)?"
9180                         . ./myread
9181                         fpossize="$ans"
9182                 fi
9183                 $rm_try
9184         fi
9185         ;;
9186 esac
9187
9188 case "$vendorprefix" in
9189 '')     d_vendorbin="$undef"
9190         vendorbin=''
9191         vendorbinexp=''
9192         ;;
9193 *)      d_vendorbin="$define"
9194         : determine where vendor-supplied executables go.
9195         case "$vendorbin" in
9196         '') dflt=$vendorprefix/bin ;;
9197         *)      dflt="$vendorbin" ;;
9198         esac
9199         fn=d~+
9200         rp='Pathname for the vendor-supplied executables directory?'
9201         . ./getfile
9202         vendorbin="$ans"
9203         vendorbinexp="$ansexp"
9204         ;;
9205 esac
9206 prefixvar=vendorbin
9207 . ./installprefix
9208
9209 case "$vendorprefix" in
9210 '')     vendorhtml1dir=''
9211         vendorhtml1direxp=''
9212         ;;
9213 *)      : determine where vendor-supplied html pages go.
9214         : There is no standard location, so try to copy the previously-selected
9215         : directory structure for the core html pages.
9216         : XXX Better default suggestions would be welcome.
9217         case "$vendorhtml1dir" in
9218         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9219         *)      dflt=$vendorhtml1dir ;;
9220         esac
9221         case "$dflt" in
9222         ''|' ') dflt=none ;;
9223         esac
9224         fn=dn+~
9225         rp='Pathname for the vendor-supplied html pages?'
9226         . ./getfile
9227         vendorhtml1dir="$ans"
9228         vendorhtml1direxp="$ansexp"
9229         ;;
9230 esac
9231 : Use ' ' for none so value is preserved next time through Configure
9232 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9233 prefixvar=vendorhtml1dir
9234 . ./installprefix
9235
9236 case "$vendorprefix" in
9237 '')     vendorhtml3dir=''
9238         vendorhtml3direxp=''
9239         ;;
9240 *)      : determine where vendor-supplied module html pages go.
9241         : There is no standard location, so try to copy the previously-selected
9242         : directory structure for the core html pages.
9243         : XXX Better default suggestions would be welcome.
9244         case "$vendorhtml3dir" in
9245         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9246         *)      dflt=$vendorhtml3dir ;;
9247         esac
9248         case "$dflt" in
9249         ''|' ') dflt=none ;;
9250         esac
9251         fn=dn+~
9252         rp='Pathname for the vendor-supplied html pages?'
9253         . ./getfile
9254         vendorhtml3dir="$ans"
9255         vendorhtml3direxp="$ansexp"
9256         ;;
9257 esac
9258 : Use ' ' for none so value is preserved next time through Configure
9259 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9260 prefixvar=vendorhtml3dir
9261 . ./installprefix
9262
9263 case "$vendorprefix" in
9264 '')     vendorman1dir=''
9265         vendorman1direxp=''
9266         ;;
9267 *)      : determine where vendor-supplied manual pages go.
9268         case "$vendorman1dir" in
9269         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9270         *)      dflt=$vendorman1dir ;;
9271         esac
9272         case "$dflt" in
9273         ''|' ') dflt=none ;;
9274         esac
9275         fn=nd~+
9276         rp='Pathname for the vendor-supplied manual section 1 pages?'
9277         . ./getfile
9278         vendorman1dir="$ans"
9279         vendorman1direxp="$ansexp"
9280         ;;
9281 esac
9282 : Use ' ' for none so value is preserved next time through Configure
9283 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9284 prefixvar=vendorman1dir
9285 . ./installprefix
9286
9287 case "$vendorprefix" in
9288 '')     vendorman3dir=''
9289         vendorman3direxp=''
9290         ;;
9291 *)      : determine where vendor-supplied module manual pages go.
9292         case "$vendorman3dir" in
9293         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9294         *)      dflt=$vendorman3dir ;;
9295         esac
9296         case "$dflt" in
9297         ''|' ') dflt=none ;;
9298         esac
9299         fn=nd~+
9300         rp='Pathname for the vendor-supplied manual section 3 pages?'
9301         . ./getfile
9302         vendorman3dir="$ans"
9303         vendorman3direxp="$ansexp"
9304         ;;
9305 esac
9306 : Use ' ' for none so value is preserved next time through Configure
9307 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9308 prefixvar=vendorman3dir
9309 . ./installprefix
9310
9311 case "$vendorprefix" in
9312 '')     d_vendorscript="$undef"
9313         vendorscript=''
9314         vendorscriptexp=''
9315         ;;
9316 *)      d_vendorscript="$define"
9317         : determine where vendor-supplied scripts go.
9318         case "$vendorscript" in
9319         '')     dflt=$vendorprefix/script
9320                 $test -d $dflt || dflt=$vendorbin ;;
9321         *)  dflt="$vendorscript" ;;
9322         esac
9323         $cat <<EOM
9324
9325 The installation process will create a directory for
9326 vendor-supplied scripts.
9327
9328 EOM
9329         fn=d~+
9330         rp='Pathname for the vendor-supplied scripts directory?'
9331         . ./getfile
9332         vendorscript="$ans"
9333         vendorscriptexp="$ansexp"
9334         ;;
9335 esac
9336 prefixvar=vendorscript
9337 . ./installprefix
9338
9339 : see if qgcvt exists
9340 set qgcvt d_qgcvt
9341 eval $inlibc
9342
9343 echo " "
9344
9345 if $test X"$d_longdbl" = X"$define"; then
9346
9347 echo "Checking how to print long doubles..." >&4
9348
9349 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9350         $cat >try.c <<'EOCP'
9351 #include <sys/types.h>
9352 #include <stdio.h>
9353 int main() {
9354   double d = 123.456;
9355   printf("%.3f\n", d);
9356 }
9357 EOCP
9358         set try
9359         if eval $compile; then
9360                 yyy=`$run ./try`
9361                 case "$yyy" in
9362                 123.456)
9363                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9364                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9365                         echo "We will use %f."
9366                         ;;
9367                 esac
9368         fi
9369 fi
9370
9371 if $test X"$sPRIfldbl" = X; then
9372         $cat >try.c <<'EOCP'
9373 #include <sys/types.h>
9374 #include <stdio.h>
9375 int main() {
9376   long double d = 123.456;
9377   printf("%.3Lf\n", d);
9378 }
9379 EOCP
9380         set try
9381         if eval $compile; then
9382                 yyy=`$run ./try`
9383                 case "$yyy" in
9384                 123.456)
9385                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9386                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9387                         echo "We will use %Lf."
9388                         ;;
9389                 esac
9390         fi
9391 fi
9392
9393 if $test X"$sPRIfldbl" = X; then
9394         $cat >try.c <<'EOCP'
9395 #include <sys/types.h>
9396 #include <stdio.h>
9397 int main() {
9398   long double d = 123.456;
9399   printf("%.3llf\n", d);
9400 }
9401 EOCP
9402         set try
9403         if eval $compile; then
9404                 yyy=`$run ./try`
9405                 case "$yyy" in
9406                 123.456)
9407                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9408                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9409                         echo "We will use %llf."
9410                         ;;
9411                 esac
9412         fi
9413 fi
9414
9415 if $test X"$sPRIfldbl" = X; then
9416         $cat >try.c <<'EOCP'
9417 #include <sys/types.h>
9418 #include <stdio.h>
9419 int main() {
9420   long double d = 123.456;
9421   printf("%.3lf\n", d);
9422 }
9423 EOCP
9424         set try
9425         if eval $compile; then
9426                 yyy=`$run ./try`
9427                 case "$yyy" in
9428                 123.456)
9429                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9430                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9431                         echo "We will use %lf."
9432                         ;;
9433                 esac
9434         fi
9435 fi
9436
9437 if $test X"$sPRIfldbl" = X; then
9438         echo "Cannot figure out how to print long doubles." >&4
9439 else
9440         sSCNfldbl=$sPRIfldbl    # expect consistency
9441 fi
9442
9443 $rm_try
9444
9445 fi # d_longdbl
9446
9447 case "$sPRIfldbl" in
9448 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9449         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9450         d_SCNfldbl="$undef";
9451         ;;
9452 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9453         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9454         d_SCNfldbl="$define";
9455         ;;
9456 esac
9457
9458 : Check how to convert floats to strings.
9459
9460 if test "X$d_Gconvert" = X; then
9461
9462 echo " "
9463 echo "Checking for an efficient way to convert floats to strings."
9464 echo " " > try.c
9465 case "$uselongdouble" in
9466 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9467 esac
9468 case "$d_longdbl" in
9469 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9470 esac
9471 case "$d_PRIgldbl" in
9472 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9473 esac
9474 $cat >>try.c <<EOP
9475 #ifdef TRY_gconvert
9476 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9477 char *myname = "gconvert";
9478 #endif
9479 #ifdef TRY_gcvt
9480 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9481 char *myname = "gcvt";
9482 #endif
9483 #ifdef TRY_qgcvt
9484 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9485 char *myname = "qgcvt";
9486 #define DOUBLETYPE long double
9487 #endif
9488 #ifdef TRY_sprintf
9489 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9490 #ifdef HAS_PRIgldbl
9491 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9492 #else
9493 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9494 #endif
9495 #else
9496 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9497 #endif
9498 char *myname = "sprintf";
9499 #endif
9500
9501 #ifndef DOUBLETYPE
9502 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9503 #define DOUBLETYPE long double
9504 #else
9505 #define DOUBLETYPE double
9506 #endif
9507 #endif
9508
9509 #include <stdio.h>
9510
9511 #define I_STDLIB $i_stdlib
9512 #ifdef I_STDLIB
9513 #include <stdlib.h>
9514 #endif
9515
9516 int
9517 checkit(expect, got)
9518 char *expect;
9519 char *got;
9520 {
9521     if (strcmp(expect, got)) {
9522                 printf("%s oddity:  Expected %s, got %s\n",
9523                         myname, expect, got);
9524                 exit(1);
9525         }
9526 }
9527
9528 int main()
9529 {
9530         char buf[64];
9531         buf[63] = '\0';
9532
9533         /* This must be 1st test on (which?) platform */
9534         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9535         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9536         checkit("0.1", buf);
9537
9538         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9539         checkit("0.01", buf);
9540
9541         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9542         checkit("0.001", buf);
9543
9544         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9545         checkit("0.0001", buf);
9546
9547         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9548         if (strlen(buf) > 5)
9549             checkit("9e-005", buf); /* for Microsoft ?? */
9550         else
9551             checkit("9e-05", buf);
9552
9553         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9554         checkit("1", buf);
9555
9556         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9557         checkit("1.1", buf);
9558
9559         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9560         checkit("1.01", buf);
9561
9562         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9563         checkit("1.001", buf);
9564
9565         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9566         checkit("1.0001", buf);
9567
9568         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9569         checkit("1.00001", buf);
9570
9571         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9572         checkit("1.000001", buf);
9573
9574         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9575         checkit("0", buf);
9576
9577         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9578         checkit("-1", buf);
9579
9580         /* Some Linux gcvt's give 1.e+5 here. */
9581         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9582         checkit("100000", buf);
9583
9584         /* Some Linux gcvt's give -1.e+5 here. */
9585         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9586         checkit("-100000", buf);
9587
9588         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9589         checkit("123.456", buf);
9590
9591         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9592         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9593         /* 34 should be enough to scare even long double
9594          * places into using the e notation. */
9595         if (strlen(buf) > 5)
9596             checkit("1e+034", buf); /* for Microsoft */
9597         else
9598             checkit("1e+34", buf);
9599
9600         /* For Perl, if you add additional tests here, also add them to
9601          * t/base/num.t for benefit of platforms not using Configure or
9602          * overriding d_Gconvert */
9603
9604         exit(0);
9605 }
9606 EOP
9607 : first add preferred functions to our list
9608 xxx_list=""
9609 for xxx_convert in $gconvert_preference; do
9610     case $xxx_convert in
9611     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9612     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9613     esac
9614 done
9615 : then add any others
9616 for xxx_convert in gconvert gcvt sprintf; do
9617     case "$xxx_list" in
9618     *$xxx_convert*) ;;
9619     *) xxx_list="$xxx_list $xxx_convert" ;;
9620     esac
9621 done
9622
9623 case "$d_longdbl$uselongdouble" in
9624 "$define$define")
9625     : again, add prefered functions to our list first
9626     xxx_ld_list=""
9627     for xxx_convert in $gconvert_ld_preference; do
9628         case $xxx_convert in
9629         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9630         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9631         esac
9632     done
9633     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9634     for xxx_convert in qgcvt sprintf $xxx_list; do
9635         case "$xxx_ld_list" in
9636         $xxx_convert*|*" $xxx_convert"*) ;;
9637         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9638         esac
9639     done
9640     : if sprintf cannot do long doubles, move it to the end
9641     if test "$d_PRIgldbl" != "$define"; then
9642         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9643     fi
9644     : if no qgcvt, remove it
9645     if test "$d_qgcvt" != "$define"; then
9646         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9647     fi
9648     : use the ld_list
9649     xxx_list="$xxx_ld_list"
9650     ;;
9651 esac
9652
9653 for xxx_convert in $xxx_list; do
9654         echo "Trying $xxx_convert..."
9655         $rm -f try try$_o core
9656         set try -DTRY_$xxx_convert
9657         if eval $compile; then
9658                 echo "$xxx_convert() found." >&4
9659                 if $run ./try; then
9660                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9661                         break;
9662                 else
9663                         echo "...But $xxx_convert didn't work as I expected."
9664                         xxx_convert=''
9665                 fi
9666         else
9667                 echo "$xxx_convert NOT found." >&4
9668         fi
9669 done
9670
9671 if test X$xxx_convert = X; then
9672     echo "*** WHOA THERE!!! ***" >&4
9673     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9674     xxx_convert=sprintf
9675 fi
9676
9677 case "$xxx_convert" in
9678 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9679 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9680 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9681 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9682    "$define$define$define")
9683       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9684    "$define$define$undef")
9685       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9686    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9687    esac
9688    ;;
9689 esac
9690
9691 fi
9692 $rm_try
9693
9694 : see if _fwalk exists
9695 set fwalk d__fwalk
9696 eval $inlibc
9697
9698 : Initialize h_fcntl
9699 h_fcntl=false
9700
9701 : Initialize h_sysfile
9702 h_sysfile=false
9703
9704 : access call always available on UNIX
9705 set access d_access
9706 eval $inlibc
9707
9708 : locate the flags for 'access()'
9709 case "$d_access" in
9710 "$define")
9711         echo " "
9712         $cat >access.c <<EOCP
9713 #include <sys/types.h>
9714 #ifdef I_FCNTL
9715 #include <fcntl.h>
9716 #endif
9717 #ifdef I_SYS_FILE
9718 #include <sys/file.h>
9719 #endif
9720 #ifdef I_UNISTD
9721 #include <unistd.h>
9722 #endif
9723 #$i_stdlib I_STDLIB
9724 #ifdef I_STDLIB
9725 #include <stdlib.h>
9726 #endif
9727 int main() {
9728         exit(R_OK);
9729 }
9730 EOCP
9731         : check sys/file.h first, no particular reason here
9732         if $test `./findhdr sys/file.h` && \
9733                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9734                 h_sysfile=true;
9735                 echo "<sys/file.h> defines the *_OK access constants." >&4
9736         elif $test `./findhdr fcntl.h` && \
9737                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9738                 h_fcntl=true;
9739                 echo "<fcntl.h> defines the *_OK access constants." >&4
9740         elif $test `./findhdr unistd.h` && \
9741                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9742                 echo "<unistd.h> defines the *_OK access constants." >&4
9743         else
9744                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9745         fi
9746         ;;
9747 esac
9748 $rm -f access*
9749
9750 : see if accessx exists
9751 set accessx d_accessx
9752 eval $inlibc
9753
9754 : see if aintl exists
9755 set aintl d_aintl
9756 eval $inlibc
9757
9758 : see if alarm exists
9759 set alarm d_alarm
9760 eval $inlibc
9761
9762 : see if POSIX threads are available
9763 set pthread.h i_pthread
9764 eval $inhdr
9765
9766 : define a fucntion to check prototypes
9767 $cat > protochk <<EOSH
9768 $startsh
9769 cc="$cc"
9770 optimize="$optimize"
9771 ccflags="$ccflags"
9772 prototype="$prototype"
9773 define="$define"
9774 rm_try="$rm_try"
9775 usethreads=$usethreads
9776 i_pthread=$i_pthread
9777 pthread_h_first=$pthread_h_first
9778 EOSH
9779
9780 $cat >> protochk <<'EOSH'
9781
9782 $rm_try
9783 foo="$1"
9784 shift
9785 while test $# -ge 2; do
9786         case "$1" in
9787                 $define) echo "#include <$2>" >> try.c ;;
9788                 literal) echo "$2" >> try.c ;;
9789         esac
9790     # Extra magic for the benefit of systems that need pthread.h
9791     # to be included early to correctly detect threadsafe functions.
9792     # Such functions must guarantee themselves, though, that the usethreads
9793     # and i_pthread have been defined, before calling protochk.
9794     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9795         echo "#include <pthread.h>" >> try.c
9796         pthread_h_done=yes
9797     fi
9798     shift 2
9799 done
9800 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9801 cat >> try.c <<'EOCP'
9802 #ifdef CAN_PROTOTYPE
9803 #define _(args) args
9804 #else
9805 #define _(args) ()
9806 #endif
9807 EOCP
9808 echo "$foo" >> try.c
9809 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9810 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9811 status=$?
9812 $rm_try
9813 exit $status
9814 EOSH
9815 chmod +x protochk
9816 $eunicefix protochk
9817
9818 hasproto='varname=$1; func=$2; shift; shift;
9819 while $test $# -ge 2; do
9820         case "$1" in
9821         $define) echo "#include <$2>";;
9822         esac ;
9823     shift 2;
9824 done > try.c;
9825 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9826 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9827         echo "$func() prototype found.";
9828         val="$define";
9829 else
9830         echo "$func() prototype NOT found.";
9831         val="$undef";
9832 fi;
9833 set $varname;
9834 eval $setvar;
9835 $rm_try tryout.c'
9836
9837 : see if sys/types.h has to be included
9838 set sys/types.h i_systypes
9839 eval $inhdr
9840
9841 : see if sys/select.h has to be included
9842 set sys/select.h i_sysselct
9843 eval $inhdr
9844
9845 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9846 while $test $# -ge 2; do
9847         case "$1" in
9848         $define) echo "#include <$2>";;
9849         esac ;
9850     shift 2;
9851 done > try.c;
9852 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9853 set try;
9854 if eval $compile; then
9855         val="$define";
9856 else
9857         val="$undef";
9858 fi;
9859 set $varname;
9860 eval $setvar;
9861 $rm_try'
9862
9863 : see if we should include time.h, sys/time.h, or both
9864 echo " "
9865 if test "X$timeincl" = X; then
9866         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9867         $echo $n "I'm now running the test program...$c"
9868         $cat >try.c <<EOCP
9869 #include <sys/types.h>
9870 #ifdef I_TIME
9871 #include <time.h>
9872 #endif
9873 #ifdef I_SYSTIME
9874 #ifdef SYSTIMEKERNEL
9875 #define KERNEL
9876 #endif
9877 #include <sys/time.h>
9878 #endif
9879 #ifdef I_SYSSELECT
9880 #include <sys/select.h>
9881 #endif
9882 #$i_stdlib I_STDLIB
9883 #ifdef I_STDLIB
9884 #include <stdlib.h>
9885 #endif
9886 int main()
9887 {
9888         struct tm foo;
9889 #ifdef S_TIMEVAL
9890         struct timeval bar;
9891 #endif
9892 #ifdef S_TIMEZONE
9893         struct timezone tzp;
9894 #endif
9895         if (foo.tm_sec == foo.tm_sec)
9896                 exit(0);
9897 #ifdef S_TIMEVAL
9898         if (bar.tv_sec == bar.tv_sec)
9899                 exit(0);
9900 #endif
9901         exit(1);
9902 }
9903 EOCP
9904         flags=''
9905         for s_timezone in '-DS_TIMEZONE' ''; do
9906         sysselect=''
9907         for s_timeval in '-DS_TIMEVAL' ''; do
9908         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9909         for i_time in '' '-DI_TIME'; do
9910         for i_systime in '-DI_SYSTIME' ''; do
9911                 case "$flags" in
9912                 '') $echo $n ".$c"
9913                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9914                         if eval $compile; then
9915                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9916                                 shift
9917                                 flags="$*"
9918                                 echo " "
9919                                 $echo $n "Succeeded with $flags$c"
9920                         fi
9921                         ;;
9922                 esac
9923         done
9924         done
9925         done
9926         done
9927         done
9928         timeincl=''
9929         echo " "
9930         case "$flags" in
9931         *SYSTIMEKERNEL*) i_systimek="$define"
9932                 timeincl=`./findhdr sys/time.h`
9933                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9934         *) i_systimek="$undef";;
9935         esac
9936         case "$flags" in
9937         *I_TIME*) i_time="$define"
9938                 timeincl=`./findhdr time.h`" $timeincl"
9939                 echo "We'll include <time.h>." >&4;;
9940         *) i_time="$undef";;
9941         esac
9942         case "$flags" in
9943         *I_SYSTIME*) i_systime="$define"
9944                 timeincl=`./findhdr sys/time.h`" $timeincl"
9945                 echo "We'll include <sys/time.h>." >&4;;
9946         *) i_systime="$undef";;
9947         esac
9948         $rm_try
9949 fi
9950 : see if struct tm knows about tm_zone
9951 case "$i_systime$i_time" in
9952 *$define*)
9953         echo " "
9954         echo "Checking to see if your struct tm has tm_zone field..." >&4
9955         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9956         eval $hasfield
9957         ;;
9958 *)      val="$undef"
9959         set d_tm_tm_zone
9960         eval $setvar
9961         ;;
9962 esac
9963 case "$d_tm_tm_zone" in
9964 "$define")      echo "Yes, it does."   ;;
9965 *)              echo "No, it doesn't." ;;
9966 esac
9967 : see if struct tm knows about tm_gmtoff
9968 case "$i_systime$i_time" in
9969 *$define*)
9970         echo " "
9971         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9972         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9973         eval $hasfield
9974         ;;
9975 *)      val="$undef"
9976         set d_tm_tm_gmtoff
9977         eval $setvar
9978         ;;
9979 esac
9980 case "$d_tm_tm_gmtoff" in
9981 "$define")      echo "Yes, it does."   ;;
9982 *)              echo "No, it doesn't." ;;
9983 esac
9984
9985 : see if asctime_r exists
9986 set asctime_r d_asctime_r
9987 eval $inlibc
9988 case "$d_asctime_r" in
9989 "$define")
9990         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9991         case "$d_asctime_r_proto:$usethreads" in
9992         ":define")      d_asctime_r_proto=define
9993                 set d_asctime_r_proto asctime_r $hdrs
9994                 eval $hasproto ;;
9995         *)      ;;
9996         esac
9997         case "$d_asctime_r_proto" in
9998         define)
9999         case "$asctime_r_proto" in
10000         ''|0) try='char* asctime_r(const struct tm*, char*);'
10001         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10002         esac
10003         case "$asctime_r_proto" in
10004         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10005         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10006         esac
10007         case "$asctime_r_proto" in
10008         ''|0) try='int asctime_r(const struct tm*, char*);'
10009         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10010         esac
10011         case "$asctime_r_proto" in
10012         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10013         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10014         esac
10015         case "$asctime_r_proto" in
10016         ''|0)   d_asctime_r=undef
10017                 asctime_r_proto=0
10018                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10019         * )     case "$asctime_r_proto" in
10020                 REENTRANT_PROTO*) ;;
10021                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10022                 esac
10023                 echo "Prototype: $try" ;;
10024         esac
10025         ;;
10026         *)      case "$usethreads" in
10027                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10028                 esac
10029                 d_asctime_r=undef
10030                 asctime_r_proto=0
10031                 ;;
10032         esac
10033         ;;
10034 *)      asctime_r_proto=0
10035         ;;
10036 esac
10037
10038 : see if atolf exists
10039 set atolf d_atolf
10040 eval $inlibc
10041
10042 : see if atoll exists
10043 set atoll d_atoll
10044 eval $inlibc
10045
10046 : Look for GCC-style attribute format
10047 case "$d_attribute_format" in
10048 '')
10049 echo " "
10050 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10051 $cat >attrib.c <<'EOCP'
10052 #include <stdio.h>
10053 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10054 EOCP
10055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10056         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10057                 echo "Your C compiler doesn't support __attribute__((format))."
10058                 val="$undef"
10059         else
10060                 echo "Your C compiler supports __attribute__((format))."
10061                 val="$define"
10062         fi
10063 else
10064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10065         val="$undef"
10066 fi
10067 ;;
10068 *) val="$d_attribute_format" ;;
10069 esac
10070 set d_attribute_format
10071 eval $setvar
10072 $rm -f attrib*
10073
10074 : Look for GCC-style attribute format with null format allowed
10075 case "$d_printf_format_null" in
10076 '') case "$d_attribute_format" in
10077     $define)
10078         echo " "
10079         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10080 $cat >attrib.c <<EOCP
10081 #include <stdio.h>
10082 #$i_stdlib I_STDLIB
10083 #ifdef I_STDLIB
10084 #include <stdlib.h>
10085 #endif
10086 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10087 int null_printf (char* pat,...) { return (int)pat; }
10088 int main () { exit(null_printf(NULL)); }
10089 EOCP
10090         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10091             : run the executable in case it produces a run-time warning
10092             if $run ./attrib >>attrib.out 2>&1; then
10093                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10094                     echo "Your C compiler doesn't allow __printf__ format to be null."
10095                     val="$undef"
10096                 else
10097                     echo "Your C compiler allows __printf__ format to be null."
10098                     val="$define"
10099                 fi
10100             else
10101             echo "Your C compiler executable failed with __printf__ format null."
10102             val="$undef"
10103         fi
10104     else
10105         echo "Your C compiler fails with __printf__ format null."
10106         val="$undef"
10107     fi
10108     ;;
10109     *)  val="$undef" ;;
10110     esac
10111 ;;
10112 *)  val="$d_printf_format_null" ;;
10113 esac
10114 set d_printf_format_null
10115 eval $setvar
10116 $rm -f attrib*
10117
10118 : Look for GCC-style attribute malloc
10119 case "$d_attribute_malloc" in
10120 '')
10121 echo " "
10122 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10123 $cat >attrib.c <<'EOCP'
10124 #include <stdio.h>
10125 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10126 EOCP
10127 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10128         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10129                 echo "Your C compiler doesn't support __attribute__((malloc))."
10130                 val="$undef"
10131         else
10132                 echo "Your C compiler supports __attribute__((malloc))."
10133                 val="$define"
10134         fi
10135 else
10136         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10137         val="$undef"
10138 fi
10139 ;;
10140 *) val="$d_attribute_malloc" ;;
10141 esac
10142 set d_attribute_malloc
10143 eval $setvar
10144 $rm -f attrib*
10145
10146 : Look for GCC-style attribute nonnull
10147 case "$d_attribute_nonnull" in
10148 '')
10149 echo " "
10150 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10151 $cat >attrib.c <<'EOCP'
10152 #include <stdio.h>
10153 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10154 EOCP
10155 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10156         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10157                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10158                 val="$undef"
10159         else
10160                 echo "Your C compiler supports __attribute__((nonnull))."
10161                 val="$define"
10162         fi
10163 else
10164         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10165         val="$undef"
10166 fi
10167 ;;
10168 *) val="$d_attribute_nonnull" ;;
10169 esac
10170 set d_attribute_nonnull
10171 eval $setvar
10172 $rm -f attrib*
10173
10174 : Look for GCC-style attribute noreturn
10175 case "$d_attribute_noreturn" in
10176 '')
10177 echo " "
10178 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10179 $cat >attrib.c <<'EOCP'
10180 #include <stdio.h>
10181 void fall_over_dead( void ) __attribute__((noreturn));
10182 EOCP
10183 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10184         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10185                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10186                 val="$undef"
10187         else
10188                 echo "Your C compiler supports __attribute__((noreturn))."
10189                 val="$define"
10190         fi
10191 else
10192         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10193         val="$undef"
10194 fi
10195 ;;
10196 *) val="$d_attribute_noreturn" ;;
10197 esac
10198 set d_attribute_noreturn
10199 eval $setvar
10200 $rm -f attrib*
10201
10202 : Look for GCC-style attribute pure
10203 case "$d_attribute_pure" in
10204 '')
10205 echo " "
10206 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10207 $cat >attrib.c <<'EOCP'
10208 #include <stdio.h>
10209 int square( int n ) __attribute__((pure));
10210 EOCP
10211 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10212         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10213                 echo "Your C compiler doesn't support __attribute__((pure))."
10214                 val="$undef"
10215         else
10216                 echo "Your C compiler supports __attribute__((pure))."
10217                 val="$define"
10218         fi
10219 else
10220         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10221         val="$undef"
10222 fi
10223 ;;
10224 *) val="$d_attribute_pure" ;;
10225 esac
10226 set d_attribute_pure
10227 eval $setvar
10228 $rm -f attrib*
10229
10230 : Look for GCC-style attribute unused
10231 case "$d_attribute_unused" in
10232 '')
10233 echo " "
10234 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10235 $cat >attrib.c <<'EOCP'
10236 #include <stdio.h>
10237 int do_something( int dummy __attribute__((unused)), int n );
10238 EOCP
10239 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10240         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10241                 echo "Your C compiler doesn't support __attribute__((unused))."
10242                 val="$undef"
10243         else
10244                 echo "Your C compiler supports __attribute__((unused))."
10245                 val="$define"
10246         fi
10247 else
10248         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10249         val="$undef"
10250 fi
10251 ;;
10252 *) val="$d_attribute_unused" ;;
10253 esac
10254 set d_attribute_unused
10255 eval $setvar
10256 $rm -f attrib*
10257
10258 : Look for GCC-style attribute warn_unused_result
10259 case "$d_attribute_warn_unused_result" in
10260 '')
10261 echo " "
10262 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10263 $cat >attrib.c <<'EOCP'
10264 #include <stdio.h>
10265 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10266 EOCP
10267 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10268         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10269                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10270                 val="$undef"
10271         else
10272                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10273                 val="$define"
10274         fi
10275 else
10276         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10277         val="$undef"
10278 fi
10279 ;;
10280 *) val="$d_attribute_warn_unused_result" ;;
10281 esac
10282 set d_attribute_warn_unused_result
10283 eval $setvar
10284 $rm -f attrib*
10285
10286 : see if bcmp exists
10287 set bcmp d_bcmp
10288 eval $inlibc
10289
10290 : see if bcopy exists
10291 set bcopy d_bcopy
10292 eval $inlibc
10293
10294 : see if getpgrp exists
10295 set getpgrp d_getpgrp
10296 eval $inlibc
10297
10298 case "$d_getpgrp" in
10299 "$define")
10300         echo " "
10301         echo "Checking to see which flavor of getpgrp is in use..."
10302         $cat >try.c <<EOP
10303 #$i_unistd I_UNISTD
10304 #include <sys/types.h>
10305 #ifdef I_UNISTD
10306 #  include <unistd.h>
10307 #endif
10308 #$i_stdlib I_STDLIB
10309 #ifdef I_STDLIB
10310 #include <stdlib.h>
10311 #endif
10312 int main()
10313 {
10314         if (getuid() == 0) {
10315                 printf("(I see you are running Configure as super-user...)\n");
10316                 setuid(1);
10317         }
10318 #ifdef TRY_BSD_PGRP
10319         if (getpgrp(1) == 0)
10320                 exit(0);
10321 #else
10322         if (getpgrp() > 0)
10323                 exit(0);
10324 #endif
10325         exit(1);
10326 }
10327 EOP
10328         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10329                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10330                 val="$define"
10331         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10332                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10333                 val="$undef"
10334         else
10335                 echo "I can't seem to compile and run the test program."
10336                 if ./usg; then
10337                         xxx="a USG one, i.e. you use getpgrp()."
10338                 else
10339                         # SVR4 systems can appear rather BSD-ish.
10340                         case "$i_unistd" in
10341                         $undef)
10342                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10343                                 val="$define"
10344                                 ;;
10345                         $define)
10346                                 xxx="probably a USG one, i.e. you use getpgrp()."
10347                                 val="$undef"
10348                                 ;;
10349                         esac
10350                 fi
10351                 echo "Assuming your getpgrp is $xxx" >&4
10352         fi
10353         ;;
10354 *) val="$undef";;
10355 esac
10356 set d_bsdgetpgrp
10357 eval $setvar
10358 $rm_try
10359
10360 : see if setpgrp exists
10361 set setpgrp d_setpgrp
10362 eval $inlibc
10363
10364 case "$d_setpgrp" in
10365 "$define")
10366         echo " "
10367         echo "Checking to see which flavor of setpgrp is in use..."
10368         $cat >try.c <<EOP
10369 #$i_unistd I_UNISTD
10370 #include <sys/types.h>
10371 #ifdef I_UNISTD
10372 #  include <unistd.h>
10373 #endif
10374 #$i_stdlib I_STDLIB
10375 #ifdef I_STDLIB
10376 #include <stdlib.h>
10377 #endif
10378 int main()
10379 {
10380         if (getuid() == 0) {
10381                 printf("(I see you are running Configure as super-user...)\n");
10382                 setuid(1);
10383         }
10384 #ifdef TRY_BSD_PGRP
10385         if (-1 == setpgrp(1, 1))
10386                 exit(0);
10387 #else
10388         if (setpgrp() != -1)
10389                 exit(0);
10390 #endif
10391         exit(1);
10392 }
10393 EOP
10394         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10395                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10396                 val="$define"
10397         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10398                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10399                 val="$undef"
10400         else
10401                 echo "(I can't seem to compile and run the test program.)"
10402                 if ./usg; then
10403                         xxx="a USG one, i.e. you use setpgrp()."
10404                 else
10405                         # SVR4 systems can appear rather BSD-ish.
10406                         case "$i_unistd" in
10407                         $undef)
10408                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10409                                 val="$define"
10410                                 ;;
10411                         $define)
10412                                 xxx="probably a USG one, i.e. you use setpgrp()."
10413                                 val="$undef"
10414                                 ;;
10415                         esac
10416                 fi
10417                 echo "Assuming your setpgrp is $xxx" >&4
10418         fi
10419         ;;
10420 *) val="$undef";;
10421 esac
10422 set d_bsdsetpgrp
10423 eval $setvar
10424 $rm_try
10425
10426 : Look for GCC-style __builtin_choose_expr
10427 case "$d_builtin_choose_expr" in
10428 '')
10429     echo " "
10430     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10431     $cat >try.c <<'EOCP'
10432 #include <assert.h>
10433 #include <stdlib.h>
10434 #include <stdio.h>
10435
10436 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10437
10438 int main(void) {
10439     assert( SYRINX(1) == 2112 );
10440     assert( SYRINX(1) != 5150 );
10441     assert( SYRINX(0) == 5150 );
10442     assert( SYRINX(0) != 2112 );
10443     puts( "All good!" );
10444     exit(0);
10445 }
10446
10447 EOCP
10448     set try
10449     if eval $compile; then
10450         echo "Your C compiler supports __builtin_choose_expr."
10451         val="$define"
10452     else
10453         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10454         val="$undef"
10455     fi
10456 ;;
10457 *) val="$d_builtin_choose_expr" ;;
10458 esac
10459
10460 set d_builtin_choose_expr
10461 eval $setvar
10462 $rm_try
10463
10464 : Look for GCC-style __builtin_expect
10465 case "$d_builtin_expect" in
10466 '')
10467     echo " "
10468     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10469     $cat >builtin.c <<'EOCP'
10470 int main(void) {
10471     int n = 50;
10472     if ( __builtin_expect(n, 0) ) n = 1;
10473 }
10474 EOCP
10475     set try
10476     if eval $compile; then
10477         echo "Your C compiler supports __builtin_choose_expr."
10478         val="$define"
10479     else
10480         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10481         val="$undef"
10482     fi
10483     ;;
10484 *) val="$d_builtin_expect" ;;
10485 esac
10486
10487 set d_builtin_expect
10488 eval $setvar
10489 $rm_try
10490
10491 : see if bzero exists
10492 set bzero d_bzero
10493 eval $inlibc
10494
10495 : see if stdarg is available
10496 echo " "
10497 if $test `./findhdr stdarg.h`; then
10498         echo "<stdarg.h> found." >&4
10499         valstd="$define"
10500 else
10501         echo "<stdarg.h> NOT found." >&4
10502         valstd="$undef"
10503 fi
10504
10505 : see if varags is available
10506 echo " "
10507 if $test `./findhdr varargs.h`; then
10508         echo "<varargs.h> found." >&4
10509 else
10510         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10511 fi
10512
10513 : set up the varargs testing programs
10514 $cat > varargs.c <<EOP
10515 #ifdef I_STDARG
10516 #include <stdarg.h>
10517 #endif
10518 #ifdef I_VARARGS
10519 #include <varargs.h>
10520 #endif
10521
10522 #ifdef I_STDARG
10523 int f(char *p, ...)
10524 #else
10525 int f(va_alist)
10526 va_dcl
10527 #endif
10528 {
10529         va_list ap;
10530 #ifndef I_STDARG
10531         char *p;
10532 #endif
10533 #ifdef I_STDARG
10534         va_start(ap,p);
10535 #else
10536         va_start(ap);
10537         p = va_arg(ap, char *);
10538 #endif
10539         va_end(ap);
10540         return 0;
10541 }
10542 EOP
10543 $cat > varargs <<EOP
10544 $startsh
10545 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10546         echo "true"
10547 else
10548         echo "false"
10549 fi
10550 $rm -f varargs$_o
10551 EOP
10552 chmod +x varargs
10553
10554 : now check which varargs header should be included
10555 echo " "
10556 i_varhdr=''
10557 case "$valstd" in
10558 "$define")
10559         if `./varargs I_STDARG`; then
10560                 val='stdarg.h'
10561         elif `./varargs I_VARARGS`; then
10562                 val='varargs.h'
10563         fi
10564         ;;
10565 *)
10566         if `./varargs I_VARARGS`; then
10567                 val='varargs.h'
10568         fi
10569         ;;
10570 esac
10571 case "$val" in
10572 '')
10573 echo "I could not find the definition for va_dcl... You have problems..." >&4
10574         val="$undef"; set i_stdarg; eval $setvar
10575         val="$undef"; set i_varargs; eval $setvar
10576         ;;
10577 *) 
10578         set i_varhdr
10579         eval $setvar
10580         case "$i_varhdr" in
10581         stdarg.h)
10582                 val="$define"; set i_stdarg; eval $setvar
10583                 val="$undef"; set i_varargs; eval $setvar
10584                 ;;
10585         varargs.h)
10586                 val="$undef"; set i_stdarg; eval $setvar
10587                 val="$define"; set i_varargs; eval $setvar
10588                 ;;
10589         esac
10590         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10591 esac
10592 $rm -f varargs*
10593
10594 : see if the Compiler supports C99 variadic macros
10595 case "$i_stdarg$i_stdlib" in
10596     "$define$define")
10597     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10598     $cat >try.c <<EOCP
10599 #include <stdio.h>
10600 #include <stdarg.h>
10601
10602 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10603
10604 int main() {
10605   char buf[20];
10606   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10607   puts(buf);
10608   return 0;
10609 }
10610 EOCP
10611     set try
10612     if eval $compile && $run ./try 2>&1 >/dev/null; then
10613         case "`$run ./try`" in
10614             "123 456 789")
10615             echo "You have C99 variadic macros." >&4
10616             d_c99_variadic_macros="$define"
10617             ;;
10618             *)
10619             echo "You don't have functional C99 variadic macros." >&4
10620             d_c99_variadic_macros="$undef"
10621             ;;
10622         esac
10623     else
10624         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10625         d_c99_variadic_macros="$undef"
10626     fi
10627     $rm_try
10628     ;;
10629     *)
10630     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10631     d_c99_variadic_macros="$undef"
10632     ;;
10633 esac
10634
10635 : see if signal is declared as pointer to function returning int or void
10636 echo " "
10637 xxx=`./findhdr signal.h`
10638 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10639 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10640         echo "You have int (*signal())() instead of void." >&4
10641         val="$undef"
10642 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10643         echo "You have void (*signal())()." >&4
10644         val="$define"
10645 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10646         echo "You have int (*signal())() instead of void." >&4
10647         val="$undef"
10648 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10649         echo "You have void (*signal())()." >&4
10650         val="$define"
10651 else
10652         case "$d_voidsig" in
10653         '')
10654         echo "I can't determine whether signal handler returns void or int..." >&4
10655                 dflt=void
10656                 rp="What type does your signal handler return?"
10657                 . ./myread
10658                 case "$ans" in
10659                 v*) val="$define";;
10660                 *) val="$undef";;
10661                 esac;;
10662         "$define")
10663                 echo "As you already told me, signal handler returns void." >&4
10664                 val="$define"
10665                 ;;
10666         *)      echo "As you already told me, signal handler returns int." >&4
10667                 val="$undef"
10668                 ;;
10669         esac
10670 fi
10671 set d_voidsig
10672 eval $setvar
10673 case "$d_voidsig" in
10674 "$define") signal_t="void";;
10675 *) signal_t="int";;
10676 esac
10677 $rm -f $$.tmp
10678
10679 : check for ability to cast large floats to 32-bit ints.
10680 echo " "
10681 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10682 if $test "$intsize" -ge 4; then
10683         xxx=int
10684 else
10685         xxx=long
10686 fi
10687 $cat >try.c <<EOCP
10688 #include <stdio.h>
10689 #$i_stdlib I_STDLIB
10690 #ifdef I_STDLIB
10691 #include <stdlib.h>
10692 #endif
10693 #include <sys/types.h>
10694 #include <signal.h>
10695 $signal_t blech(int s) { exit(3); }
10696 int main()
10697 {
10698         $xxx i32;
10699         double f, g;
10700         int result = 0;
10701         char str[16];
10702         signal(SIGFPE, blech);
10703
10704         /* Don't let compiler optimize the test away.  Store the number
10705            in a writable string for gcc to pass to sscanf under HP/UX.
10706         */
10707         sprintf(str, "2147483647");
10708         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10709         g = 10 * f;
10710         i32  = ($xxx) g;
10711
10712         /* x86 processors will probably give 0x8000 0000, which is a
10713            sign change.  We don't want that.  We want to mimic SPARC
10714            behavior here, which is to preserve the sign and give
10715            back 0x7fff ffff.
10716         */
10717         if (i32 != ($xxx) f)
10718                 result |= 1;
10719         exit(result);
10720 }
10721 EOCP
10722 set try
10723 if eval $compile_ok; then
10724         $run ./try
10725         yyy=$?
10726 else
10727         echo "(I can't seem to compile the test program--assuming it can't)"
10728         yyy=1
10729 fi
10730 case "$yyy" in
10731 0)      val="$define"
10732         echo "Yup, it can."
10733         ;;
10734 *)      val="$undef"
10735         echo "Nope, it can't."
10736         ;;
10737 esac
10738 set d_casti32
10739 eval $setvar
10740 $rm_try
10741
10742 : check for ability to cast negative floats to unsigned
10743 echo " "
10744 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10745 $cat >try.c <<EOCP
10746 #include <stdio.h>
10747 #$i_stdlib I_STDLIB
10748 #ifdef I_STDLIB
10749 #include <stdlib.h>
10750 #endif
10751 #include <sys/types.h>
10752 #include <signal.h>
10753 $signal_t blech(int s) { exit(7); }
10754 $signal_t blech_in_list(int s) { exit(4); }
10755 unsigned long dummy_long(unsigned long p) { return p; }
10756 unsigned int dummy_int(unsigned int p) { return p; }
10757 unsigned short dummy_short(unsigned short p) { return p; }
10758 int main()
10759 {
10760         double f;
10761         unsigned long along;
10762         unsigned int aint;
10763         unsigned short ashort;
10764         int result = 0;
10765         char str[16];
10766
10767         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10768            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10769            optimized the whole file away
10770         */
10771         /* Store the number in a writable string for gcc to pass to
10772            sscanf under HP/UX.
10773         */
10774         sprintf(str, "-123");
10775         sscanf(str, "%lf", &f);  /* f = -123.; */
10776
10777         signal(SIGFPE, blech);
10778         along = (unsigned long)f;
10779         aint = (unsigned int)f;
10780         ashort = (unsigned short)f;
10781         if (along != (unsigned long)-123)
10782                 result |= 1;
10783         if (aint != (unsigned int)-123)
10784                 result |= 1;
10785         if (ashort != (unsigned short)-123)
10786                 result |= 1;
10787         sprintf(str, "1073741824.");
10788         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10789         f = f + f;
10790         along = 0;
10791         along = (unsigned long)f;
10792         if (along != 0x80000000)
10793                 result |= 2;
10794         f -= 1.;
10795         along = 0;
10796         along = (unsigned long)f;
10797         if (along != 0x7fffffff)
10798                 result |= 1;
10799         f += 2.;
10800         along = 0;
10801         along = (unsigned long)f;
10802         if (along != 0x80000001)
10803                 result |= 2;
10804         if (result)
10805                 exit(result);
10806         signal(SIGFPE, blech_in_list);
10807         sprintf(str, "123.");
10808         sscanf(str, "%lf", &f);  /* f = 123.; */
10809         along = dummy_long((unsigned long)f);
10810         aint = dummy_int((unsigned int)f);
10811         ashort = dummy_short((unsigned short)f);
10812         if (along != (unsigned long)123)
10813                 result |= 4;
10814         if (aint != (unsigned int)123)
10815                 result |= 4;
10816         if (ashort != (unsigned short)123)
10817                 result |= 4;
10818         exit(result);
10819
10820 }
10821 EOCP
10822 set try
10823 if eval $compile_ok; then
10824         $run ./try
10825         castflags=$?
10826 else
10827         echo "(I can't seem to compile the test program--assuming it can't)"
10828         castflags=7
10829 fi
10830 case "$castflags" in
10831 0)      val="$define"
10832         echo "Yup, it can."
10833         ;;
10834 *)      val="$undef"
10835         echo "Nope, it can't."
10836         ;;
10837 esac
10838 set d_castneg
10839 eval $setvar
10840 $rm_try
10841
10842 : see if vprintf exists
10843 echo " "
10844 if set vprintf val -f d_vprintf; eval $csym; $val; then
10845         echo 'vprintf() found.' >&4
10846         val="$define"
10847         $cat >try.c <<EOF
10848 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10849 #$i_varargs I_VARARGS
10850
10851 #$i_stdlib I_STDLIB
10852 #$i_unistd I_UNISTD
10853
10854 #ifdef I_STDARG
10855 #  include <stdarg.h>
10856 #else /* I_VARARGS */
10857 #  include <varargs.h>
10858 #endif
10859
10860 #ifdef I_UNISTD
10861 #  include <unistd.h>
10862 #endif
10863
10864 #ifdef I_STDLIB
10865 #  include <stdlib.h>
10866 #endif
10867
10868 #include <stdio.h> /* vsprintf prototype */
10869
10870 #ifdef I_STDARG
10871 void xxx(int n, ...)
10872 {
10873     va_list args;
10874     char buf[10];
10875     va_start(args, n);
10876     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10877 }
10878 int main() { xxx(1, "foo"); }
10879
10880 #else /* I_VARARGS */
10881
10882 xxx(va_alist)
10883 va_dcl
10884 {
10885     va_list args;
10886     char buf[10];
10887     va_start(args);
10888     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10889 }
10890 int main() { xxx("foo"); }
10891
10892 #endif
10893
10894 EOF
10895         set try
10896         if eval $compile_ok; then
10897                 if $run ./try; then
10898                         echo "Your vsprintf() returns (int)." >&4
10899                         val2="$undef"
10900                 else
10901                         echo "Your vsprintf() returns (char*)." >&4
10902                         val2="$define"
10903                 fi
10904         else
10905                 echo 'I am unable to compile the vsprintf() test program.' >&4
10906                 # We shouldn't get here.  If we do, assume the standard signature,
10907                 # not the old BSD one.
10908                 echo 'Guessing that vsprintf() returns (int).' >&4
10909                 val2="$undef"
10910         fi
10911 else
10912         echo 'vprintf() NOT found.' >&4
10913         val="$undef"
10914         val2="$undef"
10915 fi
10916 $rm_try
10917 set d_vprintf
10918 eval $setvar
10919 val=$val2
10920 set d_charvspr
10921 eval $setvar
10922
10923 : see if chown exists
10924 set chown d_chown
10925 eval $inlibc
10926
10927 : see if chroot exists
10928 set chroot d_chroot
10929 eval $inlibc
10930
10931 : see if chsize exists
10932 set chsize d_chsize
10933 eval $inlibc
10934
10935 : see if class exists
10936 set class d_class
10937 eval $inlibc
10938
10939 : see if clearenv exists
10940 set clearenv d_clearenv
10941 eval $inlibc
10942
10943 hasstruct='varname=$1; struct=$2; shift; shift;
10944 while $test $# -ge 2; do
10945         case "$1" in
10946         $define) echo "#include <$2>";;
10947         esac ;
10948     shift 2;
10949 done > try.c;
10950 echo "int main () { struct $struct foo; }" >> try.c;
10951 set try;
10952 if eval $compile; then
10953         val="$define";
10954 else
10955         val="$undef";
10956 fi;
10957 set $varname;
10958 eval $setvar;
10959 $rm_try'
10960
10961 socketlib=''
10962 sockethdr=''
10963 : see whether socket exists
10964 echo " "
10965 $echo $n "Hmm... $c" >&4
10966 if set socket val -f d_socket; eval $csym; $val; then
10967         echo "Looks like you have Berkeley networking support." >&4
10968         d_socket="$define"
10969         if set setsockopt val -f; eval $csym; $val; then
10970                 d_oldsock="$undef"
10971         else
10972                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10973                 d_oldsock="$define"
10974         fi
10975 else
10976         if $contains socklib libc.list >/dev/null 2>&1; then
10977                 echo "Looks like you have Berkeley networking support." >&4
10978                 d_socket="$define"
10979                 : we will have to assume that it supports the 4.2 BSD interface
10980                 d_oldsock="$undef"
10981         else
10982                 echo "You don't have Berkeley networking in libc$_a..." >&4
10983                 if test "X$d_socket" = "X$define"; then
10984                    echo "...but you seem to believe that you have sockets." >&4
10985                 else
10986                         for net in net socket
10987                         do
10988                                 if test -f /usr/lib/lib$net$_a; then
10989                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10990                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10991                                         if $contains socket libc.list >/dev/null 2>&1; then
10992                                                 d_socket="$define"
10993                                                 socketlib="-l$net"
10994                                                 case "$net" in
10995                                                 net)
10996                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10997                                                         sockethdr="-I/usr/netinclude"
10998                                                         ;;
10999                                                 esac
11000                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11001                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11002                                                         d_oldsock="$undef"
11003                                                 else
11004                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11005                                                         d_oldsock="$define"
11006                                                 fi
11007                                                 break
11008                                         fi
11009                                 fi
11010                         done
11011                         if test "X$d_socket" != "X$define"; then
11012                            echo "or anywhere else I see." >&4
11013                            d_socket="$undef"
11014                            d_oldsock="$undef"
11015                         fi
11016                 fi
11017         fi
11018 fi
11019
11020 : see if socketpair exists
11021 set socketpair d_sockpair
11022 eval $inlibc
11023
11024
11025 echo " "
11026 echo "Checking the availability of certain socket constants..." >&4
11027 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11028         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11029         $cat >try.c <<EOF
11030 #include <sys/types.h>
11031 #include <sys/socket.h>
11032 int main() {
11033     int i = $ENUM;
11034 }
11035 EOF
11036         val="$undef"
11037         set try; if eval $compile; then
11038                 val="$define"
11039         fi
11040         set d_${enum}; eval $setvar
11041         $rm_try
11042 done
11043
11044 : see if this is a sys/uio.h system
11045 set sys/uio.h i_sysuio
11046 eval $inhdr
11047
11048
11049 echo " "
11050 echo "Checking to see if your system supports struct cmsghdr..." >&4
11051 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11052 eval $hasstruct
11053 case "$d_cmsghdr_s" in
11054 "$define")      echo "Yes, it does."   ;;
11055 *)              echo "No, it doesn't." ;;
11056 esac
11057
11058
11059 : check for const keyword
11060 echo " "
11061 echo 'Checking to see if your C compiler knows about "const"...' >&4
11062 $cat >const.c <<'EOCP'
11063 typedef struct spug { int drokk; } spug;
11064 int main()
11065 {
11066         const char *foo;
11067         const spug y = { 0 };
11068 }
11069 EOCP
11070 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11071         val="$define"
11072         echo "Yup, it does."
11073 else
11074         val="$undef"
11075         echo "Nope, it doesn't."
11076 fi
11077 set d_const
11078 eval $setvar
11079
11080 : see if copysignl exists
11081 set copysignl d_copysignl
11082 eval $inlibc
11083
11084 : see if crypt exists
11085 echo " "
11086 set crypt d_crypt
11087 eval $inlibc
11088 case "$d_crypt" in
11089 $define) cryptlib='' ;;
11090 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11091                 echo 'crypt() found.' >&4
11092                 val="$define"
11093                 cryptlib=''
11094         else
11095                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11096                 if $test -z "$cryptlib"; then
11097                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11098                 else
11099                         cryptlib=-lcrypt
11100                 fi
11101                 if $test -z "$cryptlib"; then
11102                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11103                 else
11104                         cryptlib=-lcrypt
11105                 fi
11106                 if $test -z "$cryptlib"; then
11107                         cryptlib=`./loc libcrypt$_a "" $libpth`
11108                 else
11109                         cryptlib=-lcrypt
11110                 fi
11111                 if $test -z "$cryptlib"; then
11112                         echo 'crypt() NOT found.' >&4
11113                         val="$undef"
11114                 else
11115                         val="$define"
11116                 fi
11117         fi
11118         set d_crypt
11119         eval $setvar
11120         ;;
11121 esac
11122
11123 : see if this is a crypt.h system
11124 set crypt.h i_crypt
11125 eval $inhdr
11126
11127 : see if crypt_r exists
11128 set crypt_r d_crypt_r
11129 eval $inlibc
11130 case "$d_crypt_r" in
11131 "$define")
11132         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11133         case "$d_crypt_r_proto:$usethreads" in
11134         ":define")      d_crypt_r_proto=define
11135                 set d_crypt_r_proto crypt_r $hdrs
11136                 eval $hasproto ;;
11137         *)      ;;
11138         esac
11139         case "$d_crypt_r_proto" in
11140         define)
11141         case "$crypt_r_proto" in
11142         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11143         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11144         esac
11145         case "$crypt_r_proto" in
11146         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11147         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11148         esac
11149         case "$crypt_r_proto" in
11150         ''|0)   d_crypt_r=undef
11151                 crypt_r_proto=0
11152                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11153         * )     case "$crypt_r_proto" in
11154                 REENTRANT_PROTO*) ;;
11155                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11156                 esac
11157                 echo "Prototype: $try" ;;
11158         esac
11159         ;;
11160         *)      case "$usethreads" in
11161                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11162                 esac
11163                 d_crypt_r=undef
11164                 crypt_r_proto=0
11165                 ;;
11166         esac
11167         ;;
11168 *)      crypt_r_proto=0
11169         ;;
11170 esac
11171
11172 : get csh whereabouts
11173 case "$csh" in
11174 'csh') val="$undef" ;;
11175 *) val="$define" ;;
11176 esac
11177 set d_csh
11178 eval $setvar
11179 : Respect a hint or command line value for full_csh.
11180 case "$full_csh" in
11181 '') full_csh=$csh ;;
11182 esac
11183
11184 : see if ctermid exists
11185 set ctermid d_ctermid
11186 eval $inlibc
11187
11188 : see if ctermid_r exists
11189 set ctermid_r d_ctermid_r
11190 eval $inlibc
11191 case "$d_ctermid_r" in
11192 "$define")
11193         hdrs="$i_systypes sys/types.h define stdio.h "
11194         case "$d_ctermid_r_proto:$usethreads" in
11195         ":define")      d_ctermid_r_proto=define
11196                 set d_ctermid_r_proto ctermid_r $hdrs
11197                 eval $hasproto ;;
11198         *)      ;;
11199         esac
11200         case "$d_ctermid_r_proto" in
11201         define)
11202         case "$ctermid_r_proto" in
11203         ''|0) try='char* ctermid_r(char*);'
11204         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11205         esac
11206         case "$ctermid_r_proto" in
11207         ''|0)   d_ctermid_r=undef
11208                 ctermid_r_proto=0
11209                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11210         * )     case "$ctermid_r_proto" in
11211                 REENTRANT_PROTO*) ;;
11212                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11213                 esac
11214                 echo "Prototype: $try" ;;
11215         esac
11216         ;;
11217         *)      case "$usethreads" in
11218                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11219                 esac
11220                 d_ctermid_r=undef
11221                 ctermid_r_proto=0
11222                 ;;
11223         esac
11224         ;;
11225 *)      ctermid_r_proto=0
11226         ;;
11227 esac
11228
11229 : see if ctime_r exists
11230 set ctime_r d_ctime_r
11231 eval $inlibc
11232 case "$d_ctime_r" in
11233 "$define")
11234         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11235         case "$d_ctime_r_proto:$usethreads" in
11236         ":define")      d_ctime_r_proto=define
11237                 set d_ctime_r_proto ctime_r $hdrs
11238                 eval $hasproto ;;
11239         *)      ;;
11240         esac
11241         case "$d_ctime_r_proto" in
11242         define)
11243         case "$ctime_r_proto" in
11244         ''|0) try='char* ctime_r(const time_t*, char*);'
11245         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11246         esac
11247         case "$ctime_r_proto" in
11248         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11249         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11250         esac
11251         case "$ctime_r_proto" in
11252         ''|0) try='int ctime_r(const time_t*, char*);'
11253         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11254         esac
11255         case "$ctime_r_proto" in
11256         ''|0) try='int ctime_r(const time_t*, char*, int);'
11257         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11258         esac
11259         case "$ctime_r_proto" in
11260         ''|0)   d_ctime_r=undef
11261                 ctime_r_proto=0
11262                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11263         * )     case "$ctime_r_proto" in
11264                 REENTRANT_PROTO*) ;;
11265                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11266                 esac
11267                 echo "Prototype: $try" ;;
11268         esac
11269         ;;
11270         *)      case "$usethreads" in
11271                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11272                 esac
11273                 d_ctime_r=undef
11274                 ctime_r_proto=0
11275                 ;;
11276         esac
11277         ;;
11278 *)      ctime_r_proto=0
11279         ;;
11280 esac
11281
11282 : see if cuserid exists
11283 set cuserid d_cuserid
11284 eval $inlibc
11285
11286 : see if this is a limits.h system
11287 set limits.h i_limits
11288 eval $inhdr
11289
11290 : see if this is a float.h system
11291 set float.h i_float
11292 eval $inhdr
11293
11294 : See if number of significant digits in a double precision number is known
11295 echo " "
11296 $cat >dbl_dig.c <<EOM
11297 #$i_limits I_LIMITS
11298 #$i_float I_FLOAT
11299 #ifdef I_LIMITS
11300 #include <limits.h>
11301 #endif
11302 #ifdef I_FLOAT
11303 #include <float.h>
11304 #endif
11305 #ifdef DBL_DIG
11306 printf("Contains DBL_DIG");
11307 #endif
11308 EOM
11309 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11310 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11311         echo "DBL_DIG found." >&4
11312         val="$define"
11313 else
11314         echo "DBL_DIG NOT found." >&4
11315         val="$undef"
11316 fi
11317 $rm -f dbl_dig.?
11318 set d_dbl_dig
11319 eval $setvar
11320
11321 : see if dbm.h is available
11322 : see if dbmclose exists
11323 set dbmclose d_dbmclose
11324 eval $inlibc
11325
11326 case "$d_dbmclose" in
11327 $define)
11328         set dbm.h i_dbm
11329         eval $inhdr
11330         case "$i_dbm" in
11331         $define)
11332                 val="$undef"
11333                 set i_rpcsvcdbm
11334                 eval $setvar
11335                 ;;
11336         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11337                 eval $inhdr
11338                 ;;
11339         esac
11340         ;;
11341 *)      echo "We won't be including <dbm.h>"
11342         val="$undef"
11343         set i_dbm
11344         eval $setvar
11345         val="$undef"
11346         set i_rpcsvcdbm
11347         eval $setvar
11348         ;;
11349 esac
11350
11351 : see if prototype for dbminit is available
11352 echo " "
11353 set d_dbminitproto dbminit $i_dbm dbm.h
11354 eval $hasproto
11355
11356 : see if difftime exists
11357 set difftime d_difftime
11358 eval $inlibc
11359
11360 : see if this is a dirent system
11361 echo " "
11362 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11363         val="$define"
11364         echo "<dirent.h> found." >&4
11365 else
11366         val="$undef"
11367         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11368                 echo "<sys/dir.h> found." >&4
11369                 echo " "
11370         else
11371                 xinc=`./findhdr sys/ndir.h`
11372         fi
11373         echo "<dirent.h> NOT found." >&4
11374 fi
11375 set i_dirent
11376 eval $setvar
11377
11378 : Look for type of directory structure.
11379 echo " "
11380 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11381
11382 case "$direntrytype" in
11383 ''|' ')
11384         case "$i_dirent" in
11385         $define) guess1='struct dirent' ;;
11386         *) guess1='struct direct'  ;;
11387         esac
11388         ;;
11389 *)      guess1="$direntrytype"
11390         ;;
11391 esac
11392
11393 case "$guess1" in
11394 'struct dirent') guess2='struct direct' ;;
11395 *) guess2='struct dirent' ;;
11396 esac
11397
11398 if $contains "$guess1" try.c >/dev/null 2>&1; then
11399         direntrytype="$guess1"
11400         echo "Your directory entries are $direntrytype." >&4
11401 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11402         direntrytype="$guess2"
11403         echo "Your directory entries seem to be $direntrytype." >&4
11404 else
11405         echo "I don't recognize your system's directory entries." >&4
11406         rp="What type is used for directory entries on this system?"
11407         dflt="$guess1"
11408         . ./myread
11409         direntrytype="$ans"
11410 fi
11411 $rm_try
11412
11413 : see if the directory entry stores field length
11414 echo " "
11415 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11416 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11417         echo "Good, your directory entry keeps length information in d_namlen." >&4
11418         val="$define"
11419 else
11420         echo "Your directory entry does not know about the d_namlen field." >&4
11421         val="$undef"
11422 fi
11423 set d_dirnamlen
11424 eval $setvar
11425 $rm_try
11426
11427 : Look for DIR.dd_fd
11428 case "$i_dirent" in
11429 "$define")
11430     echo "Checking to see if DIR has a dd_fd member variable" >&4
11431     $cat >try.c <<EOCP
11432 #$i_stdlib I_STDLIB
11433 #ifdef I_STDLIB
11434 #include <stdlib.h>
11435 #endif
11436 #include <dirent.h>
11437
11438 int main() {
11439     DIR dir;
11440     dir.dd_fd = 1;
11441     return 0;
11442 }
11443 EOCP
11444     val=$undef
11445     set try
11446     if eval $compile; then
11447         echo "Yes, it does."
11448         val="$define"
11449     else
11450         echo "No, it does not."
11451         val="$undef"
11452     fi
11453     ;;
11454 *)
11455     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11456     val="$undef"
11457     ;;
11458 esac
11459 set d_dir_dd_fd
11460 eval $setvar
11461 $rm_try
11462
11463 : see if this is an sysdir system
11464 set sys/dir.h i_sysdir
11465 eval $inhdr
11466
11467 : see if this is an sysndir system
11468 set sys/ndir.h i_sysndir
11469 eval $inhdr
11470
11471 : Look for dirfd
11472 echo " "
11473 $cat >dirfd.c <<EOM
11474 #include <stdio.h>
11475 #$i_stdlib I_STDLIB
11476 #ifdef I_STDLIB
11477 #include <stdlib.h>
11478 #endif
11479 #$i_dirent I_DIRENT             /**/
11480 #$i_sysdir I_SYS_DIR            /**/
11481 #$i_sysndir I_SYS_NDIR          /**/
11482 #$i_systypes I_SYS_TYPES        /**/
11483 #if defined(I_SYS_TYPES)
11484 #include <sys/types.h>
11485 #endif
11486 #if defined(I_DIRENT)
11487 #include <dirent.h>
11488 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11489 #include <sys/dir.h>
11490 #endif
11491 #else
11492 #ifdef I_SYS_NDIR
11493 #include <sys/ndir.h>
11494 #else
11495 #ifdef I_SYS_DIR
11496 #ifdef hp9000s500
11497 #include <ndir.h>       /* may be wrong in the future */
11498 #else
11499 #include <sys/dir.h>
11500 #endif
11501 #endif
11502 #endif
11503 #endif 
11504 int main() {
11505         DIR *dirp = opendir(".");
11506         if (dirfd(dirp) >= 0)
11507                 exit(0);
11508         else
11509                 exit(1);
11510 }
11511 EOM
11512 val=$undef
11513 set dirfd
11514 if eval $compile; then
11515         val="$define"
11516 fi
11517 case "$val" in
11518 $define)        echo "dirfd() found." >&4       ;;
11519 *)              echo "dirfd() NOT found." >&4   ;;
11520 esac
11521 set d_dirfd
11522 eval $setvar
11523 $rm -f dirfd*
11524
11525 : see if dlerror exists
11526 xxx_runnm="$runnm"
11527 runnm=false
11528 set dlerror d_dlerror
11529 eval $inlibc
11530 runnm="$xxx_runnm"
11531
11532 : see if dlfcn is available
11533 set dlfcn.h i_dlfcn
11534 eval $inhdr
11535
11536 case "$usedl" in
11537 $define|y|true)
11538         $cat << EOM
11539
11540 On a few systems, the dynamically loaded modules that perl generates and uses
11541 will need a different extension than shared libs. The default will probably
11542 be appropriate.
11543
11544 EOM
11545         case "$dlext" in
11546         '')     dflt="$so" ;;
11547         *)      dflt="$dlext" ;;
11548         esac
11549         rp='What is the extension of dynamically loaded modules'
11550         . ./myread
11551         dlext="$ans"
11552         ;;
11553 *)
11554         dlext="none"
11555         ;;
11556 esac
11557
11558 : Check if dlsym need a leading underscore
11559 echo " "
11560 val="$undef"
11561
11562 case "$dlsrc" in
11563 dl_dlopen.xs)
11564         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11565         $cat >dyna.c <<'EOM'
11566 fred () { }
11567 EOM
11568
11569 $cat >fred.c<<EOM
11570
11571 #include <stdio.h>
11572 #$i_stdlib I_STDLIB
11573 #ifdef I_STDLIB
11574 #include <stdlib.h>
11575 #endif
11576 #$i_dlfcn I_DLFCN
11577 #ifdef I_DLFCN
11578 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11579 #else
11580 #include <sys/types.h>
11581 #include <nlist.h>
11582 #include <link.h>
11583 #endif
11584
11585 extern int fred() ;
11586
11587 int main()
11588 {
11589     void * handle ;
11590     void * symbol ;
11591 #ifndef RTLD_LAZY
11592     int mode = 1 ;
11593 #else
11594     int mode = RTLD_LAZY ;
11595 #endif
11596     handle = dlopen("./dyna.$dlext", mode) ;
11597     if (handle == NULL) {
11598         printf ("1\n") ;
11599         fflush (stdout) ;
11600         exit(0);
11601     }
11602     symbol = dlsym(handle, "fred") ;
11603     if (symbol == NULL) {
11604         /* try putting a leading underscore */
11605         symbol = dlsym(handle, "_fred") ;
11606         if (symbol == NULL) {
11607             printf ("2\n") ;
11608             fflush (stdout) ;
11609             exit(0);
11610         }
11611         printf ("3\n") ;
11612     }
11613     else
11614         printf ("4\n") ;
11615     fflush (stdout) ;
11616     exit(0);
11617 }
11618 EOM
11619         : Call the object file tmp-dyna.o in case dlext=o.
11620         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11621                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11622                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11623                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11624                 xxx=`$run ./fred`
11625                 case $xxx in
11626                 1)      echo "Test program failed using dlopen." >&4
11627                         echo "Perhaps you should not use dynamic loading." >&4;;
11628                 2)      echo "Test program failed using dlsym." >&4
11629                         echo "Perhaps you should not use dynamic loading." >&4;;
11630                 3)      echo "dlsym needs a leading underscore" >&4
11631                         val="$define" ;;
11632                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11633                 esac
11634         else
11635                 echo "I can't compile and run the test program." >&4
11636                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11637         fi
11638         ;;
11639 esac
11640                 
11641 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11642
11643 set d_dlsymun
11644 eval $setvar
11645
11646 : see if drand48_r exists
11647 set drand48_r d_drand48_r
11648 eval $inlibc
11649 case "$d_drand48_r" in
11650 "$define")
11651         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11652         case "$d_drand48_r_proto:$usethreads" in
11653         ":define")      d_drand48_r_proto=define
11654                 set d_drand48_r_proto drand48_r $hdrs
11655                 eval $hasproto ;;
11656         *)      ;;
11657         esac
11658         case "$d_drand48_r_proto" in
11659         define)
11660         case "$drand48_r_proto" in
11661         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11662         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11663         esac
11664         case "$drand48_r_proto" in
11665         ''|0)   d_drand48_r=undef
11666                 drand48_r_proto=0
11667                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11668         * )     case "$drand48_r_proto" in
11669                 REENTRANT_PROTO*) ;;
11670                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11671                 esac
11672                 echo "Prototype: $try" ;;
11673         esac
11674         ;;
11675         *)      case "$usethreads" in
11676                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11677                 esac
11678                 d_drand48_r=undef
11679                 drand48_r_proto=0
11680                 ;;
11681         esac
11682         ;;
11683 *)      drand48_r_proto=0
11684         ;;
11685 esac
11686
11687 : see if prototype for drand48 is available
11688 echo " "
11689 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11690 eval $hasproto
11691
11692 : see if dup2 exists
11693 set dup2 d_dup2
11694 eval $inlibc
11695
11696 : see if eaccess exists
11697 set eaccess d_eaccess
11698 eval $inlibc
11699
11700 : see if endgrent exists
11701 set endgrent d_endgrent
11702 eval $inlibc
11703
11704 : see if this is an grp system
11705 set grp.h i_grp
11706 eval $inhdr
11707
11708 case "$i_grp" in
11709 $define)
11710         xxx=`./findhdr grp.h`
11711         $cppstdin $cppflags $cppminus < $xxx >$$.h
11712
11713         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11714                 val="$define"
11715         else
11716                 val="$undef"
11717         fi
11718         set d_grpasswd
11719         eval $setvar
11720
11721         $rm -f $$.h
11722         ;;
11723 *)
11724         val="$undef";
11725         set d_grpasswd; eval $setvar
11726         ;;
11727 esac
11728
11729 : see if endgrent_r exists
11730 set endgrent_r d_endgrent_r
11731 eval $inlibc
11732 case "$d_endgrent_r" in
11733 "$define")
11734         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11735         case "$d_endgrent_r_proto:$usethreads" in
11736         ":define")      d_endgrent_r_proto=define
11737                 set d_endgrent_r_proto endgrent_r $hdrs
11738                 eval $hasproto ;;
11739         *)      ;;
11740         esac
11741         case "$d_endgrent_r_proto" in
11742         define)
11743         case "$endgrent_r_proto" in
11744         ''|0) try='int endgrent_r(FILE**);'
11745         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11746         esac
11747         case "$endgrent_r_proto" in
11748         ''|0) try='void endgrent_r(FILE**);'
11749         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11750         esac
11751         case "$endgrent_r_proto" in
11752         ''|0)   d_endgrent_r=undef
11753                 endgrent_r_proto=0
11754                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11755         * )     case "$endgrent_r_proto" in
11756                 REENTRANT_PROTO*) ;;
11757                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11758                 esac
11759                 echo "Prototype: $try" ;;
11760         esac
11761         ;;
11762         *)      case "$usethreads" in
11763                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11764                 esac
11765                 d_endgrent_r=undef
11766                 endgrent_r_proto=0
11767                 ;;
11768         esac
11769         ;;
11770 *)      endgrent_r_proto=0
11771         ;;
11772 esac
11773
11774 : see if endhostent exists
11775 set endhostent d_endhent
11776 eval $inlibc
11777
11778 : see if this is a netdb.h system
11779 set netdb.h i_netdb
11780 eval $inhdr
11781
11782 : see if endhostent_r exists
11783 set endhostent_r d_endhostent_r
11784 eval $inlibc
11785 case "$d_endhostent_r" in
11786 "$define")
11787         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11788         case "$d_endhostent_r_proto:$usethreads" in
11789         ":define")      d_endhostent_r_proto=define
11790                 set d_endhostent_r_proto endhostent_r $hdrs
11791                 eval $hasproto ;;
11792         *)      ;;
11793         esac
11794         case "$d_endhostent_r_proto" in
11795         define)
11796         case "$endhostent_r_proto" in
11797         ''|0) try='int endhostent_r(struct hostent_data*);'
11798         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11799         esac
11800         case "$endhostent_r_proto" in
11801         ''|0) try='void endhostent_r(struct hostent_data*);'
11802         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11803         esac
11804         case "$endhostent_r_proto" in
11805         ''|0)   d_endhostent_r=undef
11806                 endhostent_r_proto=0
11807                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11808         * )     case "$endhostent_r_proto" in
11809                 REENTRANT_PROTO*) ;;
11810                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11811                 esac
11812                 echo "Prototype: $try" ;;
11813         esac
11814         ;;
11815         *)      case "$usethreads" in
11816                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11817                 esac
11818                 d_endhostent_r=undef
11819                 endhostent_r_proto=0
11820                 ;;
11821         esac
11822         ;;
11823 *)      endhostent_r_proto=0
11824         ;;
11825 esac
11826
11827 : see if endnetent exists
11828 set endnetent d_endnent
11829 eval $inlibc
11830
11831 : see if endnetent_r exists
11832 set endnetent_r d_endnetent_r
11833 eval $inlibc
11834 case "$d_endnetent_r" in
11835 "$define")
11836         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11837         case "$d_endnetent_r_proto:$usethreads" in
11838         ":define")      d_endnetent_r_proto=define
11839                 set d_endnetent_r_proto endnetent_r $hdrs
11840                 eval $hasproto ;;
11841         *)      ;;
11842         esac
11843         case "$d_endnetent_r_proto" in
11844         define)
11845         case "$endnetent_r_proto" in
11846         ''|0) try='int endnetent_r(struct netent_data*);'
11847         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11848         esac
11849         case "$endnetent_r_proto" in
11850         ''|0) try='void endnetent_r(struct netent_data*);'
11851         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11852         esac
11853         case "$endnetent_r_proto" in
11854         ''|0)   d_endnetent_r=undef
11855                 endnetent_r_proto=0
11856                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11857         * )     case "$endnetent_r_proto" in
11858                 REENTRANT_PROTO*) ;;
11859                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11860                 esac
11861                 echo "Prototype: $try" ;;
11862         esac
11863         ;;
11864         *)      case "$usethreads" in
11865                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11866                 esac
11867                 d_endnetent_r=undef
11868                 endnetent_r_proto=0
11869                 ;;
11870         esac
11871         ;;
11872 *)      endnetent_r_proto=0
11873         ;;
11874 esac
11875
11876 : see if endprotoent exists
11877 set endprotoent d_endpent
11878 eval $inlibc
11879
11880 : see if endprotoent_r exists
11881 set endprotoent_r d_endprotoent_r
11882 eval $inlibc
11883 case "$d_endprotoent_r" in
11884 "$define")
11885         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11886         case "$d_endprotoent_r_proto:$usethreads" in
11887         ":define")      d_endprotoent_r_proto=define
11888                 set d_endprotoent_r_proto endprotoent_r $hdrs
11889                 eval $hasproto ;;
11890         *)      ;;
11891         esac
11892         case "$d_endprotoent_r_proto" in
11893         define)
11894         case "$endprotoent_r_proto" in
11895         ''|0) try='int endprotoent_r(struct protoent_data*);'
11896         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11897         esac
11898         case "$endprotoent_r_proto" in
11899         ''|0) try='void endprotoent_r(struct protoent_data*);'
11900         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11901         esac
11902         case "$endprotoent_r_proto" in
11903         ''|0)   d_endprotoent_r=undef
11904                 endprotoent_r_proto=0
11905                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11906         * )     case "$endprotoent_r_proto" in
11907                 REENTRANT_PROTO*) ;;
11908                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11909                 esac
11910                 echo "Prototype: $try" ;;
11911         esac
11912         ;;
11913         *)      case "$usethreads" in
11914                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11915                 esac
11916                 d_endprotoent_r=undef
11917                 endprotoent_r_proto=0
11918                 ;;
11919         esac
11920         ;;
11921 *)      endprotoent_r_proto=0
11922         ;;
11923 esac
11924
11925 : see if endpwent exists
11926 set endpwent d_endpwent
11927 eval $inlibc
11928
11929 : see if this is a pwd.h system
11930 set pwd.h i_pwd
11931 eval $inhdr
11932
11933 case "$i_pwd" in
11934 $define)
11935         xxx=`./findhdr pwd.h`
11936         $cppstdin $cppflags $cppminus < $xxx >$$.h
11937
11938         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11939                 val="$define"
11940         else
11941                 val="$undef"
11942         fi
11943         set d_pwquota
11944         eval $setvar
11945
11946         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11947                 val="$define"
11948         else
11949                 val="$undef"
11950         fi
11951         set d_pwage
11952         eval $setvar
11953
11954         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11955                 val="$define"
11956         else
11957                 val="$undef"
11958         fi
11959         set d_pwchange
11960         eval $setvar
11961
11962         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11963                 val="$define"
11964         else
11965                 val="$undef"
11966         fi
11967         set d_pwclass
11968         eval $setvar
11969
11970         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11971                 val="$define"
11972         else
11973                 val="$undef"
11974         fi
11975         set d_pwexpire
11976         eval $setvar
11977
11978         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11979                 val="$define"
11980         else
11981                 val="$undef"
11982         fi
11983         set d_pwcomment
11984         eval $setvar
11985
11986         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11987                 val="$define"
11988         else
11989                 val="$undef"
11990         fi
11991         set d_pwgecos
11992         eval $setvar
11993
11994         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11995                 val="$define"
11996         else
11997                 val="$undef"
11998         fi
11999         set d_pwpasswd
12000         eval $setvar
12001
12002         $rm -f $$.h
12003         ;;
12004 *)
12005         val="$undef"; 
12006         set d_pwquota; eval $setvar
12007         set d_pwage; eval $setvar
12008         set d_pwchange; eval $setvar
12009         set d_pwclass; eval $setvar
12010         set d_pwexpire; eval $setvar
12011         set d_pwcomment; eval $setvar
12012         set d_pwgecos; eval $setvar
12013         set d_pwpasswd; eval $setvar
12014         ;;
12015 esac
12016
12017 : see if endpwent_r exists
12018 set endpwent_r d_endpwent_r
12019 eval $inlibc
12020 case "$d_endpwent_r" in
12021 "$define")
12022         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12023         case "$d_endpwent_r_proto:$usethreads" in
12024         ":define")      d_endpwent_r_proto=define
12025                 set d_endpwent_r_proto endpwent_r $hdrs
12026                 eval $hasproto ;;
12027         *)      ;;
12028         esac
12029         case "$d_endpwent_r_proto" in
12030         define)
12031         case "$endpwent_r_proto" in
12032         ''|0) try='int endpwent_r(FILE**);'
12033         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12034         esac
12035         case "$endpwent_r_proto" in
12036         ''|0) try='void endpwent_r(FILE**);'
12037         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12038         esac
12039         case "$endpwent_r_proto" in
12040         ''|0)   d_endpwent_r=undef
12041                 endpwent_r_proto=0
12042                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12043         * )     case "$endpwent_r_proto" in
12044                 REENTRANT_PROTO*) ;;
12045                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12046                 esac
12047                 echo "Prototype: $try" ;;
12048         esac
12049         ;;
12050         *)      case "$usethreads" in
12051                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12052                 esac
12053                 d_endpwent_r=undef
12054                 endpwent_r_proto=0
12055                 ;;
12056         esac
12057         ;;
12058 *)      endpwent_r_proto=0
12059         ;;
12060 esac
12061
12062 : see if endservent exists
12063 set endservent d_endsent
12064 eval $inlibc
12065
12066 : see if endservent_r exists
12067 set endservent_r d_endservent_r
12068 eval $inlibc
12069 case "$d_endservent_r" in
12070 "$define")
12071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12072         case "$d_endservent_r_proto:$usethreads" in
12073         ":define")      d_endservent_r_proto=define
12074                 set d_endservent_r_proto endservent_r $hdrs
12075                 eval $hasproto ;;
12076         *)      ;;
12077         esac
12078         case "$d_endservent_r_proto" in
12079         define)
12080         case "$endservent_r_proto" in
12081         ''|0) try='int endservent_r(struct servent_data*);'
12082         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12083         esac
12084         case "$endservent_r_proto" in
12085         ''|0) try='void endservent_r(struct servent_data*);'
12086         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12087         esac
12088         case "$endservent_r_proto" in
12089         ''|0)   d_endservent_r=undef
12090                 endservent_r_proto=0
12091                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12092         * )     case "$endservent_r_proto" in
12093                 REENTRANT_PROTO*) ;;
12094                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12095                 esac
12096                 echo "Prototype: $try" ;;
12097         esac
12098         ;;
12099         *)      case "$usethreads" in
12100                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12101                 esac
12102                 d_endservent_r=undef
12103                 endservent_r_proto=0
12104                 ;;
12105         esac
12106         ;;
12107 *)      endservent_r_proto=0
12108         ;;
12109 esac
12110
12111 : Locate the flags for 'open()'
12112 echo " "
12113 $cat >try.c <<EOCP
12114 #include <sys/types.h>
12115 #ifdef I_FCNTL
12116 #include <fcntl.h>
12117 #endif
12118 #ifdef I_SYS_FILE
12119 #include <sys/file.h>
12120 #endif
12121 #$i_stdlib I_STDLIB
12122 #ifdef I_STDLIB
12123 #include <stdlib.h>
12124 #endif
12125 int main() {
12126         if(O_RDONLY);
12127 #ifdef O_TRUNC
12128         exit(0);
12129 #else
12130         exit(1);
12131 #endif
12132 }
12133 EOCP
12134 : check sys/file.h first to get FREAD on Sun
12135 if $test `./findhdr sys/file.h` && \
12136                 set try -DI_SYS_FILE && eval $compile; then
12137         h_sysfile=true;
12138         echo "<sys/file.h> defines the O_* constants..." >&4
12139         if $run ./try; then
12140                 echo "and you have the 3 argument form of open()." >&4
12141                 val="$define"
12142         else
12143                 echo "but not the 3 argument form of open().  Oh, well." >&4
12144                 val="$undef"
12145         fi
12146 elif $test `./findhdr fcntl.h` && \
12147                 set try -DI_FCNTL && eval $compile; then
12148         h_fcntl=true;
12149         echo "<fcntl.h> defines the O_* constants..." >&4
12150         if $run ./try; then
12151                 echo "and you have the 3 argument form of open()." >&4
12152                 val="$define"
12153         else
12154                 echo "but not the 3 argument form of open().  Oh, well." >&4
12155                 val="$undef"
12156         fi
12157 else
12158         val="$undef"
12159         echo "I can't find the O_* constant definitions!  You got problems." >&4
12160 fi
12161 set d_open3
12162 eval $setvar
12163 $rm_try
12164
12165 : see which of string.h or strings.h is needed
12166 echo " "
12167 strings=`./findhdr string.h`
12168 if $test "$strings" && $test -r "$strings"; then
12169         echo "Using <string.h> instead of <strings.h>." >&4
12170         val="$define"
12171 else
12172         val="$undef"
12173         strings=`./findhdr strings.h`
12174         if $test "$strings" && $test -r "$strings"; then
12175                 echo "Using <strings.h> instead of <string.h>." >&4
12176         else
12177                 echo "No string header found -- You'll surely have problems." >&4
12178         fi
12179 fi
12180 set i_string
12181 eval $setvar
12182 case "$i_string" in
12183 "$undef") strings=`./findhdr strings.h`;;
12184 *)        strings=`./findhdr string.h`;;
12185 esac
12186
12187 : see if this is a sys/file.h system
12188 val=''
12189 set sys/file.h val
12190 eval $inhdr
12191
12192 : do we need to include sys/file.h ?
12193 case "$val" in
12194 "$define")
12195         echo " "
12196         if $h_sysfile; then
12197                 val="$define"
12198                 echo "We'll be including <sys/file.h>." >&4
12199         else
12200                 val="$undef"
12201                 echo "We won't be including <sys/file.h>." >&4
12202         fi
12203         ;;
12204 *)
12205         h_sysfile=false
12206         ;;
12207 esac
12208 set i_sysfile
12209 eval $setvar
12210
12211 : see if fcntl.h is there
12212 val=''
12213 set fcntl.h val
12214 eval $inhdr
12215
12216 : see if we can include fcntl.h
12217 case "$val" in
12218 "$define")
12219         echo " "
12220         if $h_fcntl; then
12221                 val="$define"
12222                 echo "We'll be including <fcntl.h>." >&4
12223         else
12224                 val="$undef"
12225                 if $h_sysfile; then
12226         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12227                 else
12228                         echo "We won't be including <fcntl.h>." >&4
12229                 fi
12230         fi
12231         ;;
12232 *)
12233         h_fcntl=false
12234         val="$undef"
12235         ;;
12236 esac
12237 set i_fcntl
12238 eval $setvar
12239
12240 : see if fork exists
12241 set fork d_fork
12242 eval $inlibc
12243
12244 : see if pipe exists
12245 set pipe d_pipe
12246 eval $inlibc
12247
12248 : check for non-blocking I/O stuff
12249 case "$h_sysfile" in
12250 true) echo "#include <sys/file.h>" > head.c;;
12251 *)
12252        case "$h_fcntl" in
12253        true) echo "#include <fcntl.h>" > head.c;;
12254        *) echo "#include <sys/fcntl.h>" > head.c;;
12255        esac
12256        ;;
12257 esac
12258 echo " "
12259 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12260 case "$o_nonblock" in
12261 '')
12262         $cat head.c > try.c
12263         $cat >>try.c <<EOCP
12264 #include <stdio.h>
12265 #$i_stdlib I_STDLIB
12266 #ifdef I_STDLIB
12267 #include <stdlib.h>
12268 #endif
12269 #$i_fcntl I_FCNTL
12270 #ifdef I_FCNTL
12271 #include <fcntl.h>
12272 #endif
12273 int main() {
12274 #ifdef O_NONBLOCK
12275         printf("O_NONBLOCK\n");
12276         exit(0);
12277 #endif
12278 #ifdef O_NDELAY
12279         printf("O_NDELAY\n");
12280         exit(0);
12281 #endif
12282 #ifdef FNDELAY
12283         printf("FNDELAY\n");
12284         exit(0);
12285 #endif
12286         exit(0);
12287 }
12288 EOCP
12289         set try
12290         if eval $compile_ok; then
12291                 o_nonblock=`$run ./try`
12292                 case "$o_nonblock" in
12293                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12294                 *) echo "Seems like we can use $o_nonblock.";;
12295                 esac
12296         else
12297                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12298         fi
12299         ;;
12300 *) echo "Using $hint value $o_nonblock.";;
12301 esac
12302 $rm_try
12303
12304 echo " "
12305 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12306 case "$eagain" in
12307 '')
12308         case "$d_fork:$d_pipe" in
12309         define:define)
12310         $cat head.c > try.c
12311         $cat >>try.c <<EOCP
12312 #include <errno.h>
12313 #include <sys/types.h>
12314 #include <signal.h>
12315 #include <stdio.h>
12316 #$i_stdlib I_STDLIB
12317 #ifdef I_STDLIB
12318 #include <stdlib.h>
12319 #endif
12320 #$i_fcntl I_FCNTL
12321 #ifdef I_FCNTL
12322 #include <fcntl.h>
12323 #endif
12324 #define MY_O_NONBLOCK $o_nonblock
12325 #ifndef errno  /* XXX need better Configure test */
12326 extern int errno;
12327 #endif
12328 #$i_unistd I_UNISTD
12329 #ifdef I_UNISTD
12330 #include <unistd.h>
12331 #endif
12332 #$i_string I_STRING
12333 #ifdef I_STRING
12334 #include <string.h>
12335 #else
12336 #include <strings.h>
12337 #endif
12338 $signal_t blech(int x) { exit(3); }
12339 EOCP
12340         $cat >> try.c <<'EOCP'
12341 int main()
12342 {
12343         int pd[2];
12344         int pu[2];
12345         char buf[1];
12346         char string[100];
12347
12348         pipe(pd);       /* Down: child -> parent */
12349         pipe(pu);       /* Up: parent -> child */
12350         if (0 != fork()) {
12351                 int ret;
12352                 close(pd[1]);   /* Parent reads from pd[0] */
12353                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12354 #ifdef F_SETFL
12355                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12356                         exit(1);
12357 #else
12358                 exit(4);
12359 #endif
12360                 signal(SIGALRM, blech);
12361                 alarm(5);
12362                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12363                         exit(2);
12364                 sprintf(string, "%d\n", ret);
12365                 write(2, string, strlen(string));
12366                 alarm(0);
12367 #ifdef EAGAIN
12368                 if (errno == EAGAIN) {
12369                         printf("EAGAIN\n");
12370                         goto ok;
12371                 }
12372 #endif
12373 #ifdef EWOULDBLOCK
12374                 if (errno == EWOULDBLOCK)
12375                         printf("EWOULDBLOCK\n");
12376 #endif
12377         ok:
12378                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12379                 sleep(2);                               /* Give it time to close our pipe */
12380                 alarm(5);
12381                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12382                 alarm(0);
12383                 sprintf(string, "%d\n", ret);
12384                 write(4, string, strlen(string));
12385                 exit(0);
12386         }
12387
12388         close(pd[0]);                   /* We write to pd[1] */
12389         close(pu[1]);                   /* We read from pu[0] */
12390         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12391         close(pd[1]);                   /* Pipe pd is now fully closed! */
12392         exit(0);                                /* Bye bye, thank you for playing! */
12393 }
12394 EOCP
12395         set try
12396         if eval $compile_ok; then
12397                 echo "$startsh" >mtry
12398                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12399                 chmod +x mtry
12400                 ./mtry >/dev/null 2>&1
12401                 case $? in
12402                 0) eagain=`$cat try.out`;;
12403                 1) echo "Could not perform non-blocking setting!";;
12404                 2) echo "I did a successful read() for something that was not there!";;
12405                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12406                 4) echo "Could not find F_SETFL!";;
12407                 *) echo "Something terribly wrong happened during testing.";;
12408                 esac
12409                 rd_nodata=`$cat try.ret`
12410                 echo "A read() system call with no data present returns $rd_nodata."
12411                 case "$rd_nodata" in
12412                 0|-1) ;;
12413                 *)
12414                         echo "(That's peculiar, fixing that to be -1.)"
12415                         rd_nodata=-1
12416                         ;;
12417                 esac
12418                 case "$eagain" in
12419                 '')
12420                         echo "Forcing errno EAGAIN on read() with no data available."
12421                         eagain=EAGAIN
12422                         ;;
12423                 *)
12424                         echo "Your read() sets errno to $eagain when no data is available."
12425                         ;;
12426                 esac
12427                 status=`$cat try.err`
12428                 case "$status" in
12429                 0) echo "And it correctly returns 0 to signal EOF.";;
12430                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12431                 *) echo "However, your read() returns '$status' on EOF??";;
12432                 esac
12433                 val="$define"
12434                 if test "$status" = "$rd_nodata"; then
12435                         echo "WARNING: you can't distinguish between EOF and no data!"
12436                         val="$undef"
12437                 fi
12438         else
12439                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12440                 eagain=EAGAIN
12441         fi
12442         ;;
12443         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12444                 eagain=EAGAIN
12445                 val="$define"
12446                 ;;
12447         esac
12448         set d_eofnblk
12449         eval $setvar
12450         ;;
12451 *)
12452         echo "Using $hint value $eagain."
12453         echo "Your read() returns $rd_nodata when no data is present."
12454         case "$d_eofnblk" in
12455         "$define") echo "And you can see EOF because read() returns 0.";;
12456         "$undef") echo "But you can't see EOF status from read() returned value.";;
12457         *)
12458                 echo "(Assuming you can't see EOF status from read anyway.)"
12459                 d_eofnblk=$undef
12460                 ;;
12461         esac
12462         ;;
12463 esac
12464 $rm_try head.c mtry
12465
12466 : see if _ptr and _cnt from stdio act std
12467 echo " "
12468
12469 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12470         echo "(Looks like you have stdio.h from BSD.)"
12471         case "$stdio_ptr" in
12472         '') stdio_ptr='((fp)->_p)'
12473                 ptr_lval=$define
12474                 ;;
12475         *)      ptr_lval=$d_stdio_ptr_lval;;
12476         esac
12477         case "$stdio_cnt" in
12478         '') stdio_cnt='((fp)->_r)'
12479                 cnt_lval=$define
12480                 ;;
12481         *)      cnt_lval=$d_stdio_cnt_lval;;
12482         esac
12483         case "$stdio_base" in
12484         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12485         esac
12486         case "$stdio_bufsiz" in
12487         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12488         esac
12489 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12490         echo "(Looks like you have stdio.h from Linux.)"
12491         case "$stdio_ptr" in
12492         '') stdio_ptr='((fp)->_IO_read_ptr)'
12493                 ptr_lval=$define
12494                 ;;
12495         *)      ptr_lval=$d_stdio_ptr_lval;;
12496         esac
12497         case "$stdio_cnt" in
12498         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12499                 cnt_lval=$undef
12500                 ;;
12501         *)      cnt_lval=$d_stdio_cnt_lval;;
12502         esac
12503         case "$stdio_base" in
12504         '') stdio_base='((fp)->_IO_read_base)';;
12505         esac
12506         case "$stdio_bufsiz" in
12507         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12508         esac
12509 else
12510         case "$stdio_ptr" in
12511         '') stdio_ptr='((fp)->_ptr)'
12512                 ptr_lval=$define
12513                 ;;
12514         *)      ptr_lval=$d_stdio_ptr_lval;;
12515         esac
12516         case "$stdio_cnt" in
12517         '') stdio_cnt='((fp)->_cnt)'
12518                 cnt_lval=$define
12519                 ;;
12520         *)      cnt_lval=$d_stdio_cnt_lval;;
12521         esac
12522         case "$stdio_base" in
12523         '') stdio_base='((fp)->_base)';;
12524         esac
12525         case "$stdio_bufsiz" in
12526         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12527         esac
12528 fi
12529
12530 : test whether _ptr and _cnt really work
12531 echo "Checking how std your stdio is..." >&4
12532 $cat >try.c <<EOP
12533 #include <stdio.h>
12534 #$i_stdlib I_STDLIB
12535 #ifdef I_STDLIB
12536 #include <stdlib.h>
12537 #endif
12538 #define FILE_ptr(fp)    $stdio_ptr
12539 #define FILE_cnt(fp)    $stdio_cnt
12540 int main() {
12541         FILE *fp = fopen("try.c", "r");
12542         char c = getc(fp);
12543         if (
12544                 18 <= FILE_cnt(fp) &&
12545                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12546         )
12547                 exit(0);
12548         exit(1);
12549 }
12550 EOP
12551 val="$undef"
12552 set try
12553 if eval $compile && $to try.c; then
12554         if $run ./try; then
12555                 echo "Your stdio acts pretty std."
12556                 val="$define"
12557         else
12558                 echo "Your stdio isn't very std."
12559         fi
12560 else
12561         echo "Your stdio doesn't appear very std."
12562 fi
12563 $rm_try
12564
12565 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12566 # direct buffer manipulation no longer works.  The Configure tests
12567 # should be changed to correctly detect this, but until then,
12568 # the following check should at least let perl compile and run.
12569 # (This quick fix should be updated before 5.8.1.)
12570 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12571 # A. Dougherty, June 3, 2002.
12572 case "$d_gnulibc" in
12573 $define)
12574         case "$gnulibc_version" in
12575         2.[01]*)  ;;
12576         2.2) ;;
12577         2.2.[0-9]) ;;
12578         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12579                 val="$undef"
12580                 ;;
12581         esac
12582         ;;
12583 esac
12584 set d_stdstdio
12585 eval $setvar
12586
12587 : Can _ptr be used as an lvalue?
12588 case "$d_stdstdio$ptr_lval" in
12589 $define$define) val=$define ;;
12590 *) val=$undef ;;
12591 esac
12592 set d_stdio_ptr_lval
12593 eval $setvar
12594
12595 : Can _cnt be used as an lvalue?
12596 case "$d_stdstdio$cnt_lval" in
12597 $define$define) val=$define ;;
12598 *) val=$undef ;;
12599 esac
12600 set d_stdio_cnt_lval
12601 eval $setvar
12602
12603
12604 : test whether setting _ptr sets _cnt as a side effect
12605 d_stdio_ptr_lval_sets_cnt="$undef"
12606 d_stdio_ptr_lval_nochange_cnt="$undef"
12607 case "$d_stdio_ptr_lval$d_stdstdio" in
12608 $define$define)
12609         echo "Checking to see what happens if we set the stdio ptr..." >&4
12610 $cat >try.c <<EOP
12611 #include <stdio.h>
12612 /* Can we scream? */
12613 /* Eat dust sed :-) */
12614 /* In the buffer space, no one can hear you scream. */
12615 #$i_stdlib I_STDLIB
12616 #ifdef I_STDLIB
12617 #include <stdlib.h>
12618 #endif
12619 #define FILE_ptr(fp)    $stdio_ptr
12620 #define FILE_cnt(fp)    $stdio_cnt
12621 #include <sys/types.h>
12622 int main() {
12623         FILE *fp = fopen("try.c", "r");
12624         int c;
12625         char *ptr;
12626         size_t cnt;
12627         if (!fp) {
12628             puts("Fail even to read");
12629             exit(1);
12630         }
12631         c = getc(fp); /* Read away the first # */
12632         if (c == EOF) {
12633             puts("Fail even to read");
12634             exit(1);
12635         }
12636         if (!(
12637                 18 <= FILE_cnt(fp) &&
12638                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12639         )) {
12640                 puts("Fail even to read");
12641                 exit (1);
12642         }
12643         ptr = (char*) FILE_ptr(fp);
12644         cnt = (size_t)FILE_cnt(fp);
12645
12646         FILE_ptr(fp) += 42;
12647
12648         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12649                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12650                 exit (1);
12651         }
12652         if (FILE_cnt(fp) <= 20) {
12653                 printf ("Fail (<20 chars to test)");
12654                 exit (1);
12655         }
12656         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12657                 puts("Fail compare");
12658                 exit (1);
12659         }
12660         if (cnt == FILE_cnt(fp)) {
12661                 puts("Pass_unchanged");
12662                 exit (0);
12663         }
12664         if (FILE_cnt(fp) == (cnt - 42)) {
12665                 puts("Pass_changed");
12666                 exit (0);
12667         }
12668         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12669         return 1;
12670
12671 }
12672 EOP
12673         set try
12674         if eval $compile && $to try.c; then
12675                 case `$run ./try` in
12676                 Pass_changed)
12677                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12678                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12679                 Pass_unchanged)
12680                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12681                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12682                 Fail*)
12683                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12684                 *)
12685                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12686         esac
12687         else
12688                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12689         fi
12690         $rm_try
12691         ;;
12692 esac
12693
12694 : see if _base is also standard
12695 val="$undef"
12696 case "$d_stdstdio" in
12697 $define)
12698         $cat >try.c <<EOP
12699 #include <stdio.h>
12700 #$i_stdlib I_STDLIB
12701 #ifdef I_STDLIB
12702 #include <stdlib.h>
12703 #endif
12704 #define FILE_base(fp)   $stdio_base
12705 #define FILE_bufsiz(fp) $stdio_bufsiz
12706 int main() {
12707         FILE *fp = fopen("try.c", "r");
12708         char c = getc(fp);
12709         if (
12710                 19 <= FILE_bufsiz(fp) &&
12711                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12712         )
12713                 exit(0);
12714         exit(1);
12715 }
12716 EOP
12717         set try
12718         if eval $compile && $to try.c; then
12719                 if $run ./try; then
12720                         echo "And its _base field acts std."
12721                         val="$define"
12722                 else
12723                         echo "But its _base field isn't std."
12724                 fi
12725         else
12726                 echo "However, it seems to be lacking the _base field."
12727         fi
12728         $rm_try
12729         ;;
12730 esac
12731 set d_stdiobase
12732 eval $setvar
12733
12734 : see if fast_stdio exists
12735 val="$undef"
12736 case "$d_stdstdio:$d_stdio_ptr_lval" in
12737 "$define:$define")
12738         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12739         *$define*)
12740                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12741                 val="$define"
12742                 ;;
12743         esac
12744         ;;
12745 esac
12746 set d_faststdio
12747 eval $setvar
12748
12749
12750
12751 : see if fchdir exists
12752 set fchdir d_fchdir
12753 eval $inlibc
12754
12755 : see if fchmod exists
12756 set fchmod d_fchmod
12757 eval $inlibc
12758
12759 : see if fchown exists
12760 set fchown d_fchown
12761 eval $inlibc
12762
12763 : see if this is an fcntl system
12764 set fcntl d_fcntl
12765 eval $inlibc
12766
12767 echo " "
12768 : See if fcntl-based locking works.
12769 $cat >try.c <<EOCP
12770 #$i_stdlib I_STDLIB
12771 #ifdef I_STDLIB
12772 #include <stdlib.h>
12773 #endif
12774 #include <unistd.h>
12775 #include <fcntl.h>
12776 #include <signal.h>
12777 $signal_t blech(int x) { exit(3); }
12778 int main() {
12779 #if defined(F_SETLK) && defined(F_SETLKW)
12780      struct flock flock;
12781      int retval, fd;
12782      fd = open("try.c", O_RDONLY);
12783      flock.l_type = F_RDLCK;
12784      flock.l_whence = SEEK_SET;
12785      flock.l_start = flock.l_len = 0;
12786      signal(SIGALRM, blech);
12787      alarm(10);
12788      retval = fcntl(fd, F_SETLK, &flock);
12789      close(fd);
12790      (retval < 0 ? exit(2) : exit(0));
12791 #else
12792      exit(2);
12793 #endif
12794 }
12795 EOCP
12796 echo "Checking if fcntl-based file locking works... "
12797 case "$d_fcntl" in
12798 "$define")
12799         set try
12800         if eval $compile_ok; then
12801                 if $run ./try; then
12802                         echo "Yes, it seems to work."
12803                         val="$define"
12804                 else
12805                         echo "Nope, it didn't work."
12806                         val="$undef"
12807                         case "$?" in
12808                         3) $cat >&4 <<EOM
12809 ***
12810 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12811 *** This is (almost) impossible.
12812 *** If your NFS lock daemons are not feeling well, something like
12813 *** this may happen, please investigate.  Cannot continue, aborting.
12814 ***
12815 EOM
12816                                 exit 1
12817                                 ;;
12818                         esac
12819                 fi
12820         else
12821                 echo "I'm unable to compile the test program, so I'll assume not."
12822                 val="$undef"
12823         fi
12824         ;;
12825 *) val="$undef";
12826         echo "Nope, since you don't even have fcntl()."
12827         ;;
12828 esac
12829 set d_fcntl_can_lock
12830 eval $setvar
12831 $rm_try
12832
12833 : check for fd_set items
12834 $cat <<EOM
12835
12836 Checking to see how well your C compiler handles fd_set and friends ...
12837 EOM
12838 $cat >try.c <<EOCP
12839 #$i_stdlib I_STDLIB
12840 #ifdef I_STDLIB
12841 #include <stdlib.h>
12842 #endif
12843 #$i_systime I_SYS_TIME
12844 #$i_sysselct I_SYS_SELECT
12845 #$d_socket HAS_SOCKET
12846 #include <sys/types.h>
12847 #ifdef HAS_SOCKET
12848 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12849 #endif
12850 #ifdef I_SYS_TIME
12851 #include <sys/time.h>
12852 #endif
12853 #ifdef I_SYS_SELECT
12854 #include <sys/select.h>
12855 #endif
12856 int main() {
12857         fd_set fds;
12858
12859 #ifdef TRYBITS
12860         if(fds.fds_bits);
12861 #endif
12862
12863 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12864         exit(0);
12865 #else
12866         exit(1);
12867 #endif
12868 }
12869 EOCP
12870 set try -DTRYBITS
12871 if eval $compile; then
12872         d_fds_bits="$define"
12873         d_fd_set="$define"
12874         echo "Well, your system knows about the normal fd_set typedef..." >&4
12875         if $run ./try; then
12876                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12877                 d_fd_macros="$define"
12878         else
12879                 $cat >&4 <<'EOM'
12880 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12881 EOM
12882                 d_fd_macros="$undef"
12883         fi
12884 else
12885         $cat <<'EOM'
12886 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12887 EOM
12888         set try
12889         if eval $compile; then
12890                 d_fds_bits="$undef"
12891                 d_fd_set="$define"
12892                 echo "Well, your system has some sort of fd_set available..." >&4
12893                 if $run ./try; then
12894                         echo "and you have the normal fd_set macros." >&4
12895                         d_fd_macros="$define"
12896                 else
12897                         $cat <<'EOM'
12898 but not the normal fd_set macros!  Gross!  More work for me...
12899 EOM
12900                         d_fd_macros="$undef"
12901                 fi
12902         else
12903         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12904                 d_fd_set="$undef"
12905                 d_fds_bits="$undef"
12906                 d_fd_macros="$undef"
12907         fi
12908 fi
12909 $rm_try
12910
12911 : see if fgetpos exists
12912 set fgetpos d_fgetpos
12913 eval $inlibc
12914
12915 : see if finite exists
12916 set finite d_finite
12917 eval $inlibc
12918
12919 : see if finitel exists
12920 set finitel d_finitel
12921 eval $inlibc
12922
12923 : see if flock exists
12924 set flock d_flock
12925 eval $inlibc
12926
12927 : see if prototype for flock is available
12928 echo " "
12929 set d_flockproto flock $i_sysfile sys/file.h
12930 eval $hasproto
12931
12932 : see if fp_class exists
12933 set fp_class d_fp_class
12934 eval $inlibc
12935
12936 : see if pathconf exists
12937 set pathconf d_pathconf
12938 eval $inlibc
12939
12940 : see if fpathconf exists
12941 set fpathconf d_fpathconf
12942 eval $inlibc
12943
12944 : see if fpclass exists
12945 set fpclass d_fpclass
12946 eval $inlibc
12947
12948 : see if fpclassify exists
12949 set fpclassify d_fpclassify
12950 eval $inlibc
12951
12952 : see if fpclassl exists
12953 set fpclassl d_fpclassl
12954 eval $inlibc
12955
12956
12957 : check for fpos64_t
12958 echo " "
12959 echo "Checking to see if you have fpos64_t..." >&4
12960 $cat >try.c <<EOCP
12961 #include <stdio.h>
12962 int main() { fpos64_t x = 7; }
12963 EOCP
12964 set try
12965 if eval $compile; then
12966         val="$define"
12967         echo "You have fpos64_t."
12968 else
12969         val="$undef"
12970         echo "You do not have fpos64_t."
12971         case "$fpossize" in
12972         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12973         esac
12974 fi
12975 $rm_try
12976 set d_fpos64_t
12977 eval $setvar
12978
12979 : see if frexpl exists
12980 set frexpl d_frexpl
12981 eval $inlibc
12982
12983 : see if this is a sys/param system
12984 set sys/param.h i_sysparam
12985 eval $inhdr
12986
12987 : see if this is a sys/mount.h system
12988 set sys/mount.h i_sysmount
12989 eval $inhdr
12990
12991
12992 echo " "
12993 echo "Checking to see if your system supports struct fs_data..." >&4
12994 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12995 eval $hasstruct
12996 case "$d_fs_data_s" in
12997 "$define")      echo "Yes, it does."   ;;
12998 *)              echo "No, it doesn't." ;;
12999 esac
13000
13001 : see if fseeko exists
13002 set fseeko d_fseeko
13003 eval $inlibc
13004 case "$longsize" in
13005 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13006 esac
13007
13008 : see if fsetpos exists
13009 set fsetpos d_fsetpos
13010 eval $inlibc
13011
13012
13013 : see if fstatfs exists
13014 set fstatfs d_fstatfs
13015 eval $inlibc
13016
13017
13018 : see if statvfs exists
13019 set statvfs d_statvfs
13020 eval $inlibc
13021
13022 : see if fstatvfs exists
13023 set fstatvfs d_fstatvfs
13024 eval $inlibc
13025
13026
13027 : see if fsync exists
13028 set fsync d_fsync
13029 eval $inlibc
13030
13031 : see if ftello exists
13032 set ftello d_ftello
13033 eval $inlibc
13034 case "$longsize" in
13035 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13036 esac
13037
13038 d_futimes="$undef"
13039 : check for a working futimes
13040 echo " "
13041 echo "Checking if you have a working futimes()" >&4
13042 $cat >try.c <<EOCP
13043 #include <stdio.h>
13044 #include <sys/time.h>
13045 #include <errno.h>
13046 #include <fcntl.h>
13047
13048 int main ()
13049 {
13050     int fd, rv;
13051     fd = open ("try.c", O_RDWR);
13052     if (-1 == fd) exit (1);
13053     rv = futimes (fd, NULL);
13054     exit (rv == -1 ? errno : 0);
13055 }
13056 EOCP
13057 set try
13058 if eval $compile; then
13059     `$run ./try`
13060     rc=$?
13061     case "$rc" in
13062         0)  echo "Yes, you have" >&4
13063             d_futimes="$define"
13064             ;;
13065         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13066             ;;
13067     esac
13068 else
13069     echo "No, it does not (probably harmless)" >&4
13070 fi
13071 $rm_try
13072
13073 : see if getcwd exists
13074 set getcwd d_getcwd
13075 eval $inlibc
13076
13077 : see if getespwnam exists
13078 set getespwnam d_getespwnam
13079 eval $inlibc
13080
13081
13082 : see if getfsstat exists
13083 set getfsstat d_getfsstat
13084 eval $inlibc
13085
13086 : see if getgrent exists
13087 set getgrent d_getgrent
13088 eval $inlibc
13089
13090 : see if getgrent_r exists
13091 set getgrent_r d_getgrent_r
13092 eval $inlibc
13093 case "$d_getgrent_r" in
13094 "$define")
13095         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13096         case "$d_getgrent_r_proto:$usethreads" in
13097         ":define")      d_getgrent_r_proto=define
13098                 set d_getgrent_r_proto getgrent_r $hdrs
13099                 eval $hasproto ;;
13100         *)      ;;
13101         esac
13102         case "$d_getgrent_r_proto" in
13103         define)
13104         case "$getgrent_r_proto" in
13105         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13106         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13107         esac
13108         case "$getgrent_r_proto" in
13109         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13110         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13111         esac
13112         case "$getgrent_r_proto" in
13113         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13114         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13115         esac
13116         case "$getgrent_r_proto" in
13117         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13118         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13119         esac
13120         case "$getgrent_r_proto" in
13121         ''|0) try='int getgrent_r(struct group*, char*, int);'
13122         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13123         esac
13124         case "$getgrent_r_proto" in
13125         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13126         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13127         esac
13128         case "$getgrent_r_proto" in
13129         ''|0)   d_getgrent_r=undef
13130                 getgrent_r_proto=0
13131                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13132         * )     case "$getgrent_r_proto" in
13133                 REENTRANT_PROTO*) ;;
13134                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13135                 esac
13136                 echo "Prototype: $try" ;;
13137         esac
13138         ;;
13139         *)      case "$usethreads" in
13140                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13141                 esac
13142                 d_getgrent_r=undef
13143                 getgrent_r_proto=0
13144                 ;;
13145         esac
13146         ;;
13147 *)      getgrent_r_proto=0
13148         ;;
13149 esac
13150
13151 : see if getgrgid_r exists
13152 set getgrgid_r d_getgrgid_r
13153 eval $inlibc
13154 case "$d_getgrgid_r" in
13155 "$define")
13156         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13157         case "$d_getgrgid_r_proto:$usethreads" in
13158         ":define")      d_getgrgid_r_proto=define
13159                 set d_getgrgid_r_proto getgrgid_r $hdrs
13160                 eval $hasproto ;;
13161         *)      ;;
13162         esac
13163         case "$d_getgrgid_r_proto" in
13164         define)
13165         case "$getgrgid_r_proto" in
13166         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13167         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13168         esac
13169         case "$getgrgid_r_proto" in
13170         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13171         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13172         esac
13173         case "$getgrgid_r_proto" in
13174         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13175         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13176         esac
13177         case "$getgrgid_r_proto" in
13178         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13179         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13180         esac
13181         case "$getgrgid_r_proto" in
13182         ''|0)   d_getgrgid_r=undef
13183                 getgrgid_r_proto=0
13184                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13185         * )     case "$getgrgid_r_proto" in
13186                 REENTRANT_PROTO*) ;;
13187                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13188                 esac
13189                 echo "Prototype: $try" ;;
13190         esac
13191         ;;
13192         *)      case "$usethreads" in
13193                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13194                 esac
13195                 d_getgrgid_r=undef
13196                 getgrgid_r_proto=0
13197                 ;;
13198         esac
13199         ;;
13200 *)      getgrgid_r_proto=0
13201         ;;
13202 esac
13203
13204 : see if getgrnam_r exists
13205 set getgrnam_r d_getgrnam_r
13206 eval $inlibc
13207 case "$d_getgrnam_r" in
13208 "$define")
13209         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13210         case "$d_getgrnam_r_proto:$usethreads" in
13211         ":define")      d_getgrnam_r_proto=define
13212                 set d_getgrnam_r_proto getgrnam_r $hdrs
13213                 eval $hasproto ;;
13214         *)      ;;
13215         esac
13216         case "$d_getgrnam_r_proto" in
13217         define)
13218         case "$getgrnam_r_proto" in
13219         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13220         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13221         esac
13222         case "$getgrnam_r_proto" in
13223         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13224         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13225         esac
13226         case "$getgrnam_r_proto" in
13227         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13228         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13229         esac
13230         case "$getgrnam_r_proto" in
13231         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13232         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13233         esac
13234         case "$getgrnam_r_proto" in
13235         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13236         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13237         esac
13238         case "$getgrnam_r_proto" in
13239         ''|0)   d_getgrnam_r=undef
13240                 getgrnam_r_proto=0
13241                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13242         * )     case "$getgrnam_r_proto" in
13243                 REENTRANT_PROTO*) ;;
13244                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13245                 esac
13246                 echo "Prototype: $try" ;;
13247         esac
13248         ;;
13249         *)      case "$usethreads" in
13250                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13251                 esac
13252                 d_getgrnam_r=undef
13253                 getgrnam_r_proto=0
13254                 ;;
13255         esac
13256         ;;
13257 *)      getgrnam_r_proto=0
13258         ;;
13259 esac
13260
13261 : see if gethostbyaddr exists
13262 set gethostbyaddr d_gethbyaddr
13263 eval $inlibc
13264
13265 : see if gethostbyname exists
13266 set gethostbyname d_gethbyname
13267 eval $inlibc
13268
13269 : see if gethostent exists
13270 set gethostent d_gethent
13271 eval $inlibc
13272
13273 : see how we will look up host name
13274 echo " "
13275 call=''
13276 if set gethostname val -f d_gethname; eval $csym; $val; then
13277         echo 'gethostname() found.' >&4
13278         d_gethname="$define"
13279         call=gethostname
13280 fi
13281 if set uname val -f d_uname; eval $csym; $val; then
13282         if ./xenix; then
13283                 $cat <<'EOM'
13284 uname() was found, but you're running xenix, and older versions of xenix
13285 have a broken uname(). If you don't really know whether your xenix is old
13286 enough to have a broken system call, use the default answer.
13287
13288 EOM
13289                 dflt=y
13290                 case "$d_uname" in
13291                 "$define") dflt=n;;
13292                 esac
13293                 rp='Is your uname() broken?'
13294                 . ./myread
13295                 case "$ans" in
13296                 n*) d_uname="$define"; call=uname;;
13297                 esac
13298         else
13299                 echo 'uname() found.' >&4
13300                 d_uname="$define"
13301                 case "$call" in
13302                 '') call=uname ;;
13303                 esac
13304         fi
13305 fi
13306 case "$d_gethname" in
13307 '') d_gethname="$undef";;
13308 esac
13309 case "$d_uname" in
13310 '') d_uname="$undef";;
13311 esac
13312 case "$d_uname$d_gethname" in
13313 *define*)
13314         dflt=n
13315         cat <<EOM
13316  
13317 Every now and then someone has a $call() that lies about the hostname
13318 but can't be fixed for political or economic reasons.  If you wish, I can
13319 pretend $call() isn't there and maybe compute hostname at run-time
13320 thanks to the '$phostname' command.
13321
13322 EOM
13323         rp="Shall I ignore $call() from now on?"
13324         . ./myread
13325         case "$ans" in
13326         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13327         esac;;
13328 esac
13329 case "$phostname" in
13330 '') aphostname='';;
13331 *) case "$aphostname" in
13332         /*) ;;
13333         *) set X $phostname
13334                 shift
13335                 file=$1
13336                 shift
13337                 file=`./loc $file $file $pth`
13338                 aphostname=`echo $file $*`
13339                 ;;
13340         esac
13341         ;;
13342 esac
13343 case "$d_uname$d_gethname" in
13344 *define*) ;;
13345 *)
13346         case "$phostname" in
13347         '')
13348                 echo "There will be no way for $package to get your hostname." >&4;;
13349         *)
13350         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13351                 ;;
13352         esac;;
13353 esac
13354 case "$d_phostname" in
13355 '') d_phostname="$undef";;
13356 esac
13357
13358 : see if gethostbyaddr_r exists
13359 set gethostbyaddr_r d_gethostbyaddr_r
13360 eval $inlibc
13361 case "$d_gethostbyaddr_r" in
13362 "$define")
13363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13364         case "$d_gethostbyaddr_r_proto:$usethreads" in
13365         ":define")      d_gethostbyaddr_r_proto=define
13366                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13367                 eval $hasproto ;;
13368         *)      ;;
13369         esac
13370         case "$d_gethostbyaddr_r_proto" in
13371         define)
13372         case "$gethostbyaddr_r_proto" in
13373         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13374         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13375         esac
13376         case "$gethostbyaddr_r_proto" in
13377         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13378         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13379         esac
13380         case "$gethostbyaddr_r_proto" in
13381         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13382         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13383         esac
13384         case "$gethostbyaddr_r_proto" in
13385         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13386         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13387         esac
13388         case "$gethostbyaddr_r_proto" in
13389         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13390         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13391         esac
13392         case "$gethostbyaddr_r_proto" in
13393         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13394         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13395         esac
13396         case "$gethostbyaddr_r_proto" in
13397         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13398         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13399         esac
13400         case "$gethostbyaddr_r_proto" in
13401         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13402         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13403         esac
13404         case "$gethostbyaddr_r_proto" in
13405         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13406         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13407         esac
13408         case "$gethostbyaddr_r_proto" in
13409         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13410         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13411         esac
13412         case "$gethostbyaddr_r_proto" in
13413         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13414         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13415         esac
13416         case "$gethostbyaddr_r_proto" in
13417         ''|0)   d_gethostbyaddr_r=undef
13418                 gethostbyaddr_r_proto=0
13419                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13420         * )     case "$gethostbyaddr_r_proto" in
13421                 REENTRANT_PROTO*) ;;
13422                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13423                 esac
13424                 echo "Prototype: $try" ;;
13425         esac
13426         ;;
13427         *)      case "$usethreads" in
13428                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13429                 esac
13430                 d_gethostbyaddr_r=undef
13431                 gethostbyaddr_r_proto=0
13432                 ;;
13433         esac
13434         ;;
13435 *)      gethostbyaddr_r_proto=0
13436         ;;
13437 esac
13438
13439 : see if gethostbyname_r exists
13440 set gethostbyname_r d_gethostbyname_r
13441 eval $inlibc
13442 case "$d_gethostbyname_r" in
13443 "$define")
13444         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13445         case "$d_gethostbyname_r_proto:$usethreads" in
13446         ":define")      d_gethostbyname_r_proto=define
13447                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13448                 eval $hasproto ;;
13449         *)      ;;
13450         esac
13451         case "$d_gethostbyname_r_proto" in
13452         define)
13453         case "$gethostbyname_r_proto" in
13454         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13455         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13456         esac
13457         case "$gethostbyname_r_proto" in
13458         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13459         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13460         esac
13461         case "$gethostbyname_r_proto" in
13462         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13463         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13464         esac
13465         case "$gethostbyname_r_proto" in
13466         ''|0)   d_gethostbyname_r=undef
13467                 gethostbyname_r_proto=0
13468                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13469         * )     case "$gethostbyname_r_proto" in
13470                 REENTRANT_PROTO*) ;;
13471                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13472                 esac
13473                 echo "Prototype: $try" ;;
13474         esac
13475         ;;
13476         *)      case "$usethreads" in
13477                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13478                 esac
13479                 d_gethostbyname_r=undef
13480                 gethostbyname_r_proto=0
13481                 ;;
13482         esac
13483         ;;
13484 *)      gethostbyname_r_proto=0
13485         ;;
13486 esac
13487
13488 : see if gethostent_r exists
13489 set gethostent_r d_gethostent_r
13490 eval $inlibc
13491 case "$d_gethostent_r" in
13492 "$define")
13493         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13494         case "$d_gethostent_r_proto:$usethreads" in
13495         ":define")      d_gethostent_r_proto=define
13496                 set d_gethostent_r_proto gethostent_r $hdrs
13497                 eval $hasproto ;;
13498         *)      ;;
13499         esac
13500         case "$d_gethostent_r_proto" in
13501         define)
13502         case "$gethostent_r_proto" in
13503         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13504         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13505         esac
13506         case "$gethostent_r_proto" in
13507         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13508         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13509         esac
13510         case "$gethostent_r_proto" in
13511         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13512         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13513         esac
13514         case "$gethostent_r_proto" in
13515         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13516         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13517         esac
13518         case "$gethostent_r_proto" in
13519         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13520         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13521         esac
13522         case "$gethostent_r_proto" in
13523         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13524         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13525         esac
13526         case "$gethostent_r_proto" in
13527         ''|0)   d_gethostent_r=undef
13528                 gethostent_r_proto=0
13529                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13530         * )     case "$gethostent_r_proto" in
13531                 REENTRANT_PROTO*) ;;
13532                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13533                 esac
13534                 echo "Prototype: $try" ;;
13535         esac
13536         ;;
13537         *)      case "$usethreads" in
13538                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13539                 esac
13540                 d_gethostent_r=undef
13541                 gethostent_r_proto=0
13542                 ;;
13543         esac
13544         ;;
13545 *)      gethostent_r_proto=0
13546         ;;
13547 esac
13548
13549 : see if prototypes for various gethostxxx netdb.h functions are available
13550 echo " "
13551 set d_gethostprotos gethostent $i_netdb netdb.h
13552 eval $hasproto
13553
13554 : see if getitimer exists
13555 set getitimer d_getitimer
13556 eval $inlibc
13557
13558 : see if getlogin exists
13559 set getlogin d_getlogin
13560 eval $inlibc
13561
13562 : see if getlogin_r exists
13563 set getlogin_r d_getlogin_r
13564 eval $inlibc
13565 case "$d_getlogin_r" in
13566 "$define")
13567         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13568         case "$d_getlogin_r_proto:$usethreads" in
13569         ":define")      d_getlogin_r_proto=define
13570                 set d_getlogin_r_proto getlogin_r $hdrs
13571                 eval $hasproto ;;
13572         *)      ;;
13573         esac
13574         case "$d_getlogin_r_proto" in
13575         define)
13576         case "$getlogin_r_proto" in
13577         ''|0) try='int getlogin_r(char*, size_t);'
13578         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13579         esac
13580         case "$getlogin_r_proto" in
13581         ''|0) try='int getlogin_r(char*, int);'
13582         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13583         esac
13584         case "$getlogin_r_proto" in
13585         ''|0) try='char* getlogin_r(char*, size_t);'
13586         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13587         esac
13588         case "$getlogin_r_proto" in
13589         ''|0) try='char* getlogin_r(char*, int);'
13590         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13591         esac
13592         case "$getlogin_r_proto" in
13593         ''|0)   d_getlogin_r=undef
13594                 getlogin_r_proto=0
13595                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13596         * )     case "$getlogin_r_proto" in
13597                 REENTRANT_PROTO*) ;;
13598                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13599                 esac
13600                 echo "Prototype: $try" ;;
13601         esac
13602         ;;
13603         *)      case "$usethreads" in
13604                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13605                 esac
13606                 d_getlogin_r=undef
13607                 getlogin_r_proto=0
13608                 ;;
13609         esac
13610         ;;
13611 *)      getlogin_r_proto=0
13612         ;;
13613 esac
13614
13615 : see if getmnt exists
13616 set getmnt d_getmnt
13617 eval $inlibc
13618
13619 : see if getmntent exists
13620 set getmntent d_getmntent
13621 eval $inlibc
13622
13623 : see if getnetbyaddr exists
13624 set getnetbyaddr d_getnbyaddr
13625 eval $inlibc
13626
13627 : see if getnetbyname exists
13628 set getnetbyname d_getnbyname
13629 eval $inlibc
13630
13631 : see if getnetent exists
13632 set getnetent d_getnent
13633 eval $inlibc
13634
13635 : see if getnetbyaddr_r exists
13636 set getnetbyaddr_r d_getnetbyaddr_r
13637 eval $inlibc
13638 case "$d_getnetbyaddr_r" in
13639 "$define")
13640         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13641         case "$d_getnetbyaddr_r_proto:$usethreads" in
13642         ":define")      d_getnetbyaddr_r_proto=define
13643                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13644                 eval $hasproto ;;
13645         *)      ;;
13646         esac
13647         case "$d_getnetbyaddr_r_proto" in
13648         define)
13649         case "$getnetbyaddr_r_proto" in
13650         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13651         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13652         esac
13653         case "$getnetbyaddr_r_proto" in
13654         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13655         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13656         esac
13657         case "$getnetbyaddr_r_proto" in
13658         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13659         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13660         esac
13661         case "$getnetbyaddr_r_proto" in
13662         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13663         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13664         esac
13665         case "$getnetbyaddr_r_proto" in
13666         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13667         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13668         esac
13669         case "$getnetbyaddr_r_proto" in
13670         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13671         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13672         esac
13673         case "$getnetbyaddr_r_proto" in
13674         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13675         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13676         esac
13677         case "$getnetbyaddr_r_proto" in
13678         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13679         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13680         esac
13681         case "$getnetbyaddr_r_proto" in
13682         ''|0)   d_getnetbyaddr_r=undef
13683                 getnetbyaddr_r_proto=0
13684                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13685         * )     case "$getnetbyaddr_r_proto" in
13686                 REENTRANT_PROTO*) ;;
13687                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13688                 esac
13689                 echo "Prototype: $try" ;;
13690         esac
13691         ;;
13692         *)      case "$usethreads" in
13693                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13694                 esac
13695                 d_getnetbyaddr_r=undef
13696                 getnetbyaddr_r_proto=0
13697                 ;;
13698         esac
13699         ;;
13700 *)      getnetbyaddr_r_proto=0
13701         ;;
13702 esac
13703
13704 : see if getnetbyname_r exists
13705 set getnetbyname_r d_getnetbyname_r
13706 eval $inlibc
13707 case "$d_getnetbyname_r" in
13708 "$define")
13709         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13710         case "$d_getnetbyname_r_proto:$usethreads" in
13711         ":define")      d_getnetbyname_r_proto=define
13712                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13713                 eval $hasproto ;;
13714         *)      ;;
13715         esac
13716         case "$d_getnetbyname_r_proto" in
13717         define)
13718         case "$getnetbyname_r_proto" in
13719         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13720         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13721         esac
13722         case "$getnetbyname_r_proto" in
13723         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13724         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13725         esac
13726         case "$getnetbyname_r_proto" in
13727         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13728         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13729         esac
13730         case "$getnetbyname_r_proto" in
13731         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13732         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13733         esac
13734         case "$getnetbyname_r_proto" in
13735         ''|0)   d_getnetbyname_r=undef
13736                 getnetbyname_r_proto=0
13737                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13738         * )     case "$getnetbyname_r_proto" in
13739                 REENTRANT_PROTO*) ;;
13740                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13741                 esac
13742                 echo "Prototype: $try" ;;
13743         esac
13744         ;;
13745         *)      case "$usethreads" in
13746                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13747                 esac
13748                 d_getnetbyname_r=undef
13749                 getnetbyname_r_proto=0
13750                 ;;
13751         esac
13752         ;;
13753 *)      getnetbyname_r_proto=0
13754         ;;
13755 esac
13756
13757 : see if getnetent_r exists
13758 set getnetent_r d_getnetent_r
13759 eval $inlibc
13760 case "$d_getnetent_r" in
13761 "$define")
13762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13763         case "$d_getnetent_r_proto:$usethreads" in
13764         ":define")      d_getnetent_r_proto=define
13765                 set d_getnetent_r_proto getnetent_r $hdrs
13766                 eval $hasproto ;;
13767         *)      ;;
13768         esac
13769         case "$d_getnetent_r_proto" in
13770         define)
13771         case "$getnetent_r_proto" in
13772         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13773         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13774         esac
13775         case "$getnetent_r_proto" in
13776         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13777         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13778         esac
13779         case "$getnetent_r_proto" in
13780         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13781         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13782         esac
13783         case "$getnetent_r_proto" in
13784         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13785         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13786         esac
13787         case "$getnetent_r_proto" in
13788         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13789         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13790         esac
13791         case "$getnetent_r_proto" in
13792         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13793         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13794         esac
13795         case "$getnetent_r_proto" in
13796         ''|0)   d_getnetent_r=undef
13797                 getnetent_r_proto=0
13798                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13799         * )     case "$getnetent_r_proto" in
13800                 REENTRANT_PROTO*) ;;
13801                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13802                 esac
13803                 echo "Prototype: $try" ;;
13804         esac
13805         ;;
13806         *)      case "$usethreads" in
13807                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13808                 esac
13809                 d_getnetent_r=undef
13810                 getnetent_r_proto=0
13811                 ;;
13812         esac
13813         ;;
13814 *)      getnetent_r_proto=0
13815         ;;
13816 esac
13817
13818 : see if prototypes for various getnetxxx netdb.h functions are available
13819 echo " "
13820 set d_getnetprotos getnetent $i_netdb netdb.h
13821 eval $hasproto
13822
13823 : see if getpagesize exists
13824 set getpagesize d_getpagsz
13825 eval $inlibc
13826
13827
13828 : see if getprotobyname exists
13829 set getprotobyname d_getpbyname
13830 eval $inlibc
13831
13832 : see if getprotobynumber exists
13833 set getprotobynumber d_getpbynumber
13834 eval $inlibc
13835
13836 : see if getprotoent exists
13837 set getprotoent d_getpent
13838 eval $inlibc
13839
13840 : see if getpgid exists
13841 set getpgid d_getpgid
13842 eval $inlibc
13843
13844 : see if getpgrp2 exists
13845 set getpgrp2 d_getpgrp2
13846 eval $inlibc
13847
13848 : see if getppid exists
13849 set getppid d_getppid
13850 eval $inlibc
13851
13852 : see if getpriority exists
13853 set getpriority d_getprior
13854 eval $inlibc
13855
13856 : see if getprotobyname_r exists
13857 set getprotobyname_r d_getprotobyname_r
13858 eval $inlibc
13859 case "$d_getprotobyname_r" in
13860 "$define")
13861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13862         case "$d_getprotobyname_r_proto:$usethreads" in
13863         ":define")      d_getprotobyname_r_proto=define
13864                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13865                 eval $hasproto ;;
13866         *)      ;;
13867         esac
13868         case "$d_getprotobyname_r_proto" in
13869         define)
13870         case "$getprotobyname_r_proto" in
13871         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13872         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13873         esac
13874         case "$getprotobyname_r_proto" in
13875         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13876         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13877         esac
13878         case "$getprotobyname_r_proto" in
13879         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13880         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13881         esac
13882         case "$getprotobyname_r_proto" in
13883         ''|0)   d_getprotobyname_r=undef
13884                 getprotobyname_r_proto=0
13885                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13886         * )     case "$getprotobyname_r_proto" in
13887                 REENTRANT_PROTO*) ;;
13888                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13889                 esac
13890                 echo "Prototype: $try" ;;
13891         esac
13892         ;;
13893         *)      case "$usethreads" in
13894                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13895                 esac
13896                 d_getprotobyname_r=undef
13897                 getprotobyname_r_proto=0
13898                 ;;
13899         esac
13900         ;;
13901 *)      getprotobyname_r_proto=0
13902         ;;
13903 esac
13904
13905 : see if getprotobynumber_r exists
13906 set getprotobynumber_r d_getprotobynumber_r
13907 eval $inlibc
13908 case "$d_getprotobynumber_r" in
13909 "$define")
13910         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13911         case "$d_getprotobynumber_r_proto:$usethreads" in
13912         ":define")      d_getprotobynumber_r_proto=define
13913                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13914                 eval $hasproto ;;
13915         *)      ;;
13916         esac
13917         case "$d_getprotobynumber_r_proto" in
13918         define)
13919         case "$getprotobynumber_r_proto" in
13920         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13921         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13922         esac
13923         case "$getprotobynumber_r_proto" in
13924         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13925         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13926         esac
13927         case "$getprotobynumber_r_proto" in
13928         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13929         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13930         esac
13931         case "$getprotobynumber_r_proto" in
13932         ''|0)   d_getprotobynumber_r=undef
13933                 getprotobynumber_r_proto=0
13934                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13935         * )     case "$getprotobynumber_r_proto" in
13936                 REENTRANT_PROTO*) ;;
13937                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13938                 esac
13939                 echo "Prototype: $try" ;;
13940         esac
13941         ;;
13942         *)      case "$usethreads" in
13943                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13944                 esac
13945                 d_getprotobynumber_r=undef
13946                 getprotobynumber_r_proto=0
13947                 ;;
13948         esac
13949         ;;
13950 *)      getprotobynumber_r_proto=0
13951         ;;
13952 esac
13953
13954 : see if getprotoent_r exists
13955 set getprotoent_r d_getprotoent_r
13956 eval $inlibc
13957 case "$d_getprotoent_r" in
13958 "$define")
13959         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13960         case "$d_getprotoent_r_proto:$usethreads" in
13961         ":define")      d_getprotoent_r_proto=define
13962                 set d_getprotoent_r_proto getprotoent_r $hdrs
13963                 eval $hasproto ;;
13964         *)      ;;
13965         esac
13966         case "$d_getprotoent_r_proto" in
13967         define)
13968         case "$getprotoent_r_proto" in
13969         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13970         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13971         esac
13972         case "$getprotoent_r_proto" in
13973         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13974         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13975         esac
13976         case "$getprotoent_r_proto" in
13977         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13978         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13979         esac
13980         case "$getprotoent_r_proto" in
13981         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13982         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13983         esac
13984         case "$getprotoent_r_proto" in
13985         ''|0)   d_getprotoent_r=undef
13986                 getprotoent_r_proto=0
13987                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13988         * )     case "$getprotoent_r_proto" in
13989                 REENTRANT_PROTO*) ;;
13990                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13991                 esac
13992                 echo "Prototype: $try" ;;
13993         esac
13994         ;;
13995         *)      case "$usethreads" in
13996                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13997                 esac
13998                 d_getprotoent_r=undef
13999                 getprotoent_r_proto=0
14000                 ;;
14001         esac
14002         ;;
14003 *)      getprotoent_r_proto=0
14004         ;;
14005 esac
14006
14007 : see if prototypes for various getprotoxxx netdb.h functions are available
14008 echo " "
14009 set d_getprotoprotos getprotoent $i_netdb netdb.h
14010 eval $hasproto
14011
14012 : see if getprpwnam exists
14013 set getprpwnam d_getprpwnam
14014 eval $inlibc
14015
14016 : see if getpwent exists
14017 set getpwent d_getpwent
14018 eval $inlibc
14019
14020 : see if getpwent_r exists
14021 set getpwent_r d_getpwent_r
14022 eval $inlibc
14023 case "$d_getpwent_r" in
14024 "$define")
14025         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14026         case "$d_getpwent_r_proto:$usethreads" in
14027         ":define")      d_getpwent_r_proto=define
14028                 set d_getpwent_r_proto getpwent_r $hdrs
14029                 eval $hasproto ;;
14030         *)      ;;
14031         esac
14032         case "$d_getpwent_r_proto" in
14033         define)
14034         case "$getpwent_r_proto" in
14035         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14036         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14037         esac
14038         case "$getpwent_r_proto" in
14039         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14040         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14041         esac
14042         case "$getpwent_r_proto" in
14043         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14044         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14045         esac
14046         case "$getpwent_r_proto" in
14047         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14048         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14049         esac
14050         case "$getpwent_r_proto" in
14051         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14052         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14053         esac
14054         case "$getpwent_r_proto" in
14055         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14056         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14057         esac
14058         case "$getpwent_r_proto" in
14059         ''|0)   d_getpwent_r=undef
14060                 getpwent_r_proto=0
14061                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14062         * )     case "$getpwent_r_proto" in
14063                 REENTRANT_PROTO*) ;;
14064                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14065                 esac
14066                 echo "Prototype: $try" ;;
14067         esac
14068         ;;
14069         *)      case "$usethreads" in
14070                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14071                 esac
14072                 d_getpwent_r=undef
14073                 getpwent_r_proto=0
14074                 ;;
14075         esac
14076         ;;
14077 *)      getpwent_r_proto=0
14078         ;;
14079 esac
14080
14081 : see if getpwnam_r exists
14082 set getpwnam_r d_getpwnam_r
14083 eval $inlibc
14084 case "$d_getpwnam_r" in
14085 "$define")
14086         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14087         case "$d_getpwnam_r_proto:$usethreads" in
14088         ":define")      d_getpwnam_r_proto=define
14089                 set d_getpwnam_r_proto getpwnam_r $hdrs
14090                 eval $hasproto ;;
14091         *)      ;;
14092         esac
14093         case "$d_getpwnam_r_proto" in
14094         define)
14095         case "$getpwnam_r_proto" in
14096         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14097         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14098         esac
14099         case "$getpwnam_r_proto" in
14100         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14101         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14102         esac
14103         case "$getpwnam_r_proto" in
14104         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14105         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14106         esac
14107         case "$getpwnam_r_proto" in
14108         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14109         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14110         esac
14111         case "$getpwnam_r_proto" in
14112         ''|0)   d_getpwnam_r=undef
14113                 getpwnam_r_proto=0
14114                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14115         * )     case "$getpwnam_r_proto" in
14116                 REENTRANT_PROTO*) ;;
14117                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14118                 esac
14119                 echo "Prototype: $try" ;;
14120         esac
14121         ;;
14122         *)      case "$usethreads" in
14123                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14124                 esac
14125                 d_getpwnam_r=undef
14126                 getpwnam_r_proto=0
14127                 ;;
14128         esac
14129         ;;
14130 *)      getpwnam_r_proto=0
14131         ;;
14132 esac
14133
14134 : see if getpwuid_r exists
14135 set getpwuid_r d_getpwuid_r
14136 eval $inlibc
14137 case "$d_getpwuid_r" in
14138 "$define")
14139         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14140         case "$d_getpwuid_r_proto:$usethreads" in
14141         ":define")      d_getpwuid_r_proto=define
14142                 set d_getpwuid_r_proto getpwuid_r $hdrs
14143                 eval $hasproto ;;
14144         *)      ;;
14145         esac
14146         case "$d_getpwuid_r_proto" in
14147         define)
14148         case "$getpwuid_r_proto" in
14149         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14150         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14151         esac
14152         case "$getpwuid_r_proto" in
14153         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14154         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14155         esac
14156         case "$getpwuid_r_proto" in
14157         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14158         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14159         esac
14160         case "$getpwuid_r_proto" in
14161         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14162         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14163         esac
14164         case "$getpwuid_r_proto" in
14165         ''|0)   d_getpwuid_r=undef
14166                 getpwuid_r_proto=0
14167                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14168         * )     case "$getpwuid_r_proto" in
14169                 REENTRANT_PROTO*) ;;
14170                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14171                 esac
14172                 echo "Prototype: $try" ;;
14173         esac
14174         ;;
14175         *)      case "$usethreads" in
14176                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14177                 esac
14178                 d_getpwuid_r=undef
14179                 getpwuid_r_proto=0
14180                 ;;
14181         esac
14182         ;;
14183 *)      getpwuid_r_proto=0
14184         ;;
14185 esac
14186
14187
14188 : see if getservbyname exists
14189 set getservbyname d_getsbyname
14190 eval $inlibc
14191
14192 : see if getservbyport exists
14193 set getservbyport d_getsbyport
14194 eval $inlibc
14195
14196 : see if getservent exists
14197 set getservent d_getsent
14198 eval $inlibc
14199
14200 : see if getservbyname_r exists
14201 set getservbyname_r d_getservbyname_r
14202 eval $inlibc
14203 case "$d_getservbyname_r" in
14204 "$define")
14205         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14206         case "$d_getservbyname_r_proto:$usethreads" in
14207         ":define")      d_getservbyname_r_proto=define
14208                 set d_getservbyname_r_proto getservbyname_r $hdrs
14209                 eval $hasproto ;;
14210         *)      ;;
14211         esac
14212         case "$d_getservbyname_r_proto" in
14213         define)
14214         case "$getservbyname_r_proto" in
14215         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14216         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14217         esac
14218         case "$getservbyname_r_proto" in
14219         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14220         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14221         esac
14222         case "$getservbyname_r_proto" in
14223         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14224         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14225         esac
14226         case "$getservbyname_r_proto" in
14227         ''|0)   d_getservbyname_r=undef
14228                 getservbyname_r_proto=0
14229                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14230         * )     case "$getservbyname_r_proto" in
14231                 REENTRANT_PROTO*) ;;
14232                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14233                 esac
14234                 echo "Prototype: $try" ;;
14235         esac
14236         ;;
14237         *)      case "$usethreads" in
14238                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14239                 esac
14240                 d_getservbyname_r=undef
14241                 getservbyname_r_proto=0
14242                 ;;
14243         esac
14244         ;;
14245 *)      getservbyname_r_proto=0
14246         ;;
14247 esac
14248
14249 : see if getservbyport_r exists
14250 set getservbyport_r d_getservbyport_r
14251 eval $inlibc
14252 case "$d_getservbyport_r" in
14253 "$define")
14254         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14255         case "$d_getservbyport_r_proto:$usethreads" in
14256         ":define")      d_getservbyport_r_proto=define
14257                 set d_getservbyport_r_proto getservbyport_r $hdrs
14258                 eval $hasproto ;;
14259         *)      ;;
14260         esac
14261         case "$d_getservbyport_r_proto" in
14262         define)
14263         case "$getservbyport_r_proto" in
14264         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14265         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14266         esac
14267         case "$getservbyport_r_proto" in
14268         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14269         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14270         esac
14271         case "$getservbyport_r_proto" in
14272         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14273         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14274         esac
14275         case "$getservbyport_r_proto" in
14276         ''|0)   d_getservbyport_r=undef
14277                 getservbyport_r_proto=0
14278                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14279         * )     case "$getservbyport_r_proto" in
14280                 REENTRANT_PROTO*) ;;
14281                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14282                 esac
14283                 echo "Prototype: $try" ;;
14284         esac
14285         ;;
14286         *)      case "$usethreads" in
14287                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14288                 esac
14289                 d_getservbyport_r=undef
14290                 getservbyport_r_proto=0
14291                 ;;
14292         esac
14293         ;;
14294 *)      getservbyport_r_proto=0
14295         ;;
14296 esac
14297
14298 : see if getservent_r exists
14299 set getservent_r d_getservent_r
14300 eval $inlibc
14301 case "$d_getservent_r" in
14302 "$define")
14303         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14304         case "$d_getservent_r_proto:$usethreads" in
14305         ":define")      d_getservent_r_proto=define
14306                 set d_getservent_r_proto getservent_r $hdrs
14307                 eval $hasproto ;;
14308         *)      ;;
14309         esac
14310         case "$d_getservent_r_proto" in
14311         define)
14312         case "$getservent_r_proto" in
14313         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14314         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14315         esac
14316         case "$getservent_r_proto" in
14317         ''|0) try='int getservent_r(struct servent*, char*, int);'
14318         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14319         esac
14320         case "$getservent_r_proto" in
14321         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14322         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14323         esac
14324         case "$getservent_r_proto" in
14325         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14326         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14327         esac
14328         case "$getservent_r_proto" in
14329         ''|0)   d_getservent_r=undef
14330                 getservent_r_proto=0
14331                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14332         * )     case "$getservent_r_proto" in
14333                 REENTRANT_PROTO*) ;;
14334                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14335                 esac
14336                 echo "Prototype: $try" ;;
14337         esac
14338         ;;
14339         *)      case "$usethreads" in
14340                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14341                 esac
14342                 d_getservent_r=undef
14343                 getservent_r_proto=0
14344                 ;;
14345         esac
14346         ;;
14347 *)      getservent_r_proto=0
14348         ;;
14349 esac
14350
14351 : see if prototypes for various getservxxx netdb.h functions are available
14352 echo " "
14353 set d_getservprotos getservent $i_netdb netdb.h
14354 eval $hasproto
14355
14356 : see if getspnam exists
14357 set getspnam d_getspnam
14358 eval $inlibc
14359
14360 : see if this is a shadow.h system
14361 set shadow.h i_shadow
14362 eval $inhdr
14363
14364 : see if getspnam_r exists
14365 set getspnam_r d_getspnam_r
14366 eval $inlibc
14367 case "$d_getspnam_r" in
14368 "$define")
14369         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14370         case "$d_getspnam_r_proto:$usethreads" in
14371         ":define")      d_getspnam_r_proto=define
14372                 set d_getspnam_r_proto getspnam_r $hdrs
14373                 eval $hasproto ;;
14374         *)      ;;
14375         esac
14376         case "$d_getspnam_r_proto" in
14377         define)
14378         case "$getspnam_r_proto" in
14379         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14380         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14381         esac
14382         case "$getspnam_r_proto" in
14383         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14384         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14385         esac
14386         case "$getspnam_r_proto" in
14387         ''|0)   d_getspnam_r=undef
14388                 getspnam_r_proto=0
14389                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14390         * )     case "$getspnam_r_proto" in
14391                 REENTRANT_PROTO*) ;;
14392                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14393                 esac
14394                 echo "Prototype: $try" ;;
14395         esac
14396         ;;
14397         *)      case "$usethreads" in
14398                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14399                 esac
14400                 d_getspnam_r=undef
14401                 getspnam_r_proto=0
14402                 ;;
14403         esac
14404         ;;
14405 *)      getspnam_r_proto=0
14406         ;;
14407 esac
14408
14409 : see if gettimeofday or ftime exists
14410 set gettimeofday d_gettimeod
14411 eval $inlibc
14412 case "$d_gettimeod" in
14413 "$undef")
14414         set ftime d_ftime 
14415         eval $inlibc
14416         ;;
14417 *)
14418         val="$undef"; set d_ftime; eval $setvar
14419         ;;
14420 esac
14421 case "$d_gettimeod$d_ftime" in
14422 "$undef$undef")
14423         echo " "
14424         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14425         ;;
14426 esac
14427
14428 : see if gmtime_r exists
14429 set gmtime_r d_gmtime_r
14430 eval $inlibc
14431 case "$d_gmtime_r" in
14432 "$define")
14433         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14434         case "$d_gmtime_r_proto:$usethreads" in
14435         ":define")      d_gmtime_r_proto=define
14436                 set d_gmtime_r_proto gmtime_r $hdrs
14437                 eval $hasproto ;;
14438         *)      ;;
14439         esac
14440         case "$d_gmtime_r_proto" in
14441         define)
14442         case "$gmtime_r_proto" in
14443         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14444         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14445         esac
14446         case "$gmtime_r_proto" in
14447         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14448         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14449         esac
14450         case "$gmtime_r_proto" in
14451         ''|0)   d_gmtime_r=undef
14452                 gmtime_r_proto=0
14453                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14454         * )     case "$gmtime_r_proto" in
14455                 REENTRANT_PROTO*) ;;
14456                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14457                 esac
14458                 echo "Prototype: $try" ;;
14459         esac
14460         ;;
14461         *)      case "$usethreads" in
14462                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14463                 esac
14464                 d_gmtime_r=undef
14465                 gmtime_r_proto=0
14466                 ;;
14467         esac
14468         ;;
14469 *)      gmtime_r_proto=0
14470         ;;
14471 esac
14472
14473 : see if hasmntopt exists
14474 set hasmntopt d_hasmntopt
14475 eval $inlibc
14476
14477 : see if this is a netinet/in.h or sys/in.h system
14478 set netinet/in.h i_niin sys/in.h i_sysin
14479 eval $inhdr
14480
14481 : see if arpa/inet.h has to be included
14482 set arpa/inet.h i_arpainet
14483 eval $inhdr
14484
14485 : see if htonl --and friends-- exists
14486 val=''
14487 set htonl val
14488 eval $inlibc
14489
14490 : Maybe they are macros.
14491 case "$val" in
14492 $undef)
14493         $cat >htonl.c <<EOM
14494 #include <stdio.h>
14495 #include <sys/types.h>
14496 #$i_niin I_NETINET_IN
14497 #$i_sysin I_SYS_IN
14498 #$i_arpainet I_ARPA_INET
14499 #ifdef I_NETINET_IN
14500 #include <netinet/in.h>
14501 #endif
14502 #ifdef I_SYS_IN
14503 #include <sys/in.h>
14504 #endif
14505 #ifdef I_ARPA_INET
14506 #include <arpa/inet.h>
14507 #endif
14508 #ifdef htonl
14509 printf("Defined as a macro.");
14510 #endif
14511 EOM
14512         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14513         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14514                 val="$define"
14515                 echo "But it seems to be defined as a macro." >&4
14516         fi
14517         $rm -f htonl.?
14518         ;;
14519 esac
14520 set d_htonl
14521 eval $setvar
14522
14523 : see if ilogbl exists
14524 set ilogbl d_ilogbl
14525 eval $inlibc
14526
14527 : index or strchr
14528 echo " "
14529 if set index val -f; eval $csym; $val; then
14530         if set strchr val -f d_strchr; eval $csym; $val; then
14531                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14532                         val="$define"
14533                         vali="$undef"
14534                         echo "strchr() found." >&4
14535                 else
14536                         val="$undef"
14537                         vali="$define"
14538                         echo "index() found." >&4
14539                 fi
14540         else
14541                 val="$undef"
14542                 vali="$define"
14543                 echo "index() found." >&4
14544         fi
14545 else
14546         if set strchr val -f d_strchr; eval $csym; $val; then
14547                 val="$define"
14548                 vali="$undef"
14549                 echo "strchr() found." >&4
14550         else
14551                 echo "No index() or strchr() found!" >&4
14552                 val="$undef"
14553                 vali="$undef"
14554         fi
14555 fi
14556 set d_strchr; eval $setvar
14557 val="$vali"
14558 set d_index; eval $setvar
14559
14560 : check whether inet_aton exists
14561 set inet_aton d_inetaton
14562 eval $inlibc
14563
14564 : Look for isascii
14565 echo " "
14566 $cat >isascii.c <<EOCP
14567 #include <stdio.h>
14568 #include <ctype.h>
14569 #$i_stdlib I_STDLIB
14570 #ifdef I_STDLIB
14571 #include <stdlib.h>
14572 #endif
14573 int main() {
14574         int c = 'A';
14575         if (isascii(c))
14576                 exit(0);
14577         else
14578                 exit(1);
14579 }
14580 EOCP
14581 set isascii
14582 if eval $compile; then
14583         echo "isascii() found." >&4
14584         val="$define"
14585 else
14586         echo "isascii() NOT found." >&4
14587         val="$undef"
14588 fi
14589 set d_isascii
14590 eval $setvar
14591 $rm -f isascii*
14592
14593 : see if isfinite exists
14594 set isfinite d_isfinite
14595 eval $inlibc
14596
14597 : see if isinf exists
14598 set isinf d_isinf
14599 eval $inlibc
14600
14601 : see if isnan exists
14602 set isnan d_isnan
14603 eval $inlibc
14604
14605 : see if isnanl exists
14606 set isnanl d_isnanl
14607 eval $inlibc
14608
14609 : see if killpg exists
14610 set killpg d_killpg
14611 eval $inlibc
14612
14613 : see if lchown exists
14614 echo " "
14615 $cat > try.c <<'EOCP'
14616 /* System header to define __stub macros and hopefully few prototypes,
14617     which can conflict with char lchown(); below.  */
14618 #include <assert.h>
14619 /* Override any gcc2 internal prototype to avoid an error.  */
14620 /* We use char because int might match the return type of a gcc2
14621    builtin and then its argument prototype would still apply.  */
14622 char lchown();
14623 int main() {
14624     /*  The GNU C library defines this for functions which it implements
14625         to always fail with ENOSYS.  Some functions are actually named
14626         something starting with __ and the normal name is an alias.  */
14627 #if defined (__stub_lchown) || defined (__stub___lchown)
14628 choke me
14629 #else
14630 lchown();
14631 #endif
14632 ; return 0; }
14633 EOCP
14634 set try
14635 if eval $compile; then
14636     $echo "lchown() found." >&4
14637     val="$define"
14638 else
14639     $echo "lchown() NOT found." >&4
14640     val="$undef"
14641 fi
14642 set d_lchown
14643 eval $setvar
14644
14645 : See if number of significant digits in a double precision number is known
14646 echo " "
14647 $cat >ldbl_dig.c <<EOM
14648 #$i_limits I_LIMITS
14649 #$i_float I_FLOAT
14650 #ifdef I_LIMITS
14651 #include <limits.h>
14652 #endif
14653 #ifdef I_FLOAT
14654 #include <float.h>
14655 #endif
14656 #ifdef LDBL_DIG
14657 printf("Contains LDBL_DIG");
14658 #endif
14659 EOM
14660 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14661 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14662         echo "LDBL_DIG found." >&4
14663         val="$define"
14664 else
14665         echo "LDBL_DIG NOT found." >&4
14666         val="$undef"
14667 fi
14668 $rm -f ldbl_dig.?
14669 set d_ldbl_dig
14670 eval $setvar
14671
14672 : see if this is a math.h system
14673 set math.h i_math
14674 eval $inhdr
14675
14676 d_libm_lib_version="$undef"
14677 case $i_math in
14678     $define)
14679         : check to see if math.h defines _LIB_VERSION
14680         echo " "
14681         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14682         $cat >try.c <<EOCP
14683 #include <unistd.h>
14684 #include <math.h>
14685 int main (int argc, char *argv[])
14686 {
14687     printf ("%d\n", _LIB_VERSION);
14688     return (0);
14689     } /* main */
14690 EOCP
14691         set try
14692         if eval $compile; then
14693             foo=`$run ./try`
14694             echo "Yes, it does ($foo)" >&4
14695             d_libm_lib_version="$define"
14696         else
14697             echo "No, it does not (probably harmless)" >&4
14698             fi
14699         $rm_try
14700         ;;
14701
14702     esac
14703
14704 : see if link exists
14705 set link d_link
14706 eval $inlibc
14707
14708 : see if localtime_r exists
14709 set localtime_r d_localtime_r
14710 eval $inlibc
14711 case "$d_localtime_r" in
14712 "$define")
14713         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14714         case "$d_localtime_r_proto:$usethreads" in
14715         ":define")      d_localtime_r_proto=define
14716                 set d_localtime_r_proto localtime_r $hdrs
14717                 eval $hasproto ;;
14718         *)      ;;
14719         esac
14720         case "$d_localtime_r_proto" in
14721         define)
14722         case "$localtime_r_proto" in
14723         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14724         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14725         esac
14726         case "$localtime_r_proto" in
14727         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14728         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14729         esac
14730         case "$localtime_r_proto" in
14731         ''|0)   d_localtime_r=undef
14732                 localtime_r_proto=0
14733                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14734         * )     case "$localtime_r_proto" in
14735                 REENTRANT_PROTO*) ;;
14736                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14737                 esac
14738                 echo "Prototype: $try" ;;
14739         esac
14740         ;;
14741         *)      case "$usethreads" in
14742                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14743                 esac
14744                 d_localtime_r=undef
14745                 localtime_r_proto=0
14746                 ;;
14747         esac
14748         ;;
14749 *)      localtime_r_proto=0
14750         ;;
14751 esac
14752
14753 : see if localtime_r calls tzset
14754 case "$localtime_r_proto" in
14755 REENTRANT_PROTO*)
14756         $cat >try.c <<EOCP
14757 /*  Does our libc's localtime_r call tzset ?
14758  *  return 0 if so, 1 otherwise.
14759  */
14760 #include <sys/types.h>
14761 #include <unistd.h>
14762 #include <time.h>
14763 #include <string.h>
14764 #include <malloc.h>
14765 int main()
14766 {
14767     time_t t = time(0L);
14768     char w_tz[]="TZ" "=GMT+5",
14769          e_tz[]="TZ" "=GMT-5",
14770         *tz_e = (char*)malloc(16),
14771         *tz_w = (char*)malloc(16);
14772     struct tm tm_e, tm_w;
14773     memset(&tm_e,'\0',sizeof(struct tm));
14774     memset(&tm_w,'\0',sizeof(struct tm));
14775     strcpy(tz_e,e_tz);
14776     strcpy(tz_w,w_tz);
14777
14778     putenv(tz_e);
14779     localtime_r(&t, &tm_e);
14780
14781     putenv(tz_w);
14782     localtime_r(&t, &tm_w);
14783
14784     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14785         return 1;
14786     return 0;
14787 }
14788 EOCP
14789         set try
14790         if eval $compile; then
14791             if $run ./try; then
14792                 d_localtime_r_needs_tzset=undef;
14793             else
14794                 d_localtime_r_needs_tzset=define;
14795             fi;
14796         else
14797             d_localtime_r_needs_tzset=undef;
14798         fi;
14799      ;;
14800   *)
14801      d_localtime_r_needs_tzset=undef;
14802      ;;
14803 esac
14804 $rm_try
14805
14806 : see if localeconv exists
14807 set localeconv d_locconv
14808 eval $inlibc
14809
14810 : see if lockf exists
14811 set lockf d_lockf
14812 eval $inlibc
14813
14814 : see if prototype for lseek is available
14815 echo " "
14816 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14817 eval $hasproto
14818
14819 : see if lstat exists
14820 set lstat d_lstat
14821 eval $inlibc
14822
14823 : see if madvise exists
14824 set madvise d_madvise
14825 eval $inlibc
14826
14827 : see if malloc_size exists
14828 set malloc_size d_malloc_size
14829 eval $inlibc
14830
14831 : see if malloc_size_good exists
14832 set malloc_good_size d_malloc_good_size
14833 eval $inlibc
14834
14835 : see if mblen exists
14836 set mblen d_mblen
14837 eval $inlibc
14838
14839 : see if mbstowcs exists
14840 set mbstowcs d_mbstowcs
14841 eval $inlibc
14842
14843 : see if mbtowc exists
14844 set mbtowc d_mbtowc
14845 eval $inlibc
14846
14847 : see if memchr exists
14848 set memchr d_memchr
14849 eval $inlibc
14850
14851 : see if memcmp exists
14852 set memcmp d_memcmp
14853 eval $inlibc
14854
14855 : see if memcpy exists
14856 set memcpy d_memcpy
14857 eval $inlibc
14858
14859 : see if memmove exists
14860 set memmove d_memmove
14861 eval $inlibc
14862
14863 : see if memset exists
14864 set memset d_memset
14865 eval $inlibc
14866
14867 : see if mkdir exists
14868 set mkdir d_mkdir
14869 eval $inlibc
14870
14871 : see if mkdtemp exists
14872 set mkdtemp d_mkdtemp
14873 eval $inlibc
14874
14875 : see if mkfifo exists
14876 set mkfifo d_mkfifo
14877 eval $inlibc
14878
14879 : see if mkstemp exists
14880 set mkstemp d_mkstemp
14881 eval $inlibc
14882
14883 : see if mkstemps exists
14884 set mkstemps d_mkstemps
14885 eval $inlibc
14886
14887 : see if mktime exists
14888 set mktime d_mktime
14889 eval $inlibc
14890
14891 : see if this is a sys/mman.h system
14892 set sys/mman.h i_sysmman
14893 eval $inhdr
14894
14895 : see if mmap exists
14896 set mmap d_mmap
14897 eval $inlibc
14898 : see what shmat returns
14899 : default to something harmless
14900 mmaptype='void *'
14901 case "$i_sysmman$d_mmap" in
14902 "$define$define")
14903         $cat >mmap.c <<'END'
14904 #include <sys/mman.h>
14905 void *mmap();
14906 END
14907         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14908                 mmaptype='void *'
14909         else
14910                 mmaptype='caddr_t'
14911         fi
14912         echo "and it returns ($mmaptype)." >&4
14913         ;;
14914 esac
14915
14916
14917
14918 : see if sqrtl exists
14919 set sqrtl d_sqrtl
14920 eval $inlibc
14921
14922 : see if scalbnl exists
14923 set scalbnl d_scalbnl
14924 eval $inlibc
14925
14926 : see if modfl exists
14927 set modfl d_modfl
14928 eval $inlibc
14929
14930 : see if prototype for modfl is available
14931 echo " "
14932 set d_modflproto modfl $i_math math.h
14933 eval $hasproto
14934
14935 d_modfl_pow32_bug="$undef"
14936
14937 case "$d_longdbl$d_modfl" in
14938 $define$define)
14939         $cat <<EOM
14940 Checking to see whether your modfl() is okay for large values...
14941 EOM
14942 $cat >try.c <<EOCP
14943 #include <math.h>
14944 #include <stdio.h>
14945 EOCP
14946 if $test "X$d_modflproto" != "X$define"; then
14947         $cat >>try.c <<EOCP
14948 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14949 long double modfl (long double, long double *);
14950 EOCP
14951 fi
14952 $cat >>try.c <<EOCP
14953 int main() {
14954     long double nv = 4294967303.15;
14955     long double v, w;
14956     v = modfl(nv, &w);
14957 #ifdef __GLIBC__
14958     printf("glibc");
14959 #endif
14960     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14961     return 0;
14962 }
14963 EOCP
14964         case "$osname:$gccversion" in
14965         aix:)   saveccflags="$ccflags"
14966                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14967         esac
14968         set try
14969         if eval $compile; then
14970                 foo=`$run ./try`
14971                 case "$foo" in
14972                 *" 4294967303.150000 1.150000 4294967302.000000")
14973                         echo >&4 "Your modfl() is broken for large values."
14974                         d_modfl_pow32_bug="$define"
14975                         case "$foo" in
14976                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14977                         ;;
14978                         esac
14979                         ;;
14980                 *" 4294967303.150000 0.150000 4294967303.000000")
14981                         echo >&4 "Your modfl() seems okay for large values."
14982                         ;;
14983                 *)      echo >&4 "I don't understand your modfl() at all."
14984                         d_modfl="$undef"
14985                         ;;
14986                 esac
14987                 $rm_try
14988         else
14989                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14990                 d_modfl="$undef"
14991         fi
14992         case "$osname:$gccversion" in
14993         aix:)   ccflags="$saveccflags" ;; # restore
14994         esac
14995         ;;
14996 esac
14997
14998 if $test "$uselongdouble" = "$define"; then
14999     message=""
15000     if $test "$d_sqrtl" != "$define"; then
15001         message="$message sqrtl"
15002     fi
15003     if $test "$d_modfl" != "$define"; then
15004         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15005             echo "You have both aintl and copysignl, so I can emulate modfl."
15006         else
15007             message="$message modfl"
15008         fi
15009     fi
15010     if $test "$d_frexpl" != "$define"; then
15011         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15012             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15013         else
15014             message="$message frexpl"
15015         fi
15016     fi
15017
15018     if $test "$message" != ""; then
15019         $cat <<EOM >&4
15020
15021 *** You requested the use of long doubles but you do not seem to have
15022 *** the following mathematical functions needed for long double support:
15023 ***    $message
15024 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15025 *** Cannot continue, aborting.
15026
15027 EOM
15028
15029         exit 1
15030     fi
15031 fi
15032
15033 : see if mprotect exists
15034 set mprotect d_mprotect
15035 eval $inlibc
15036
15037 : see if msgctl exists
15038 set msgctl d_msgctl
15039 eval $inlibc
15040
15041 : see if msgget exists
15042 set msgget d_msgget
15043 eval $inlibc
15044
15045 : see if msgsnd exists
15046 set msgsnd d_msgsnd
15047 eval $inlibc
15048
15049 : see if msgrcv exists
15050 set msgrcv d_msgrcv
15051 eval $inlibc
15052
15053 : see how much of the 'msg*(2)' library is present.
15054 h_msg=true
15055 echo " "
15056 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15057 *"$undef"*) h_msg=false;;
15058 esac
15059 case "$osname" in
15060 freebsd)
15061     case "`ipcs 2>&1`" in
15062     "SVID messages"*"not configured"*)
15063         echo "Your $osname does not have the msg*(2) configured." >&4
15064         h_msg=false
15065         val="$undef"
15066         set msgctl d_msgctl
15067         eval $setvar
15068         set msgget d_msgget
15069         eval $setvar
15070         set msgsnd d_msgsnd
15071         eval $setvar
15072         set msgrcv d_msgrcv
15073         eval $setvar
15074         ;;
15075     esac
15076     ;;
15077 esac
15078 : we could also check for sys/ipc.h ...
15079 if $h_msg && $test `./findhdr sys/msg.h`; then
15080         echo "You have the full msg*(2) library." >&4
15081         val="$define"
15082 else
15083         echo "You don't have the full msg*(2) library." >&4
15084         val="$undef"
15085 fi
15086 set d_msg
15087 eval $setvar
15088
15089
15090 echo " "
15091 echo "Checking to see if your system supports struct msghdr..." >&4
15092 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15093 eval $hasstruct
15094 case "$d_msghdr_s" in
15095 "$define")      echo "Yes, it does."   ;;
15096 *)              echo "No, it doesn't." ;;
15097 esac
15098
15099
15100 : see if msync exists
15101 set msync d_msync
15102 eval $inlibc
15103
15104 : see if munmap exists
15105 set munmap d_munmap
15106 eval $inlibc
15107
15108 : see if nice exists
15109 set nice d_nice
15110 eval $inlibc
15111
15112 : see if this is a langinfo.h system
15113 set langinfo.h i_langinfo
15114 eval $inhdr
15115
15116 : see if nl_langinfo exists
15117 set nl_langinfo d_nl_langinfo
15118 eval $inlibc
15119
15120 : check for volatile keyword
15121 echo " "
15122 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15123 $cat >try.c <<'EOCP'
15124 int main()
15125 {
15126         typedef struct _goo_struct goo_struct;
15127         goo_struct * volatile goo = ((goo_struct *)0);
15128         struct _goo_struct {
15129                 long long_int;
15130                 int reg_int;
15131                 char char_var;
15132         };
15133         typedef unsigned short foo_t;
15134         char *volatile foo;
15135         volatile int bar;
15136         volatile foo_t blech;
15137         foo = foo;
15138 }
15139 EOCP
15140 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15141         val="$define"
15142         echo "Yup, it does."
15143 else
15144         val="$undef"
15145         echo "Nope, it doesn't."
15146 fi
15147 set d_volatile
15148 eval $setvar
15149 $rm_try
15150
15151
15152 echo " "
15153 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15154
15155 case "$use64bitint:$d_quad:$quadtype" in
15156 define:define:?*)
15157         ivtype="$quadtype"
15158         uvtype="$uquadtype"
15159         ivsize=8
15160         uvsize=8
15161         ;;
15162 *)      ivtype="long"
15163         uvtype="unsigned long"
15164         ivsize=$longsize
15165         uvsize=$longsize
15166         ;;
15167 esac
15168
15169 case "$uselongdouble:$d_longdbl" in
15170 define:define)
15171         nvtype="long double"
15172         nvsize=$longdblsize
15173         ;;
15174 *)      nvtype=double
15175         nvsize=$doublesize
15176         ;;
15177 esac
15178
15179 $echo "(IV will be "$ivtype", $ivsize bytes)"
15180 $echo "(UV will be "$uvtype", $uvsize bytes)"
15181 $echo "(NV will be "$nvtype", $nvsize bytes)"
15182
15183 $cat >try.c <<EOCP
15184 #$i_inttypes I_INTTYPES
15185 #ifdef I_INTTYPES
15186 #include <inttypes.h>
15187 #endif
15188 #include <stdio.h>
15189 int main() {
15190 #ifdef INT8
15191    int8_t i =  INT8_MAX;
15192   uint8_t u = UINT8_MAX;
15193   printf("int8_t\n");
15194 #endif
15195 #ifdef INT16
15196    int16_t i =  INT16_MAX;
15197   uint16_t i = UINT16_MAX;
15198   printf("int16_t\n");
15199 #endif
15200 #ifdef INT32
15201    int32_t i =  INT32_MAX;
15202   uint32_t u = UINT32_MAX;
15203   printf("int32_t\n");
15204 #endif
15205 }
15206 EOCP
15207
15208 i8type="signed char"
15209 u8type="unsigned char"
15210 i8size=1
15211 u8size=1
15212
15213 case "$i16type" in
15214 '')     case "$shortsize" in
15215         2)      i16type=short
15216                 u16type="unsigned short"
15217                 i16size=$shortsize
15218                 u16size=$shortsize
15219                 ;;
15220         esac
15221         ;;
15222 esac
15223 case "$i16type" in
15224 '')     set try -DINT16
15225         if eval $compile; then
15226                 case "`$run ./try`" in
15227                 int16_t)
15228                         i16type=int16_t
15229                         u16type=uint16_t
15230                         i16size=2
15231                         u16size=2
15232                         ;;
15233                 esac
15234         fi
15235         ;;
15236 esac
15237 case "$i16type" in
15238 '')     if $test $shortsize -ge 2; then
15239                 i16type=short
15240                 u16type="unsigned short"
15241                 i16size=$shortsize
15242                 u16size=$shortsize
15243         fi
15244         ;;
15245 esac
15246
15247 case "$i32type" in
15248 '')     case "$longsize" in
15249         4)      i32type=long
15250                 u32type="unsigned long"
15251                 i32size=$longsize
15252                 u32size=$longsize
15253                 ;;
15254         *)      case "$intsize" in
15255                 4)      i32type=int
15256                         u32type="unsigned int"
15257                         i32size=$intsize
15258                         u32size=$intsize
15259                         ;;
15260                 esac
15261                 ;;
15262         esac
15263         ;;
15264 esac
15265 case "$i32type" in
15266 '')     set try -DINT32
15267         if eval $compile; then
15268                 case "`$run ./try`" in
15269                 int32_t)
15270                         i32type=int32_t
15271                         u32type=uint32_t
15272                         i32size=4
15273                         u32size=4
15274                         ;;
15275                 esac
15276         fi
15277         ;;
15278 esac
15279 case "$i32type" in
15280 '')     if $test $intsize -ge 4; then
15281                 i32type=int
15282                 u32type="unsigned int"
15283                 i32size=$intsize
15284                 u32size=$intsize
15285         fi
15286         ;;
15287 esac
15288
15289 case "$i64type" in
15290 '')     case "$d_quad:$quadtype" in
15291         define:?*)
15292                 i64type="$quadtype"
15293                 u64type="$uquadtype"
15294                 i64size=8
15295                 u64size=8
15296                 ;;
15297         esac
15298         ;;
15299 esac
15300
15301 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15302 : volatile so that the compiler has to store it out to memory.
15303 if test X"$d_volatile" = X"$define"; then
15304         volatile=volatile
15305 fi
15306 $cat <<EOP >try.c
15307 #include <stdio.h>
15308 #$i_stdlib I_STDLIB
15309 #ifdef I_STDLIB
15310 #include <stdlib.h>
15311 #endif
15312 #include <sys/types.h>
15313 #include <signal.h>
15314 #ifdef SIGFPE
15315 $volatile int bletched = 0;
15316 $signal_t blech(int s) { bletched = 1; }
15317 #endif
15318 int main() {
15319     $uvtype u = 0;
15320     $nvtype d;
15321     int     n = 8 * $uvsize;
15322     int     i;
15323 #ifdef SIGFPE
15324     signal(SIGFPE, blech);
15325 #endif
15326
15327     for (i = 0; i < n; i++) {
15328       u = u << 1 | ($uvtype)1;
15329       d = ($nvtype)u;
15330       if (($uvtype)d != u)
15331         break;
15332       if (d <= 0)
15333         break;
15334       d = ($nvtype)(u - 1);
15335       if (($uvtype)d != (u - 1))
15336         break;
15337 #ifdef SIGFPE
15338       if (bletched)
15339         break;
15340 #endif
15341     }
15342     printf("%d\n", ((i == n) ? -n : i));
15343     exit(0);
15344 }
15345 EOP
15346 set try
15347
15348 d_nv_preserves_uv="$undef"
15349 if eval $compile; then
15350         nv_preserves_uv_bits="`$run ./try`"
15351 fi
15352 case "$nv_preserves_uv_bits" in
15353 \-[1-9]*)
15354         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15355         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15356         d_nv_preserves_uv="$define"
15357         ;;
15358 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15359         d_nv_preserves_uv="$undef" ;;
15360 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15361         nv_preserves_uv_bits="0" ;;
15362 esac
15363 $rm_try
15364
15365 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15366 : volatile so that the compiler has to store it out to memory.
15367 if test X"$d_volatile" = X"$define"; then
15368         volatile=volatile
15369 fi
15370 $cat <<EOP >try.c
15371 #include <stdio.h>
15372 #$i_stdlib I_STDLIB
15373 #ifdef I_STDLIB
15374 #include <stdlib.h>
15375 #endif
15376 #$i_string I_STRING
15377 #ifdef I_STRING
15378 #  include <string.h>
15379 #else
15380 #  include <strings.h>
15381 #endif
15382 #include <sys/types.h>
15383 #include <signal.h>
15384 #ifdef SIGFPE
15385 $volatile int bletched = 0;
15386 $signal_t blech(int s) { bletched = 1; }
15387 #endif
15388
15389 int checkit($nvtype d, char *where) {
15390     unsigned char *p = (char *)&d;
15391     unsigned char *end = p + sizeof(d);
15392     int fail = 0;
15393
15394     while (p < end)
15395         fail += *p++;
15396
15397     if (!fail)
15398         return 0;
15399
15400     p = (char *)&d;
15401     printf("No - %s: 0x", where);
15402     while (p < end)
15403         printf ("%02X", *p++);
15404     printf("\n");
15405     return 1;
15406 }
15407
15408 int main(int argc, char **argv) {
15409     $nvtype d = 0.0;
15410     int fail = 0;
15411     fail += checkit(d, "0.0");
15412
15413     /* The compiler shouldn't be assuming that bletched is 0  */
15414     d = bletched;
15415
15416     fail += checkit(d, "bleched");
15417
15418 #ifdef SIGFPE
15419     signal(SIGFPE, blech);
15420 #endif
15421
15422     /* Paranoia - the compiler should have no way of knowing that ANSI says
15423        that argv[argc] will always be NULL.  Actually, if it did assume this it
15424        would be buggy, as this is C and main() can be called from elsewhere in
15425        the program.  */
15426     d = argv[argc] ? 1 : 0;
15427
15428     if (d) {
15429         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15430     }
15431
15432     fail += checkit(d, "ternary");
15433
15434     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15435
15436     if (d != 0.0) {
15437         printf("No - memset doesn't give 0.0\n");
15438         /* This might just blow up:  */
15439         printf("(gives %g)\n", d);
15440         return 1;
15441     }
15442
15443 #ifdef SIGFPE
15444     if (bletched) {
15445         printf("No - something bleched\n");
15446         return 1;
15447     }
15448 #endif
15449     if (fail) {
15450       printf("No - %d fail(s)\n", fail);
15451       return 1;
15452     }
15453     printf("Yes\n");
15454     return 0;
15455 }
15456 EOP
15457 set try
15458
15459 d_nv_zero_is_allbits_zero="$undef"
15460 if eval $compile; then
15461     xxx="`$run ./try`"
15462     case "$?" in
15463         0)
15464             case "$xxx" in
15465                 Yes)  cat >&4 <<EOM
15466 0.0 is represented as all bits zero in memory
15467 EOM
15468                     d_nv_zero_is_allbits_zero="$define"
15469                     ;;
15470                 *)  cat >&4 <<EOM
15471 0.0 is not represented as all bits zero in memory
15472 EOM
15473                     d_nv_zero_is_allbits_zero="$undef"
15474                     ;;
15475             esac
15476             ;;
15477         *)  cat >&4 <<EOM
15478 0.0 is not represented as all bits zero in memory
15479 EOM
15480             d_nv_zero_is_allbits_zero="$undef"
15481             ;;
15482     esac
15483 fi
15484 $rm_try
15485
15486 : check for off64_t
15487 echo " "
15488 echo "Checking to see if you have off64_t..." >&4
15489 $cat >try.c <<EOCP
15490 #include <sys/types.h>
15491 #include <unistd.h>
15492 int main() { off64_t x = 7; }
15493 EOCP
15494 set try
15495 if eval $compile; then
15496         val="$define"
15497         echo "You have off64_t."
15498 else
15499         val="$undef"
15500         echo "You do not have off64_t."
15501         case "$lseeksize" in
15502         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15503         esac
15504 fi
15505 $rm_try
15506 set d_off64_t
15507 eval $setvar
15508
15509 : how to create joinable pthreads
15510 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15511         echo " "
15512         echo "Checking what constant to use for creating joinable pthreads..." >&4
15513         $cat >try.c <<'EOCP'
15514 #include <pthread.h>
15515 int main() {
15516     int detachstate = JOINABLE;
15517 }
15518 EOCP
15519         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15520         if eval $compile; then
15521                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15522                 val="$undef" # Yes, undef.
15523                 set d_old_pthread_create_joinable
15524                 eval $setvar
15525                 val=""
15526                 set old_pthread_create_joinable
15527                 eval $setvar
15528         else
15529                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15530                 if eval $compile; then
15531                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15532                         val="$define"
15533                         set d_old_pthread_create_joinable
15534                         eval $setvar
15535                         val=PTHREAD_CREATE_UNDETACHED
15536                         set old_pthread_create_joinable
15537                         eval $setvar
15538                 else
15539                         set try -DJOINABLE=__UNDETACHED
15540                         if eval $compile; then
15541                                 echo "You seem to use __UNDETACHED." >&4
15542                                 val="$define"
15543                                 set d_old_pthread_create_joinable
15544                                 eval $setvar
15545                                 val=__UNDETACHED
15546                                 set old_pthread_create_joinable
15547                                 eval $setvar
15548                         else
15549                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15550                                 val="$define"
15551                                 set d_old_pthread_create_joinable
15552                                 eval $setvar
15553                                 val=0
15554                                 set old_pthread_create_joinable
15555                                 eval $setvar
15556                         fi
15557                 fi
15558         fi
15559         $rm_try
15560 else
15561     d_old_pthread_create_joinable="$undef"
15562     old_pthread_create_joinable=""
15563 fi
15564
15565 : see if pause exists
15566 set pause d_pause
15567 eval $inlibc
15568
15569 : see if poll exists
15570 set poll d_poll
15571 eval $inlibc
15572
15573 : see if readlink exists
15574 set readlink d_readlink
15575 eval $inlibc
15576
15577 echo " "
15578 procselfexe=''
15579 val="$undef"
15580 case "$d_readlink" in
15581 "$define")
15582         if $issymlink /proc/self/exe ; then
15583                 $ls -l /proc/self/exe > reflect
15584                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15585                         echo "You have Linux-like /proc/self/exe."
15586                         procselfexe='"/proc/self/exe"'
15587                         val="$define"
15588                 fi
15589         fi
15590         if $issymlink /proc/curproc/file ; then
15591                 $ls -l /proc/curproc/file > reflect
15592                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15593                         echo "You have BSD-like /proc/curproc/file."
15594                         procselfexe='"/proc/curproc/file"'
15595                         val="$define"
15596                 fi
15597         fi
15598         ;;
15599 esac
15600 $rm -f reflect
15601 set d_procselfexe
15602 eval $setvar
15603
15604 : backward compatibility for d_hvfork
15605 if test X$d_hvfork != X; then
15606         d_vfork="$d_hvfork"
15607         d_hvfork=''
15608 fi
15609 : see if there is a vfork
15610 val=''
15611 set vfork val
15612 eval $inlibc
15613
15614 d_pseudofork=$undef
15615
15616 : Ok, but do we want to use it. vfork is reportedly unreliable in
15617 : perl on Solaris 2.x, and probably elsewhere.
15618 case "$val" in
15619 $define)
15620         echo " "
15621         case "$usevfork" in
15622         false) dflt='n';;
15623         *) dflt='y';;
15624         esac
15625         cat <<'EOM'
15626
15627 Perl can only use a vfork() that doesn't suffer from strict
15628 restrictions on calling functions or modifying global data in
15629 the child.  For example, glibc-2.1 contains such a vfork()
15630 that is unsuitable.  If your system provides a proper fork()
15631 call, chances are that you do NOT want perl to use vfork().
15632
15633 EOM
15634         rp="Do you still want to use vfork()?"
15635         . ./myread
15636         case "$ans" in
15637         y|Y) ;;
15638         *)
15639                 echo "Ok, we won't use vfork()."
15640                 val="$undef"
15641                 ;;
15642         esac
15643         ;;
15644 esac
15645 set d_vfork
15646 eval $setvar
15647 case "$d_vfork" in
15648 $define) usevfork='true';;
15649 *) usevfork='false';;
15650 esac
15651
15652 : see whether the pthread_atfork exists
15653 $cat >try.c <<EOP
15654 #include <pthread.h>
15655 #include <stdio.h>
15656 int main() {
15657 #ifdef  PTHREAD_ATFORK
15658         pthread_atfork(NULL,NULL,NULL);
15659 #endif
15660 }
15661 EOP
15662
15663 : see if pthread_atfork exists
15664 set try -DPTHREAD_ATFORK
15665 if eval $compile; then
15666     val="$define"
15667 else
15668     val="$undef"
15669 fi
15670 case "$usethreads" in
15671 $define)
15672         case "$val" in
15673         $define) echo 'pthread_atfork found.' >&4        ;;
15674         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15675         esac
15676 esac
15677 set d_pthread_atfork
15678 eval $setvar
15679
15680 : see if pthread_attr_setscope exists
15681 set pthread_attr_setscope d_pthread_attr_setscope
15682 eval $inlibc
15683
15684
15685 : see whether the various POSIXish _yields exist
15686 $cat >try.c <<EOP
15687 #include <pthread.h>
15688 #include <stdio.h>
15689 int main() {
15690 #ifdef SCHED_YIELD
15691         sched_yield();
15692 #else
15693 #ifdef PTHREAD_YIELD
15694         pthread_yield();
15695 #else
15696 #ifdef PTHREAD_YIELD_NULL
15697         pthread_yield(NULL);
15698 #endif
15699 #endif
15700 #endif
15701 }
15702 EOP
15703 : see if sched_yield exists
15704 set try -DSCHED_YIELD
15705 if eval $compile; then
15706     val="$define"
15707     sched_yield='sched_yield()'
15708 else
15709     val="$undef"
15710 fi
15711 case "$usethreads" in
15712 $define)
15713         case "$val" in
15714         $define) echo 'sched_yield() found.' >&4        ;;
15715         *)       echo 'sched_yield() NOT found.' >&4    ;;
15716         esac
15717 esac
15718 set d_sched_yield
15719 eval $setvar
15720
15721 : see if pthread_yield exists
15722 set try -DPTHREAD_YIELD
15723 if eval $compile; then
15724     val="$define"
15725     case "$sched_yield" in
15726     '') sched_yield='pthread_yield()' ;;
15727     esac
15728 else
15729     set try -DPTHREAD_YIELD_NULL
15730     if eval $compile; then
15731         val="$define"
15732         case "$sched_yield" in
15733         '') sched_yield='pthread_yield(NULL)' ;;
15734         esac
15735     else
15736         val="$undef"
15737     fi
15738 fi
15739 case "$usethreads" in
15740 $define)
15741         case "$val" in
15742         $define) echo 'pthread_yield() found.' >&4      ;;
15743         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15744         esac
15745         ;;
15746 esac
15747 set d_pthread_yield
15748 eval $setvar
15749 case "$sched_yield" in
15750 '') sched_yield=undef ;;
15751 esac
15752 $rm_try
15753
15754 : see if random_r exists
15755 set random_r d_random_r
15756 eval $inlibc
15757 case "$d_random_r" in
15758 "$define")
15759         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15760         case "$d_random_r_proto:$usethreads" in
15761         ":define")      d_random_r_proto=define
15762                 set d_random_r_proto random_r $hdrs
15763                 eval $hasproto ;;
15764         *)      ;;
15765         esac
15766         case "$d_random_r_proto" in
15767         define)
15768         case "$random_r_proto" in
15769         ''|0) try='int random_r(int*, struct random_data*);'
15770         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15771         esac
15772         case "$random_r_proto" in
15773         ''|0) try='int random_r(long*, struct random_data*);'
15774         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15775         esac
15776         case "$random_r_proto" in
15777         ''|0) try='int random_r(struct random_data*, int32_t*);'
15778         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15779         esac
15780         case "$random_r_proto" in
15781         ''|0)   d_random_r=undef
15782                 random_r_proto=0
15783                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15784         * )     case "$random_r_proto" in
15785                 REENTRANT_PROTO*) ;;
15786                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15787                 esac
15788                 echo "Prototype: $try" ;;
15789         esac
15790         ;;
15791         *)      case "$usethreads" in
15792                 define) echo "random_r has no prototype, not using it." >&4 ;;
15793                 esac
15794                 d_random_r=undef
15795                 random_r_proto=0
15796                 ;;
15797         esac
15798         ;;
15799 *)      random_r_proto=0
15800         ;;
15801 esac
15802
15803 : see if readdir and friends exist
15804 set readdir d_readdir
15805 eval $inlibc
15806 set seekdir d_seekdir
15807 eval $inlibc
15808 set telldir d_telldir
15809 eval $inlibc
15810 set rewinddir d_rewinddir
15811 eval $inlibc
15812
15813 : see if readdir64_r exists
15814 set readdir64_r d_readdir64_r
15815 eval $inlibc
15816 case "$d_readdir64_r" in
15817 "$define")
15818         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15819         case "$d_readdir64_r_proto:$usethreads" in
15820         ":define")      d_readdir64_r_proto=define
15821                 set d_readdir64_r_proto readdir64_r $hdrs
15822                 eval $hasproto ;;
15823         *)      ;;
15824         esac
15825         case "$d_readdir64_r_proto" in
15826         define)
15827         case "$readdir64_r_proto" in
15828         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15829         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15830         esac
15831         case "$readdir64_r_proto" in
15832         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15833         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15834         esac
15835         case "$readdir64_r_proto" in
15836         ''|0)   d_readdir64_r=undef
15837                 readdir64_r_proto=0
15838                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15839         * )     case "$readdir64_r_proto" in
15840                 REENTRANT_PROTO*) ;;
15841                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15842                 esac
15843                 echo "Prototype: $try" ;;
15844         esac
15845         ;;
15846         *)      case "$usethreads" in
15847                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15848                 esac
15849                 d_readdir64_r=undef
15850                 readdir64_r_proto=0
15851                 ;;
15852         esac
15853         ;;
15854 *)      readdir64_r_proto=0
15855         ;;
15856 esac
15857
15858 : see if readdir_r exists
15859 set readdir_r d_readdir_r
15860 eval $inlibc
15861 case "$d_readdir_r" in
15862 "$define")
15863         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15864         case "$d_readdir_r_proto:$usethreads" in
15865         ":define")      d_readdir_r_proto=define
15866                 set d_readdir_r_proto readdir_r $hdrs
15867                 eval $hasproto ;;
15868         *)      ;;
15869         esac
15870         case "$d_readdir_r_proto" in
15871         define)
15872         case "$readdir_r_proto" in
15873         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15874         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15875         esac
15876         case "$readdir_r_proto" in
15877         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15878         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15879         esac
15880         case "$readdir_r_proto" in
15881         ''|0)   d_readdir_r=undef
15882                 readdir_r_proto=0
15883                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15884         * )     case "$readdir_r_proto" in
15885                 REENTRANT_PROTO*) ;;
15886                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15887                 esac
15888                 echo "Prototype: $try" ;;
15889         esac
15890         ;;
15891         *)      case "$usethreads" in
15892                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15893                 esac
15894                 d_readdir_r=undef
15895                 readdir_r_proto=0
15896                 ;;
15897         esac
15898         ;;
15899 *)      readdir_r_proto=0
15900         ;;
15901 esac
15902
15903 : see if readv exists
15904 set readv d_readv
15905 eval $inlibc
15906
15907 : see if recvmsg exists
15908 set recvmsg d_recvmsg
15909 eval $inlibc
15910
15911 : see if rename exists
15912 set rename d_rename
15913 eval $inlibc
15914
15915 : see if rmdir exists
15916 set rmdir d_rmdir
15917 eval $inlibc
15918
15919 : see if memory.h is available.
15920 val=''
15921 set memory.h val
15922 eval $inhdr
15923
15924 : See if it conflicts with string.h
15925 case "$val" in
15926 $define)
15927         case "$strings" in
15928         '') ;;
15929         *)
15930                 $cppstdin $cppflags $cppminus < $strings > mem.h
15931                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15932                         echo " "
15933                         echo "We won't be including <memory.h>."
15934                         val="$undef"
15935                 fi
15936                 $rm -f mem.h
15937                 ;;
15938         esac
15939 esac
15940 set i_memory
15941 eval $setvar
15942
15943 : can bcopy handle overlapping blocks?
15944 echo " "
15945 val="$undef"
15946 case "$d_memmove" in
15947 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15948 *)      case "$d_bcopy" in
15949         "$define")
15950                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15951                 $cat >try.c <<EOCP
15952 #$i_memory I_MEMORY
15953 #$i_stdlib I_STDLIB
15954 #$i_string I_STRING
15955 #$i_unistd I_UNISTD
15956 EOCP
15957         $cat >>try.c <<'EOCP'
15958 #include <stdio.h>
15959 #ifdef I_MEMORY
15960 #  include <memory.h>
15961 #endif
15962 #ifdef I_STDLIB
15963 #  include <stdlib.h>
15964 #endif
15965 #ifdef I_STRING
15966 #  include <string.h>
15967 #else
15968 #  include <strings.h>
15969 #endif
15970 #ifdef I_UNISTD
15971 #  include <unistd.h>  /* Needed for NetBSD */
15972 #endif
15973 int main()
15974 {
15975 char buf[128], abc[128];
15976 char *b;
15977 int len;
15978 int off;
15979 int align;
15980
15981 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15982    try to store the string in read-only memory. */
15983 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15984
15985 for (align = 7; align >= 0; align--) {
15986         for (len = 36; len; len--) {
15987                 b = buf+align;
15988                 bcopy(abc, b, len);
15989                 for (off = 1; off <= len; off++) {
15990                         bcopy(b, b+off, len);
15991                         bcopy(b+off, b, len);
15992                         if (bcmp(b, abc, len))
15993                                 exit(1);
15994                 }
15995         }
15996 }
15997 exit(0);
15998 }
15999 EOCP
16000                 set try
16001                 if eval $compile_ok; then
16002                         if $run ./try 2>/dev/null; then
16003                                 echo "Yes, it can."
16004                                 val="$define"
16005                         else
16006                                 echo "It can't, sorry."
16007                         fi
16008                 else
16009                         echo "(I can't compile the test program, so we'll assume not...)"
16010                 fi
16011                 ;;
16012         esac
16013         $rm_try
16014         ;;
16015 esac
16016 set d_safebcpy
16017 eval $setvar
16018
16019 : can memcpy handle overlapping blocks?
16020 echo " "
16021 val="$undef"
16022 case "$d_memmove" in
16023 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16024 *)      case "$d_memcpy" in
16025         "$define")
16026                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16027                 $cat >try.c <<EOCP
16028 #$i_memory I_MEMORY
16029 #$i_stdlib I_STDLIB
16030 #$i_string I_STRING
16031 #$i_unistd I_UNISTD
16032 EOCP
16033         $cat >>try.c <<'EOCP'
16034 #include <stdio.h>
16035 #ifdef I_MEMORY
16036 #  include <memory.h>
16037 #endif
16038 #ifdef I_STDLIB
16039 #  include <stdlib.h>
16040 #endif
16041 #ifdef I_STRING
16042 #  include <string.h>
16043 #else
16044 #  include <strings.h>
16045 #endif
16046 #ifdef I_UNISTD
16047 #  include <unistd.h>  /* Needed for NetBSD */
16048 #endif
16049 int main()
16050 {
16051 char buf[128], abc[128];
16052 char *b;
16053 int len;
16054 int off;
16055 int align;
16056
16057 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16058    try to store the string in read-only memory. */
16059 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16060
16061 for (align = 7; align >= 0; align--) {
16062         for (len = 36; len; len--) {
16063                 b = buf+align;
16064                 memcpy(b, abc, len);
16065                 for (off = 1; off <= len; off++) {
16066                         memcpy(b+off, b, len);
16067                         memcpy(b, b+off, len);
16068                         if (memcmp(b, abc, len))
16069                                 exit(1);
16070                 }
16071         }
16072 }
16073 exit(0);
16074 }
16075 EOCP
16076                 set try
16077                 if eval $compile_ok; then
16078                         if $run ./try 2>/dev/null; then
16079                                 echo "Yes, it can."
16080                                 val="$define"
16081                         else
16082                                 echo "It can't, sorry."
16083                         fi
16084                 else
16085                         echo "(I can't compile the test program, so we'll assume not...)"
16086                 fi
16087                 ;;
16088         esac
16089         $rm_try
16090         ;;
16091 esac
16092 set d_safemcpy
16093 eval $setvar
16094
16095 : can memcmp be trusted to compare relative magnitude?
16096 val="$undef"
16097 case "$d_memcmp" in
16098 "$define")
16099         echo " "
16100         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16101         $cat >try.c <<EOCP
16102 #$i_memory I_MEMORY
16103 #$i_stdlib I_STDLIB
16104 #$i_string I_STRING
16105 #$i_unistd I_UNISTD
16106 EOCP
16107         $cat >>try.c <<'EOCP'
16108 #include <stdio.h>
16109 #ifdef I_MEMORY
16110 #  include <memory.h>
16111 #endif
16112 #ifdef I_STDLIB
16113 #  include <stdlib.h>
16114 #endif
16115 #ifdef I_STRING
16116 #  include <string.h>
16117 #else
16118 #  include <strings.h>
16119 #endif
16120 #ifdef I_UNISTD
16121 #  include <unistd.h>  /* Needed for NetBSD */
16122 #endif
16123 int main()
16124 {
16125 char a = -1;
16126 char b = 0;
16127 if ((a < b) && memcmp(&a, &b, 1) < 0)
16128         exit(1);
16129 exit(0);
16130 }
16131 EOCP
16132         set try
16133         if eval $compile_ok; then
16134                 if $run ./try 2>/dev/null; then
16135                         echo "Yes, it can."
16136                         val="$define"
16137                 else
16138                         echo "No, it can't (it uses signed chars)."
16139                 fi
16140         else
16141                 echo "(I can't compile the test program, so we'll assume not...)"
16142         fi
16143         ;;
16144 esac
16145 $rm_try
16146 set d_sanemcmp
16147 eval $setvar
16148
16149 : see if prototype for sbrk is available
16150 echo " "
16151 set d_sbrkproto sbrk $i_unistd unistd.h
16152 eval $hasproto
16153
16154 : see if select exists
16155 set select d_select
16156 eval $inlibc
16157
16158 : see if semctl exists
16159 set semctl d_semctl
16160 eval $inlibc
16161
16162 : see if semget exists
16163 set semget d_semget
16164 eval $inlibc
16165
16166 : see if semop exists
16167 set semop d_semop
16168 eval $inlibc
16169
16170 : see how much of the 'sem*(2)' library is present.
16171 h_sem=true
16172 echo " "
16173 case "$d_semctl$d_semget$d_semop" in
16174 *"$undef"*) h_sem=false;;
16175 esac
16176 case "$osname" in
16177 freebsd)
16178     case "`ipcs 2>&1`" in
16179     "SVID messages"*"not configured"*)
16180         echo "Your $osname does not have the sem*(2) configured." >&4
16181         h_sem=false
16182         val="$undef"
16183         set semctl d_semctl
16184         eval $setvar
16185         set semget d_semget
16186         eval $setvar
16187         set semop d_semop
16188         eval $setvar
16189         ;;
16190     esac
16191     ;;
16192 esac
16193 : we could also check for sys/ipc.h ...
16194 if $h_sem && $test `./findhdr sys/sem.h`; then
16195         echo "You have the full sem*(2) library." >&4
16196         val="$define"
16197 else
16198         echo "You don't have the full sem*(2) library." >&4
16199         val="$undef"
16200 fi
16201 set d_sem
16202 eval $setvar
16203
16204 : see whether sys/sem.h defines union semun
16205 echo " "
16206 $cat > try.c <<'END'
16207 #include <sys/types.h>
16208 #include <sys/ipc.h>
16209 #include <sys/sem.h>
16210 int main () { union semun semun; semun.buf = 0; }
16211 END
16212 set try
16213 if eval $compile; then
16214     echo "You have union semun in <sys/sem.h>." >&4
16215     val="$define"
16216 else
16217     echo "You do not have union semun in <sys/sem.h>." >&4
16218     val="$undef"
16219 fi
16220 $rm_try
16221 set d_union_semun
16222 eval $setvar
16223
16224 : see how to do semctl IPC_STAT
16225 case "$d_sem" in
16226 $define)
16227     echo " "
16228     $cat > tryh.h <<END
16229 #ifndef S_IRUSR
16230 #   ifdef S_IREAD
16231 #       define S_IRUSR S_IREAD
16232 #       define S_IWUSR S_IWRITE
16233 #       define S_IXUSR S_IEXEC
16234 #   else
16235 #       define S_IRUSR 0400
16236 #       define S_IWUSR 0200
16237 #       define S_IXUSR 0100
16238 #   endif
16239 #   define S_IRGRP (S_IRUSR>>3)
16240 #   define S_IWGRP (S_IWUSR>>3)
16241 #   define S_IXGRP (S_IXUSR>>3)
16242 #   define S_IROTH (S_IRUSR>>6)
16243 #   define S_IWOTH (S_IWUSR>>6)
16244 #   define S_IXOTH (S_IXUSR>>6)
16245 #endif
16246 #ifndef S_IRWXU
16247 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16248 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16249 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16250 #endif
16251 END
16252     : see whether semctl IPC_STAT can use union semun
16253     case "$d_semctl_semun" in
16254     '')
16255       val="$undef"
16256       $cat > try.c <<END
16257 #include <sys/types.h>
16258 #include <sys/ipc.h>
16259 #include <sys/sem.h>
16260 #include <sys/stat.h>
16261 #include <stdio.h>
16262 #include <errno.h>
16263 #include "tryh.h"
16264 #ifndef errno
16265 extern int errno;
16266 #endif
16267 #$d_union_semun HAS_UNION_SEMUN
16268 int main() {
16269     union semun
16270 #ifndef HAS_UNION_SEMUN
16271     {
16272         int val;
16273         struct semid_ds *buf;
16274         unsigned short *array;
16275     }
16276 #endif
16277     arg;
16278     int sem, st;
16279
16280 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16281     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16282     if (sem > -1) {
16283         struct semid_ds argbuf;
16284         arg.buf = &argbuf;
16285 #       ifdef IPC_STAT
16286         st = semctl(sem, 0, IPC_STAT, arg);
16287         if (st == 0)
16288             printf("semun\n");
16289         else
16290 #       endif /* IPC_STAT */
16291             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16292 #       ifdef IPC_RMID
16293         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16294 #       endif /* IPC_RMID */
16295             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16296     } else
16297 #endif /* IPC_PRIVATE && ... */
16298         printf("semget failed: errno = %d\n", errno);
16299   return 0;
16300 }
16301 END
16302       set try
16303       if eval $compile; then
16304           xxx=`$run ./try`
16305           case "$xxx" in
16306           semun) val="$define" ;;
16307           esac
16308       fi
16309       $rm_try
16310       set d_semctl_semun
16311       eval $setvar
16312       ;;
16313     esac
16314     case "$d_semctl_semun" in
16315     $define)
16316         echo "You can use union semun for semctl IPC_STAT." >&4
16317         also='also'
16318         ;;
16319     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16320         also=''
16321         ;;
16322     esac
16323
16324     : see whether semctl IPC_STAT can use struct semid_ds pointer
16325     case "$d_semctl_semid_ds" in
16326     '')
16327       val="$undef"
16328       $cat > try.c <<'END'
16329 #include <sys/types.h>
16330 #include <sys/ipc.h>
16331 #include <sys/sem.h>
16332 #include <sys/stat.h>
16333 #include "tryh.h"
16334 #include <stdio.h>
16335 #include <errno.h>
16336 #ifndef errno
16337 extern int errno;
16338 #endif
16339 int main() {
16340     struct semid_ds arg;
16341     int sem, st;
16342
16343 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16344     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16345     if (sem > -1) {
16346 #       ifdef IPC_STAT
16347         st = semctl(sem, 0, IPC_STAT, &arg);
16348         if (st == 0)
16349             printf("semid_ds\n");
16350         else
16351 #       endif /* IPC_STAT */
16352             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16353 #       ifdef IPC_RMID
16354         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16355 #       endif /* IPC_RMID */
16356             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16357     } else
16358 #endif /* IPC_PRIVATE && ... */
16359         printf("semget failed: errno = %d\n", errno);
16360
16361     return 0;
16362 }
16363 END
16364       set try
16365       if eval $compile; then
16366           xxx=`$run ./try`
16367           case "$xxx" in
16368           semid_ds) val="$define" ;;
16369           esac
16370       fi
16371       $rm_try
16372       set d_semctl_semid_ds
16373       eval $setvar
16374       ;;
16375     esac
16376     case "$d_semctl_semid_ds" in
16377     $define)
16378         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16379         ;;
16380     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16381         ;;
16382     esac
16383     ;;
16384 *)  val="$undef"
16385
16386     # We do not have the full sem*(2) library, so assume we can not
16387     # use either.
16388
16389     set d_semctl_semun
16390     eval $setvar
16391
16392     set d_semctl_semid_ds
16393     eval $setvar
16394     ;;
16395 esac
16396 $rm_try tryh.h
16397
16398 : see if sendmsg exists
16399 set sendmsg d_sendmsg
16400 eval $inlibc
16401
16402 : see if setegid exists
16403 set setegid d_setegid
16404 eval $inlibc
16405
16406 : see if seteuid exists
16407 set seteuid d_seteuid
16408 eval $inlibc
16409
16410 : see if setgrent exists
16411 set setgrent d_setgrent
16412 eval $inlibc
16413
16414 : see if setgrent_r exists
16415 set setgrent_r d_setgrent_r
16416 eval $inlibc
16417 case "$d_setgrent_r" in
16418 "$define")
16419         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16420         case "$d_setgrent_r_proto:$usethreads" in
16421         ":define")      d_setgrent_r_proto=define
16422                 set d_setgrent_r_proto setgrent_r $hdrs
16423                 eval $hasproto ;;
16424         *)      ;;
16425         esac
16426         case "$d_setgrent_r_proto" in
16427         define)
16428         case "$setgrent_r_proto" in
16429         ''|0) try='int setgrent_r(FILE**);'
16430         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16431         esac
16432         case "$setgrent_r_proto" in
16433         ''|0) try='void setgrent_r(FILE**);'
16434         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16435         esac
16436         case "$setgrent_r_proto" in
16437         ''|0)   d_setgrent_r=undef
16438                 setgrent_r_proto=0
16439                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16440         * )     case "$setgrent_r_proto" in
16441                 REENTRANT_PROTO*) ;;
16442                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16443                 esac
16444                 echo "Prototype: $try" ;;
16445         esac
16446         ;;
16447         *)      case "$usethreads" in
16448                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16449                 esac
16450                 d_setgrent_r=undef
16451                 setgrent_r_proto=0
16452                 ;;
16453         esac
16454         ;;
16455 *)      setgrent_r_proto=0
16456         ;;
16457 esac
16458
16459 : see if sethostent exists
16460 set sethostent d_sethent
16461 eval $inlibc
16462
16463 : see if sethostent_r exists
16464 set sethostent_r d_sethostent_r
16465 eval $inlibc
16466 case "$d_sethostent_r" in
16467 "$define")
16468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16469         case "$d_sethostent_r_proto:$usethreads" in
16470         ":define")      d_sethostent_r_proto=define
16471                 set d_sethostent_r_proto sethostent_r $hdrs
16472                 eval $hasproto ;;
16473         *)      ;;
16474         esac
16475         case "$d_sethostent_r_proto" in
16476         define)
16477         case "$sethostent_r_proto" in
16478         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16479         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16480         esac
16481         case "$sethostent_r_proto" in
16482         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16483         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16484         esac
16485         case "$sethostent_r_proto" in
16486         ''|0)   d_sethostent_r=undef
16487                 sethostent_r_proto=0
16488                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16489         * )     case "$sethostent_r_proto" in
16490                 REENTRANT_PROTO*) ;;
16491                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16492                 esac
16493                 echo "Prototype: $try" ;;
16494         esac
16495         ;;
16496         *)      case "$usethreads" in
16497                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16498                 esac
16499                 d_sethostent_r=undef
16500                 sethostent_r_proto=0
16501                 ;;
16502         esac
16503         ;;
16504 *)      sethostent_r_proto=0
16505         ;;
16506 esac
16507
16508 : see if setitimer exists
16509 set setitimer d_setitimer
16510 eval $inlibc
16511
16512 : see if setlinebuf exists
16513 set setlinebuf d_setlinebuf
16514 eval $inlibc
16515
16516 : see if setlocale exists
16517 set setlocale d_setlocale
16518 eval $inlibc
16519
16520 : see if locale.h is available
16521 set locale.h i_locale
16522 eval $inhdr
16523
16524 : see if setlocale_r exists
16525 set setlocale_r d_setlocale_r
16526 eval $inlibc
16527 case "$d_setlocale_r" in
16528 "$define")
16529         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16530         case "$d_setlocale_r_proto:$usethreads" in
16531         ":define")      d_setlocale_r_proto=define
16532                 set d_setlocale_r_proto setlocale_r $hdrs
16533                 eval $hasproto ;;
16534         *)      ;;
16535         esac
16536         case "$d_setlocale_r_proto" in
16537         define)
16538         case "$setlocale_r_proto" in
16539         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16540         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16541         esac
16542         case "$setlocale_r_proto" in
16543         ''|0)   d_setlocale_r=undef
16544                 setlocale_r_proto=0
16545                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16546         * )     case "$setlocale_r_proto" in
16547                 REENTRANT_PROTO*) ;;
16548                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16549                 esac
16550                 echo "Prototype: $try" ;;
16551         esac
16552         ;;
16553         *)      case "$usethreads" in
16554                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16555                 esac
16556                 d_setlocale_r=undef
16557                 setlocale_r_proto=0
16558                 ;;
16559         esac
16560         ;;
16561 *)      setlocale_r_proto=0
16562         ;;
16563 esac
16564
16565 : see if setnetent exists
16566 set setnetent d_setnent
16567 eval $inlibc
16568
16569 : see if setnetent_r exists
16570 set setnetent_r d_setnetent_r
16571 eval $inlibc
16572 case "$d_setnetent_r" in
16573 "$define")
16574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16575         case "$d_setnetent_r_proto:$usethreads" in
16576         ":define")      d_setnetent_r_proto=define
16577                 set d_setnetent_r_proto setnetent_r $hdrs
16578                 eval $hasproto ;;
16579         *)      ;;
16580         esac
16581         case "$d_setnetent_r_proto" in
16582         define)
16583         case "$setnetent_r_proto" in
16584         ''|0) try='int setnetent_r(int, struct netent_data*);'
16585         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16586         esac
16587         case "$setnetent_r_proto" in
16588         ''|0) try='void setnetent_r(int, struct netent_data*);'
16589         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16590         esac
16591         case "$setnetent_r_proto" in
16592         ''|0)   d_setnetent_r=undef
16593                 setnetent_r_proto=0
16594                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16595         * )     case "$setnetent_r_proto" in
16596                 REENTRANT_PROTO*) ;;
16597                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16598                 esac
16599                 echo "Prototype: $try" ;;
16600         esac
16601         ;;
16602         *)      case "$usethreads" in
16603                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16604                 esac
16605                 d_setnetent_r=undef
16606                 setnetent_r_proto=0
16607                 ;;
16608         esac
16609         ;;
16610 *)      setnetent_r_proto=0
16611         ;;
16612 esac
16613
16614 : see if setprotoent exists
16615 set setprotoent d_setpent
16616 eval $inlibc
16617
16618 : see if setpgid exists
16619 set setpgid d_setpgid
16620 eval $inlibc
16621
16622 : see if setpgrp2 exists
16623 set setpgrp2 d_setpgrp2
16624 eval $inlibc
16625
16626 : see if setpriority exists
16627 set setpriority d_setprior
16628 eval $inlibc
16629
16630 : see if setproctitle exists
16631 set setproctitle d_setproctitle
16632 eval $inlibc
16633
16634 : see if setprotoent_r exists
16635 set setprotoent_r d_setprotoent_r
16636 eval $inlibc
16637 case "$d_setprotoent_r" in
16638 "$define")
16639         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16640         case "$d_setprotoent_r_proto:$usethreads" in
16641         ":define")      d_setprotoent_r_proto=define
16642                 set d_setprotoent_r_proto setprotoent_r $hdrs
16643                 eval $hasproto ;;
16644         *)      ;;
16645         esac
16646         case "$d_setprotoent_r_proto" in
16647         define)
16648         case "$setprotoent_r_proto" in
16649         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16650         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16651         esac
16652         case "$setprotoent_r_proto" in
16653         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16654         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16655         esac
16656         case "$setprotoent_r_proto" in
16657         ''|0)   d_setprotoent_r=undef
16658                 setprotoent_r_proto=0
16659                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16660         * )     case "$setprotoent_r_proto" in
16661                 REENTRANT_PROTO*) ;;
16662                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16663                 esac
16664                 echo "Prototype: $try" ;;
16665         esac
16666         ;;
16667         *)      case "$usethreads" in
16668                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16669                 esac
16670                 d_setprotoent_r=undef
16671                 setprotoent_r_proto=0
16672                 ;;
16673         esac
16674         ;;
16675 *)      setprotoent_r_proto=0
16676         ;;
16677 esac
16678
16679 : see if setpwent exists
16680 set setpwent d_setpwent
16681 eval $inlibc
16682
16683 : see if setpwent_r exists
16684 set setpwent_r d_setpwent_r
16685 eval $inlibc
16686 case "$d_setpwent_r" in
16687 "$define")
16688         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16689         case "$d_setpwent_r_proto:$usethreads" in
16690         ":define")      d_setpwent_r_proto=define
16691                 set d_setpwent_r_proto setpwent_r $hdrs
16692                 eval $hasproto ;;
16693         *)      ;;
16694         esac
16695         case "$d_setpwent_r_proto" in
16696         define)
16697         case "$setpwent_r_proto" in
16698         ''|0) try='int setpwent_r(FILE**);'
16699         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16700         esac
16701         case "$setpwent_r_proto" in
16702         ''|0) try='void setpwent_r(FILE**);'
16703         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16704         esac
16705         case "$setpwent_r_proto" in
16706         ''|0)   d_setpwent_r=undef
16707                 setpwent_r_proto=0
16708                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16709         * )     case "$setpwent_r_proto" in
16710                 REENTRANT_PROTO*) ;;
16711                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16712                 esac
16713                 echo "Prototype: $try" ;;
16714         esac
16715         ;;
16716         *)      case "$usethreads" in
16717                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16718                 esac
16719                 d_setpwent_r=undef
16720                 setpwent_r_proto=0
16721                 ;;
16722         esac
16723         ;;
16724 *)      setpwent_r_proto=0
16725         ;;
16726 esac
16727
16728 : see if setregid exists
16729 set setregid d_setregid
16730 eval $inlibc
16731 set setresgid d_setresgid
16732 eval $inlibc
16733
16734 : see if setreuid exists
16735 set setreuid d_setreuid
16736 eval $inlibc
16737 set setresuid d_setresuid
16738 eval $inlibc
16739
16740 : see if setrgid exists
16741 set setrgid d_setrgid
16742 eval $inlibc
16743
16744 : see if setruid exists
16745 set setruid d_setruid
16746 eval $inlibc
16747
16748 : see if setservent exists
16749 set setservent d_setsent
16750 eval $inlibc
16751
16752 : see if setservent_r exists
16753 set setservent_r d_setservent_r
16754 eval $inlibc
16755 case "$d_setservent_r" in
16756 "$define")
16757         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16758         case "$d_setservent_r_proto:$usethreads" in
16759         ":define")      d_setservent_r_proto=define
16760                 set d_setservent_r_proto setservent_r $hdrs
16761                 eval $hasproto ;;
16762         *)      ;;
16763         esac
16764         case "$d_setservent_r_proto" in
16765         define)
16766         case "$setservent_r_proto" in
16767         ''|0) try='int setservent_r(int, struct servent_data*);'
16768         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16769         esac
16770         case "$setservent_r_proto" in
16771         ''|0) try='void setservent_r(int, struct servent_data*);'
16772         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16773         esac
16774         case "$setservent_r_proto" in
16775         ''|0)   d_setservent_r=undef
16776                 setservent_r_proto=0
16777                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16778         * )     case "$setservent_r_proto" in
16779                 REENTRANT_PROTO*) ;;
16780                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16781                 esac
16782                 echo "Prototype: $try" ;;
16783         esac
16784         ;;
16785         *)      case "$usethreads" in
16786                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16787                 esac
16788                 d_setservent_r=undef
16789                 setservent_r_proto=0
16790                 ;;
16791         esac
16792         ;;
16793 *)      setservent_r_proto=0
16794         ;;
16795 esac
16796
16797 : see if setsid exists
16798 set setsid d_setsid
16799 eval $inlibc
16800
16801 : see if setvbuf exists
16802 set setvbuf d_setvbuf
16803 eval $inlibc
16804
16805 : see if sfio.h is available
16806 set sfio.h i_sfio
16807 eval $inhdr
16808
16809
16810 : see if sfio library is available
16811 case "$i_sfio" in
16812 $define)
16813         val=''
16814         set sfreserve val
16815         eval $inlibc
16816         ;;
16817 *)
16818         val="$undef"
16819         ;;
16820 esac
16821 : Ok, but do we want to use it.
16822 case "$val" in
16823 $define)
16824         case "$usesfio" in
16825         true|$define|[yY]*) dflt='y';;
16826         *) dflt='n';;
16827         esac
16828         echo "$package can use the sfio library, but it is experimental."
16829         case "$useperlio" in
16830         "$undef")
16831             echo "For sfio also the PerlIO abstraction layer is needed."
16832             echo "Earlier you said you wouldn't want that."
16833             ;;
16834         esac
16835         rp="You seem to have sfio available, do you want to try using it?"
16836         . ./myread
16837         case "$ans" in
16838         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16839                 useperlio="$define"
16840                 val="$define"
16841                 ;;
16842         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16843                 val="$undef"
16844                 ;;
16845         esac
16846         ;;
16847 *)      case "$usesfio" in
16848         true|$define|[yY]*)
16849                 echo "Sorry, cannot find sfio on this machine." >&4
16850                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16851                 val="$undef"
16852                 ;;
16853         esac
16854         ;;
16855 esac
16856 set d_sfio
16857 eval $setvar
16858 case "$d_sfio" in
16859 $define) usesfio='true';;
16860 *) usesfio='false';;
16861 esac
16862 case "$d_sfio" in
16863 $define) ;;
16864 *)      : Remove sfio from list of libraries to use
16865         case "$libs" in
16866         *-lsfio*)
16867                 echo "Removing unneeded -lsfio from library list" >&4
16868                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16869                 shift
16870                 libs="$*"
16871                 echo "libs = $libs" >&4
16872                 ;;
16873         esac
16874 ;;
16875 esac
16876
16877
16878 : see if shmctl exists
16879 set shmctl d_shmctl
16880 eval $inlibc
16881
16882 : see if shmget exists
16883 set shmget d_shmget
16884 eval $inlibc
16885
16886 : see if shmat exists
16887 set shmat d_shmat
16888 eval $inlibc
16889 : see what shmat returns
16890 case "$d_shmat" in
16891 "$define")
16892         $cat >shmat.c <<'END'
16893 #include <sys/shm.h>
16894 void *shmat();
16895 END
16896         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16897                 shmattype='void *'
16898         else
16899                 shmattype='char *'
16900         fi
16901         echo "and it returns ($shmattype)." >&4
16902         : see if a prototype for shmat is available
16903         xxx=`./findhdr sys/shm.h`
16904         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16905         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16906                 val="$define"
16907         else
16908                 val="$undef"
16909         fi
16910         $rm -f shmat.[co]
16911         ;;
16912 *)
16913         val="$undef"
16914         ;;
16915 esac
16916 set d_shmatprototype
16917 eval $setvar
16918
16919 : see if shmdt exists
16920 set shmdt d_shmdt
16921 eval $inlibc
16922
16923 : see how much of the 'shm*(2)' library is present.
16924 h_shm=true
16925 echo " "
16926 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16927 *"$undef"*) h_shm=false;;
16928 esac
16929 case "$osname" in
16930 freebsd)
16931     case "`ipcs 2>&1`" in
16932     "SVID shared memory"*"not configured"*)
16933         echo "Your $osname does not have the shm*(2) configured." >&4
16934         h_shm=false
16935         val="$undef"
16936         set shmctl d_shmctl
16937         evat $setvar
16938         set shmget d_shmget
16939         evat $setvar
16940         set shmat d_shmat
16941         evat $setvar
16942         set shmdt d_shmdt
16943         evat $setvar
16944         ;;
16945     esac
16946     ;;
16947 esac
16948 : we could also check for sys/ipc.h ...
16949 if $h_shm && $test `./findhdr sys/shm.h`; then
16950         echo "You have the full shm*(2) library." >&4
16951         val="$define"
16952 else
16953         echo "You don't have the full shm*(2) library." >&4
16954         val="$undef"
16955 fi
16956 set d_shm
16957 eval $setvar
16958
16959 echo " "
16960 : see if we have sigaction
16961 if set sigaction val -f d_sigaction; eval $csym; $val; then
16962         echo 'sigaction() found.' >&4
16963         $cat > try.c <<EOP
16964 #include <stdio.h>
16965 #include <sys/types.h>
16966 #include <signal.h>
16967 #$i_stdlib I_STDLIB
16968 #ifdef I_STDLIB
16969 #include <stdlib.h>
16970 #endif
16971 int main()
16972 {
16973     struct sigaction act, oact;
16974     act.sa_flags = 0;
16975     oact.sa_handler = 0;
16976     /* so that act and oact are used */
16977     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16978 }
16979 EOP
16980         set try
16981         if eval $compile_ok; then
16982                 val="$define"
16983         else
16984                 echo "But you don't seem to have a useable struct sigaction." >&4
16985                 val="$undef"
16986         fi
16987 else
16988         echo 'sigaction NOT found.' >&4
16989         val="$undef"
16990 fi
16991 set d_sigaction; eval $setvar
16992 $rm_try
16993
16994 : see if this is a sunmath.h system
16995 set sunmath.h i_sunmath
16996 eval $inhdr
16997
16998 : see if signbit exists
16999 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17000 $cat >try.c <<EOCP
17001 #$i_math I_MATH
17002 #$i_sunmath I_SUNMATH
17003 #ifdef I_MATH
17004 #  include <math.h>
17005 #endif
17006 #ifdef I_SUNMATH  /* Solaris special math library */
17007 #  include <sunmath.h>
17008 #endif
17009 #define NV $nvtype
17010 int main(int argc, char **argv)
17011 {
17012     NV x = 0.0;
17013     NV y = -0.0;
17014     if ((signbit(x) == 0) && (signbit(y) != 0))
17015         return 0;
17016     else
17017         return 1;
17018 }
17019 EOCP
17020 val="$undef"
17021 set try
17022 if eval $compile; then
17023     if $run ./try; then
17024         $echo "Yes." >&4
17025         val="$define"
17026     else
17027         $echo "Signbit seems to be available, but doesn't work as I expected."
17028         $echo "I won't use it." >&4
17029         val="$undef"
17030     fi
17031 else
17032     $echo "Nope." >&4
17033     dflt="$undef"
17034 fi
17035 set d_signbit
17036 eval $setvar
17037 $rm_try
17038
17039 : see if sigprocmask exists
17040 set sigprocmask d_sigprocmask
17041 eval $inlibc
17042
17043 : see if sigsetjmp exists
17044 echo " "
17045 case "$d_sigsetjmp" in
17046 '')
17047         $cat >try.c <<EOP
17048 #include <setjmp.h>
17049 #$i_stdlib I_STDLIB
17050 #ifdef I_STDLIB
17051 #include <stdlib.h>
17052 #endif
17053 sigjmp_buf env;
17054 int set = 1;
17055 int main()
17056 {
17057         if (sigsetjmp(env,1))
17058                 exit(set);
17059         set = 0;
17060         siglongjmp(env, 1);
17061         exit(1);
17062 }
17063 EOP
17064         set try
17065         if eval $compile; then
17066                 if $run ./try >/dev/null 2>&1; then
17067                         echo "POSIX sigsetjmp found." >&4
17068                         val="$define"
17069                 else
17070                         $cat >&4 <<EOM
17071 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17072 I'll ignore them.
17073 EOM
17074                         val="$undef"
17075                 fi
17076         else
17077                 echo "sigsetjmp not found." >&4
17078                 val="$undef"
17079         fi
17080         ;;
17081 *) val="$d_sigsetjmp"
17082         case "$d_sigsetjmp" in
17083         $define) echo "POSIX sigsetjmp found." >&4;;
17084         $undef) echo "sigsetjmp not found." >&4;;
17085         esac
17086         ;;
17087 esac
17088 set d_sigsetjmp
17089 eval $setvar
17090 $rm_try
17091
17092 : see if snprintf exists
17093 set snprintf d_snprintf
17094 eval $inlibc
17095
17096 : see if vsnprintf exists
17097 set vsnprintf d_vsnprintf
17098 eval $inlibc
17099
17100 case "$d_snprintf-$d_vsnprintf" in
17101 "$define-$define")
17102     $cat <<EOM
17103 Checking whether your snprintf() and vsnprintf() work okay...
17104 EOM
17105     $cat >try.c <<'EOCP'
17106 /* v?snprintf testing logic courtesy of Russ Allbery.
17107  * According to C99:
17108  * - if the buffer is too short it still must be \0-terminated
17109  * - if the buffer is too short the potentially required length
17110  *   must be returned and not -1
17111  * - if the buffer is NULL the potentially required length
17112  *   must be returned and not -1 or core dump
17113  */
17114 #include <stdio.h>
17115 #include <stdarg.h>
17116
17117 char buf[2];
17118
17119 int test (char *format, ...)
17120 {
17121     va_list args;
17122     int count;
17123
17124     va_start (args, format);
17125     count = vsnprintf (buf, sizeof buf, format, args);
17126     va_end (args);
17127     return count;
17128 }
17129
17130 int main ()
17131 {
17132     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17133              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17134 }
17135 EOCP
17136     set try
17137     if eval $compile; then
17138         `$run ./try`
17139         case "$?" in
17140         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17141         *) cat <<EOM >&4
17142 Your snprintf() and snprintf() don't seem to be working okay.
17143 EOM
17144            d_snprintf="$undef"
17145            d_vsnprintf="$undef"
17146            ;;
17147         esac
17148     else
17149         echo "(I can't seem to compile the test program--assuming they don't)"
17150         d_snprintf="$undef"
17151         d_vsnprintf="$undef"
17152     fi
17153     $rm_try
17154     ;;
17155 esac
17156
17157 : see if sockatmark exists
17158 set sockatmark d_sockatmark
17159 eval $inlibc
17160
17161 : see if prototype for sockatmark is available
17162 echo " "
17163 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17164 eval $hasproto
17165
17166 : see if socks5_init exists
17167 set socks5_init d_socks5_init
17168 eval $inlibc
17169
17170 : see if sprintf returns the length of the string in the buffer as per ANSI
17171 $echo "Checking whether sprintf returns the length of the string..." >&4
17172 $cat <<EOP >try.c
17173 #include <stdio.h>
17174 #$i_stdlib I_STDLIB
17175 #ifdef I_STDLIB
17176 #include <stdlib.h>
17177 #endif
17178 #$i_string I_STRING
17179 #ifdef I_STRING
17180 #  include <string.h>
17181 #else
17182 #  include <strings.h>
17183 #endif
17184 #$i_math I_MATH
17185 #ifdef I_MATH
17186 #include <math.h>
17187 #endif
17188
17189 char buffer[256];
17190
17191 int check (size_t expect, int test) {
17192   size_t got = strlen(buffer);
17193   if (expect == got)
17194     return 0;
17195
17196   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17197        test, buffer);
17198   exit (test);
17199 }
17200
17201 int main(int argc, char **argv) {
17202   int test = 0;
17203
17204   check(sprintf(buffer, ""), ++test);
17205   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17206   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17207
17208   return 0;
17209 }
17210 EOP
17211 set try
17212
17213 d_sprintf_returns_strlen="$undef"
17214 if eval $compile; then
17215     xxx="`$run ./try`"
17216     case "$?" in
17217         0) cat >&4 <<EOM
17218 sprintf returns the length of the string (as ANSI says it should)
17219 EOM
17220         d_sprintf_returns_strlen="$define"
17221         ;;
17222         *) cat >&4 <<EOM
17223 sprintf does not return the length of the string (how old is this system?)
17224 EOM
17225         d_sprintf_returns_strlen="$undef"
17226         ;;
17227     esac
17228 fi
17229 $rm_try
17230
17231 : see if srand48_r exists
17232 set srand48_r d_srand48_r
17233 eval $inlibc
17234 case "$d_srand48_r" in
17235 "$define")
17236         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17237         case "$d_srand48_r_proto:$usethreads" in
17238         ":define")      d_srand48_r_proto=define
17239                 set d_srand48_r_proto srand48_r $hdrs
17240                 eval $hasproto ;;
17241         *)      ;;
17242         esac
17243         case "$d_srand48_r_proto" in
17244         define)
17245         case "$srand48_r_proto" in
17246         ''|0) try='int srand48_r(long, struct drand48_data*);'
17247         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17248         esac
17249         case "$srand48_r_proto" in
17250         ''|0)   d_srand48_r=undef
17251                 srand48_r_proto=0
17252                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17253         * )     case "$srand48_r_proto" in
17254                 REENTRANT_PROTO*) ;;
17255                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17256                 esac
17257                 echo "Prototype: $try" ;;
17258         esac
17259         ;;
17260         *)      case "$usethreads" in
17261                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17262                 esac
17263                 d_srand48_r=undef
17264                 srand48_r_proto=0
17265                 ;;
17266         esac
17267         ;;
17268 *)      srand48_r_proto=0
17269         ;;
17270 esac
17271
17272 : see if srandom_r exists
17273 set srandom_r d_srandom_r
17274 eval $inlibc
17275 case "$d_srandom_r" in
17276 "$define")
17277         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17278         case "$d_srandom_r_proto:$usethreads" in
17279         ":define")      d_srandom_r_proto=define
17280                 set d_srandom_r_proto srandom_r $hdrs
17281                 eval $hasproto ;;
17282         *)      ;;
17283         esac
17284         case "$d_srandom_r_proto" in
17285         define)
17286         case "$srandom_r_proto" in
17287         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17288         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17289         esac
17290         case "$srandom_r_proto" in
17291         ''|0)   d_srandom_r=undef
17292                 srandom_r_proto=0
17293                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17294         * )     case "$srandom_r_proto" in
17295                 REENTRANT_PROTO*) ;;
17296                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17297                 esac
17298                 echo "Prototype: $try" ;;
17299         esac
17300         ;;
17301         *)      case "$usethreads" in
17302                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17303                 esac
17304                 d_srandom_r=undef
17305                 srandom_r_proto=0
17306                 ;;
17307         esac
17308         ;;
17309 *)      srandom_r_proto=0
17310         ;;
17311 esac
17312
17313 : see if prototype for setresgid is available
17314 echo " "
17315 set d_sresgproto setresgid $i_unistd unistd.h
17316 eval $hasproto
17317
17318 : see if prototype for setresuid is available
17319 echo " "
17320 set d_sresuproto setresuid $i_unistd unistd.h
17321 eval $hasproto
17322
17323 : see if sys/stat.h is available
17324 set sys/stat.h i_sysstat
17325 eval $inhdr
17326
17327
17328 : see if stat knows about block sizes
17329 echo " "
17330 echo "Checking to see if your struct stat has st_blocks field..." >&4
17331 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17332 eval $hasfield
17333
17334
17335 : see if this is a sys/vfs.h system
17336 set sys/vfs.h i_sysvfs
17337 eval $inhdr
17338
17339
17340 : see if this is a sys/statfs.h system
17341 set sys/statfs.h i_sysstatfs
17342 eval $inhdr
17343
17344
17345 echo " "
17346 echo "Checking to see if your system supports struct statfs..." >&4
17347 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
17348 eval $hasstruct
17349 case "$d_statfs_s" in
17350 "$define")      echo "Yes, it does."   ;;
17351 *)              echo "No, it doesn't." ;;
17352 esac
17353
17354
17355
17356 : see if struct statfs knows about f_flags
17357 case "$d_statfs_s" in
17358 define) 
17359         echo " "
17360         echo "Checking to see if your struct statfs has f_flags field..." >&4
17361         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
17362         eval $hasfield
17363         ;;
17364 *)      val="$undef"
17365         set d_statfs_f_flags
17366         eval $setvar
17367         ;;
17368 esac
17369 case "$d_statfs_f_flags" in
17370 "$define")      echo "Yes, it does."   ;;
17371 *)              echo "No, it doesn't." ;;
17372 esac
17373
17374 $cat >&4 <<EOM
17375 Checking how to access stdio streams by file descriptor number...
17376 EOM
17377 case "$stdio_stream_array" in
17378 '')     $cat >try.c <<EOCP
17379 #include <stdio.h>
17380 int main() {
17381   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17382     printf("yes\n");
17383 }
17384 EOCP
17385         for s in _iob __iob __sF
17386         do
17387                 set try -DSTDIO_STREAM_ARRAY=$s
17388                 if eval $compile; then
17389                         case "`$run ./try`" in
17390                         yes)    stdio_stream_array=$s; break ;;
17391                         esac
17392                 fi
17393         done
17394         $rm_try
17395 esac
17396 case "$stdio_stream_array" in
17397 '')     $cat >&4 <<EOM
17398 I can't figure out how to access stdio streams by file descriptor number.
17399 EOM
17400         d_stdio_stream_array="$undef"
17401         ;;
17402 *)      $cat >&4 <<EOM
17403 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17404 EOM
17405         d_stdio_stream_array="$define"
17406         ;;
17407 esac
17408
17409 : see if strcoll exists
17410 set strcoll d_strcoll
17411 eval $inlibc
17412
17413 : check for structure copying
17414 echo " "
17415 echo "Checking to see if your C compiler can copy structs..." >&4
17416 $cat >try.c <<'EOCP'
17417 int main()
17418 {
17419         struct blurfl {
17420                 int dyick;
17421         } foo, bar;
17422
17423         foo = bar;
17424 }
17425 EOCP
17426 if $cc -c try.c >/dev/null 2>&1 ; then
17427         val="$define"
17428         echo "Yup, it can."
17429 else
17430         val="$undef"
17431         echo "Nope, it can't."
17432 fi
17433 set d_strctcpy
17434 eval $setvar
17435 $rm_try
17436
17437 : see if strerror and/or sys_errlist[] exist
17438 echo " "
17439 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17440     if set strerror val -f d_strerror; eval $csym; $val; then
17441                 echo 'strerror() found.' >&4
17442                 d_strerror="$define"
17443                 d_strerrm='strerror(e)'
17444                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17445                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17446                         d_syserrlst="$define"
17447                 else
17448                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17449                         d_syserrlst="$undef"
17450                 fi
17451     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17452                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17453                 echo 'strerror() found in string header.' >&4
17454                 d_strerror="$define"
17455                 d_strerrm='strerror(e)'
17456                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17457                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17458                                 d_syserrlst="$define"
17459                 else
17460                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17461                         d_syserrlst="$undef"
17462                 fi
17463     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17464                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17465                 d_strerror="$undef"
17466                 d_syserrlst="$define"
17467                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17468     else
17469                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17470                 d_strerror="$undef"
17471                 d_syserrlst="$undef"
17472                 d_strerrm='"unknown"'
17473     fi
17474 fi
17475
17476 : see if strerror_r exists
17477 set strerror_r d_strerror_r
17478 eval $inlibc
17479 case "$d_strerror_r" in
17480 "$define")
17481         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17482         case "$d_strerror_r_proto:$usethreads" in
17483         ":define")      d_strerror_r_proto=define
17484                 set d_strerror_r_proto strerror_r $hdrs
17485                 eval $hasproto ;;
17486         *)      ;;
17487         esac
17488         case "$d_strerror_r_proto" in
17489         define)
17490         case "$strerror_r_proto" in
17491         ''|0) try='int strerror_r(int, char*, size_t);'
17492         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17493         esac
17494         case "$strerror_r_proto" in
17495         ''|0) try='int strerror_r(int, char*, int);'
17496         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17497         esac
17498         case "$strerror_r_proto" in
17499         ''|0) try='char* strerror_r(int, char*, size_t);'
17500         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17501         esac
17502         case "$strerror_r_proto" in
17503         ''|0)   d_strerror_r=undef
17504                 strerror_r_proto=0
17505                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17506         * )     case "$strerror_r_proto" in
17507                 REENTRANT_PROTO*) ;;
17508                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17509                 esac
17510                 echo "Prototype: $try" ;;
17511         esac
17512         ;;
17513         *)      case "$usethreads" in
17514                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17515                 esac
17516                 d_strerror_r=undef
17517                 strerror_r_proto=0
17518                 ;;
17519         esac
17520         ;;
17521 *)      strerror_r_proto=0
17522         ;;
17523 esac
17524
17525 : see if strftime exists
17526 set strftime d_strftime
17527 eval $inlibc
17528
17529 : see if strlcat exists
17530 set strlcat d_strlcat
17531 eval $inlibc
17532
17533 : see if strlcpy exists
17534 set strlcpy d_strlcpy
17535 eval $inlibc
17536
17537 : see if strtod exists
17538 set strtod d_strtod
17539 eval $inlibc
17540
17541 : see if strtol exists
17542 set strtol d_strtol
17543 eval $inlibc
17544
17545 : see if strtold exists
17546 set strtold d_strtold
17547 eval $inlibc
17548
17549 : see if strtoll exists
17550 set strtoll d_strtoll
17551 eval $inlibc
17552
17553 case "$d_longlong-$d_strtoll" in
17554 "$define-$define")
17555         $cat <<EOM
17556 Checking whether your strtoll() works okay...
17557 EOM
17558         $cat >try.c <<'EOCP'
17559 #include <errno.h>
17560 #ifdef __hpux
17561 #define strtoll __strtoll
17562 #endif
17563 #ifdef __EMX__
17564 #define strtoll _strtoll
17565 #endif
17566 #include <stdio.h>
17567 extern long long int strtoll(char *s, char **, int); 
17568 static int bad = 0;
17569 int check(char *s, long long ell, int een) {
17570         long long gll;
17571         errno = 0;
17572         gll = strtoll(s, 0, 10);
17573         if (!((gll == ell) && (errno == een)))
17574                 bad++;
17575 }
17576 int main() {
17577         check(" 1",                                      1LL, 0);
17578         check(" 0",                                      0LL, 0);
17579         check("-1",                                     -1LL, 0);
17580         check("-9223372036854775808", -9223372036854775808LL, 0);
17581         check("-9223372036854775808", -9223372036854775808LL, 0);
17582         check(" 9223372036854775807",  9223372036854775807LL, 0);
17583         check("-9223372036854775808", -9223372036854775808LL, 0);
17584         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17585         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17586         if (!bad)
17587                 printf("ok\n");
17588 }
17589 EOCP
17590         set try
17591         if eval $compile; then
17592                 yyy=`$run ./try`
17593                 case "$yyy" in
17594                 ok) echo "Your strtoll() seems to be working okay." ;;
17595                 *) cat <<EOM >&4
17596 Your strtoll() doesn't seem to be working okay.
17597 EOM
17598                    d_strtoll="$undef"
17599                    ;;
17600                 esac
17601         else
17602                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17603                 d_strtoll="$undef"
17604         fi
17605         ;;
17606 esac
17607
17608 : see if strtoq exists
17609 set strtoq d_strtoq
17610 eval $inlibc
17611
17612 : see if strtoul exists
17613 set strtoul d_strtoul
17614 eval $inlibc
17615
17616 case "$d_strtoul" in
17617 "$define")
17618         $cat <<EOM
17619 Checking whether your strtoul() works okay...
17620 EOM
17621         $cat >try.c <<'EOCP'
17622 #include <errno.h>
17623 #include <stdio.h>
17624 extern unsigned long int strtoul(char *s, char **, int); 
17625 static int bad = 0;
17626 void check(char *s, unsigned long eul, int een) {
17627         unsigned long gul;
17628         errno = 0;
17629         gul = strtoul(s, 0, 10);
17630         if (!((gul == eul) && (errno == een)))
17631                 bad++;
17632 }
17633 int main() {
17634         check(" 1", 1L, 0);
17635         check(" 0", 0L, 0);
17636 EOCP
17637         case "$longsize" in
17638         8)
17639             $cat >>try.c <<'EOCP'
17640         check("18446744073709551615", 18446744073709551615UL, 0);
17641         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17642 #if 0 /* strtoul() for /^-/ strings is undefined. */
17643         check("-1", 18446744073709551615UL, 0);
17644         check("-18446744073709551614", 2, 0);
17645         check("-18446744073709551615", 1, 0);
17646         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17647         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17648 #endif
17649 EOCP
17650                 ;;
17651         4)
17652                     $cat >>try.c <<'EOCP'
17653         check("4294967295", 4294967295UL, 0);
17654         check("4294967296", 4294967295UL, ERANGE);
17655 #if 0 /* strtoul() for /^-/ strings is undefined. */
17656         check("-1", 4294967295UL, 0);
17657         check("-4294967294", 2, 0);
17658         check("-4294967295", 1, 0);
17659         check("-4294967296", 4294967295UL, ERANGE);
17660         check("-4294967297", 4294967295UL, ERANGE);
17661 #endif
17662 EOCP
17663                 ;;
17664         *)
17665 : Should we write these tests to be more portable by sprintf-ing
17666 : ~0 and then manipulating that char string as input for strtol?
17667                 ;;
17668         esac
17669         $cat >>try.c <<'EOCP'
17670         if (!bad)
17671                 printf("ok\n");
17672         return 0;
17673 }
17674 EOCP
17675         set try
17676         if eval $compile; then
17677                 case "`$run ./try`" in
17678                 ok) echo "Your strtoul() seems to be working okay." ;;
17679                 *) cat <<EOM >&4
17680 Your strtoul() doesn't seem to be working okay.
17681 EOM
17682                    d_strtoul="$undef"
17683                    ;;
17684                 esac
17685         else
17686                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17687                 d_strtoul="$undef"
17688         fi
17689         ;;
17690 esac
17691
17692 : see if strtoull exists
17693 set strtoull d_strtoull
17694 eval $inlibc
17695
17696 case "$d_longlong-$d_strtoull" in
17697 "$define-$define")
17698         $cat <<EOM
17699 Checking whether your strtoull() works okay...
17700 EOM
17701         $cat >try.c <<'EOCP'
17702 #include <errno.h>
17703 #ifdef __hpux
17704 #define strtoull __strtoull
17705 #endif
17706 #include <stdio.h>
17707 extern unsigned long long int strtoull(char *s, char **, int); 
17708 static int bad = 0;
17709 int check(char *s, long long eull, int een) {
17710         long long gull;
17711         errno = 0;
17712         gull = strtoull(s, 0, 10);
17713         if (!((gull == eull) && (errno == een)))
17714                 bad++;
17715 }
17716 int main() {
17717         check(" 1",                                        1LL, 0);
17718         check(" 0",                                        0LL, 0);
17719         check("18446744073709551615",  18446744073709551615ULL, 0);
17720         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17721 #if 0 /* strtoull() for /^-/ strings is undefined. */
17722         check("-1",                    18446744073709551615ULL, 0);
17723         check("-18446744073709551614",                     2LL, 0);
17724         check("-18446744073709551615",                     1LL, 0);
17725         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17726         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17727 #endif
17728         if (!bad)
17729                 printf("ok\n");
17730 }
17731 EOCP
17732         set try
17733         if eval $compile; then
17734                 case "`$run ./try`" in
17735                 ok) echo "Your strtoull() seems to be working okay." ;;
17736                 *) cat <<EOM >&4
17737 Your strtoull() doesn't seem to be working okay.
17738 EOM
17739                    d_strtoull="$undef"
17740                    ;;
17741                 esac
17742         else
17743                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17744                 d_strtoull="$undef"
17745         fi
17746         ;;
17747 esac
17748
17749 : see if strtouq exists
17750 set strtouq d_strtouq
17751 eval $inlibc
17752
17753 case "$d_strtouq" in
17754 "$define")
17755         $cat <<EOM
17756 Checking whether your strtouq() works okay...
17757 EOM
17758         $cat >try.c <<'EOCP'
17759 #include <errno.h>
17760 #include <stdio.h>
17761 extern unsigned long long int strtouq(char *s, char **, int); 
17762 static int bad = 0;
17763 void check(char *s, unsigned long long eull, int een) {
17764         unsigned long long gull;
17765         errno = 0;
17766         gull = strtouq(s, 0, 10);
17767         if (!((gull == eull) && (errno == een)))
17768                 bad++;
17769 }
17770 int main() {
17771         check(" 1",                                        1LL, 0);
17772         check(" 0",                                        0LL, 0);
17773         check("18446744073709551615",  18446744073709551615ULL, 0);
17774         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17775 #if 0 /* strtouq() for /^-/ strings is undefined. */
17776         check("-1",                    18446744073709551615ULL, 0);
17777         check("-18446744073709551614",                     2LL, 0);
17778         check("-18446744073709551615",                     1LL, 0);
17779         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17780         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17781 #endif
17782         if (!bad)
17783                 printf("ok\n");
17784         return 0;
17785 }
17786 EOCP
17787         set try
17788         if eval $compile; then
17789                 case "`$run ./try`" in
17790                 ok) echo "Your strtouq() seems to be working okay." ;;
17791                 *) cat <<EOM >&4
17792 Your strtouq() doesn't seem to be working okay.
17793 EOM
17794                    d_strtouq="$undef"
17795                    ;;
17796                 esac
17797         else
17798                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17799                 d_strtouq="$undef"
17800         fi
17801         ;;
17802 esac
17803
17804 : see if strxfrm exists
17805 set strxfrm d_strxfrm
17806 eval $inlibc
17807
17808 : see if symlink exists
17809 set symlink d_symlink
17810 eval $inlibc
17811
17812 : see if syscall exists
17813 set syscall d_syscall
17814 eval $inlibc
17815
17816 : see if prototype for syscall is available
17817 echo " "
17818 set d_syscallproto syscall $i_unistd unistd.h
17819 eval $hasproto
17820
17821 : see if sysconf exists
17822 set sysconf d_sysconf
17823 eval $inlibc
17824
17825 : see if system exists
17826 set system d_system
17827 eval $inlibc
17828
17829 : see if tcgetpgrp exists
17830 set tcgetpgrp d_tcgetpgrp
17831 eval $inlibc
17832
17833 : see if tcsetpgrp exists
17834 set tcsetpgrp d_tcsetpgrp
17835 eval $inlibc
17836
17837 : see if prototype for telldir is available
17838 echo " "
17839 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17840 eval $hasproto
17841
17842 : see if time exists
17843 echo " "
17844 if test "X$d_time" = X -o X"$timetype" = X; then
17845     if set time val -f d_time; eval $csym; $val; then
17846                 echo 'time() found.' >&4
17847                 val="$define"
17848                 rp="What is the type returned by time() on this system?"
17849                 set time_t timetype long stdio.h sys/types.h
17850                 eval $typedef_ask
17851     else
17852                 echo 'time() not found, hope that will do.' >&4
17853                 val="$undef"
17854                 timetype='int';
17855     fi
17856     set d_time
17857     eval $setvar
17858 fi
17859
17860 : see if this is a sys/times.h system
17861 set sys/times.h i_systimes
17862 eval $inhdr
17863
17864 : see if times exists
17865 echo " "
17866 if set times val -f d_times; eval $csym; $val; then
17867         echo 'times() found.' >&4
17868         d_times="$define"
17869         inc=''
17870         case "$i_systimes" in
17871         "$define") inc='sys/times.h';;
17872         esac
17873         rp="What is the type returned by times() on this system?"
17874         set clock_t clocktype long stdio.h sys/types.h $inc
17875         eval $typedef_ask
17876 else
17877         echo 'times() NOT found, hope that will do.' >&4
17878         d_times="$undef"
17879         clocktype='int'
17880 fi
17881
17882 : see if tmpnam_r exists
17883 set tmpnam_r d_tmpnam_r
17884 eval $inlibc
17885 case "$d_tmpnam_r" in
17886 "$define")
17887         hdrs="$i_systypes sys/types.h define stdio.h "
17888         case "$d_tmpnam_r_proto:$usethreads" in
17889         ":define")      d_tmpnam_r_proto=define
17890                 set d_tmpnam_r_proto tmpnam_r $hdrs
17891                 eval $hasproto ;;
17892         *)      ;;
17893         esac
17894         case "$d_tmpnam_r_proto" in
17895         define)
17896         case "$tmpnam_r_proto" in
17897         ''|0) try='char* tmpnam_r(char*);'
17898         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17899         esac
17900         case "$tmpnam_r_proto" in
17901         ''|0)   d_tmpnam_r=undef
17902                 tmpnam_r_proto=0
17903                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17904         * )     case "$tmpnam_r_proto" in
17905                 REENTRANT_PROTO*) ;;
17906                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17907                 esac
17908                 echo "Prototype: $try" ;;
17909         esac
17910         ;;
17911         *)      case "$usethreads" in
17912                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17913                 esac
17914                 d_tmpnam_r=undef
17915                 tmpnam_r_proto=0
17916                 ;;
17917         esac
17918         ;;
17919 *)      tmpnam_r_proto=0
17920         ;;
17921 esac
17922
17923 : see if truncate exists
17924 set truncate d_truncate
17925 eval $inlibc
17926
17927 : see if ttyname_r exists
17928 set ttyname_r d_ttyname_r
17929 eval $inlibc
17930 case "$d_ttyname_r" in
17931 "$define")
17932         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17933         case "$d_ttyname_r_proto:$usethreads" in
17934         ":define")      d_ttyname_r_proto=define
17935                 set d_ttyname_r_proto ttyname_r $hdrs
17936                 eval $hasproto ;;
17937         *)      ;;
17938         esac
17939         case "$d_ttyname_r_proto" in
17940         define)
17941         case "$ttyname_r_proto" in
17942         ''|0) try='int ttyname_r(int, char*, size_t);'
17943         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17944         esac
17945         case "$ttyname_r_proto" in
17946         ''|0) try='int ttyname_r(int, char*, int);'
17947         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17948         esac
17949         case "$ttyname_r_proto" in
17950         ''|0) try='char* ttyname_r(int, char*, int);'
17951         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17952         esac
17953         case "$ttyname_r_proto" in
17954         ''|0)   d_ttyname_r=undef
17955                 ttyname_r_proto=0
17956                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17957         * )     case "$ttyname_r_proto" in
17958                 REENTRANT_PROTO*) ;;
17959                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17960                 esac
17961                 echo "Prototype: $try" ;;
17962         esac
17963         ;;
17964         *)      case "$usethreads" in
17965                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17966                 esac
17967                 d_ttyname_r=undef
17968                 ttyname_r_proto=0
17969                 ;;
17970         esac
17971         ;;
17972 *)      ttyname_r_proto=0
17973         ;;
17974 esac
17975
17976 : see if tzname[] exists
17977 echo " "
17978 if set tzname val -a d_tzname; eval $csym; $val; then
17979         val="$define"
17980         echo 'tzname[] found.' >&4
17981 else
17982         val="$undef"
17983         echo 'tzname[] NOT found.' >&4
17984 fi
17985 set d_tzname
17986 eval $setvar
17987
17988 case "$osname" in
17989 next|rhapsody|darwin) multiarch="$define" ;;
17990 esac
17991 case "$multiarch" in
17992 ''|[nN]*) multiarch="$undef" ;;
17993 esac
17994
17995 : check for ordering of bytes in a UV
17996 echo " "
17997 case "$usecrosscompile$multiarch" in
17998 *$define*)
17999         $cat <<EOM
18000 You seem to be either cross-compiling or doing a multiarchitecture build,
18001 skipping the byteorder check.
18002
18003 EOM
18004         byteorder='ffff'
18005         ;;
18006 *)
18007         case "$byteorder" in
18008         '')
18009                 $cat <<'EOM'
18010 In the following, larger digits indicate more significance.  A big-endian
18011 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18012 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18013 machines may have weird orders like 3412.  A Cray will report 87654321,
18014 an Alpha will report 12345678. If the test program works the default is
18015 probably right.
18016 I'm now running the test program...
18017 EOM
18018                 $cat >try.c <<EOCP
18019 #include <stdio.h>
18020 #$i_stdlib I_STDLIB
18021 #ifdef I_STDLIB
18022 #include <stdlib.h>
18023 #endif
18024 #include <sys/types.h>
18025 typedef $uvtype UV;
18026 int main()
18027 {
18028         int i;
18029         union {
18030                 UV l;
18031                 char c[$uvsize];
18032         } u;
18033
18034         if ($uvsize > 4)
18035                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18036         else
18037                 u.l = (UV)0x04030201;
18038         for (i = 0; i < $uvsize; i++)
18039                 printf("%c", u.c[i]+'0');
18040         printf("\n");
18041         exit(0);
18042 }
18043 EOCP
18044                 xxx_prompt=y
18045                 set try
18046                 if eval $compile && $run ./try > /dev/null; then
18047                         dflt=`$run ./try`
18048                         case "$dflt" in
18049                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18050                                 echo "(The test program ran ok.)"
18051                                 echo "byteorder=$dflt"
18052                                 xxx_prompt=n
18053                         ;;
18054                         ????|????????) echo "(The test program ran ok.)" ;;
18055                         *) echo "(The test program didn't run right for some reason.)" ;;
18056                         esac
18057                 else
18058                         dflt='4321'
18059                         cat <<'EOM'
18060 (I can't seem to compile the test program.  Guessing big-endian...)
18061 EOM
18062                 fi
18063                 case "$xxx_prompt" in
18064                 y)
18065                         rp="What is the order of bytes in $uvtype?"
18066                         . ./myread
18067                         byteorder="$ans"
18068                         ;;
18069                 *)      byteorder=$dflt
18070                         ;;
18071                 esac
18072                 ;;
18073         esac
18074         $rm_try
18075         ;;
18076 esac
18077
18078 $cat <<EOM
18079
18080 Checking to see whether you can access character data unalignedly...
18081 EOM
18082 case "$d_u32align" in
18083 '')   $cat >try.c <<EOCP
18084 #include <stdio.h>
18085 #$i_stdlib I_STDLIB
18086 #ifdef I_STDLIB
18087 #include <stdlib.h>
18088 #endif
18089 #define U32 $u32type
18090 #define BYTEORDER 0x$byteorder
18091 #define U8 $u8type
18092 #include <signal.h>
18093 #ifdef SIGBUS
18094 $signal_t bletch(int s) { exit(4); }
18095 #endif
18096 int main() {
18097 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18098     U8 buf[8];
18099     U32 *up;
18100     int i;
18101
18102     if (sizeof(U32) != 4) {
18103         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18104         exit(1);
18105     }
18106
18107     fflush(stdout);
18108
18109 #ifdef SIGBUS
18110     signal(SIGBUS, bletch);
18111 #endif
18112
18113     buf[0] = 0;
18114     buf[1] = 0;
18115     buf[2] = 0;
18116     buf[3] = 1;
18117     buf[4] = 0;
18118     buf[5] = 0;
18119     buf[6] = 0;
18120     buf[7] = 1;
18121
18122     for (i = 0; i < 4; i++) {
18123         up = (U32*)(buf + i);
18124         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18125                (*up == 1 << (8*(3-i)))  /* little-endian */
18126               )
18127            )
18128         {
18129             printf("read failed (%x)\n", *up);
18130             exit(2);
18131         }
18132     }
18133
18134     /* write test */
18135     for (i = 0; i < 4; i++) {
18136         up = (U32*)(buf + i);
18137         *up = 0xBeef;
18138         if (*up != 0xBeef) {
18139             printf("write failed (%x)\n", *up);
18140             exit(3);
18141         }
18142     }
18143
18144     exit(0);
18145 #else
18146     printf("1\n");
18147     exit(1);
18148 #endif
18149     return 0;
18150 }
18151 EOCP
18152 set try
18153 if eval $compile_ok; then
18154         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18155         $run ./try 2>&1 >/dev/null
18156         case "$?" in
18157         0)      cat >&4 <<EOM
18158 You can access character data pretty unalignedly.
18159 EOM
18160                 d_u32align="$undef"
18161                 ;;
18162         *)      cat >&4 <<EOM
18163 It seems that you must access character data in an aligned manner.
18164 EOM
18165                 d_u32align="$define"
18166                 ;;
18167         esac
18168 else
18169         rp='Can you access character data at unaligned addresses?'
18170         dflt='n'
18171         . ./myread
18172         case "$ans" in
18173         [yY]*)  d_u32align="$undef"  ;;
18174         *)      d_u32align="$define" ;;
18175         esac
18176 fi
18177 $rm_try
18178 ;;
18179 esac
18180
18181 : see if ualarm exists
18182 set ualarm d_ualarm
18183 eval $inlibc
18184
18185 : see if umask exists
18186 set umask d_umask
18187 eval $inlibc
18188
18189 : see if unordered exists
18190 set unordered d_unordered
18191 eval $inlibc
18192
18193 : see if unsetenv exists
18194 set unsetenv d_unsetenv
18195 eval $inlibc
18196
18197 : see if usleep exists
18198 set usleep d_usleep
18199 eval $inlibc
18200
18201 : see if prototype for usleep is available
18202 echo " "
18203 set d_usleepproto usleep $i_unistd unistd.h
18204 eval $hasproto
18205
18206 : see if ustat exists
18207 set ustat d_ustat
18208 eval $inlibc
18209
18210 : see if closedir exists
18211 set closedir d_closedir
18212 eval $inlibc
18213
18214 case "$d_closedir" in
18215 "$define")
18216         echo " "
18217         echo "Checking whether closedir() returns a status..." >&4
18218         cat > try.c <<EOM
18219 #$i_dirent I_DIRENT             /**/
18220 #$i_sysdir I_SYS_DIR            /**/
18221 #$i_sysndir I_SYS_NDIR          /**/
18222 #$i_systypes I_SYS_TYPES        /**/
18223
18224 #if defined(I_SYS_TYPES)
18225 #include <sys/types.h>
18226 #endif
18227 #if defined(I_DIRENT)
18228 #include <dirent.h>
18229 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18230 #include <sys/dir.h>
18231 #endif
18232 #else
18233 #ifdef I_SYS_NDIR
18234 #include <sys/ndir.h>
18235 #else
18236 #ifdef I_SYS_DIR
18237 #ifdef hp9000s500
18238 #include <ndir.h>       /* may be wrong in the future */
18239 #else
18240 #include <sys/dir.h>
18241 #endif
18242 #endif
18243 #endif
18244 #endif
18245 int main() { return closedir(opendir(".")); }
18246 EOM
18247         set try
18248         if eval $compile_ok; then
18249                 if $run ./try > /dev/null 2>&1 ; then
18250                         echo "Yes, it does."
18251                         val="$undef"
18252                 else
18253                         echo "No, it doesn't."
18254                         val="$define"
18255                 fi
18256         else
18257                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18258                 val="$define"
18259         fi
18260         ;;
18261 *)
18262         val="$undef";
18263         ;;
18264 esac
18265 set d_void_closedir
18266 eval $setvar
18267 $rm_try
18268
18269 : see if there is a wait4
18270 set wait4 d_wait4
18271 eval $inlibc
18272
18273 : see if waitpid exists
18274 set waitpid d_waitpid
18275 eval $inlibc
18276
18277 : see if wcstombs exists
18278 set wcstombs d_wcstombs
18279 eval $inlibc
18280
18281 : see if wctomb exists
18282 set wctomb d_wctomb
18283 eval $inlibc
18284
18285 : see if writev exists
18286 set writev d_writev
18287 eval $inlibc
18288
18289 : preserve RCS keywords in files with variable substitution, grrr
18290 Date='$Date'
18291 Id='$Id'
18292 Log='$Log'
18293 RCSfile='$RCSfile'
18294 Revision='$Revision'
18295
18296 : check for alignment requirements
18297 echo " "
18298 case "$usecrosscompile$multiarch" in
18299 *$define*)
18300         $cat <<EOM
18301 You seem to be either cross-compiling or doing a multiarchitecture build,
18302 skipping the memory alignment check.
18303
18304 EOM
18305         case "$alignbytes" in
18306         '') alignbytes=8 ;;
18307         esac
18308         ;;
18309 *)
18310         case "$alignbytes" in
18311         '') echo "Checking alignment constraints..." >&4
18312                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18313                         $cat >try.c <<'EOCP'
18314 typedef long double NV;
18315 EOCP
18316                 else
18317                         $cat >try.c <<'EOCP'
18318 typedef double NV;
18319 EOCP
18320                 fi
18321                 $cat >>try.c <<'EOCP'
18322 #include <stdio.h>
18323 struct foobar {
18324         char foo;
18325         NV bar;
18326 } try_algn;
18327 int main()
18328 {
18329     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18330     return(0);
18331 }
18332 EOCP
18333                 set try
18334                 if eval $compile_ok; then
18335                         dflt=`$run ./try`
18336                 else
18337                         dflt='8'
18338                         echo "(I can't seem to compile the test program...)"
18339                 fi
18340                 ;;
18341         *) dflt="$alignbytes"
18342                 ;;
18343         esac
18344         rp="Doubles must be aligned on a how-many-byte boundary?"
18345         . ./myread
18346         alignbytes="$ans"
18347         $rm_try
18348         ;;
18349 esac
18350
18351
18352 : set the base revision
18353 baserev=5.0
18354
18355 : how do we concatenate cpp tokens here?
18356 echo " "
18357 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18358 $cat >cpp_stuff.c <<'EOCP'
18359 #define RCAT(a,b)a/**/b
18360 #define ACAT(a,b)a ## b
18361 RCAT(Rei,ser)
18362 ACAT(Cir,cus)
18363 EOCP
18364 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18365 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18366         echo "Oh!  Smells like ANSI's been here." >&4
18367         echo "We can catify or stringify, separately or together!"
18368         cpp_stuff=42
18369 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18370         echo "Ah, yes!  The good old days!" >&4
18371         echo "However, in the good old days we don't know how to stringify and"
18372         echo "catify at the same time."
18373         cpp_stuff=1
18374 else
18375         $cat >&4 <<EOM
18376 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18377 You're going to have to edit the values of CAT[2-5] in config.h...
18378 EOM
18379         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18380 fi
18381 $rm -f cpp_stuff.*
18382
18383 : see if this is a db.h system
18384 set db.h i_db
18385 eval $inhdr
18386
18387 case "$i_db" in
18388 $define)
18389         : Check db version.
18390         echo " "
18391         echo "Checking Berkeley DB version ..." >&4
18392         $cat >try.c <<EOCP
18393 #$d_const HASCONST
18394 #ifndef HASCONST
18395 #define const
18396 #endif
18397 #include <sys/types.h>
18398 #include <stdio.h>
18399 #$i_stdlib I_STDLIB
18400 #ifdef I_STDLIB
18401 #include <stdlib.h>
18402 #endif
18403 #include <db.h>
18404 int main(int argc, char *argv[])
18405 {
18406 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18407     int Major, Minor, Patch ;
18408     unsigned long Version ;
18409     (void)db_version(&Major, &Minor, &Patch) ;
18410     if (argc == 2) {
18411         printf("%d %d %d %d %d %d\n",
18412                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18413                Major, Minor, Patch);
18414         exit(0);
18415     }
18416     printf("You have Berkeley DB Version 2 or greater.\n");
18417
18418     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18419                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18420     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18421                 Major, Minor, Patch) ;
18422
18423     /* check that db.h & libdb are compatible */
18424     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18425         printf("db.h and libdb are incompatible.\n") ;
18426         exit(3);
18427     }
18428
18429     printf("db.h and libdb are compatible.\n") ;
18430
18431     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18432                 + DB_VERSION_PATCH ;
18433
18434     /* needs to be >= 2.3.4 */
18435     if (Version < 2003004) {
18436     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18437         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18438         exit(2);
18439     }
18440
18441     exit(0);
18442 #else
18443 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18444     if (argc == 2) {
18445         printf("1 0 0\n");
18446         exit(0);
18447     }
18448     printf("You have Berkeley DB Version 1.\n");
18449     exit(0);    /* DB version < 2: the coast is clear. */
18450 #else
18451     exit(1);    /* <db.h> not Berkeley DB? */
18452 #endif
18453 #endif
18454 }
18455 EOCP
18456         set try
18457         if eval $compile_ok && $run ./try; then
18458                 echo 'Looks OK.' >&4
18459                 set `$run ./try 1`
18460                 db_version_major=$1
18461                 db_version_minor=$2
18462                 db_version_patch=$3
18463         else
18464                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18465                 i_db=$undef
18466                 case " $libs " in
18467                 *"-ldb "*)
18468                         : Remove db from list of libraries to use
18469                         echo "Removing unusable -ldb from library list" >&4
18470                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18471                         shift
18472                         libs="$*"
18473                         echo "libs = $libs" >&4
18474                         ;;
18475                 esac
18476         fi
18477         $rm_try
18478         ;;
18479 esac
18480
18481 case "$i_db" in
18482 define)
18483         : Check the return type needed for hash
18484         echo " "
18485         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18486         $cat >try.c <<EOCP
18487 #$d_const HASCONST
18488 #ifndef HASCONST
18489 #define const
18490 #endif
18491 #include <sys/types.h>
18492 #include <db.h>
18493
18494 #ifndef DB_VERSION_MAJOR
18495 u_int32_t hash_cb (ptr, size)
18496 const void *ptr;
18497 size_t size;
18498 {
18499 }
18500 HASHINFO info;
18501 int main()
18502 {
18503         info.hash = hash_cb;
18504 }
18505 #endif
18506 EOCP
18507         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18508                 if $contains warning try.out >>/dev/null 2>&1 ; then
18509                         db_hashtype='int'
18510                 else
18511                         db_hashtype='u_int32_t'
18512                 fi
18513         else
18514                 : XXX Maybe we should just give up here.
18515                 db_hashtype=u_int32_t
18516                 $cat try.out >&4
18517                 echo "Help:  I can't seem to compile the db test program." >&4
18518                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18519         fi
18520         $rm_try
18521         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18522         ;;
18523 *)      db_hashtype=u_int32_t
18524         ;;
18525 esac
18526 case "$i_db" in
18527 define)
18528         : Check the return type needed for prefix
18529         echo " "
18530         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18531         cat >try.c <<EOCP
18532 #$d_const HASCONST
18533 #ifndef HASCONST
18534 #define const
18535 #endif
18536 #include <sys/types.h>
18537 #include <db.h>
18538
18539 #ifndef DB_VERSION_MAJOR
18540 size_t prefix_cb (key1, key2)
18541 const DBT *key1;
18542 const DBT *key2;
18543 {
18544 }
18545 BTREEINFO info;
18546 int main()
18547 {
18548         info.prefix = prefix_cb;
18549 }
18550 #endif
18551 EOCP
18552         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18553                 if $contains warning try.out >>/dev/null 2>&1 ; then
18554                         db_prefixtype='int'
18555                 else
18556                         db_prefixtype='size_t'
18557                 fi
18558         else
18559                 db_prefixtype='size_t'
18560                 : XXX Maybe we should just give up here.
18561                 $cat try.out >&4
18562                 echo "Help:  I can't seem to compile the db test program." >&4
18563                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18564         fi
18565         $rm_try
18566         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18567         ;;
18568 *)      db_prefixtype='size_t'
18569         ;;
18570 esac
18571
18572 : How can we generate normalized random numbers ?
18573 echo " "
18574 echo "Looking for a random number function..." >&4
18575 case "$randfunc" in
18576 '')
18577         if set drand48 val -f; eval $csym; $val; then
18578                 dflt="drand48"
18579                 echo "Good, found drand48()." >&4
18580         elif set random val -f; eval $csym; $val; then
18581                 dflt="random"
18582                 echo "OK, found random()." >&4
18583         else
18584                 dflt="rand"
18585                 echo "Yick, looks like I have to use rand()." >&4
18586         fi
18587         echo " "
18588         ;;
18589 *)
18590         dflt="$randfunc"
18591         ;;
18592 esac
18593 cont=true
18594
18595 case "$ccflags" in
18596 *-Dmy_rand=*|*-Dmy_srand=*)
18597         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18598         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18599         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18600         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18601         ;;
18602 esac
18603
18604 while $test "$cont"; do
18605         rp="Use which function to generate random numbers?"
18606         . ./myread
18607         if $test "$ans" = "$dflt"; then
18608                 : null
18609         else
18610                 randbits=''
18611         fi
18612         randfunc="$ans"
18613         if set $ans val -f; eval $csym; $val; then
18614                 cont=''
18615         else
18616                 dflt=y
18617                 rp="I cannot find function $ans. Use that name anyway?"
18618                 . ./myread
18619                 dflt=rand
18620                 case "$ans" in
18621                         [yY]*) cont='';;
18622                 esac
18623         fi
18624         case "$cont" in
18625         '')
18626                 case "$randfunc" in
18627                 drand48)
18628                         drand01="drand48()"
18629                         seedfunc="srand48"
18630                         randbits=48
18631                         randseedtype=long
18632                         ;;
18633                 rand|random)
18634                         case "$randbits" in
18635                         '')
18636 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18637                                 $cat >try.c <<EOCP
18638 #$i_unistd I_UNISTD
18639 #$i_stdlib I_STDLIB
18640 #include <stdio.h>
18641 #ifdef I_UNISTD
18642 #  include <unistd.h>
18643 #endif
18644 #ifdef I_STDLIB
18645 #  include <stdlib.h>
18646 #endif
18647 int main()
18648 {
18649         register int i;
18650         register unsigned long tmp;
18651         register unsigned long max = 0L;
18652
18653         for (i = 1000; i; i--) {
18654                 tmp = (unsigned long) $randfunc();
18655                 if (tmp > max) max = tmp;
18656         }
18657         for (i = 0; max; i++)
18658                 max /= 2;
18659         printf("%d\n",i);
18660 }
18661 EOCP
18662                                 set try
18663                                 if eval $compile_ok; then
18664                                         dflt=`try`
18665                                 else
18666                                         dflt='?'
18667                                         echo "(I can't seem to compile the test program...)"
18668                                 fi
18669                                 ;;
18670                         *)
18671                                 dflt="$randbits"
18672                                 ;;
18673                         esac
18674                         rp="How many bits does your $randfunc() function produce?"
18675                         . ./myread
18676                         randbits="$ans"
18677                         $rm_try
18678                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18679                         seedfunc="s$randfunc"
18680                         randseedtype=unsigned
18681                         ;;
18682                 *)
18683                         dflt="31"
18684                         rp="How many bits does your $randfunc() function produce?"
18685                         . ./myread
18686                         randbits="$ans"
18687                         seedfunc="s$randfunc"
18688                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18689                         if set $seedfunc val -f; eval $csym; $val; then
18690                                 echo "(Using $seedfunc() to seed random generator)"
18691                         else
18692                                 echo "(Warning: no $seedfunc() to seed random generator)"
18693                                 seedfunc=rand
18694                         fi
18695                         randseedtype=unsigned
18696                         ;;
18697                 esac
18698                 ;;
18699         esac
18700 done
18701
18702 echo " "
18703 echo "Determining whether or not we are on an EBCDIC system..." >&4
18704 $cat >try.c <<'EOM'
18705 int main()
18706 {
18707   if ('M'==0xd4) return 0;
18708   return 1;
18709 }
18710 EOM
18711
18712 val=$undef
18713 set try
18714 if eval $compile_ok; then
18715         if $run ./try; then
18716                 echo "You seem to speak EBCDIC." >&4
18717                 val="$define"
18718         else
18719                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18720         fi
18721 else
18722         echo "I'm unable to compile the test program." >&4
18723         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18724 fi
18725 $rm_try
18726 set ebcdic
18727 eval $setvar
18728
18729 echo " "
18730 $cat >&4 <<EOM
18731 Checking how to flush all pending stdio output...
18732 EOM
18733 # I only know how to find the first 32 possibly open files on SunOS.
18734 # See also hints/sunos_4_1.sh and util.c  --AD
18735 case "$osname" in
18736 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18737 esac
18738 $cat >>try.c <<EOCP
18739 #include <stdio.h>
18740 #$i_stdlib I_STDLIB
18741 #ifdef I_STDLIB
18742 #include <stdlib.h>
18743 #endif
18744 #$i_unistd I_UNISTD
18745 #ifdef I_UNISTD
18746 # include <unistd.h>
18747 #endif
18748 #$d_sysconf HAS_SYSCONF
18749 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18750 #ifdef HAS_STDIO_STREAM_ARRAY
18751 # define STDIO_STREAM_ARRAY $stdio_stream_array
18752 #endif
18753 int main() {
18754   FILE* p;
18755   unlink("try.out");
18756   p = fopen("try.out", "w");
18757 #ifdef TRY_FPUTC
18758   fputc('x', p);
18759 #else
18760 # ifdef TRY_FPRINTF
18761   fprintf(p, "x");
18762 # endif
18763 #endif
18764 #ifdef TRY_FFLUSH_NULL
18765   fflush(NULL);
18766 #endif
18767 #ifdef TRY_FFLUSH_ALL
18768   {
18769     long open_max = -1;
18770 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18771     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18772 # else
18773 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18774     open_max = sysconf(_SC_OPEN_MAX);
18775 #  else
18776 #   ifdef FOPEN_MAX
18777     open_max = FOPEN_MAX;
18778 #   else
18779 #    ifdef OPEN_MAX
18780     open_max = OPEN_MAX;
18781 #    else
18782 #     ifdef _NFILE
18783     open_max = _NFILE;
18784 #     endif
18785 #    endif
18786 #   endif
18787 #  endif
18788 # endif
18789 # ifdef HAS_STDIO_STREAM_ARRAY
18790     if (open_max > 0) {
18791       long i;
18792       for (i = 0; i < open_max; i++)
18793             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18794                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18795                 STDIO_STREAM_ARRAY[i]._flag)
18796                 fflush(&STDIO_STREAM_ARRAY[i]);
18797     }
18798   }
18799 # endif
18800 #endif
18801   _exit(42);
18802 }
18803 EOCP
18804 : first we have to find out how _not_ to flush
18805 $to try.c
18806 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18807     output=''
18808     set try -DTRY_FPUTC
18809     if eval $compile; then
18810             $run ./try 2>/dev/null
18811             code="$?"
18812             $from try.out
18813             if $test ! -s try.out -a "X$code" = X42; then
18814                 output=-DTRY_FPUTC
18815             fi
18816     fi
18817     case "$output" in
18818     '')
18819             set try -DTRY_FPRINTF
18820             if eval $compile; then
18821                     $run ./try 2>/dev/null
18822                     code="$?"
18823                     $from try.out
18824                     if $test ! -s try.out -a "X$code" = X42; then
18825                         output=-DTRY_FPRINTF
18826                     fi
18827             fi
18828         ;;
18829     esac
18830 fi
18831 : check for fflush NULL behaviour
18832 case "$fflushNULL" in
18833 '')     set try -DTRY_FFLUSH_NULL $output
18834         if eval $compile; then
18835                 $run ./try 2>/dev/null
18836                 code="$?"
18837                 $from try.out
18838                 if $test -s try.out -a "X$code" = X42; then
18839                         fflushNULL="`$cat try.out`"
18840                 else
18841                         if $test "X$code" != X42; then
18842                                 $cat >&4 <<EOM
18843 (If this test failed, don't worry, we'll try another method shortly.)
18844 EOM
18845                         fi
18846                 fi
18847         fi
18848         $rm_try
18849         case "$fflushNULL" in
18850         x)      $cat >&4 <<EOM
18851 Your fflush(NULL) works okay for output streams.
18852 Let's see if it clobbers input pipes...
18853 EOM
18854 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18855 # bug that improperly flushes the input end of pipes.  So we avoid the
18856 # autoflush on fork/system/exec support for now. :-(
18857 $cat >tryp.c <<EOCP
18858 #include <stdio.h>
18859 int
18860 main(int argc, char **argv)
18861 {
18862     char buf[1024];
18863     int i;
18864     char *bp = buf;
18865     while (1) {
18866         while ((i = getc(stdin)) != -1
18867                && (*bp++ = i) != '\n'
18868                && bp < &buf[1024])
18869         /* DO NOTHING */ ;
18870         *bp = '\0';
18871         fprintf(stdout, "%s", buf);
18872         fflush(NULL);
18873         if (i == -1)
18874             return 0;
18875         bp = buf;
18876     }
18877 }
18878 EOCP
18879                 fflushNULL="$define"
18880                 set tryp
18881                 if eval $compile; then
18882                     $rm -f tryp.out
18883                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18884                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18885                        $cat >&4 <<EOM
18886 fflush(NULL) seems to behave okay with input streams.
18887 EOM
18888                         fflushNULL="$define"
18889                     else
18890                         $cat >&4 <<EOM
18891 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18892 EOM
18893                         fflushNULL="$undef"
18894                     fi
18895                 fi
18896                 $rm -f core tryp.c tryp.core core.tryp.*
18897                 ;;
18898         '')     $cat >&4 <<EOM
18899 Your fflush(NULL) isn't working (contrary to ANSI C).
18900 EOM
18901                 fflushNULL="$undef"
18902                 ;;
18903         *)      $cat >&4 <<EOM
18904 Cannot figure out whether your fflush(NULL) works or not.
18905 I'm assuming it doesn't (contrary to ANSI C).
18906 EOM
18907                 fflushNULL="$undef"
18908                 ;;
18909         esac
18910         ;;
18911 $define|true|[yY]*)
18912         fflushNULL="$define"
18913         ;;
18914 *)
18915         fflushNULL="$undef"
18916         ;;
18917 esac
18918 : check explicit looping only if NULL did not work, and if the pipe
18919 : bug does not show up on an explicit flush too
18920 case "$fflushNULL" in
18921 "$undef")
18922         $cat >tryp.c <<EOCP
18923 #include <stdio.h>
18924 int
18925 main(int argc, char **argv)
18926 {
18927     char buf[1024];
18928     int i;
18929     char *bp = buf;
18930     while (1) {
18931         while ((i = getc(stdin)) != -1
18932                && (*bp++ = i) != '\n'
18933                && bp < &buf[1024])
18934         /* DO NOTHING */ ;
18935         *bp = '\0';
18936         fprintf(stdout, "%s", buf);
18937         fflush(stdin);
18938         if (i == -1)
18939             return 0;
18940         bp = buf;
18941     }
18942 }
18943 EOCP
18944         set tryp
18945         if eval $compile; then
18946             $rm -f tryp.out
18947             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18948             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18949                $cat >&4 <<EOM
18950 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18951 EOM
18952                 : now check for fflushall behaviour
18953                 case "$fflushall" in
18954                 '')     set try -DTRY_FFLUSH_ALL $output
18955                         if eval $compile; then
18956                                 $cat >&4 <<EOM
18957 (Now testing the other method--but note that this also may fail.)
18958 EOM
18959                                 $run ./try 2>/dev/null
18960                                 code=$?
18961                                 $from try.out
18962                                 if $test -s try.out -a "X$code" = X42; then
18963                                         fflushall="`$cat try.out`"
18964                                 fi
18965                         fi
18966                         $rm_try
18967                         case "$fflushall" in
18968                         x)      $cat >&4 <<EOM
18969 Whew. Flushing explicitly all the stdio streams works.
18970 EOM
18971                                 fflushall="$define"
18972                                 ;;
18973                         '')     $cat >&4 <<EOM
18974 Sigh. Flushing explicitly all the stdio streams doesn't work.
18975 EOM
18976                                 fflushall="$undef"
18977                                 ;;
18978                         *)      $cat >&4 <<EOM
18979 Cannot figure out whether flushing stdio streams explicitly works or not.
18980 I'm assuming it doesn't.
18981 EOM
18982                                 fflushall="$undef"
18983                                 ;;
18984                         esac
18985                         ;;
18986                 "$define"|true|[yY]*)
18987                         fflushall="$define"
18988                         ;;
18989                 *)
18990                         fflushall="$undef"
18991                         ;;
18992                 esac
18993             else
18994                 $cat >&4 <<EOM
18995 All is futile.  Even fflush(stdin) clobbers input pipes!
18996 EOM
18997                 fflushall="$undef"
18998             fi
18999         else
19000             fflushall="$undef"
19001         fi
19002         $rm -f core tryp.c tryp.core core.tryp.*
19003         ;;
19004 *)      fflushall="$undef"
19005         ;;
19006 esac
19007
19008 case "$fflushNULL$fflushall" in
19009 undefundef)
19010         $cat <<EOM
19011 OK, I give up.  I cannot figure out how to flush pending stdio output.
19012 We won't be flushing handles at all before fork/exec/popen.
19013 EOM
19014         ;;
19015 esac
19016 $rm_try
19017
19018 : Store the full pathname to the ar program for use in the C program
19019 : Respect a hint or command line value for full_ar.
19020 case "$full_ar" in
19021 '') full_ar=$ar ;;
19022 esac
19023
19024 : Store the full pathname to the sed program for use in the C program
19025 full_sed=$sed
19026
19027 : see what type gids are declared as in the kernel
19028 echo " "
19029 echo "Looking for the type for group ids returned by getgid()."
19030 set gid_t gidtype xxx stdio.h sys/types.h
19031 eval $typedef
19032 case "$gidtype" in
19033 xxx)
19034         xxx=`./findhdr sys/user.h`
19035         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19036         case $1 in
19037         unsigned) dflt="$1 $2" ;;
19038         *) dflt="$1" ;;
19039         esac
19040         ;;
19041 *) dflt="$gidtype";;
19042 esac
19043 case "$gidtype" in
19044 gid_t) echo "gid_t found." ;;
19045 *)      rp="What is the type for group ids returned by getgid()?"
19046         . ./myread
19047         gidtype="$ans"
19048         ;;
19049 esac
19050
19051 echo " "
19052 case "$gidtype" in
19053 *_t) zzz="$gidtype"     ;;
19054 *)   zzz="gid"          ;;
19055 esac
19056 echo "Checking the size of $zzz..." >&4 
19057 cat > try.c <<EOCP
19058 #include <sys/types.h>
19059 #include <stdio.h>
19060 #$i_stdlib I_STDLIB
19061 #ifdef I_STDLIB
19062 #include <stdlib.h>
19063 #endif
19064 int main() {
19065     printf("%d\n", (int)sizeof($gidtype));
19066     exit(0);
19067 }
19068 EOCP
19069 set try
19070 if eval $compile_ok; then
19071         yyy=`$run ./try`
19072         case "$yyy" in
19073         '')     gidsize=4
19074                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19075                 ;;
19076         *)      gidsize=$yyy
19077                 echo "Your $zzz is $gidsize bytes long."
19078                 ;;
19079         esac
19080 else
19081         gidsize=4
19082         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19083 fi
19084
19085
19086 echo " "
19087 case "$gidtype" in
19088 *_t) zzz="$gidtype"     ;;
19089 *)   zzz="gid"          ;;
19090 esac
19091 echo "Checking the sign of $zzz..." >&4 
19092 cat > try.c <<EOCP
19093 #include <sys/types.h>
19094 #include <stdio.h>
19095 int main() {
19096         $gidtype foo = -1;
19097         if (foo < 0)
19098                 printf("-1\n");
19099         else
19100                 printf("1\n");
19101 }
19102 EOCP
19103 set try
19104 if eval $compile; then
19105         yyy=`$run ./try`
19106         case "$yyy" in
19107         '')     gidsign=1
19108                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19109                 ;;
19110         *)      gidsign=$yyy
19111                 case "$gidsign" in
19112                  1) echo "Your $zzz is unsigned." ;;
19113                 -1) echo "Your $zzz is signed."   ;;
19114                 esac
19115                 ;;
19116         esac
19117 else
19118         gidsign=1
19119         echo "(I can't compile the test program--guessing unsigned.)" >&4
19120 fi
19121
19122
19123 echo " "
19124
19125 if $test X"$quadtype" != X; then
19126
19127 echo "Checking how to print 64-bit integers..." >&4
19128
19129 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19130         $cat >try.c <<'EOCP'
19131 #include <sys/types.h>
19132 #include <stdio.h>
19133 int main() {
19134   int q = 12345678901;
19135   printf("%ld\n", q);
19136 }
19137 EOCP
19138         set try
19139         if eval $compile; then
19140                 yyy=`$run ./try`
19141                 case "$yyy" in
19142                 12345678901)
19143                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19144                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19145                         echo "We will use %d."
19146                         ;;
19147                 esac
19148         fi
19149 fi
19150
19151 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19152         $cat >try.c <<'EOCP'
19153 #include <sys/types.h>
19154 #include <stdio.h>
19155 int main() {
19156   long q = 12345678901;
19157   printf("%ld\n", q);
19158 }
19159 EOCP
19160         set try
19161         if eval $compile; then
19162                 yyy=`$run ./try`
19163                 case "$yyy" in
19164                 12345678901)
19165                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19166                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19167                         echo "We will use %ld."
19168                         ;;
19169                 esac
19170         fi
19171 fi
19172
19173 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19174         $cat >try.c <<'EOCP'
19175 #include <sys/types.h>
19176 #include <inttypes.h>
19177 #include <stdio.h>
19178 int main() {
19179   int64_t q = 12345678901;
19180   printf("%" PRId64 "\n", q);
19181 }
19182 EOCP
19183         set try
19184         if eval $compile; then
19185                 yyy=`$run ./try`
19186                 case "$yyy" in
19187                 12345678901)
19188                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19189                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19190                         echo "We will use the C9X style."
19191                         ;;
19192                 esac
19193         fi
19194 fi
19195
19196 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19197         $cat >try.c <<EOCP
19198 #include <sys/types.h>
19199 #include <stdio.h>
19200 int main() {
19201   $quadtype q = 12345678901;
19202   printf("%Ld\n", q);
19203 }
19204 EOCP
19205         set try
19206         if eval $compile; then
19207                 yyy=`$run ./try`
19208                 case "$yyy" in
19209                 12345678901)
19210                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19211                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19212                         echo "We will use %Ld."
19213                         ;;
19214                 esac
19215         fi
19216 fi
19217
19218 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19219         $cat >try.c <<'EOCP'
19220 #include <sys/types.h>
19221 #include <stdio.h>
19222 int main() {
19223   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19224   printf("%lld\n", q);
19225 }
19226 EOCP
19227         set try
19228         if eval $compile; then
19229                 yyy=`$run ./try`
19230                 case "$yyy" in
19231                 12345678901)
19232                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19233                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19234                         echo "We will use the %lld style."
19235                         ;;
19236                 esac
19237         fi
19238 fi
19239
19240 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19241         $cat >try.c <<EOCP
19242 #include <sys/types.h>
19243 #include <stdio.h>
19244 int main() {
19245   $quadtype q = 12345678901;
19246   printf("%qd\n", q);
19247 }
19248 EOCP
19249         set try
19250         if eval $compile; then
19251                 yyy=`$run ./try`
19252                 case "$yyy" in
19253                 12345678901)
19254                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19255                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19256                         echo "We will use %qd."
19257                         ;;
19258                 esac
19259         fi
19260 fi
19261
19262 if $test X"$sPRId64" = X; then
19263         echo "Cannot figure out how to print 64-bit integers." >&4
19264 fi
19265 $rm_try
19266
19267 fi
19268
19269 case "$sPRId64" in
19270 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19271         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19272         ;;
19273 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19274         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19275         ;;
19276 esac
19277
19278
19279 echo " "
19280 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19281
19282 if $test X"$ivsize" = X8; then
19283         ivdformat="$sPRId64"
19284         uvuformat="$sPRIu64"
19285         uvoformat="$sPRIo64"
19286         uvxformat="$sPRIx64"
19287         uvXUformat="$sPRIXU64"
19288 else
19289         if $test X"$ivsize" = X"$longsize"; then
19290                 ivdformat='"ld"'
19291                 uvuformat='"lu"'
19292                 uvoformat='"lo"'
19293                 uvxformat='"lx"'
19294                 uvXUformat='"lX"'
19295         else
19296                 if $test X"$ivsize" = X"$intsize"; then
19297                         ivdformat='"d"'
19298                         uvuformat='"u"'
19299                         uvoformat='"o"'
19300                         uvxformat='"x"'
19301                         uvXUformat='"X"'
19302                 else
19303                         : far out
19304                         if $test X"$ivsize" = X"$shortsize"; then
19305                                 ivdformat='"hd"'
19306                                 uvuformat='"hu"'
19307                                 uvoformat='"ho"'
19308                                 uvxformat='"hx"'
19309                                 uvXUformat='"hX"'
19310                         fi
19311                 fi
19312         fi
19313 fi
19314
19315 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19316         nveformat="$sPRIeldbl"
19317         nvfformat="$sPRIfldbl"
19318         nvgformat="$sPRIgldbl"
19319         nvEUformat="$sPRIEUldbl"
19320         nvFUformat="$sPRIFUldbl"
19321         nvGUformat="$sPRIGUldbl"
19322 else
19323         nveformat='"e"'
19324         nvfformat='"f"'
19325         nvgformat='"g"'
19326         nvEUformat='"E"'
19327         nvFUformat='"F"'
19328         nvGUformat='"G"'
19329 fi
19330
19331 case "$ivdformat" in
19332 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19333     exit 1
19334     ;;
19335 esac
19336
19337
19338 echo " "
19339 $echo "Checking the format string to be used for gids..." >&4
19340
19341 case "$gidsign" in
19342 -1)     if $test X"$gidsize" = X"$ivsize"; then
19343                 gidformat="$ivdformat"
19344         else
19345                 if $test X"$gidsize" = X"$longsize"; then
19346                         gidformat='"ld"'
19347                 else
19348                         if $test X"$gidsize" = X"$intsize"; then
19349                                 gidformat='"d"'
19350                         else
19351                                 if $test X"$gidsize" = X"$shortsize"; then
19352                                         gidformat='"hd"'
19353                                 fi
19354                         fi
19355                 fi
19356         fi
19357         ;;
19358 *)      if $test X"$gidsize" = X"$uvsize"; then
19359                 gidformat="$uvuformat"
19360         else
19361                 if $test X"$gidsize" = X"$longsize"; then
19362                         gidformat='"lu"'
19363                 else
19364                         if $test X"$gidsize" = X"$intsize"; then
19365                                 gidformat='"u"'
19366                         else
19367                                 if $test X"$gidsize" = X"$shortsize"; then
19368                                         gidformat='"hu"'
19369                                 fi
19370                         fi
19371                 fi
19372         fi
19373         ;;
19374 esac
19375
19376 : see if getgroups exists
19377 set getgroups d_getgrps
19378 eval $inlibc
19379
19380 : see if setgroups exists
19381 set setgroups d_setgrps
19382 eval $inlibc
19383
19384
19385 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19386 echo " "
19387 case "$d_getgrps$d_setgrps" in
19388 *define*)
19389         case "$groupstype" in
19390         '') dflt="$gidtype" ;;
19391         *)  dflt="$groupstype" ;;
19392         esac
19393         $cat <<EOM
19394 What type of pointer is the second argument to getgroups() and setgroups()?
19395 Usually this is the same as group ids, $gidtype, but not always.
19396
19397 EOM
19398         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19399         . ./myread
19400         groupstype="$ans"
19401         ;;
19402 *)  groupstype="$gidtype";;
19403 esac
19404
19405
19406 if $test $patchlevel -lt 9; then
19407 : MAD is not available in 5.8.x or earlier.
19408     ans=n;
19409 else
19410     case "$mad" in
19411     $define|true|[yY]*) dflt='y' ;;
19412     *)                  dflt='n' ;;
19413     esac
19414     cat <<EOM
19415
19416 Would you like to build with Misc Attribute Decoration? This is development
19417 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19418 overhead on the interpreter.
19419
19420 If this doesn't make any sense to you, just accept the default '$dflt'.
19421 EOM
19422     rp='Build Perl with MAD?'
19423     . ./myread
19424 fi
19425 case "$ans" in
19426 y|Y)    val="$define"
19427         madlyh='madly.h madly.act madly.tab'
19428         madlysrc='madly.c'
19429         madlyobj="madly$_o" ;;
19430 *)      val="$undef"
19431         madlyh=''
19432         madlysrc=''
19433         madlyobj='' ;;
19434 esac
19435 set mad
19436 eval $setvar
19437
19438 echo " "
19439 echo "Checking if your $make program sets \$(MAKE)..." >&4
19440 case "$make_set_make" in
19441 '')
19442         $sed 's/^X //' > testmake.mak << 'EOF'
19443 Xall:
19444 X       @echo 'maketemp="$(MAKE)"'
19445 EOF
19446         case "`$make -f testmake.mak 2>/dev/null`" in
19447         *maketemp=*) make_set_make='#' ;;
19448         *)      make_set_make="MAKE=$make" ;;
19449         esac
19450         $rm -f testmake.mak
19451         ;;
19452 esac
19453 case "$make_set_make" in
19454 '#') echo "Yup, it does.";;
19455 *) echo "Nope, it doesn't.";;
19456 esac
19457
19458 : see what type is used for mode_t
19459 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19460 set mode_t modetype int stdio.h sys/types.h
19461 eval $typedef_ask
19462
19463 : see if we need va_copy
19464 echo " "
19465 case "$i_stdarg" in
19466 "$define")
19467         $cat >try.c <<EOCP
19468 #include <stdarg.h>
19469 #include <stdio.h>
19470 #$i_stdlib I_STDLIB
19471 #ifdef I_STDLIB
19472 #include <stdlib.h>
19473 #endif
19474 #include <signal.h>
19475
19476 int
19477 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19478 {
19479   return vfprintf(f, fmt, *valp);
19480 }
19481
19482 int
19483 myvfprintf(FILE *f, const  char *fmt, va_list val)
19484 {
19485   return ivfprintf(f, fmt, &val);
19486 }
19487
19488 int
19489 myprintf(char *fmt, ...)
19490 {
19491   va_list val;
19492   va_start(val, fmt);
19493   return myvfprintf(stdout, fmt, val);
19494 }
19495
19496 int
19497 main(int ac, char **av)
19498 {
19499   signal(SIGSEGV, exit);
19500
19501   myprintf("%s%cs all right, then\n", "that", '\'');
19502   exit(0);
19503 }
19504 EOCP
19505         set try
19506         if eval $compile && $run ./try 2>&1 >/dev/null; then
19507                 case "`$run ./try`" in
19508                 "that's all right, then")
19509                         okay=yes
19510                         ;;
19511                 esac
19512         fi
19513         case "$okay" in
19514         yes)    echo "It seems that you don't need va_copy()." >&4
19515                 need_va_copy="$undef"
19516                 ;;
19517         *)      echo "It seems that va_copy() or similar will be needed." >&4
19518                 need_va_copy="$define"
19519                 ;;
19520         esac
19521         $rm_try
19522         ;;
19523 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19524         ;;
19525 esac
19526
19527 : see what type is used for size_t
19528 rp="What is the type used for the length parameter for string functions?"
19529 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19530 eval $typedef_ask
19531
19532 : check for type of arguments to gethostbyaddr. 
19533 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19534         case "$d_gethbyaddr" in
19535         $define)
19536                 $cat <<EOM
19537
19538 Checking to see what type of arguments are accepted by gethostbyaddr().
19539 EOM
19540                 hdrs="$define sys/types.h
19541                         $d_socket sys/socket.h 
19542                         $i_niin netinet/in.h 
19543                         $i_netdb netdb.h
19544                         $i_unistd unistd.h"
19545                 : The first arg can 'char *' or 'void *'
19546                 : The second arg is some of integral type
19547                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19548                         for yyy in size_t long int; do
19549                                 case "$netdb_host_type" in
19550                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19551                                         if ./protochk "$try" $hdrs; then
19552                                                 echo "Your system accepts $xxx for the first arg."
19553                                                 echo "...and $yyy for the second arg."
19554                                                 netdb_host_type="$xxx"
19555                                                 netdb_hlen_type="$yyy"
19556                                         fi
19557                                         ;;
19558                                 esac
19559                         done
19560                 done
19561                 : In case none of those worked, prompt the user.
19562                 case "$netdb_host_type" in
19563                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19564                         dflt='char *'
19565                         . ./myread
19566                         netdb_host_type=$ans
19567                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19568                         dflt="$sizetype"
19569                         . ./myread
19570                         netdb_hlen_type=$ans
19571                         ;;
19572                 esac
19573                 ;;
19574         *)      : no gethostbyaddr, so pick harmless defaults
19575                 netdb_host_type='char *'
19576                 netdb_hlen_type="$sizetype"
19577                 ;;
19578         esac
19579         # Remove the "const" if needed. -- but then we'll have a 
19580         # prototype clash!
19581         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19582 fi
19583
19584 : check for type of argument to gethostbyname. 
19585 if test "X$netdb_name_type" = X ; then
19586         case "$d_gethbyname" in
19587         $define)
19588                 $cat <<EOM
19589
19590 Checking to see what type of argument is accepted by gethostbyname().
19591 EOM
19592                 hdrs="$define sys/types.h
19593                         $d_socket sys/socket.h 
19594                         $i_niin netinet/in.h 
19595                         $i_netdb netdb.h
19596                         $i_unistd unistd.h"
19597                 for xxx in "const char *" "char *"; do
19598                         case "$netdb_name_type" in
19599                         '')     try="extern struct hostent *gethostbyname($xxx);"
19600                                 if ./protochk "$try" $hdrs; then
19601                                         echo "Your system accepts $xxx."
19602                                         netdb_name_type="$xxx"
19603                                 fi
19604                                 ;;
19605                         esac
19606                 done
19607                 : In case none of those worked, prompt the user.
19608                 case "$netdb_name_type" in
19609                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19610                         dflt='char *'
19611                         . ./myread
19612                         netdb_name_type=$ans
19613                         ;;
19614                 esac
19615                 ;;
19616         *)      : no gethostbyname, so pick harmless default
19617                 netdb_name_type='char *'
19618                 ;;
19619         esac
19620 fi
19621
19622 : check for type of 1st argument to getnetbyaddr. 
19623 if test "X$netdb_net_type" = X ; then
19624         case "$d_getnbyaddr" in
19625         $define)
19626                 $cat <<EOM
19627
19628 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19629 EOM
19630                 hdrs="$define sys/types.h
19631                         $d_socket sys/socket.h 
19632                         $i_niin netinet/in.h 
19633                         $i_netdb netdb.h
19634                         $i_unistd unistd.h"
19635                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19636                         case "$netdb_net_type" in
19637                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19638                                 if ./protochk "$try" $hdrs; then
19639                                         echo "Your system accepts $xxx."
19640                                         netdb_net_type="$xxx"
19641                                 fi
19642                                 ;;
19643                         esac
19644                 done
19645                 : In case none of those worked, prompt the user.
19646                 case "$netdb_net_type" in
19647                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19648                         dflt='long'
19649                         . ./myread
19650                         netdb_net_type=$ans
19651                         ;;
19652                 esac
19653                 ;;
19654         *)      : no getnetbyaddr, so pick harmless default
19655                 netdb_net_type='long'
19656                 ;;
19657         esac
19658 fi
19659 : locate the preferred pager for this system
19660 fn=f/
19661 case "$pager" in
19662 '')
19663         dflt=''
19664         case "$pg" in
19665         /*) dflt=$pg;;
19666         [a-zA-Z]:/*) dflt=$pg;;
19667         esac
19668         case "$more" in
19669         /*) dflt=$more;;
19670         [a-zA-Z]:/*) dflt=$more;;
19671         esac
19672         case "$less" in
19673         /*) dflt=$less;;
19674         [a-zA-Z]:/*) dflt=$less;;
19675         esac
19676         case "$dflt" in
19677         '') dflt=/usr/ucb/more;;
19678         esac
19679         ;;
19680 *)      dflt="$pager"
19681         : Instruct ./getfile to trust the hinted or previous pager value,
19682         : even if it does not begin with a slash.  For example, on os2,
19683         : pager might be cmd /c more.  See comments in UU/getfile.
19684         fn="f/($pager)"
19685         ;;
19686 esac
19687 echo " "
19688 rp='What pager is used on your system?'
19689 . ./getfile
19690 pager="$ans"
19691
19692 : see what type pids are declared as in the kernel
19693 rp="What is the type of process ids on this system?"
19694 set pid_t pidtype int stdio.h sys/types.h
19695 eval $typedef_ask
19696
19697 : see if ar generates random libraries by itself
19698 echo " "
19699 echo "Checking how to generate random libraries on your machine..." >&4
19700 echo 'int bar1() { return bar2(); }' > bar1.c
19701 echo 'int bar2() { return 2; }' > bar2.c
19702 $cat > foo.c <<EOP
19703 #$i_stdlib I_STDLIB
19704 #ifdef I_STDLIB
19705 #include <stdlib.h>
19706 #endif
19707 int main() { printf("%d\n", bar1()); exit(0); }
19708 EOP
19709 $cc $ccflags -c bar1.c >/dev/null 2>&1
19710 $cc $ccflags -c bar2.c >/dev/null 2>&1
19711 $cc $ccflags -c foo.c >/dev/null 2>&1
19712 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19713 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19714         $run ./foobar >/dev/null 2>&1; then
19715         echo "$ar appears to generate random libraries itself."
19716         orderlib=false
19717         if [ "X$ranlib" = "X" ]; then
19718             ranlib=":"
19719         fi
19720 elif $ar s bar$_a >/dev/null 2>&1 &&
19721         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19722         $run ./foobar >/dev/null 2>&1; then
19723                 echo "a table of contents needs to be added with '$ar s'."
19724                 orderlib=false
19725                 ranlib="$ar s"
19726 elif $ar ts bar$_a >/dev/null 2>&1 &&
19727         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19728         $run ./foobar >/dev/null 2>&1; then
19729                 echo "a table of contents needs to be added with '$ar ts'."
19730                 orderlib=false
19731                 ranlib="$ar ts"
19732 else
19733         case "$ranlib" in
19734         :) ranlib='';;
19735         '')
19736                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19737                 $test -f $ranlib || ranlib=''
19738                 ;;
19739         esac
19740         if $test -n "$ranlib"; then
19741                 echo "your system has '$ranlib'; we'll use that."
19742                 orderlib=false
19743         else
19744                 echo "your system doesn't seem to support random libraries"
19745                 echo "so we'll use lorder and tsort to order the libraries."
19746                 orderlib=true
19747                 ranlib=":"
19748         fi
19749 fi
19750 $rm -f foo* bar*
19751
19752 : check for type of arguments to select.
19753 case "$selecttype" in
19754 '') case "$d_select" in
19755         $define)
19756                 echo " "
19757                 $cat <<EOM
19758 Checking to see what type of arguments are accepted by select().
19759 EOM
19760                 hdrs="$define sys/types.h
19761                         $i_systime sys/time.h
19762                         $i_sysselct sys/select.h
19763                         $d_socket sys/socket.h"
19764                 : The first arg can be int, unsigned, or size_t
19765                 : The last arg may or may not be 'const'
19766                 val=''
19767                 : void pointer has been seen but using that
19768                 : breaks the selectminbits test
19769                 for xxx in 'fd_set *' 'int *'; do
19770                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19771                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19772                                         case "$val" in
19773                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19774                                                 if ./protochk "$try" $hdrs; then
19775                                                         echo "Your system accepts $xxx."
19776                                                         val="$xxx"
19777                                                 fi
19778                                                 ;;
19779                                         esac
19780                                 done
19781                         done
19782                 done
19783                 case "$val" in
19784                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19785                         case "$d_fd_set" in
19786                                 $define) dflt="fd_set *" ;;
19787                                 *)              dflt="int *" ;;
19788                         esac
19789                         . ./myread
19790                         val=$ans
19791                         ;;
19792                 esac
19793                 selecttype="$val"
19794                 ;;
19795         *)      : no select, so pick a harmless default
19796                 selecttype='int *'
19797                 ;;
19798         esac
19799         ;;
19800 esac
19801
19802 : check for the select 'width'
19803 case "$selectminbits" in
19804 '') safebits=`expr $ptrsize \* 8`
19805     case "$d_select" in
19806         $define)
19807                 $cat <<EOM
19808
19809 Checking to see on how many bits at a time your select() operates...
19810 EOM
19811                 $cat >try.c <<EOCP
19812 #include <sys/types.h>
19813 #$i_time I_TIME
19814 #$i_systime I_SYS_TIME
19815 #$i_systimek I_SYS_TIME_KERNEL
19816 #ifdef I_TIME
19817 #   include <time.h>
19818 #endif
19819 #ifdef I_SYS_TIME
19820 #   ifdef I_SYS_TIME_KERNEL
19821 #       define KERNEL
19822 #   endif
19823 #   include <sys/time.h>
19824 #   ifdef I_SYS_TIME_KERNEL
19825 #       undef KERNEL
19826 #   endif
19827 #endif
19828 #$i_sysselct I_SYS_SELECT
19829 #ifdef I_SYS_SELECT
19830 #include <sys/select.h>
19831 #endif
19832 #$d_socket HAS_SOCKET
19833 #ifdef HAS_SOCKET
19834 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19835 #endif
19836 #include <stdio.h>
19837 #$i_stdlib I_STDLIB
19838 #ifdef I_STDLIB
19839 #include <stdlib.h>
19840 #endif
19841 $selecttype b;
19842 #define S sizeof(*(b))
19843 #define MINBITS 64
19844 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19845 #define NBITS  (NBYTES * 8)
19846 int main() {
19847     char *s = (char *)malloc(NBYTES);
19848     struct timeval t;
19849     int i;
19850     FILE* fp;
19851     int fd;
19852
19853     if (!s)
19854         exit(1);
19855     fclose(stdin);
19856     fp = fopen("try.c", "r");
19857     if (fp == 0)
19858       exit(2);
19859     fd = fileno(fp);
19860     if (fd < 0)
19861       exit(3);
19862     b = ($selecttype)s;
19863     for (i = 0; i < NBITS; i++)
19864         FD_SET(i, b);
19865     t.tv_sec  = 0;
19866     t.tv_usec = 0;
19867     select(fd + 1, b, 0, 0, &t);
19868     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19869     free(s);
19870     printf("%d\n", i + 1);
19871     return 0;
19872 }
19873 EOCP
19874                 set try
19875                 if eval $compile_ok; then
19876                         selectminbits=`$run ./try`
19877                         case "$selectminbits" in
19878                         '')     cat >&4 <<EOM
19879 Cannot figure out on how many bits at a time your select() operates.
19880 I'll play safe and guess it is $safebits bits.
19881 EOM
19882                                 selectminbits=$safebits
19883                                 bits="$safebits bits"
19884                                 ;;
19885                         1)      bits="1 bit" ;;
19886                         *)      bits="$selectminbits bits" ;;
19887                         esac
19888                         echo "Your select() operates on $bits at a time." >&4
19889                 else
19890                         rp='What is the minimum number of bits your select() operates on?'
19891                         case "$byteorder" in
19892                         12345678)       dflt=64 ;;
19893                         1234)           dflt=32 ;;
19894                         *)              dflt=1  ;;
19895                         esac
19896                         . ./myread
19897                         val=$ans
19898                         selectminbits="$val"
19899                 fi
19900                 $rm_try
19901                 ;;
19902         *)      : no select, so pick a harmless default
19903                 selectminbits=$safebits
19904                 ;;
19905         esac
19906         ;;
19907 esac
19908
19909 : Trace out the files included by signal.h, then look for SIGxxx names.
19910 : Remove SIGARRAYSIZE used by HPUX.
19911 : Remove SIGSTKSIZE used by Linux.
19912 : Remove SIGSTKSZ used by Posix.
19913 : Remove SIGTYP void lines used by OS2.
19914 : Some cpps, like os390, dont give the file name anywhere
19915 if [ "X$fieldn" = X ]; then
19916         : Just make some guesses.  We check them later.
19917         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19918 else
19919         xxx=`echo '#include <signal.h>' |
19920         $cppstdin $cppminus $cppflags 2>/dev/null |
19921         $grep '^[       ]*#.*include' | 
19922         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19923 fi
19924 : Check this list of files to be sure we have parsed the cpp output ok.
19925 : This will also avoid potentially non-existent files, such 
19926 : as ../foo/bar.h
19927 xxxfiles=''
19928 for xx in $xxx /dev/null ; do
19929         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19930 done
19931 : If we have found no files, at least try signal.h
19932 case "$xxxfiles" in
19933 '')     xxxfiles=`./findhdr signal.h` ;;
19934 esac
19935 xxx=`awk '
19936 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19937         print substr($2, 4, 20)
19938 }
19939 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19940         print substr($3, 4, 20)
19941 }' $xxxfiles`
19942 : Append some common names just in case the awk scan failed.
19943 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19944 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19945 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19946 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19947 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19948
19949 : generate a few handy files for later
19950 $cat > signal.c <<EOCP
19951 #include <sys/types.h>
19952 #include <signal.h>
19953 #$i_stdlib I_STDLIB
19954 #ifdef I_STDLIB
19955 #include <stdlib.h>
19956 #endif
19957 #include <stdio.h>
19958 int main() {
19959
19960 /* Strange style to avoid deeply-nested #if/#else/#endif */
19961 #ifndef NSIG
19962 #  ifdef _NSIG
19963 #    define NSIG (_NSIG)
19964 #  endif
19965 #endif
19966
19967 #ifndef NSIG
19968 #  ifdef SIGMAX
19969 #    define NSIG (SIGMAX+1)
19970 #  endif
19971 #endif
19972
19973 #ifndef NSIG
19974 #  ifdef SIG_MAX
19975 #    define NSIG (SIG_MAX+1)
19976 #  endif
19977 #endif
19978
19979 #ifndef NSIG
19980 #  ifdef _SIG_MAX
19981 #    define NSIG (_SIG_MAX+1)
19982 #  endif
19983 #endif
19984
19985 #ifndef NSIG
19986 #  ifdef MAXSIG
19987 #    define NSIG (MAXSIG+1)
19988 #  endif
19989 #endif
19990
19991 #ifndef NSIG
19992 #  ifdef MAX_SIG
19993 #    define NSIG (MAX_SIG+1)
19994 #  endif
19995 #endif
19996
19997 #ifndef NSIG
19998 #  ifdef SIGARRAYSIZE
19999 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20000 #  endif
20001 #endif
20002
20003 #ifndef NSIG
20004 #  ifdef _sys_nsig
20005 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20006 #  endif
20007 #endif
20008
20009 /* Default to some arbitrary number that's big enough to get most
20010    of the common signals.
20011 */
20012 #ifndef NSIG
20013 #    define NSIG 50
20014 #endif
20015
20016 printf("NSIG %d\n", NSIG);
20017
20018 #ifndef JUST_NSIG
20019
20020 EOCP
20021
20022 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20023 {
20024         printf "#ifdef SIG"; printf $1; printf "\n"
20025         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20026         printf $1; printf ");\n"
20027         printf "#endif\n"
20028 }
20029 END {
20030         printf "#endif /* JUST_NSIG */\n";
20031         printf "exit(0);\n}\n";
20032 }
20033 ' >>signal.c
20034 $cat >signal.awk <<'EOP'
20035 BEGIN { ndups = 0 }
20036 $1 ~ /^NSIG$/ { nsig = $2 }
20037 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20038     if ($2 > maxsig) { maxsig = $2 }
20039     if (sig_name[$2]) {
20040         dup_name[ndups] = $1
20041         dup_num[ndups] = $2
20042         ndups++ 
20043     }
20044     else {
20045         sig_name[$2] = $1
20046         sig_num[$2] = $2
20047     }
20048 }
20049 END { 
20050     if (nsig == 0) {
20051         nsig = maxsig + 1
20052     }
20053     printf("NSIG %d\n", nsig);
20054     for (n = 1; n < nsig; n++) {
20055         if (sig_name[n]) {
20056             printf("%s %d\n", sig_name[n], sig_num[n])
20057         }
20058         else {
20059             printf("NUM%d %d\n", n, n) 
20060         }
20061     }
20062     for (n = 0; n < ndups; n++) {
20063         printf("%s %d\n", dup_name[n], dup_num[n])
20064     }
20065 }
20066 EOP
20067 $cat >signal_cmd <<EOS
20068 $startsh
20069 if $test -s signal.lst; then
20070     echo "Using your existing signal.lst file"
20071         exit 0
20072 fi
20073 xxx="$xxx"
20074 EOS
20075 $cat >>signal_cmd <<'EOS'
20076
20077 set signal
20078 if eval $compile_ok; then
20079         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20080 else
20081         echo "(I can't seem be able to compile the whole test program)" >&4
20082         echo "(I'll try it in little pieces.)" >&4
20083         set signal -DJUST_NSIG
20084         if eval $compile_ok; then
20085                 $run ./signal$_exe > signal.nsg
20086                 $cat signal.nsg
20087         else
20088                 echo "I can't seem to figure out how many signals you have." >&4
20089                 echo "Guessing 50." >&4
20090                 echo 'NSIG 50' > signal.nsg
20091         fi
20092         : Now look at all the signal names, one at a time.
20093         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20094                 $cat > signal.c <<EOCP
20095 #include <sys/types.h>
20096 #include <signal.h>
20097 #include <stdio.h>
20098 int main() {
20099 printf("$xx %d\n", SIG${xx});
20100 return 0;
20101 }
20102 EOCP
20103                 set signal
20104                 if eval $compile; then
20105                         echo "SIG${xx} found."
20106                         $run ./signal$_exe  >> signal.ls1
20107                 else
20108                         echo "SIG${xx} NOT found."
20109                 fi
20110         done
20111         if $test -s signal.ls1; then
20112                 $cat signal.nsg signal.ls1 |
20113                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20114         fi
20115
20116 fi
20117 if $test -s signal.lst; then
20118         :
20119 else
20120         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20121         echo 'kill -l' >signal
20122         set X `csh -f <signal`
20123         $rm -f signal
20124         shift
20125         case $# in
20126         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20127         esac
20128         echo $@ | $tr ' ' $trnl | \
20129             $awk '{ printf "%s %d\n", $1, ++s; }
20130                   END { printf "NSIG %d\n", ++s }' >signal.lst
20131 fi
20132 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20133 EOS
20134 chmod a+x signal_cmd
20135 $eunicefix signal_cmd
20136
20137 : generate list of signal names
20138 echo " "
20139 case "$sig_name_init" in
20140 '') doinit=yes ;;
20141 *)  case "$sig_num_init" in
20142     ''|*,*) doinit=yes ;;
20143     esac ;;
20144 esac
20145 case "$doinit" in
20146 yes)
20147         echo "Generating a list of signal names and numbers..." >&4
20148         . ./signal_cmd
20149         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20150         sig_name=`$awk 'BEGIN { printf "ZERO " }
20151                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20152         sig_num=`$awk  'BEGIN { printf "0 " }
20153                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20154         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20155                              !/^NSIG/   { printf "\"%s\", ", $1 }
20156                              END        { printf "0\n" }' signal.lst`
20157         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20158                              !/^NSIG/   { printf "%d, ", $2}
20159                              END        { printf "0\n"}' signal.lst`
20160         ;;
20161 esac
20162 echo "The following $sig_count signals are available:"
20163 echo " "
20164 echo $sig_name | $awk \
20165 'BEGIN { linelen = 0 }
20166 {
20167         for (i = 1; i <= NF; i++) {
20168                 name = "SIG" $i " "
20169                 linelen = linelen + length(name)
20170                 if (linelen > 70) {
20171                         printf "\n"
20172                         linelen = length(name)
20173                 }
20174                 printf "%s", name
20175         }
20176         printf "\n"
20177 }'
20178 sig_size=`echo $sig_name | awk '{print NF}'`
20179 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20180
20181 echo " "
20182 case "$sizetype" in
20183 *_t) zzz="$sizetype"    ;;
20184 *)   zzz="filesize"     ;;
20185 esac
20186 echo "Checking the size of $zzz..." >&4 
20187 cat > try.c <<EOCP
20188 #include <sys/types.h>
20189 #include <stdio.h>
20190 #$i_stdlib I_STDLIB
20191 #ifdef I_STDLIB
20192 #include <stdlib.h>
20193 #endif
20194 int main() {
20195     printf("%d\n", (int)sizeof($sizetype));
20196     exit(0);
20197 }
20198 EOCP
20199 set try
20200 if eval $compile_ok; then
20201         yyy=`$run ./try`
20202         case "$yyy" in
20203         '')     sizesize=4
20204                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20205                 ;;
20206         *)      sizesize=$yyy
20207                 echo "Your $zzz size is $sizesize bytes."
20208                 ;;
20209         esac
20210 else
20211         sizesize=4
20212         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20213 fi
20214
20215
20216 : check for socklen_t
20217 echo " "
20218 echo "Checking to see if you have socklen_t..." >&4
20219 $cat >try.c <<EOCP
20220 #include <sys/types.h>
20221 #$d_socket HAS_SOCKET
20222 #ifdef HAS_SOCKET
20223 #include <sys/socket.h>
20224 #endif
20225 int main() { socklen_t x = 16; }
20226 EOCP
20227 set try
20228 if eval $compile; then
20229         val="$define"
20230         echo "You have socklen_t."
20231 else
20232         val="$undef"
20233         echo "You do not have socklen_t."
20234         case "$sizetype" in
20235         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20236         esac
20237 fi
20238 $rm_try
20239 set d_socklen_t
20240 eval $setvar
20241
20242 : see if this is a socks.h system
20243 set socks.h i_socks
20244 eval $inhdr
20245
20246 : check for type of the size argument to socket calls
20247 case "$d_socket" in
20248 "$define")
20249         $cat <<EOM
20250
20251 Checking to see what type is the last argument of accept().
20252 EOM
20253         yyy=''
20254         case "$d_socklen_t" in
20255         "$define") yyy="$yyy socklen_t"
20256         esac
20257         yyy="$yyy $sizetype int long unsigned"
20258         for xxx in $yyy; do
20259                 case "$socksizetype" in
20260                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20261                         case "$usesocks" in
20262                         "$define")
20263                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20264                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20265                                         socksizetype="$xxx"
20266                                 fi
20267                                 ;;
20268                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20269                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20270                                         socksizetype="$xxx"
20271                                 fi
20272                                 ;;
20273                         esac
20274                         ;;
20275                 esac
20276         done
20277 : In case none of those worked, prompt the user.
20278         case "$socksizetype" in
20279         '')     rp='What is the type for socket address structure sizes?'
20280                 dflt='int'
20281                 . ./myread
20282                 socksizetype=$ans
20283                 ;;
20284         esac
20285         ;;
20286 *)      : no sockets, so pick relatively harmless default
20287         socksizetype='int'
20288         ;;
20289 esac
20290
20291 : see what type is used for signed size_t
20292 set ssize_t ssizetype int stdio.h sys/types.h
20293 eval $typedef
20294 dflt="$ssizetype"
20295 $cat > try.c <<EOM
20296 #include <stdio.h>
20297 #$i_stdlib I_STDLIB
20298 #ifdef I_STDLIB
20299 #include <stdlib.h>
20300 #endif
20301 #include <sys/types.h>
20302 #define Size_t $sizetype
20303 #define SSize_t $dflt
20304 int main()
20305 {
20306         if (sizeof(Size_t) == sizeof(SSize_t))
20307                 printf("$dflt\n");
20308         else if (sizeof(Size_t) == sizeof(int))
20309                 printf("int\n");
20310         else
20311                 printf("long\n");
20312         exit(0);
20313 }
20314 EOM
20315 echo " "
20316 set try
20317 if eval $compile_ok && $run ./try > /dev/null; then
20318         ssizetype=`$run ./try`
20319         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20320 else
20321         $cat >&4 <<EOM
20322 Help! I can't compile and run the ssize_t test program: please enlighten me!
20323 (This is probably a misconfiguration in your system or libraries, and
20324 you really ought to fix it.  Still, I'll try anyway.)
20325
20326 I need a type that is the same size as $sizetype, but is guaranteed to
20327 be signed.  Common values are ssize_t, int and long.
20328
20329 EOM
20330         rp="What signed type is the same size as $sizetype?"
20331         . ./myread
20332         ssizetype="$ans"
20333 fi
20334 $rm_try
20335
20336 : see what type of char stdio uses.
20337 echo " "
20338 echo '#include <stdio.h>' > stdio.c
20339 $cppstdin $cppminus < stdio.c > stdioh
20340 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20341         echo "Your stdio uses unsigned chars." >&4
20342         stdchar="unsigned char"
20343 else
20344         echo "Your stdio uses signed chars." >&4
20345         stdchar="char"
20346 fi
20347 $rm -f stdio.* stdioh
20348
20349 : see what type uids are declared as in the kernel
20350 echo " "
20351 echo "Looking for the type for user ids returned by getuid()."
20352 set uid_t uidtype xxx stdio.h sys/types.h
20353 eval $typedef
20354 case "$uidtype" in
20355 xxx)
20356         xxx=`./findhdr sys/user.h`
20357         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20358         case $1 in
20359         unsigned) dflt="$1 $2" ;;
20360         *) dflt="$1" ;;
20361         esac
20362         ;;
20363 *) dflt="$uidtype";;
20364 esac
20365 case "$uidtype" in
20366 uid_t)  echo "uid_t found." ;;
20367 *)      rp="What is the type for user ids returned by getuid()?"
20368         . ./myread
20369         uidtype="$ans"
20370         ;;
20371 esac
20372
20373 echo " "
20374 case "$uidtype" in
20375 *_t) zzz="$uidtype"     ;;
20376 *)   zzz="uid"          ;;
20377 esac
20378 echo "Checking the size of $zzz..." >&4 
20379 cat > try.c <<EOCP
20380 #include <sys/types.h>
20381 #include <stdio.h>
20382 #$i_stdlib I_STDLIB
20383 #ifdef I_STDLIB
20384 #include <stdlib.h>
20385 #endif
20386 int main() {
20387     printf("%d\n", (int)sizeof($uidtype));
20388     exit(0);
20389 }
20390 EOCP
20391 set try
20392 if eval $compile_ok; then
20393         yyy=`$run ./try`
20394         case "$yyy" in
20395         '')     uidsize=4
20396                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20397                 ;;
20398         *)      uidsize=$yyy
20399                 echo "Your $zzz is $uidsize bytes long."
20400                 ;;
20401         esac
20402 else
20403         uidsize=4
20404         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20405 fi
20406
20407 echo " "
20408 case "$uidtype" in
20409 *_t) zzz="$uidtype"     ;;
20410 *)   zzz="uid"          ;;
20411 esac
20412 echo "Checking the sign of $zzz..." >&4
20413 cat > try.c <<EOCP
20414 #include <sys/types.h>
20415 #include <stdio.h>
20416 int main() {
20417         $uidtype foo = -1;
20418         if (foo < 0)
20419                 printf("-1\n");
20420         else
20421                 printf("1\n");
20422 }
20423 EOCP
20424 set try
20425 if eval $compile; then
20426         yyy=`$run ./try`
20427         case "$yyy" in
20428         '')     uidsign=1
20429                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20430                 ;;
20431         *)      uidsign=$yyy
20432                 case "$uidsign" in
20433                  1) echo "Your $zzz is unsigned." ;;
20434                 -1) echo "Your $zzz is signed."   ;;
20435                 esac
20436                 ;;
20437         esac
20438 else
20439         uidsign=1
20440         echo "(I can't compile the test program--guessing unsigned.)" >&4
20441 fi
20442
20443
20444
20445 echo " "
20446 $echo "Checking the format string to be used for uids..." >&4
20447
20448 case "$uidsign" in
20449 -1)     if $test X"$uidsize" = X"$ivsize"; then
20450                 uidformat="$ivdformat"
20451         else
20452                 if $test X"$uidsize" = X"$longsize"; then
20453                         uidformat='"ld"'
20454                 else
20455                         if $test X"$uidsize" = X"$intsize"; then
20456                                 uidformat='"d"'
20457                         else
20458                                 if $test X"$uidsize" = X"$shortsize"; then
20459                                         uidformat='"hd"'
20460                                 fi
20461                         fi
20462                 fi
20463         fi
20464         ;;
20465 *)      if $test X"$uidsize" = X"$uvsize"; then
20466                 uidformat="$uvuformat"
20467         else
20468                 if $test X"$uidsize" = X"$longsize"; then
20469                         uidformat='"lu"'
20470                 else
20471                         if $test X"$uidsize" = X"$intsize"; then
20472                                 uidformat='"u"'
20473                         else
20474                                 if $test X"$uidsize" = X"$shortsize"; then
20475                                         uidformat='"hu"'
20476                                 fi
20477                         fi
20478                 fi
20479         fi
20480         ;;
20481 esac
20482
20483
20484 case "$usesitecustomize" in
20485     $define|true|[Yy]*)
20486         usesitecustomize="$define"
20487         ;;
20488     *)
20489         usesitecustomize="$undef"
20490         ;;
20491     esac
20492
20493 : determine compiler compiler
20494 case "$yacc" in
20495 '')
20496         dflt=yacc;;
20497 *)
20498         dflt="$yacc";;
20499 esac
20500 echo " "
20501 comp='yacc'
20502 if $test -f "$byacc$_exe"; then
20503         dflt="$byacc"
20504         comp="byacc or $comp"
20505 fi
20506 if $test -f "$bison$_exe"; then
20507         comp="$comp or bison -y"
20508 fi
20509 rp="Which compiler compiler ($comp) shall I use?"
20510 . ./myread
20511 yacc="$ans"
20512 case "$yacc" in
20513 *bis*)
20514         case "$yacc" in
20515         *-y*) ;;
20516         *)
20517                 yacc="$yacc -y"
20518                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20519                 ;;
20520         esac
20521         ;;
20522 esac
20523
20524
20525 : see if this is a assert.h system
20526 set assert.h i_assert
20527 eval $inhdr
20528
20529 : see if this is a fp.h system
20530 set fp.h i_fp
20531 eval $inhdr
20532
20533 : see if this is a fp_class.h system
20534 set fp_class.h i_fp_class
20535 eval $inhdr
20536
20537 : see if gdbm.h is available
20538 set gdbm.h t_gdbm
20539 eval $inhdr
20540 case "$t_gdbm" in
20541 $define)
20542         : see if gdbm_open exists
20543         set gdbm_open d_gdbm_open
20544         eval $inlibc
20545         case "$d_gdbm_open" in
20546         $undef)
20547                 t_gdbm="$undef"
20548                 echo "We won't be including <gdbm.h>"
20549                 ;;
20550         esac
20551         ;;
20552 esac
20553 val="$t_gdbm"
20554 set i_gdbm
20555 eval $setvar
20556
20557 : see if this is a ieeefp.h system
20558 case "$i_ieeefp" in
20559 '' ) set ieeefp.h i_ieeefp
20560      eval $inhdr
20561      ;;
20562 esac
20563
20564 : see if this is a libutil.h system
20565 set libutil.h i_libutil
20566 eval $inhdr
20567
20568 : see if mach cthreads are available
20569 if test "X$usethreads" = "X$define"; then
20570         set mach/cthreads.h i_machcthr
20571         eval $inhdr
20572 else
20573         i_machcthr="$undef"
20574 fi
20575
20576
20577
20578 : see if this is a mntent.h system
20579 set mntent.h i_mntent
20580 eval $inhdr
20581
20582 : see if ndbm.h is available
20583 set ndbm.h t_ndbm
20584 eval $inhdr
20585
20586 case "$t_ndbm" in
20587 $undef)
20588     # Some Linux distributions such as RedHat 7.1 put the
20589     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20590     if $test -f /usr/include/gdbm/ndbm.h; then
20591         echo '<gdbm/ndbm.h> found.'
20592         ccflags="$ccflags -I/usr/include/gdbm"
20593         cppflags="$cppflags -I/usr/include/gdbm"
20594         t_ndbm=$define
20595     fi
20596     ;;
20597 esac
20598
20599 case "$t_ndbm" in
20600 $define)
20601         : see if dbm_open exists
20602         set dbm_open d_dbm_open
20603         eval $inlibc
20604         case "$d_dbm_open" in
20605         $undef)
20606                 t_ndbm="$undef"
20607                 echo "We won't be including <ndbm.h>"
20608                 ;;
20609         esac
20610         ;;
20611 esac
20612 val="$t_ndbm"
20613 set i_ndbm
20614 eval $setvar
20615
20616 : see if net/errno.h is available
20617 val=''
20618 set net/errno.h val
20619 eval $inhdr
20620
20621 : Unfortunately, it causes problems on some systems.  Arrgh.
20622 case "$val" in
20623 $define)
20624         cat > try.c <<'EOM'
20625 #include <stdio.h>
20626 #include <errno.h>
20627 #include <net/errno.h>
20628 int func()
20629 {
20630         return ENOTSOCK;
20631 }
20632 EOM
20633         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20634                 echo "We'll be including <net/errno.h>." >&4
20635         else
20636                 echo "We won't be including <net/errno.h>." >&4
20637                 val="$undef"
20638         fi
20639         $rm_try
20640         ;;
20641 esac
20642 set i_neterrno
20643 eval $setvar
20644
20645 : see if netinet/tcp.h is available
20646 set netinet/tcp.h i_netinettcp
20647 eval $inhdr
20648
20649 : see if this is a poll.h system
20650 set poll.h i_poll
20651 eval $inhdr
20652
20653 : see if this is a prot.h system
20654 set prot.h i_prot
20655 eval $inhdr
20656
20657 echo " "
20658 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20659 $cat <<'EOSH' > Cppsym.know
20660 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20661 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20662 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20663 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20664 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20665 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20666 bull c cadmus clipper CMU COFF COMPILER_VERSION
20667 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20668 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20669 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20670 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20671 GLIBC GLIBC_MINOR
20672 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20673 H3050R H3050RX hbullx20 hcx host_mips
20674 hp200 hp300 hp700 HP700 hp800 hp9000
20675 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20676 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20677 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20678 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20679 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20680 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20681 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20682 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20683 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20684 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20685 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20686 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20687 MATH_HAS_NO_SIDE_EFFECTS
20688 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20689 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20690 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20691 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20692 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20693 NetBSD news1500 news1700 news1800 news1900 news3700
20694 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20695 ns32016 ns32332 ns32k nsc32000
20696 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20697 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20698 pc532 pdp11 PGC PIC plexus PORTAR posix
20699 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20700 POSIX_C_SOURCE POSIX_SOURCE POWER
20701 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20702 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20703 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20704 sony sony_news sonyrisc sparc sparclite spectrum
20705 stardent stdc STDC_EXT stratos sun sun3 sun386
20706 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20707 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20708 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20709 sysV68 sysV88 Tek4132 Tek4300 titan
20710 TM3200 TM5400 TM5600
20711 tower tower32 tower32_200 tower32_600 tower32_700
20712 tower32_800 tower32_850 tss
20713 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20714 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20715 unix UNIX95 UNIX99 unixpc unos
20716 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20717 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20718 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20719 USGr4 USGr4_2
20720 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20721 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20722 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20723 z8000
20724 EOSH
20725 # Maybe put other stuff here too.
20726 cat <<EOSH >>Cppsym.know
20727 $osname
20728 EOSH
20729 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20730 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20731 $cat Cppsym.know > Cppsym.c
20732 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20733 $rm -f Cppsym.a Cppsym.b Cppsym.c
20734 cat <<EOSH > Cppsym
20735 $startsh
20736 if $test \$# -gt 0; then
20737     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20738     if $test -s Cppsym.got; then
20739         $rm -f Cppsym.got
20740         exit 0
20741     fi
20742     $rm -f Cppsym.got
20743     exit 1
20744 else
20745     $tr " " "$trnl" | ./Cppsym.try
20746     exit 0
20747 fi
20748 EOSH
20749 chmod +x Cppsym
20750 $eunicefix Cppsym
20751 cat <<EOSH > Cppsym.try
20752 $startsh
20753 cat <<'EOCP' > try.c
20754 #include <stdio.h>
20755 #if cpp_stuff == 1
20756 #define STRINGIFY(a)    "a"
20757 #endif
20758 #if cpp_stuff == 42
20759 #define StGiFy(a)  #a
20760 #define STRINGIFY(a)    StGiFy(a)
20761 #endif
20762 #if $cpp_stuff != 1 && $cpp_stuff != 42
20763 #   include "Bletch: How does this C preprocessor stringify macros?"
20764 #endif
20765 int main() {
20766 EOCP
20767 $awk \\
20768 EOSH
20769 cat <<'EOSH' >> Cppsym.try
20770 'length($1) > 0 {
20771     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20772     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20773     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20774     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20775 }'       >> try.c
20776 echo 'return 0;}' >> try.c
20777 EOSH
20778 cat <<EOSH >> Cppsym.try
20779 ccflags="$ccflags"
20780 case "$osname-$gccversion" in
20781 irix-) ccflags="\$ccflags -woff 1178" ;;
20782 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20783 esac
20784 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20785 EOSH
20786 chmod +x Cppsym.try
20787 $eunicefix Cppsym.try
20788 ./Cppsym < Cppsym.know > Cppsym.true
20789 : Add in any linux cpp "predefined macros":
20790 case "$osname::$gccversion" in
20791   *linux*::*.*)
20792     tHdrH=_tmpHdr
20793     rm -f $tHdrH'.h' $tHdrH
20794     touch $tHdrH'.h'
20795     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20796        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20797        if [ -s $tHdrH'_cppsym.real' ]; then
20798           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20799        fi
20800     fi
20801     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20802   ;;
20803 esac
20804 : now check the C compiler for additional symbols
20805 postprocess_cc_v=''
20806 case "$osname" in
20807 aix) postprocess_cc_v="|$tr , ' '" ;;
20808 esac
20809 $cat >ccsym <<EOS
20810 $startsh
20811 $cat >tmp.c <<EOF
20812 extern int foo;
20813 EOF
20814 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20815 do
20816         case "\$i" in
20817         -D*) echo "\$i" | $sed 's/^-D//';;
20818         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20819         esac
20820 done
20821 $rm_try
20822 EOS
20823 postprocess_cc_v=''
20824 chmod +x ccsym
20825 $eunicefix ccsym
20826 ./ccsym > ccsym1.raw
20827 if $test -s ccsym1.raw; then
20828        $sort ccsym1.raw | $uniq >ccsym.raw
20829 else
20830        mv ccsym1.raw ccsym.raw
20831 fi
20832
20833 $awk '/\=/ { print $0; next }
20834         { print $0"=1" }' ccsym.raw >ccsym.list
20835 $comm -13 Cppsym.true ccsym.list >ccsym.own
20836 $comm -12 Cppsym.true ccsym.list >ccsym.com
20837 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20838 also=''
20839 if $test -z ccsym.raw; then
20840         echo "Your C compiler doesn't seem to define any symbols!" >&4
20841         echo " "
20842         echo "However, your C preprocessor defines the following symbols:"
20843         $cat Cppsym.true
20844         ccsymbols=''
20845         cppsymbols=`$cat Cppsym.true`
20846         cppsymbols=`echo $cppsymbols`
20847         cppccsymbols="$cppsymbols"
20848 else
20849         if $test -s ccsym.com; then
20850                 echo "Your C compiler and pre-processor define these symbols:"
20851                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20852                 also='also '
20853                 symbols='ones'
20854                 cppccsymbols=`$cat ccsym.com`
20855                 cppccsymbols=`echo $cppccsymbols`
20856                 $test "$silent" || sleep 1
20857         fi
20858         if $test -s ccsym.cpp; then
20859                 $test "$also" && echo " "
20860                 echo "Your C pre-processor ${also}defines the following symbols:"
20861                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20862                 also='further '
20863                 cppsymbols=`$cat ccsym.cpp`
20864                 cppsymbols=`echo $cppsymbols`
20865                 $test "$silent" || sleep 1
20866         fi
20867         if $test -s ccsym.own; then
20868                 $test "$also" && echo " "
20869                 echo "Your C compiler ${also}defines the following cpp symbols:"
20870                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20871                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20872                 ccsymbols=`$cat ccsym.own`
20873                 ccsymbols=`echo $ccsymbols`
20874                 $test "$silent" || sleep 1
20875         fi
20876 fi
20877
20878 : see if this is a termio system
20879 val="$undef"
20880 val2="$undef"
20881 val3="$undef"
20882 if $test `./findhdr termios.h`; then
20883         set tcsetattr i_termios
20884         eval $inlibc
20885         val3="$i_termios"
20886 fi
20887 echo " "
20888 case "$val3" in
20889 "$define") echo "You have POSIX termios.h... good!" >&4;;
20890 *) if ./Cppsym pyr; then
20891                 case "`/bin/universe`" in
20892                 ucb) if $test `./findhdr sgtty.h`; then
20893                                 val2="$define"
20894                                 echo "<sgtty.h> found." >&4
20895                         else
20896                                 echo "System is pyramid with BSD universe."
20897                                 echo "<sgtty.h> not found--you could have problems." >&4
20898                         fi;;
20899                 *) if $test `./findhdr termio.h`; then
20900                                 val="$define"
20901                                 echo "<termio.h> found." >&4
20902                         else
20903                                 echo "System is pyramid with USG universe."
20904                                 echo "<termio.h> not found--you could have problems." >&4
20905                         fi;;
20906                 esac
20907         elif ./usg; then
20908                 if $test `./findhdr termio.h`; then
20909                         echo "<termio.h> found." >&4
20910                         val="$define"
20911                 elif $test `./findhdr sgtty.h`; then
20912                         echo "<sgtty.h> found." >&4
20913                         val2="$define"
20914                 else
20915 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20916                 fi
20917         else
20918                 if $test `./findhdr sgtty.h`; then
20919                         echo "<sgtty.h> found." >&4
20920                         val2="$define"
20921                 elif $test `./findhdr termio.h`; then
20922                         echo "<termio.h> found." >&4
20923                         val="$define"
20924                 else
20925 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20926                 fi
20927         fi;;
20928 esac
20929 set i_termio; eval $setvar
20930 val=$val2; set i_sgtty; eval $setvar
20931 val=$val3; set i_termios; eval $setvar
20932
20933 : see if stddef is available
20934 set stddef.h i_stddef
20935 eval $inhdr
20936
20937 : see if sys/access.h is available
20938 set sys/access.h i_sysaccess
20939 eval $inhdr
20940
20941 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20942 set sys/filio.h i_sysfilio
20943 eval $inhdr
20944 echo " "
20945 if $test `./findhdr sys/ioctl.h`; then
20946         val="$define"
20947         echo '<sys/ioctl.h> found.' >&4
20948 else
20949         val="$undef"
20950         if $test $i_sysfilio = "$define"; then
20951             echo '<sys/ioctl.h> NOT found.' >&4
20952         else
20953                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20954                 $test $i_termio = "$define" && xxx="termio.h"
20955                 $test $i_termios = "$define" && xxx="termios.h"
20956 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20957         fi
20958 fi
20959 set i_sysioctl
20960 eval $setvar
20961
20962 : see if socket ioctl defs are in sys/sockio.h
20963 echo " "
20964 xxx=`./findhdr sys/sockio.h`
20965 if $test "$xxx"; then
20966         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20967                 val="$define"
20968                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20969         else
20970                 val="$undef"
20971                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20972         fi
20973 else
20974         val="$undef"
20975         $cat <<EOM
20976 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20977 EOM
20978 fi
20979 set i_syssockio
20980 eval $setvar
20981
20982
20983 : see if this is a syslog.h system
20984 set syslog.h i_syslog
20985 eval $inhdr
20986
20987
20988 : see if this is a sys/mode.h system
20989 set sys/mode.h i_sysmode
20990 eval $inhdr
20991
20992 : see if sys/resource.h has to be included
20993 set sys/resource.h i_sysresrc
20994 eval $inhdr
20995
20996 : see if sys/security.h is available
20997 set sys/security.h i_syssecrt
20998 eval $inhdr
20999
21000 : see if this is a sys/statvfs.h system
21001 set sys/statvfs.h i_sysstatvfs
21002 eval $inhdr
21003
21004 : see if this is a sys/un.h system
21005 set sys/un.h i_sysun
21006 eval $inhdr
21007
21008
21009 : see if this is a sys/utsname.h system
21010 set sys/utsname.h i_sysutsname
21011 eval $inhdr
21012
21013 : see if this is a syswait system
21014 set sys/wait.h i_syswait
21015 eval $inhdr
21016
21017 : see if this is a ustat.h system
21018 set ustat.h i_ustat
21019 eval $inhdr
21020
21021 : see if this is an utime system
21022 set utime.h i_utime
21023 eval $inhdr
21024
21025 : see if this is a values.h system
21026 set values.h i_values
21027 eval $inhdr
21028
21029 : see if this is a vfork system
21030 case "$d_vfork" in
21031 "$define")
21032         set vfork.h i_vfork
21033         eval $inhdr
21034         ;;
21035 *)
21036         i_vfork="$undef"
21037         ;;
21038 esac
21039
21040 echo " "
21041 echo "Looking for extensions..." >&4
21042 : If we are using the old config.sh, known_extensions may contain
21043 : old or inaccurate or duplicate values.
21044 known_extensions=''
21045 nonxs_extensions=''
21046 : We do not use find because it might not be available.
21047 : We do not just use MANIFEST because the user may have dropped
21048 : some additional extensions into the source tree and expect them
21049 : to be built.
21050
21051 : Function to recursively find available extensions, ignoring DynaLoader
21052 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21053 find_extensions='
21054     for xxx in *; do
21055         case "$xxx" in
21056             DynaLoader|dynaload) ;;
21057             *)
21058             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21059                 known_extensions="$known_extensions $1$xxx";
21060             elif $test -f $xxx/Makefile.PL; then
21061                 nonxs_extensions="$nonxs_extensions $1$xxx";
21062             else
21063                 if $test -d $xxx -a $# -lt 10; then
21064                     set $1$xxx/ $*;
21065                     cd "$xxx";
21066                     eval $find_extensions;
21067                     cd ..;
21068                     shift;
21069                 fi;
21070             fi
21071             ;;
21072         esac;
21073     done'
21074 tdir=`pwd`
21075 cd "$rsrc/ext"
21076 set X
21077 shift
21078 eval $find_extensions
21079 # Special case:  Add in modules that nest beyond the first level.
21080 # Currently threads/shared and Hash/Util/FieldHash, since they are
21081 # not picked up by the recursive find above (and adding in general
21082 # recursive finding breaks SDBM_File/sdbm).
21083 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21084 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21085 set X $known_extensions
21086 shift
21087 known_extensions="$*"
21088 set X $nonxs_extensions
21089 shift
21090 nonxs_extensions="$*"
21091 cd "$tdir"
21092
21093 : Now see which are supported on this system.
21094 avail_ext=''
21095 for xxx in $known_extensions ; do
21096         case "$xxx" in
21097         DB_File|db_file)
21098                 case "$i_db" in
21099                 $define) avail_ext="$avail_ext $xxx" ;;
21100                 esac
21101                 ;;
21102         GDBM_File|gdbm_fil)
21103                 case "$i_gdbm" in
21104                 $define) avail_ext="$avail_ext $xxx" ;;
21105                 esac
21106                 ;;
21107         I18N/Langinfo|i18n_lan)
21108                 case "$i_langinfo$d_nl_langinfo" in
21109                 $define$define) avail_ext="$avail_ext $xxx" ;;
21110                 esac
21111                 ;;
21112         IPC/SysV|ipc/sysv)
21113                 : XXX Do we need a useipcsysv variable here
21114                 case "${d_msg}${d_sem}${d_shm}" in
21115                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21116                 esac
21117                 ;;
21118         NDBM_File|ndbm_fil)
21119                 case "$i_ndbm" in
21120                 $define)
21121                     case "$osname-$use64bitint" in
21122                     hpux-define)
21123                         case "$libs" in
21124                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21125                         esac
21126                         ;;
21127                     *) avail_ext="$avail_ext $xxx" ;;
21128                     esac
21129                     ;;
21130                 esac
21131                 ;;
21132         ODBM_File|odbm_fil)
21133                 case "${i_dbm}${i_rpcsvcdbm}" in
21134                 *"${define}"*)
21135                     case "$d_cplusplus" in
21136                     define) ;; # delete as a function name will not work
21137                     *)  case "$osname-$use64bitint" in
21138                         hpux-define)
21139                             case "$libs" in
21140                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21141                             esac
21142                             ;;
21143                         *) avail_ext="$avail_ext $xxx" ;;
21144                         esac
21145                         ;;
21146                     esac
21147                     ;;
21148                 esac
21149                 ;;
21150         Opcode|opcode)
21151                 case "$useopcode" in
21152                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21153                 esac
21154                 ;;
21155         POSIX|posix)
21156                 case "$useposix" in
21157                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21158                 esac
21159                 ;;
21160         Socket|socket)
21161                 case "$d_socket" in
21162                 true|$define|y)
21163                     case "$osname" in
21164                     beos) ;; # not unless BONE
21165                     *) avail_ext="$avail_ext $xxx" ;;
21166                     esac
21167                     ;;
21168                 esac
21169                 ;;
21170         Sys/Syslog|sys/syslog)
21171                 : XXX syslog requires socket
21172                 case "$d_socket" in
21173                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21174                 esac
21175                 ;;
21176         Thread|thread)
21177                 case "$usethreads" in
21178                 true|$define|y)
21179                         case "$use5005threads" in
21180                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21181                         esac
21182                 esac
21183                 ;;
21184         threads|threads/shared)
21185                 # threads and threads::shared are special cases.
21186                 # To stop people from asking "Perl 5.8.0 was supposed
21187                 # to have this new fancy threads implementation but my
21188                 # perl doesn't have it" and from people trying to
21189                 # (re)install the threads module using CPAN.pm and
21190                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21191                 # the threads.pm and threads/shared.pm will always be
21192                 # there, croaking informatively ("you need to rebuild
21193                 # all of Perl with threads, sorry") when threads haven't
21194                 # been compiled in.
21195                 # --jhi
21196                 avail_ext="$avail_ext $xxx"
21197                 ;;
21198         Win32*)
21199                 case "$osname" in
21200                 cygwin) avail_ext="$avail_ext $xxx" ;;
21201                 esac
21202                 ;;
21203         XS/APItest|xs/apitest)
21204                 # This is just for testing.  Skip it unless we have dynamic loading.
21205
21206                 case "$usedl" in
21207                 $define) avail_ext="$avail_ext $xxx" ;;
21208                 esac
21209                 ;;
21210         XS/Typemap|xs/typemap)
21211                 # This is just for testing.  Skip it unless we have dynamic loading.
21212                 case "$usedl" in
21213                 $define) avail_ext="$avail_ext $xxx" ;;
21214                 esac
21215                 ;;
21216         *)      avail_ext="$avail_ext $xxx"
21217                 ;;
21218         esac
21219 done
21220
21221 set X $avail_ext
21222 shift
21223 avail_ext="$*"
21224
21225 case "$onlyextensions" in
21226 '') ;;
21227 *)  keepextensions=''
21228     echo "You have requested that only certains extensions be included..." >&4
21229     for i in $onlyextensions; do
21230         case " $avail_ext " in
21231         *" $i "*)
21232             echo "Keeping extension $i."
21233             keepextensions="$keepextensions $i"
21234             ;;
21235         *) echo "Ignoring extension $i." ;;
21236         esac
21237     done
21238     avail_ext="$keepextensions"
21239     ;;
21240 esac
21241
21242 case "$noextensions" in
21243 '') ;;
21244 *)  keepextensions=''
21245     echo "You have requested that certain extensions be ignored..." >&4
21246     for i in $avail_ext; do
21247         case " $noextensions " in
21248         *" $i "*) echo "Ignoring extension $i." ;;
21249         *) echo "Keeping extension $i.";
21250            keepextensions="$keepextensions $i"
21251            ;;
21252         esac
21253     done
21254     avail_ext="$keepextensions"
21255     ;;
21256 esac
21257
21258 : Now see which nonxs extensions are supported on this system.
21259 : For now assume all are.
21260 nonxs_ext=''
21261 for xxx in $nonxs_extensions ; do
21262         case "$xxx" in
21263         *)      nonxs_ext="$nonxs_ext $xxx"
21264                 ;;
21265         esac
21266 done
21267
21268 set X $nonxs_ext
21269 shift
21270 nonxs_ext="$*"
21271
21272 case $usedl in
21273 $define)
21274         $cat <<EOM
21275 A number of extensions are supplied with $package.  You may choose to
21276 compile these extensions for dynamic loading (the default), compile
21277 them into the $package executable (static loading), or not include
21278 them at all.  Answer "none" to include no extensions.
21279 Note that DynaLoader is always built and need not be mentioned here.
21280
21281 EOM
21282         case "$dynamic_ext" in
21283         '')
21284                 : Exclude those listed in static_ext
21285                 dflt=''
21286                 for xxx in $avail_ext; do
21287                         case " $static_ext " in
21288                         *" $xxx "*) ;;
21289                         *) dflt="$dflt $xxx" ;;
21290                         esac
21291                 done
21292                 set X $dflt
21293                 shift
21294                 dflt="$*"
21295                 ;;
21296         *)      dflt="$dynamic_ext"
21297                 # Perhaps we are reusing an old out-of-date config.sh.
21298                 case "$hint" in
21299                 previous)
21300                         if test X"$dynamic_ext" != X"$avail_ext"; then
21301                                 $cat <<EOM
21302 NOTICE:  Your previous config.sh list may be incorrect.
21303 The extensions now available to you are
21304         ${avail_ext}
21305 but the default list from your previous config.sh is
21306         ${dynamic_ext}
21307
21308 EOM
21309                         fi
21310                         ;;
21311                 esac
21312                 ;;
21313         esac
21314         case "$dflt" in
21315         '')     dflt=none;;
21316         esac
21317         rp="What extensions do you wish to load dynamically?"
21318         . ./myread
21319         case "$ans" in
21320         none) dynamic_ext=' ' ;;
21321         *) dynamic_ext="$ans" ;;
21322         esac
21323
21324         case "$static_ext" in
21325         '')
21326                 : Exclude those already listed in dynamic linking
21327                 dflt=''
21328                 for xxx in $avail_ext; do
21329                         case " $dynamic_ext " in
21330                         *" $xxx "*) ;;
21331                         *) dflt="$dflt $xxx" ;;
21332                         esac
21333                 done
21334                 set X $dflt
21335                 shift
21336                 dflt="$*"
21337                 ;;
21338         *)  dflt="$static_ext"
21339                 ;;
21340         esac
21341
21342         case "$dflt" in
21343         '')     dflt=none;;
21344         esac
21345         rp="What extensions do you wish to load statically?"
21346         . ./myread
21347         case "$ans" in
21348         none) static_ext=' ' ;;
21349         *) static_ext="$ans" ;;
21350         esac
21351         ;;
21352 *)
21353         $cat <<EOM
21354 A number of extensions are supplied with $package.  Answer "none"
21355 to include no extensions.
21356 Note that DynaLoader is always built and need not be mentioned here.
21357
21358 EOM
21359         case "$static_ext" in
21360         '') dflt="$avail_ext" ;;
21361         *)      dflt="$static_ext"
21362                 # Perhaps we are reusing an old out-of-date config.sh.
21363                 case "$hint" in
21364                 previous)
21365                         if test X"$static_ext" != X"$avail_ext"; then
21366                                 $cat <<EOM
21367 NOTICE:  Your previous config.sh list may be incorrect.
21368 The extensions now available to you are
21369         ${avail_ext}
21370 but the default list from your previous config.sh is
21371         ${static_ext}
21372
21373 EOM
21374                         fi
21375                         ;;
21376                 esac
21377                 ;;
21378         esac
21379         : Exclude those that are not xs extensions
21380         case "$dflt" in
21381         '')     dflt=none;;
21382         esac
21383         rp="What extensions do you wish to include?"
21384         . ./myread
21385         case "$ans" in
21386         none) static_ext=' ' ;;
21387         *) static_ext="$ans" ;;
21388         esac
21389         ;;
21390 esac
21391 #
21392 # Encode is a special case.  If we are building Encode as a static
21393 # extension, we need to explicitly list its subextensions as well.
21394 # For other nested extensions, this is handled automatically by
21395 # the appropriate Makefile.PL.
21396 case " $static_ext " in
21397         *" Encode "*) # Add the subextensions of Encode
21398         cd "$rsrc/ext"
21399         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21400                 static_ext="$static_ext Encode/$xxx"
21401         done
21402         cd "$tdir"
21403         ;;
21404 esac
21405
21406 set X $dynamic_ext $static_ext $nonxs_ext
21407 shift
21408 extensions="$*"
21409
21410 # Sanity check:  We require an extension suitable for use with
21411 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21412 # should show up as failures in the test suite, but it's helpful to
21413 # catch them now.) The 'extensions' list is normally sorted
21414 # alphabetically, so we need to accept either
21415 #    DB_File ... Fcntl ... IO  ....
21416 # or something like
21417 #    Fcntl ... NDBM_File ... IO  ....
21418 case " $extensions"  in
21419 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21420 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21421 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21422 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21423    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21424    ;;
21425 esac
21426
21427 : Remove libraries needed only for extensions
21428 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21429 : The exception is SunOS 4.x, which needs them.
21430 case "${osname}X${osvers}" in
21431 sunos*X4*)
21432     perllibs="$libs"
21433     ;;
21434 *) case "$usedl" in
21435     $define|true|[yY]*)
21436             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21437             shift
21438             perllibs="$*"
21439             ;;
21440     *)  perllibs="$libs"
21441             ;;
21442     esac
21443     ;;
21444 esac
21445
21446 : Remove build directory name from cppstdin so it can be used from
21447 : either the present location or the final installed location.
21448 echo " "
21449 : Get out of the UU directory to get correct path name.
21450 cd ..
21451 case "$cppstdin" in
21452 `pwd`/cppstdin)
21453         echo "Stripping down cppstdin path name"
21454         cppstdin=cppstdin
21455         ;;
21456 esac
21457 cd UU
21458
21459 : end of configuration questions
21460 echo " "
21461 echo "End of configuration questions."
21462 echo " "
21463
21464 : back to where it started
21465 if test -d ../UU; then
21466         cd ..
21467 fi
21468
21469 : configuration may be patched via a 'config.arch' file
21470 if $test -f config.arch; then
21471         echo "I see a config.arch file, loading it."
21472         . ./config.arch
21473 fi
21474
21475 : configuration may be patched via a 'config.over' file
21476 if $test -f config.over; then
21477         echo " "
21478         dflt=y
21479         rp='I see a config.over file.  Do you wish to load it?'
21480         . UU/myread
21481         case "$ans" in
21482         n*) echo "OK, I'll ignore it.";;
21483         *)      . ./config.over
21484                 echo "Configuration override changes have been loaded."
21485                 ;;
21486         esac
21487 fi
21488
21489 : in case they want portability, strip down executable paths
21490 case "$d_portable" in
21491 "$define")
21492         echo " "
21493         echo "Stripping down executable paths..." >&4
21494         for file in $loclist $trylist; do
21495                 eval temp=\$$file
21496                 eval $file=`basename $temp`
21497         done
21498         ;;
21499 esac
21500
21501 : create config.sh file
21502 echo " "
21503 echo "Creating config.sh..." >&4
21504 $spitshell <<EOT >config.sh
21505 $startsh
21506 #
21507 # This file was produced by running the Configure script. It holds all the
21508 # definitions figured out by Configure. Should you modify one of these values,
21509 # do not forget to propagate your changes by running "Configure -der". You may
21510 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21511 #
21512
21513 # Package name      : $package
21514 # Source directory  : $src
21515 # Configuration time: $cf_time
21516 # Configured by     : $cf_by
21517 # Target system     : $myuname
21518
21519 Author='$Author'
21520 Date='$Date'
21521 Header='$Header'
21522 Id='$Id'
21523 Locker='$Locker'
21524 Log='$Log'
21525 Mcc='$Mcc'
21526 RCSfile='$RCSfile'
21527 Revision='$Revision'
21528 Source='$Source'
21529 State='$State'
21530 _a='$_a'
21531 _exe='$_exe'
21532 _o='$_o'
21533 afs='$afs'
21534 afsroot='$afsroot'
21535 alignbytes='$alignbytes'
21536 ansi2knr='$ansi2knr'
21537 aphostname='$aphostname'
21538 api_revision='$api_revision'
21539 api_subversion='$api_subversion'
21540 api_version='$api_version'
21541 api_versionstring='$api_versionstring'
21542 ar='$ar'
21543 archlib='$archlib'
21544 archlibexp='$archlibexp'
21545 archname64='$archname64'
21546 archname='$archname'
21547 archobjs='$archobjs'
21548 asctime_r_proto='$asctime_r_proto'
21549 awk='$awk'
21550 baserev='$baserev'
21551 bash='$bash'
21552 bin='$bin'
21553 binexp='$binexp'
21554 bison='$bison'
21555 byacc='$byacc'
21556 byteorder='$byteorder'
21557 c='$c'
21558 castflags='$castflags'
21559 cat='$cat'
21560 cc='$cc'
21561 cccdlflags='$cccdlflags'
21562 ccdlflags='$ccdlflags'
21563 ccflags='$ccflags'
21564 ccflags_uselargefiles='$ccflags_uselargefiles'
21565 ccname='$ccname'
21566 ccsymbols='$ccsymbols'
21567 ccversion='$ccversion'
21568 cf_by='$cf_by'
21569 cf_email='$cf_email'
21570 cf_time='$cf_time'
21571 chgrp='$chgrp'
21572 chmod='$chmod'
21573 chown='$chown'
21574 clocktype='$clocktype'
21575 comm='$comm'
21576 compress='$compress'
21577 contains='$contains'
21578 cp='$cp'
21579 cpio='$cpio'
21580 cpp='$cpp'
21581 cpp_stuff='$cpp_stuff'
21582 cppccsymbols='$cppccsymbols'
21583 cppflags='$cppflags'
21584 cpplast='$cpplast'
21585 cppminus='$cppminus'
21586 cpprun='$cpprun'
21587 cppstdin='$cppstdin'
21588 cppsymbols='$cppsymbols'
21589 crypt_r_proto='$crypt_r_proto'
21590 cryptlib='$cryptlib'
21591 csh='$csh'
21592 ctermid_r_proto='$ctermid_r_proto'
21593 ctime_r_proto='$ctime_r_proto'
21594 d_Gconvert='$d_Gconvert'
21595 d_PRIEUldbl='$d_PRIEUldbl'
21596 d_PRIFUldbl='$d_PRIFUldbl'
21597 d_PRIGUldbl='$d_PRIGUldbl'
21598 d_PRIXU64='$d_PRIXU64'
21599 d_PRId64='$d_PRId64'
21600 d_PRIeldbl='$d_PRIeldbl'
21601 d_PRIfldbl='$d_PRIfldbl'
21602 d_PRIgldbl='$d_PRIgldbl'
21603 d_PRIi64='$d_PRIi64'
21604 d_PRIo64='$d_PRIo64'
21605 d_PRIu64='$d_PRIu64'
21606 d_PRIx64='$d_PRIx64'
21607 d_SCNfldbl='$d_SCNfldbl'
21608 d__fwalk='$d__fwalk'
21609 d_access='$d_access'
21610 d_accessx='$d_accessx'
21611 d_aintl='$d_aintl'
21612 d_alarm='$d_alarm'
21613 d_archlib='$d_archlib'
21614 d_asctime_r='$d_asctime_r'
21615 d_atolf='$d_atolf'
21616 d_atoll='$d_atoll'
21617 d_attribute_format='$d_attribute_format'
21618 d_attribute_malloc='$d_attribute_malloc'
21619 d_attribute_nonnull='$d_attribute_nonnull'
21620 d_attribute_noreturn='$d_attribute_noreturn'
21621 d_attribute_pure='$d_attribute_pure'
21622 d_attribute_unused='$d_attribute_unused'
21623 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21624 d_bcmp='$d_bcmp'
21625 d_bcopy='$d_bcopy'
21626 d_bsd='$d_bsd'
21627 d_bsdgetpgrp='$d_bsdgetpgrp'
21628 d_bsdsetpgrp='$d_bsdsetpgrp'
21629 d_builtin_choose_expr='$d_builtin_choose_expr'
21630 d_builtin_expect='$d_builtin_expect'
21631 d_bzero='$d_bzero'
21632 d_c99_variadic_macros='$d_c99_variadic_macros'
21633 d_casti32='$d_casti32'
21634 d_castneg='$d_castneg'
21635 d_charvspr='$d_charvspr'
21636 d_chown='$d_chown'
21637 d_chroot='$d_chroot'
21638 d_chsize='$d_chsize'
21639 d_class='$d_class'
21640 d_clearenv='$d_clearenv'
21641 d_closedir='$d_closedir'
21642 d_cmsghdr_s='$d_cmsghdr_s'
21643 d_const='$d_const'
21644 d_copysignl='$d_copysignl'
21645 d_cplusplus='$d_cplusplus'
21646 d_crypt='$d_crypt'
21647 d_crypt_r='$d_crypt_r'
21648 d_csh='$d_csh'
21649 d_ctermid='$d_ctermid'
21650 d_ctermid_r='$d_ctermid_r'
21651 d_ctime_r='$d_ctime_r'
21652 d_cuserid='$d_cuserid'
21653 d_dbl_dig='$d_dbl_dig'
21654 d_dbminitproto='$d_dbminitproto'
21655 d_difftime='$d_difftime'
21656 d_dir_dd_fd='$d_dir_dd_fd'
21657 d_dirfd='$d_dirfd'
21658 d_dirnamlen='$d_dirnamlen'
21659 d_dlerror='$d_dlerror'
21660 d_dlopen='$d_dlopen'
21661 d_dlsymun='$d_dlsymun'
21662 d_dosuid='$d_dosuid'
21663 d_drand48_r='$d_drand48_r'
21664 d_drand48proto='$d_drand48proto'
21665 d_dup2='$d_dup2'
21666 d_eaccess='$d_eaccess'
21667 d_endgrent='$d_endgrent'
21668 d_endgrent_r='$d_endgrent_r'
21669 d_endhent='$d_endhent'
21670 d_endhostent_r='$d_endhostent_r'
21671 d_endnent='$d_endnent'
21672 d_endnetent_r='$d_endnetent_r'
21673 d_endpent='$d_endpent'
21674 d_endprotoent_r='$d_endprotoent_r'
21675 d_endpwent='$d_endpwent'
21676 d_endpwent_r='$d_endpwent_r'
21677 d_endsent='$d_endsent'
21678 d_endservent_r='$d_endservent_r'
21679 d_eofnblk='$d_eofnblk'
21680 d_eunice='$d_eunice'
21681 d_faststdio='$d_faststdio'
21682 d_fchdir='$d_fchdir'
21683 d_fchmod='$d_fchmod'
21684 d_fchown='$d_fchown'
21685 d_fcntl='$d_fcntl'
21686 d_fcntl_can_lock='$d_fcntl_can_lock'
21687 d_fd_macros='$d_fd_macros'
21688 d_fd_set='$d_fd_set'
21689 d_fds_bits='$d_fds_bits'
21690 d_fgetpos='$d_fgetpos'
21691 d_finite='$d_finite'
21692 d_finitel='$d_finitel'
21693 d_flexfnam='$d_flexfnam'
21694 d_flock='$d_flock'
21695 d_flockproto='$d_flockproto'
21696 d_fork='$d_fork'
21697 d_fp_class='$d_fp_class'
21698 d_fpathconf='$d_fpathconf'
21699 d_fpclass='$d_fpclass'
21700 d_fpclassify='$d_fpclassify'
21701 d_fpclassl='$d_fpclassl'
21702 d_fpos64_t='$d_fpos64_t'
21703 d_frexpl='$d_frexpl'
21704 d_fs_data_s='$d_fs_data_s'
21705 d_fseeko='$d_fseeko'
21706 d_fsetpos='$d_fsetpos'
21707 d_fstatfs='$d_fstatfs'
21708 d_fstatvfs='$d_fstatvfs'
21709 d_fsync='$d_fsync'
21710 d_ftello='$d_ftello'
21711 d_ftime='$d_ftime'
21712 d_futimes='$d_futimes'
21713 d_getcwd='$d_getcwd'
21714 d_getespwnam='$d_getespwnam'
21715 d_getfsstat='$d_getfsstat'
21716 d_getgrent='$d_getgrent'
21717 d_getgrent_r='$d_getgrent_r'
21718 d_getgrgid_r='$d_getgrgid_r'
21719 d_getgrnam_r='$d_getgrnam_r'
21720 d_getgrps='$d_getgrps'
21721 d_gethbyaddr='$d_gethbyaddr'
21722 d_gethbyname='$d_gethbyname'
21723 d_gethent='$d_gethent'
21724 d_gethname='$d_gethname'
21725 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21726 d_gethostbyname_r='$d_gethostbyname_r'
21727 d_gethostent_r='$d_gethostent_r'
21728 d_gethostprotos='$d_gethostprotos'
21729 d_getitimer='$d_getitimer'
21730 d_getlogin='$d_getlogin'
21731 d_getlogin_r='$d_getlogin_r'
21732 d_getmnt='$d_getmnt'
21733 d_getmntent='$d_getmntent'
21734 d_getnbyaddr='$d_getnbyaddr'
21735 d_getnbyname='$d_getnbyname'
21736 d_getnent='$d_getnent'
21737 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21738 d_getnetbyname_r='$d_getnetbyname_r'
21739 d_getnetent_r='$d_getnetent_r'
21740 d_getnetprotos='$d_getnetprotos'
21741 d_getpagsz='$d_getpagsz'
21742 d_getpbyname='$d_getpbyname'
21743 d_getpbynumber='$d_getpbynumber'
21744 d_getpent='$d_getpent'
21745 d_getpgid='$d_getpgid'
21746 d_getpgrp2='$d_getpgrp2'
21747 d_getpgrp='$d_getpgrp'
21748 d_getppid='$d_getppid'
21749 d_getprior='$d_getprior'
21750 d_getprotobyname_r='$d_getprotobyname_r'
21751 d_getprotobynumber_r='$d_getprotobynumber_r'
21752 d_getprotoent_r='$d_getprotoent_r'
21753 d_getprotoprotos='$d_getprotoprotos'
21754 d_getprpwnam='$d_getprpwnam'
21755 d_getpwent='$d_getpwent'
21756 d_getpwent_r='$d_getpwent_r'
21757 d_getpwnam_r='$d_getpwnam_r'
21758 d_getpwuid_r='$d_getpwuid_r'
21759 d_getsbyname='$d_getsbyname'
21760 d_getsbyport='$d_getsbyport'
21761 d_getsent='$d_getsent'
21762 d_getservbyname_r='$d_getservbyname_r'
21763 d_getservbyport_r='$d_getservbyport_r'
21764 d_getservent_r='$d_getservent_r'
21765 d_getservprotos='$d_getservprotos'
21766 d_getspnam='$d_getspnam'
21767 d_getspnam_r='$d_getspnam_r'
21768 d_gettimeod='$d_gettimeod'
21769 d_gmtime_r='$d_gmtime_r'
21770 d_gnulibc='$d_gnulibc'
21771 d_grpasswd='$d_grpasswd'
21772 d_hasmntopt='$d_hasmntopt'
21773 d_htonl='$d_htonl'
21774 d_ilogbl='$d_ilogbl'
21775 d_inc_version_list='$d_inc_version_list'
21776 d_index='$d_index'
21777 d_inetaton='$d_inetaton'
21778 d_int64_t='$d_int64_t'
21779 d_isascii='$d_isascii'
21780 d_isfinite='$d_isfinite'
21781 d_isinf='$d_isinf'
21782 d_isnan='$d_isnan'
21783 d_isnanl='$d_isnanl'
21784 d_killpg='$d_killpg'
21785 d_lchown='$d_lchown'
21786 d_ldbl_dig='$d_ldbl_dig'
21787 d_libm_lib_version='$d_libm_lib_version'
21788 d_link='$d_link'
21789 d_localtime_r='$d_localtime_r'
21790 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21791 d_locconv='$d_locconv'
21792 d_lockf='$d_lockf'
21793 d_longdbl='$d_longdbl'
21794 d_longlong='$d_longlong'
21795 d_lseekproto='$d_lseekproto'
21796 d_lstat='$d_lstat'
21797 d_madvise='$d_madvise'
21798 d_malloc_good_size='$d_malloc_good_size'
21799 d_malloc_size='$d_malloc_size'
21800 d_mblen='$d_mblen'
21801 d_mbstowcs='$d_mbstowcs'
21802 d_mbtowc='$d_mbtowc'
21803 d_memchr='$d_memchr'
21804 d_memcmp='$d_memcmp'
21805 d_memcpy='$d_memcpy'
21806 d_memmove='$d_memmove'
21807 d_memset='$d_memset'
21808 d_mkdir='$d_mkdir'
21809 d_mkdtemp='$d_mkdtemp'
21810 d_mkfifo='$d_mkfifo'
21811 d_mkstemp='$d_mkstemp'
21812 d_mkstemps='$d_mkstemps'
21813 d_mktime='$d_mktime'
21814 d_mmap='$d_mmap'
21815 d_modfl='$d_modfl'
21816 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21817 d_modflproto='$d_modflproto'
21818 d_mprotect='$d_mprotect'
21819 d_msg='$d_msg'
21820 d_msg_ctrunc='$d_msg_ctrunc'
21821 d_msg_dontroute='$d_msg_dontroute'
21822 d_msg_oob='$d_msg_oob'
21823 d_msg_peek='$d_msg_peek'
21824 d_msg_proxy='$d_msg_proxy'
21825 d_msgctl='$d_msgctl'
21826 d_msgget='$d_msgget'
21827 d_msghdr_s='$d_msghdr_s'
21828 d_msgrcv='$d_msgrcv'
21829 d_msgsnd='$d_msgsnd'
21830 d_msync='$d_msync'
21831 d_munmap='$d_munmap'
21832 d_mymalloc='$d_mymalloc'
21833 d_nice='$d_nice'
21834 d_nl_langinfo='$d_nl_langinfo'
21835 d_nv_preserves_uv='$d_nv_preserves_uv'
21836 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21837 d_off64_t='$d_off64_t'
21838 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21839 d_oldpthreads='$d_oldpthreads'
21840 d_oldsock='$d_oldsock'
21841 d_open3='$d_open3'
21842 d_pathconf='$d_pathconf'
21843 d_pause='$d_pause'
21844 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21845 d_phostname='$d_phostname'
21846 d_pipe='$d_pipe'
21847 d_poll='$d_poll'
21848 d_portable='$d_portable'
21849 d_printf_format_null='$d_printf_format_null'
21850 d_procselfexe='$d_procselfexe'
21851 d_pseudofork='$d_pseudofork'
21852 d_pthread_atfork='$d_pthread_atfork'
21853 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21854 d_pthread_yield='$d_pthread_yield'
21855 d_pwage='$d_pwage'
21856 d_pwchange='$d_pwchange'
21857 d_pwclass='$d_pwclass'
21858 d_pwcomment='$d_pwcomment'
21859 d_pwexpire='$d_pwexpire'
21860 d_pwgecos='$d_pwgecos'
21861 d_pwpasswd='$d_pwpasswd'
21862 d_pwquota='$d_pwquota'
21863 d_qgcvt='$d_qgcvt'
21864 d_quad='$d_quad'
21865 d_random_r='$d_random_r'
21866 d_readdir64_r='$d_readdir64_r'
21867 d_readdir='$d_readdir'
21868 d_readdir_r='$d_readdir_r'
21869 d_readlink='$d_readlink'
21870 d_readv='$d_readv'
21871 d_recvmsg='$d_recvmsg'
21872 d_rename='$d_rename'
21873 d_rewinddir='$d_rewinddir'
21874 d_rmdir='$d_rmdir'
21875 d_safebcpy='$d_safebcpy'
21876 d_safemcpy='$d_safemcpy'
21877 d_sanemcmp='$d_sanemcmp'
21878 d_sbrkproto='$d_sbrkproto'
21879 d_scalbnl='$d_scalbnl'
21880 d_sched_yield='$d_sched_yield'
21881 d_scm_rights='$d_scm_rights'
21882 d_seekdir='$d_seekdir'
21883 d_select='$d_select'
21884 d_sem='$d_sem'
21885 d_semctl='$d_semctl'
21886 d_semctl_semid_ds='$d_semctl_semid_ds'
21887 d_semctl_semun='$d_semctl_semun'
21888 d_semget='$d_semget'
21889 d_semop='$d_semop'
21890 d_sendmsg='$d_sendmsg'
21891 d_setegid='$d_setegid'
21892 d_seteuid='$d_seteuid'
21893 d_setgrent='$d_setgrent'
21894 d_setgrent_r='$d_setgrent_r'
21895 d_setgrps='$d_setgrps'
21896 d_sethent='$d_sethent'
21897 d_sethostent_r='$d_sethostent_r'
21898 d_setitimer='$d_setitimer'
21899 d_setlinebuf='$d_setlinebuf'
21900 d_setlocale='$d_setlocale'
21901 d_setlocale_r='$d_setlocale_r'
21902 d_setnent='$d_setnent'
21903 d_setnetent_r='$d_setnetent_r'
21904 d_setpent='$d_setpent'
21905 d_setpgid='$d_setpgid'
21906 d_setpgrp2='$d_setpgrp2'
21907 d_setpgrp='$d_setpgrp'
21908 d_setprior='$d_setprior'
21909 d_setproctitle='$d_setproctitle'
21910 d_setprotoent_r='$d_setprotoent_r'
21911 d_setpwent='$d_setpwent'
21912 d_setpwent_r='$d_setpwent_r'
21913 d_setregid='$d_setregid'
21914 d_setresgid='$d_setresgid'
21915 d_setresuid='$d_setresuid'
21916 d_setreuid='$d_setreuid'
21917 d_setrgid='$d_setrgid'
21918 d_setruid='$d_setruid'
21919 d_setsent='$d_setsent'
21920 d_setservent_r='$d_setservent_r'
21921 d_setsid='$d_setsid'
21922 d_setvbuf='$d_setvbuf'
21923 d_sfio='$d_sfio'
21924 d_shm='$d_shm'
21925 d_shmat='$d_shmat'
21926 d_shmatprototype='$d_shmatprototype'
21927 d_shmctl='$d_shmctl'
21928 d_shmdt='$d_shmdt'
21929 d_shmget='$d_shmget'
21930 d_sigaction='$d_sigaction'
21931 d_signbit='$d_signbit'
21932 d_sigprocmask='$d_sigprocmask'
21933 d_sigsetjmp='$d_sigsetjmp'
21934 d_sitearch='$d_sitearch'
21935 d_snprintf='$d_snprintf'
21936 d_sockatmark='$d_sockatmark'
21937 d_sockatmarkproto='$d_sockatmarkproto'
21938 d_socket='$d_socket'
21939 d_socklen_t='$d_socklen_t'
21940 d_sockpair='$d_sockpair'
21941 d_socks5_init='$d_socks5_init'
21942 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21943 d_sqrtl='$d_sqrtl'
21944 d_srand48_r='$d_srand48_r'
21945 d_srandom_r='$d_srandom_r'
21946 d_sresgproto='$d_sresgproto'
21947 d_sresuproto='$d_sresuproto'
21948 d_statblks='$d_statblks'
21949 d_statfs_f_flags='$d_statfs_f_flags'
21950 d_statfs_s='$d_statfs_s'
21951 d_statvfs='$d_statvfs'
21952 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21953 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21954 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21955 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21956 d_stdio_stream_array='$d_stdio_stream_array'
21957 d_stdiobase='$d_stdiobase'
21958 d_stdstdio='$d_stdstdio'
21959 d_strchr='$d_strchr'
21960 d_strcoll='$d_strcoll'
21961 d_strctcpy='$d_strctcpy'
21962 d_strerrm='$d_strerrm'
21963 d_strerror='$d_strerror'
21964 d_strerror_r='$d_strerror_r'
21965 d_strftime='$d_strftime'
21966 d_strlcat='$d_strlcat'
21967 d_strlcpy='$d_strlcpy'
21968 d_strtod='$d_strtod'
21969 d_strtol='$d_strtol'
21970 d_strtold='$d_strtold'
21971 d_strtoll='$d_strtoll'
21972 d_strtoq='$d_strtoq'
21973 d_strtoul='$d_strtoul'
21974 d_strtoull='$d_strtoull'
21975 d_strtouq='$d_strtouq'
21976 d_strxfrm='$d_strxfrm'
21977 d_suidsafe='$d_suidsafe'
21978 d_symlink='$d_symlink'
21979 d_syscall='$d_syscall'
21980 d_syscallproto='$d_syscallproto'
21981 d_sysconf='$d_sysconf'
21982 d_sysernlst='$d_sysernlst'
21983 d_syserrlst='$d_syserrlst'
21984 d_system='$d_system'
21985 d_tcgetpgrp='$d_tcgetpgrp'
21986 d_tcsetpgrp='$d_tcsetpgrp'
21987 d_telldir='$d_telldir'
21988 d_telldirproto='$d_telldirproto'
21989 d_time='$d_time'
21990 d_times='$d_times'
21991 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21992 d_tm_tm_zone='$d_tm_tm_zone'
21993 d_tmpnam_r='$d_tmpnam_r'
21994 d_truncate='$d_truncate'
21995 d_ttyname_r='$d_ttyname_r'
21996 d_tzname='$d_tzname'
21997 d_u32align='$d_u32align'
21998 d_ualarm='$d_ualarm'
21999 d_umask='$d_umask'
22000 d_uname='$d_uname'
22001 d_union_semun='$d_union_semun'
22002 d_unordered='$d_unordered'
22003 d_unsetenv='$d_unsetenv'
22004 d_usleep='$d_usleep'
22005 d_usleepproto='$d_usleepproto'
22006 d_ustat='$d_ustat'
22007 d_vendorarch='$d_vendorarch'
22008 d_vendorbin='$d_vendorbin'
22009 d_vendorlib='$d_vendorlib'
22010 d_vendorscript='$d_vendorscript'
22011 d_vfork='$d_vfork'
22012 d_void_closedir='$d_void_closedir'
22013 d_voidsig='$d_voidsig'
22014 d_voidtty='$d_voidtty'
22015 d_volatile='$d_volatile'
22016 d_vprintf='$d_vprintf'
22017 d_vsnprintf='$d_vsnprintf'
22018 d_wait4='$d_wait4'
22019 d_waitpid='$d_waitpid'
22020 d_wcstombs='$d_wcstombs'
22021 d_wctomb='$d_wctomb'
22022 d_writev='$d_writev'
22023 d_xenix='$d_xenix'
22024 date='$date'
22025 db_hashtype='$db_hashtype'
22026 db_prefixtype='$db_prefixtype'
22027 db_version_major='$db_version_major'
22028 db_version_minor='$db_version_minor'
22029 db_version_patch='$db_version_patch'
22030 defvoidused='$defvoidused'
22031 direntrytype='$direntrytype'
22032 dlext='$dlext'
22033 dlsrc='$dlsrc'
22034 doublesize='$doublesize'
22035 drand01='$drand01'
22036 drand48_r_proto='$drand48_r_proto'
22037 dynamic_ext='$dynamic_ext'
22038 eagain='$eagain'
22039 ebcdic='$ebcdic'
22040 echo='$echo'
22041 egrep='$egrep'
22042 emacs='$emacs'
22043 endgrent_r_proto='$endgrent_r_proto'
22044 endhostent_r_proto='$endhostent_r_proto'
22045 endnetent_r_proto='$endnetent_r_proto'
22046 endprotoent_r_proto='$endprotoent_r_proto'
22047 endpwent_r_proto='$endpwent_r_proto'
22048 endservent_r_proto='$endservent_r_proto'
22049 eunicefix='$eunicefix'
22050 exe_ext='$exe_ext'
22051 expr='$expr'
22052 extensions='$extensions'
22053 extras='$extras'
22054 fflushNULL='$fflushNULL'
22055 fflushall='$fflushall'
22056 find='$find'
22057 firstmakefile='$firstmakefile'
22058 flex='$flex'
22059 fpossize='$fpossize'
22060 fpostype='$fpostype'
22061 freetype='$freetype'
22062 from='$from'
22063 full_ar='$full_ar'
22064 full_csh='$full_csh'
22065 full_sed='$full_sed'
22066 gccansipedantic='$gccansipedantic'
22067 gccosandvers='$gccosandvers'
22068 gccversion='$gccversion'
22069 getgrent_r_proto='$getgrent_r_proto'
22070 getgrgid_r_proto='$getgrgid_r_proto'
22071 getgrnam_r_proto='$getgrnam_r_proto'
22072 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22073 gethostbyname_r_proto='$gethostbyname_r_proto'
22074 gethostent_r_proto='$gethostent_r_proto'
22075 getlogin_r_proto='$getlogin_r_proto'
22076 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22077 getnetbyname_r_proto='$getnetbyname_r_proto'
22078 getnetent_r_proto='$getnetent_r_proto'
22079 getprotobyname_r_proto='$getprotobyname_r_proto'
22080 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22081 getprotoent_r_proto='$getprotoent_r_proto'
22082 getpwent_r_proto='$getpwent_r_proto'
22083 getpwnam_r_proto='$getpwnam_r_proto'
22084 getpwuid_r_proto='$getpwuid_r_proto'
22085 getservbyname_r_proto='$getservbyname_r_proto'
22086 getservbyport_r_proto='$getservbyport_r_proto'
22087 getservent_r_proto='$getservent_r_proto'
22088 getspnam_r_proto='$getspnam_r_proto'
22089 gidformat='$gidformat'
22090 gidsign='$gidsign'
22091 gidsize='$gidsize'
22092 gidtype='$gidtype'
22093 glibpth='$glibpth'
22094 gmake='$gmake'
22095 gmtime_r_proto='$gmtime_r_proto'
22096 gnulibc_version='$gnulibc_version'
22097 grep='$grep'
22098 groupcat='$groupcat'
22099 groupstype='$groupstype'
22100 gzip='$gzip'
22101 h_fcntl='$h_fcntl'
22102 h_sysfile='$h_sysfile'
22103 hint='$hint'
22104 hostcat='$hostcat'
22105 html1dir='$html1dir'
22106 html1direxp='$html1direxp'
22107 html3dir='$html3dir'
22108 html3direxp='$html3direxp'
22109 i16size='$i16size'
22110 i16type='$i16type'
22111 i32size='$i32size'
22112 i32type='$i32type'
22113 i64size='$i64size'
22114 i64type='$i64type'
22115 i8size='$i8size'
22116 i8type='$i8type'
22117 i_arpainet='$i_arpainet'
22118 i_assert='$i_assert'
22119 i_bsdioctl='$i_bsdioctl'
22120 i_crypt='$i_crypt'
22121 i_db='$i_db'
22122 i_dbm='$i_dbm'
22123 i_dirent='$i_dirent'
22124 i_dld='$i_dld'
22125 i_dlfcn='$i_dlfcn'
22126 i_fcntl='$i_fcntl'
22127 i_float='$i_float'
22128 i_fp='$i_fp'
22129 i_fp_class='$i_fp_class'
22130 i_gdbm='$i_gdbm'
22131 i_grp='$i_grp'
22132 i_ieeefp='$i_ieeefp'
22133 i_inttypes='$i_inttypes'
22134 i_langinfo='$i_langinfo'
22135 i_libutil='$i_libutil'
22136 i_limits='$i_limits'
22137 i_locale='$i_locale'
22138 i_machcthr='$i_machcthr'
22139 i_malloc='$i_malloc'
22140 i_math='$i_math'
22141 i_memory='$i_memory'
22142 i_mntent='$i_mntent'
22143 i_ndbm='$i_ndbm'
22144 i_netdb='$i_netdb'
22145 i_neterrno='$i_neterrno'
22146 i_netinettcp='$i_netinettcp'
22147 i_niin='$i_niin'
22148 i_poll='$i_poll'
22149 i_prot='$i_prot'
22150 i_pthread='$i_pthread'
22151 i_pwd='$i_pwd'
22152 i_rpcsvcdbm='$i_rpcsvcdbm'
22153 i_sfio='$i_sfio'
22154 i_sgtty='$i_sgtty'
22155 i_shadow='$i_shadow'
22156 i_socks='$i_socks'
22157 i_stdarg='$i_stdarg'
22158 i_stddef='$i_stddef'
22159 i_stdlib='$i_stdlib'
22160 i_string='$i_string'
22161 i_sunmath='$i_sunmath'
22162 i_sysaccess='$i_sysaccess'
22163 i_sysdir='$i_sysdir'
22164 i_sysfile='$i_sysfile'
22165 i_sysfilio='$i_sysfilio'
22166 i_sysin='$i_sysin'
22167 i_sysioctl='$i_sysioctl'
22168 i_syslog='$i_syslog'
22169 i_sysmman='$i_sysmman'
22170 i_sysmode='$i_sysmode'
22171 i_sysmount='$i_sysmount'
22172 i_sysndir='$i_sysndir'
22173 i_sysparam='$i_sysparam'
22174 i_sysresrc='$i_sysresrc'
22175 i_syssecrt='$i_syssecrt'
22176 i_sysselct='$i_sysselct'
22177 i_syssockio='$i_syssockio'
22178 i_sysstat='$i_sysstat'
22179 i_sysstatfs='$i_sysstatfs'
22180 i_sysstatvfs='$i_sysstatvfs'
22181 i_systime='$i_systime'
22182 i_systimek='$i_systimek'
22183 i_systimes='$i_systimes'
22184 i_systypes='$i_systypes'
22185 i_sysuio='$i_sysuio'
22186 i_sysun='$i_sysun'
22187 i_sysutsname='$i_sysutsname'
22188 i_sysvfs='$i_sysvfs'
22189 i_syswait='$i_syswait'
22190 i_termio='$i_termio'
22191 i_termios='$i_termios'
22192 i_time='$i_time'
22193 i_unistd='$i_unistd'
22194 i_ustat='$i_ustat'
22195 i_utime='$i_utime'
22196 i_values='$i_values'
22197 i_varargs='$i_varargs'
22198 i_varhdr='$i_varhdr'
22199 i_vfork='$i_vfork'
22200 ignore_versioned_solibs='$ignore_versioned_solibs'
22201 inc_version_list='$inc_version_list'
22202 inc_version_list_init='$inc_version_list_init'
22203 incpath='$incpath'
22204 inews='$inews'
22205 initialinstalllocation='$initialinstalllocation'
22206 installarchlib='$installarchlib'
22207 installbin='$installbin'
22208 installhtml1dir='$installhtml1dir'
22209 installhtml3dir='$installhtml3dir'
22210 installman1dir='$installman1dir'
22211 installman3dir='$installman3dir'
22212 installprefix='$installprefix'
22213 installprefixexp='$installprefixexp'
22214 installprivlib='$installprivlib'
22215 installscript='$installscript'
22216 installsitearch='$installsitearch'
22217 installsitebin='$installsitebin'
22218 installsitehtml1dir='$installsitehtml1dir'
22219 installsitehtml3dir='$installsitehtml3dir'
22220 installsitelib='$installsitelib'
22221 installsiteman1dir='$installsiteman1dir'
22222 installsiteman3dir='$installsiteman3dir'
22223 installsitescript='$installsitescript'
22224 installstyle='$installstyle'
22225 installusrbinperl='$installusrbinperl'
22226 installvendorarch='$installvendorarch'
22227 installvendorbin='$installvendorbin'
22228 installvendorhtml1dir='$installvendorhtml1dir'
22229 installvendorhtml3dir='$installvendorhtml3dir'
22230 installvendorlib='$installvendorlib'
22231 installvendorman1dir='$installvendorman1dir'
22232 installvendorman3dir='$installvendorman3dir'
22233 installvendorscript='$installvendorscript'
22234 intsize='$intsize'
22235 issymlink='$issymlink'
22236 ivdformat='$ivdformat'
22237 ivsize='$ivsize'
22238 ivtype='$ivtype'
22239 known_extensions='$known_extensions'
22240 ksh='$ksh'
22241 ld='$ld'
22242 lddlflags='$lddlflags'
22243 ldflags='$ldflags'
22244 ldflags_uselargefiles='$ldflags_uselargefiles'
22245 ldlibpthname='$ldlibpthname'
22246 less='$less'
22247 lib_ext='$lib_ext'
22248 libc='$libc'
22249 libperl='$libperl'
22250 libpth='$libpth'
22251 libs='$libs'
22252 libsdirs='$libsdirs'
22253 libsfiles='$libsfiles'
22254 libsfound='$libsfound'
22255 libspath='$libspath'
22256 libswanted='$libswanted'
22257 libswanted_uselargefiles='$libswanted_uselargefiles'
22258 line='$line'
22259 lint='$lint'
22260 lkflags='$lkflags'
22261 ln='$ln'
22262 lns='$lns'
22263 localtime_r_proto='$localtime_r_proto'
22264 locincpth='$locincpth'
22265 loclibpth='$loclibpth'
22266 longdblsize='$longdblsize'
22267 longlongsize='$longlongsize'
22268 longsize='$longsize'
22269 lp='$lp'
22270 lpr='$lpr'
22271 ls='$ls'
22272 lseeksize='$lseeksize'
22273 lseektype='$lseektype'
22274 mad='$mad'
22275 madlyh='$madlyh'
22276 madlyobj='$madlyobj'
22277 madlysrc='$madlysrc'
22278 mail='$mail'
22279 mailx='$mailx'
22280 make='$make'
22281 make_set_make='$make_set_make'
22282 mallocobj='$mallocobj'
22283 mallocsrc='$mallocsrc'
22284 malloctype='$malloctype'
22285 man1dir='$man1dir'
22286 man1direxp='$man1direxp'
22287 man1ext='$man1ext'
22288 man3dir='$man3dir'
22289 man3direxp='$man3direxp'
22290 man3ext='$man3ext'
22291 mips_type='$mips_type'
22292 mistrustnm='$mistrustnm'
22293 mkdir='$mkdir'
22294 mmaptype='$mmaptype'
22295 modetype='$modetype'
22296 more='$more'
22297 multiarch='$multiarch'
22298 mv='$mv'
22299 myarchname='$myarchname'
22300 mydomain='$mydomain'
22301 myhostname='$myhostname'
22302 myuname='$myuname'
22303 n='$n'
22304 need_va_copy='$need_va_copy'
22305 netdb_hlen_type='$netdb_hlen_type'
22306 netdb_host_type='$netdb_host_type'
22307 netdb_name_type='$netdb_name_type'
22308 netdb_net_type='$netdb_net_type'
22309 nm='$nm'
22310 nm_opt='$nm_opt'
22311 nm_so_opt='$nm_so_opt'
22312 nonxs_ext='$nonxs_ext'
22313 nroff='$nroff'
22314 nvEUformat='$nvEUformat'
22315 nvFUformat='$nvFUformat'
22316 nvGUformat='$nvGUformat'
22317 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22318 nveformat='$nveformat'
22319 nvfformat='$nvfformat'
22320 nvgformat='$nvgformat'
22321 nvsize='$nvsize'
22322 nvtype='$nvtype'
22323 o_nonblock='$o_nonblock'
22324 obj_ext='$obj_ext'
22325 old_pthread_create_joinable='$old_pthread_create_joinable'
22326 optimize='$optimize'
22327 orderlib='$orderlib'
22328 osname='$osname'
22329 osvers='$osvers'
22330 otherlibdirs='$otherlibdirs'
22331 package='$package'
22332 pager='$pager'
22333 passcat='$passcat'
22334 patchlevel='$patchlevel'
22335 path_sep='$path_sep'
22336 perl5='$perl5'
22337 perl='$perl'
22338 perl_patchlevel='$perl_patchlevel'
22339 perladmin='$perladmin'
22340 perllibs='$perllibs'
22341 perlpath='$perlpath'
22342 pg='$pg'
22343 phostname='$phostname'
22344 pidtype='$pidtype'
22345 plibpth='$plibpth'
22346 pmake='$pmake'
22347 pr='$pr'
22348 prefix='$prefix'
22349 prefixexp='$prefixexp'
22350 privlib='$privlib'
22351 privlibexp='$privlibexp'
22352 procselfexe='$procselfexe'
22353 prototype='$prototype'
22354 ptrsize='$ptrsize'
22355 quadkind='$quadkind'
22356 quadtype='$quadtype'
22357 randbits='$randbits'
22358 randfunc='$randfunc'
22359 random_r_proto='$random_r_proto'
22360 randseedtype='$randseedtype'
22361 ranlib='$ranlib'
22362 rd_nodata='$rd_nodata'
22363 readdir64_r_proto='$readdir64_r_proto'
22364 readdir_r_proto='$readdir_r_proto'
22365 revision='$revision'
22366 rm='$rm'
22367 rm_try='$rm_try'
22368 rmail='$rmail'
22369 run='$run'
22370 runnm='$runnm'
22371 sPRIEUldbl='$sPRIEUldbl'
22372 sPRIFUldbl='$sPRIFUldbl'
22373 sPRIGUldbl='$sPRIGUldbl'
22374 sPRIXU64='$sPRIXU64'
22375 sPRId64='$sPRId64'
22376 sPRIeldbl='$sPRIeldbl'
22377 sPRIfldbl='$sPRIfldbl'
22378 sPRIgldbl='$sPRIgldbl'
22379 sPRIi64='$sPRIi64'
22380 sPRIo64='$sPRIo64'
22381 sPRIu64='$sPRIu64'
22382 sPRIx64='$sPRIx64'
22383 sSCNfldbl='$sSCNfldbl'
22384 sched_yield='$sched_yield'
22385 scriptdir='$scriptdir'
22386 scriptdirexp='$scriptdirexp'
22387 sed='$sed'
22388 seedfunc='$seedfunc'
22389 selectminbits='$selectminbits'
22390 selecttype='$selecttype'
22391 sendmail='$sendmail'
22392 setgrent_r_proto='$setgrent_r_proto'
22393 sethostent_r_proto='$sethostent_r_proto'
22394 setlocale_r_proto='$setlocale_r_proto'
22395 setnetent_r_proto='$setnetent_r_proto'
22396 setprotoent_r_proto='$setprotoent_r_proto'
22397 setpwent_r_proto='$setpwent_r_proto'
22398 setservent_r_proto='$setservent_r_proto'
22399 sh='$sh'
22400 shar='$shar'
22401 sharpbang='$sharpbang'
22402 shmattype='$shmattype'
22403 shortsize='$shortsize'
22404 shrpenv='$shrpenv'
22405 shsharp='$shsharp'
22406 sig_count='$sig_count'
22407 sig_name='$sig_name'
22408 sig_name_init='$sig_name_init'
22409 sig_num='$sig_num'
22410 sig_num_init='$sig_num_init'
22411 sig_size='$sig_size'
22412 signal_t='$signal_t'
22413 sitearch='$sitearch'
22414 sitearchexp='$sitearchexp'
22415 sitebin='$sitebin'
22416 sitebinexp='$sitebinexp'
22417 sitehtml1dir='$sitehtml1dir'
22418 sitehtml1direxp='$sitehtml1direxp'
22419 sitehtml3dir='$sitehtml3dir'
22420 sitehtml3direxp='$sitehtml3direxp'
22421 sitelib='$sitelib'
22422 sitelib_stem='$sitelib_stem'
22423 sitelibexp='$sitelibexp'
22424 siteman1dir='$siteman1dir'
22425 siteman1direxp='$siteman1direxp'
22426 siteman3dir='$siteman3dir'
22427 siteman3direxp='$siteman3direxp'
22428 siteprefix='$siteprefix'
22429 siteprefixexp='$siteprefixexp'
22430 sitescript='$sitescript'
22431 sitescriptexp='$sitescriptexp'
22432 sizesize='$sizesize'
22433 sizetype='$sizetype'
22434 sleep='$sleep'
22435 smail='$smail'
22436 so='$so'
22437 sockethdr='$sockethdr'
22438 socketlib='$socketlib'
22439 socksizetype='$socksizetype'
22440 sort='$sort'
22441 spackage='$spackage'
22442 spitshell='$spitshell'
22443 srand48_r_proto='$srand48_r_proto'
22444 srandom_r_proto='$srandom_r_proto'
22445 src='$src'
22446 ssizetype='$ssizetype'
22447 startperl='$startperl'
22448 startsh='$startsh'
22449 static_ext='$static_ext'
22450 stdchar='$stdchar'
22451 stdio_base='$stdio_base'
22452 stdio_bufsiz='$stdio_bufsiz'
22453 stdio_cnt='$stdio_cnt'
22454 stdio_filbuf='$stdio_filbuf'
22455 stdio_ptr='$stdio_ptr'
22456 stdio_stream_array='$stdio_stream_array'
22457 strerror_r_proto='$strerror_r_proto'
22458 strings='$strings'
22459 submit='$submit'
22460 subversion='$subversion'
22461 sysman='$sysman'
22462 tail='$tail'
22463 tar='$tar'
22464 targetarch='$targetarch'
22465 tbl='$tbl'
22466 tee='$tee'
22467 test='$test'
22468 timeincl='$timeincl'
22469 timetype='$timetype'
22470 tmpnam_r_proto='$tmpnam_r_proto'
22471 to='$to'
22472 touch='$touch'
22473 tr='$tr'
22474 trnl='$trnl'
22475 troff='$troff'
22476 ttyname_r_proto='$ttyname_r_proto'
22477 u16size='$u16size'
22478 u16type='$u16type'
22479 u32size='$u32size'
22480 u32type='$u32type'
22481 u64size='$u64size'
22482 u64type='$u64type'
22483 u8size='$u8size'
22484 u8type='$u8type'
22485 uidformat='$uidformat'
22486 uidsign='$uidsign'
22487 uidsize='$uidsize'
22488 uidtype='$uidtype'
22489 uname='$uname'
22490 uniq='$uniq'
22491 uquadtype='$uquadtype'
22492 use5005threads='$use5005threads'
22493 use64bitall='$use64bitall'
22494 use64bitint='$use64bitint'
22495 usecrosscompile='$usecrosscompile'
22496 usedl='$usedl'
22497 usefaststdio='$usefaststdio'
22498 useithreads='$useithreads'
22499 uselargefiles='$uselargefiles'
22500 uselongdouble='$uselongdouble'
22501 usemallocwrap='$usemallocwrap'
22502 usemorebits='$usemorebits'
22503 usemultiplicity='$usemultiplicity'
22504 usemymalloc='$usemymalloc'
22505 usenm='$usenm'
22506 useopcode='$useopcode'
22507 useperlio='$useperlio'
22508 useposix='$useposix'
22509 usereentrant='$usereentrant'
22510 userelocatableinc='$userelocatableinc'
22511 usesfio='$usesfio'
22512 useshrplib='$useshrplib'
22513 usesitecustomize='$usesitecustomize'
22514 usesocks='$usesocks'
22515 usethreads='$usethreads'
22516 usevendorprefix='$usevendorprefix'
22517 usevfork='$usevfork'
22518 usrinc='$usrinc'
22519 uuname='$uuname'
22520 uvXUformat='$uvXUformat'
22521 uvoformat='$uvoformat'
22522 uvsize='$uvsize'
22523 uvtype='$uvtype'
22524 uvuformat='$uvuformat'
22525 uvxformat='$uvxformat'
22526 vendorarch='$vendorarch'
22527 vendorarchexp='$vendorarchexp'
22528 vendorbin='$vendorbin'
22529 vendorbinexp='$vendorbinexp'
22530 vendorhtml1dir='$vendorhtml1dir'
22531 vendorhtml1direxp='$vendorhtml1direxp'
22532 vendorhtml3dir='$vendorhtml3dir'
22533 vendorhtml3direxp='$vendorhtml3direxp'
22534 vendorlib='$vendorlib'
22535 vendorlib_stem='$vendorlib_stem'
22536 vendorlibexp='$vendorlibexp'
22537 vendorman1dir='$vendorman1dir'
22538 vendorman1direxp='$vendorman1direxp'
22539 vendorman3dir='$vendorman3dir'
22540 vendorman3direxp='$vendorman3direxp'
22541 vendorprefix='$vendorprefix'
22542 vendorprefixexp='$vendorprefixexp'
22543 vendorscript='$vendorscript'
22544 vendorscriptexp='$vendorscriptexp'
22545 version='$version'
22546 version_patchlevel_string='$version_patchlevel_string'
22547 versiononly='$versiononly'
22548 vi='$vi'
22549 voidflags='$voidflags'
22550 xlibpth='$xlibpth'
22551 yacc='$yacc'
22552 yaccflags='$yaccflags'
22553 zcat='$zcat'
22554 zip='$zip'
22555 EOT
22556
22557 : Add in command line options if available
22558 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22559
22560 : add special variables
22561 $test -f $src/patchlevel.h && \
22562 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22563 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22564 echo "PERL_CONFIG_SH=true" >>config.sh
22565
22566 : propagate old symbols
22567 if $test -f UU/config.sh; then
22568         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22569         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22570         $sort | $uniq -u >UU/oldsyms
22571         set X `cat UU/oldsyms`
22572         shift
22573         case $# in
22574         0) ;;
22575         *)
22576                 cat <<EOM
22577 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22578 EOM
22579                 echo "# Variables propagated from previous config.sh file." >>config.sh
22580                 for sym in `cat UU/oldsyms`; do
22581                         echo "    Propagating $hint variable "'$'"$sym..."
22582                         eval 'tmp="$'"${sym}"'"'
22583                         echo "$tmp" | \
22584                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22585                 done
22586                 ;;
22587         esac
22588 fi
22589
22590 : Finish up by extracting the .SH files
22591 case "$alldone" in
22592 exit)
22593         $rm -rf UU
22594         echo "Extraction done."
22595         exit 0
22596         ;;
22597 cont)
22598         ;;
22599 '')
22600         dflt=''
22601         nostick=true
22602         $cat <<EOM
22603
22604 If you'd like to make any changes to the config.sh file before I begin
22605 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22606
22607 EOM
22608         rp="Press return or use a shell escape to edit config.sh:"
22609         . UU/myread
22610         nostick=''
22611         case "$ans" in
22612         '') ;;
22613         *) : in case they cannot read
22614                 sh 1>&4 -c "$ans";;
22615         esac
22616         ;;
22617 esac
22618
22619 : if this fails, just run all the .SH files by hand
22620 . ./config.sh
22621
22622 echo " "
22623 exec 1>&4
22624 pwd=`pwd`
22625 . ./UU/extract
22626 cd "$pwd"
22627
22628 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22629         dflt=y
22630         case "$silent" in
22631         true) ;;
22632         *)
22633                 $cat <<EOM
22634
22635 Now you need to generate make dependencies by running "$make depend".
22636 You might prefer to run it in background: "$make depend > makedepend.out &"
22637 It can take a while, so you might not want to run it right now.
22638
22639 EOM
22640                 ;;
22641         esac
22642         rp="Run $make depend now?"
22643         . UU/myread
22644         case "$ans" in
22645         y*)
22646                 $make depend && echo "Now you must run '$make'."
22647                 ;;
22648         *)
22649                 echo "You must run '$make depend' then '$make'."
22650                 ;;
22651         esac
22652 elif test -f [Mm]akefile; then
22653         echo " "
22654         echo "Now you must run a $make."
22655 else
22656         echo "Configure done."
22657 fi
22658
22659 if $test -f Policy.sh; then
22660     $cat <<EOM
22661
22662 If you compile $package on a different machine or from a different object
22663 directory, copy the Policy.sh file from this object directory to the
22664 new one before you run Configure -- this will help you with most of
22665 the policy defaults.
22666
22667 EOM
22668 fi
22669 if $test -f config.msg; then
22670     echo "Hmm.  I also noted the following information while running:"
22671     echo " "
22672     $cat config.msg >&4
22673     $rm -f config.msg
22674 fi
22675 $rm -f kit*isdone ark*isdone
22676 $rm -rf UU
22677
22678 : End of Configure
22679