Use sv_setpvs() like a few lines before since change #33557
[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 package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Fri Mar 21 11:25:23 CET 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
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 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_assert=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_syspoll=''
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_overflows_integers_at=''
1062 nv_preserves_uv_bits=''
1063 nvsize=''
1064 nvtype=''
1065 u16size=''
1066 u16type=''
1067 u32size=''
1068 u32type=''
1069 u64size=''
1070 u64type=''
1071 u8size=''
1072 u8type=''
1073 uvsize=''
1074 uvtype=''
1075 ivdformat=''
1076 nvEUformat=''
1077 nvFUformat=''
1078 nvGUformat=''
1079 nveformat=''
1080 nvfformat=''
1081 nvgformat=''
1082 uvXUformat=''
1083 uvoformat=''
1084 uvuformat=''
1085 uvxformat=''
1086 pidtype=''
1087 prefix=''
1088 prefixexp=''
1089 installprivlib=''
1090 privlib=''
1091 privlibexp=''
1092 prototype=''
1093 ptrsize=''
1094 d_PRIXU64=''
1095 d_PRId64=''
1096 d_PRIi64=''
1097 d_PRIo64=''
1098 d_PRIu64=''
1099 d_PRIx64=''
1100 sPRIXU64=''
1101 sPRId64=''
1102 sPRIi64=''
1103 sPRIo64=''
1104 sPRIu64=''
1105 sPRIx64=''
1106 d_quad=''
1107 quadkind=''
1108 quadtype=''
1109 uquadtype=''
1110 drand01=''
1111 randbits=''
1112 randfunc=''
1113 randseedtype=''
1114 seedfunc=''
1115 installscript=''
1116 scriptdir=''
1117 scriptdirexp=''
1118 selectminbits=''
1119 selecttype=''
1120 sh=''
1121 sig_count=''
1122 sig_name=''
1123 sig_name_init=''
1124 sig_num=''
1125 sig_num_init=''
1126 sig_size=''
1127 d_sitearch=''
1128 installsitearch=''
1129 sitearch=''
1130 sitearchexp=''
1131 installsitebin=''
1132 sitebin=''
1133 sitebinexp=''
1134 installsitehtml1dir=''
1135 sitehtml1dir=''
1136 sitehtml1direxp=''
1137 installsitehtml3dir=''
1138 sitehtml3dir=''
1139 sitehtml3direxp=''
1140 installsitelib=''
1141 sitelib=''
1142 sitelib_stem=''
1143 sitelibexp=''
1144 installsiteman1dir=''
1145 siteman1dir=''
1146 siteman1direxp=''
1147 installsiteman3dir=''
1148 siteman3dir=''
1149 siteman3direxp=''
1150 siteprefix=''
1151 siteprefixexp=''
1152 installsitescript=''
1153 sitescript=''
1154 sitescriptexp=''
1155 sizesize=''
1156 sizetype=''
1157 so=''
1158 socksizetype=''
1159 sharpbang=''
1160 shsharp=''
1161 spitshell=''
1162 src=''
1163 ssizetype=''
1164 startperl=''
1165 startsh=''
1166 stdchar=''
1167 d_stdio_stream_array=''
1168 stdio_stream_array=''
1169 sysman=''
1170 trnl=''
1171 uidformat=''
1172 uidsign=''
1173 uidsize=''
1174 uidtype=''
1175 archname64=''
1176 use64bitall=''
1177 use64bitint=''
1178 dtrace=''
1179 usedtrace=''
1180 usefaststdio=''
1181 ccflags_uselargefiles=''
1182 ldflags_uselargefiles=''
1183 libswanted_uselargefiles=''
1184 uselargefiles=''
1185 uselongdouble=''
1186 usemorebits=''
1187 usemultiplicity=''
1188 nm_opt=''
1189 nm_so_opt=''
1190 runnm=''
1191 usenm=''
1192 useperlio=''
1193 usesocks=''
1194 d_oldpthreads=''
1195 use5005threads=''
1196 useithreads=''
1197 usereentrant=''
1198 usethreads=''
1199 incpath=''
1200 mips_type=''
1201 usrinc=''
1202 d_vendorarch=''
1203 installvendorarch=''
1204 vendorarch=''
1205 vendorarchexp=''
1206 d_vendorbin=''
1207 installvendorbin=''
1208 vendorbin=''
1209 vendorbinexp=''
1210 installvendorhtml1dir=''
1211 vendorhtml1dir=''
1212 vendorhtml1direxp=''
1213 installvendorhtml3dir=''
1214 vendorhtml3dir=''
1215 vendorhtml3direxp=''
1216 d_vendorlib=''
1217 installvendorlib=''
1218 vendorlib=''
1219 vendorlib_stem=''
1220 vendorlibexp=''
1221 installvendorman1dir=''
1222 vendorman1dir=''
1223 vendorman1direxp=''
1224 installvendorman3dir=''
1225 vendorman3dir=''
1226 vendorman3direxp=''
1227 usevendorprefix=''
1228 vendorprefix=''
1229 vendorprefixexp=''
1230 d_vendorscript=''
1231 installvendorscript=''
1232 vendorscript=''
1233 vendorscriptexp=''
1234 versiononly=''
1235 defvoidused=''
1236 voidflags=''
1237 yacc=''
1238 yaccflags=''
1239 CONFIG=''
1240
1241 : Detect odd OSs
1242 define='define'
1243 undef='undef'
1244 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1245 rmlist=''
1246
1247 : We must find out about Eunice early
1248 eunicefix=':'
1249 if test -f /etc/unixtovms; then
1250         eunicefix=/etc/unixtovms
1251 fi
1252 if test -f /etc/unixtovms.exe; then
1253         eunicefix=/etc/unixtovms.exe
1254 fi
1255
1256 : Set executable suffix now -- needed before hints available
1257 if test -f "/libs/version.library"; then
1258 : Amiga OS
1259     _exe=""
1260 elif test -f "/system/gnu_library/bin/ar.pm"; then
1261 : Stratus VOS
1262     _exe=".pm"
1263 elif test -n "$DJGPP"; then
1264 : DOS DJGPP
1265     _exe=".exe"
1266 elif test -d c:/. -o -n "$is_os2" ; then
1267 : OS/2 or cygwin
1268     _exe=".exe"
1269 fi
1270
1271 i_whoami=''
1272 : Trailing extension.  Override this in a hint file, if needed.
1273 : Extra object files, if any, needed on this platform.
1274 archobjs=''
1275 archname=''
1276 groupstype=''
1277 libnames=''
1278 : change the next line if compiling for Xenix/286 on Xenix/386
1279 xlibpth='/usr/lib/386 /lib/386'
1280 : Possible local library directories to search.
1281 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1282 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1283
1284 : general looking path for locating libraries
1285 glibpth="/lib /usr/lib $xlibpth"
1286 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1287 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1288 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1289 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1290
1291 : Private path used by Configure to find libraries.  Its value
1292 : is prepended to libpth. This variable takes care of special
1293 : machines, like the mips.  Usually, it should be empty.
1294 plibpth=''
1295
1296 : default library list
1297 libswanted=''
1298 : some systems want to use only the non-versioned libso:s
1299 ignore_versioned_solibs=''
1300 : set usethreads on the Configure command line to enable threads.
1301 usereentrant='undef'
1302 : full support for void wanted by default
1303 defvoidused=15
1304
1305 : Possible local include directories to search.
1306 : Set locincpth to "" in a hint file to defeat local include searches.
1307 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1308 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1309 :
1310 : no include file wanted by default
1311 inclwanted=''
1312
1313 : Enable -DEBUGGING and -DDEBUGGING from the command line
1314 EBUGGING=''
1315 DEBUGGING=old
1316
1317 ccname=''
1318 ccversion=''
1319 perllibs=''
1320 : set useposix=false in your hint file to disable the POSIX extension.
1321 useposix=true
1322 : set useopcode=false in your hint file to disable the Opcode extension.
1323 useopcode=true
1324 archname64=''
1325 ccflags_uselargefiles=''
1326 ldflags_uselargefiles=''
1327 libswanted_uselargefiles=''
1328 : set usemultiplicity on the Configure command line to enable multiplicity.
1329 : set usesocks on the Configure command line to enable socks.
1330 : List of libraries we want.
1331 : If anyone needs extra -lxxx, put those in a hint file.
1332 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1333 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1334 : We probably want to search /usr/shlib before most other libraries.
1335 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1336 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1337 glibpth="/usr/shlib $glibpth"
1338 : Do not use vfork unless overridden by a hint file.
1339 usevfork=false
1340
1341 : Find the basic shell for Bourne shell scripts
1342 case "$sh" in
1343 '')
1344         case "$SYSTYPE" in
1345         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1346         *) xxx='/bin/sh';;
1347         esac
1348         if test -f "$xxx"; then
1349                 sh="$xxx"
1350         else
1351                 : Build up a list and do a single loop so we can 'break' out.
1352                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1353                 for xxx in sh bash ksh pdksh ash; do
1354                         for p in $pth; do
1355                                 try="$try ${p}/${xxx}"
1356                         done
1357                 done
1358                 for xxx in $try; do
1359                         if test -f "$xxx"; then
1360                                 sh="$xxx";
1361                                 break
1362                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1363                                 sh="$xxx";
1364                                 break
1365                         elif test -f "$xxx.exe"; then
1366                                 sh="$xxx";
1367                                 break
1368                         fi
1369                 done
1370         fi
1371         ;;
1372 esac
1373
1374 case "$sh" in
1375 '')     cat >&2 <<EOM
1376 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1377
1378 Usually it's in /bin/sh.  How did you even get this far?
1379 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1380 we'll try to straighten this all out.
1381 EOM
1382         exit 1
1383         ;;
1384 esac
1385
1386 : see if sh knows # comments
1387 if `$sh -c '#' >/dev/null 2>&1`; then
1388         shsharp=true
1389         spitshell=cat
1390         xcat=/bin/cat
1391         test -f $xcat$_exe || xcat=/usr/bin/cat
1392         if test ! -f $xcat$_exe; then
1393                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1394                         if test -f $p/cat$_exe; then
1395                                 xcat=$p/cat
1396                                 break
1397                         fi
1398                 done
1399                 if test ! -f $xcat$_exe; then
1400                         echo "Can't find cat anywhere!"
1401                         exit 1
1402                 fi
1403         fi
1404         echo "#!$xcat" >sharp
1405         $eunicefix sharp
1406         chmod +x sharp
1407         ./sharp > today
1408         if test -s today; then
1409                 sharpbang='#!'
1410         else
1411                 echo "#! $xcat" > sharp
1412                 $eunicefix sharp
1413                 chmod +x sharp
1414                 ./sharp > today
1415                 if test -s today; then
1416                         sharpbang='#! '
1417                 else
1418                         sharpbang=': use '
1419                 fi
1420         fi
1421 else
1422         echo " "
1423         echo "Your $sh doesn't grok # comments--I will strip them later on."
1424         shsharp=false
1425         cd ..
1426         echo "exec grep -v '^[  ]*#'" >spitshell
1427         chmod +x spitshell
1428         $eunicefix spitshell
1429         spitshell=`pwd`/spitshell
1430         cd UU
1431         echo "I presume that if # doesn't work, #! won't work either!"
1432         sharpbang=': use '
1433 fi
1434 rm -f sharp today
1435
1436 : figure out how to guarantee sh startup
1437 case "$startsh" in
1438 '') startsh=${sharpbang}${sh} ;;
1439 *)
1440 esac
1441 cat >sharp <<EOSS
1442 $startsh
1443 set abc
1444 test "$?abc" != 1
1445 EOSS
1446
1447 chmod +x sharp
1448 $eunicefix sharp
1449 if ./sharp; then
1450         : echo "Yup, it does."
1451 else
1452         echo "Hmm... '$startsh' does not guarantee sh startup..."
1453         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1454 fi
1455 rm -f sharp
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         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 rm -f cmdl.opt
1481
1482 : produce awk script to parse command line options
1483 cat >options.awk <<'EOF'
1484 BEGIN {
1485         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1486
1487         len = length(optstr);
1488         for (i = 1; i <= len; i++) {
1489                 c = substr(optstr, i, 1);
1490                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1491                 if (a == ":") {
1492                         arg[c] = 1;
1493                         i++;
1494                 }
1495                 opt[c] = 1;
1496         }
1497 }
1498 {
1499         expect = 0;
1500         str = $0;
1501         if (substr(str, 1, 1) != "-") {
1502                 printf("'%s'\n", str);
1503                 next;
1504         }
1505         len = length($0);
1506         for (i = 2; i <= len; i++) {
1507                 c = substr(str, i, 1);
1508                 if (!opt[c]) {
1509                         printf("-%s\n", substr(str, i));
1510                         next;
1511                 }
1512                 printf("-%s\n", c);
1513                 if (arg[c]) {
1514                         if (i < len)
1515                                 printf("'%s'\n", substr(str, i + 1));
1516                         else
1517                                 expect = 1;
1518                         next;
1519                 }
1520         }
1521 }
1522 END {
1523         if (expect)
1524                 print "?";
1525 }
1526 EOF
1527
1528 : process the command line options
1529 set X `for arg in "$@"; do echo "X$arg"; done |
1530         sed -e s/X// | awk -f options.awk`
1531 eval "set $*"
1532 shift
1533 rm -f options.awk
1534
1535 : set up default values
1536 fastread=''
1537 reuseval=false
1538 config_sh=''
1539 alldone=''
1540 error=''
1541 silent=''
1542 extractsh=''
1543 override=''
1544 knowitall=''
1545 rm -f optdef.sh posthint.sh
1546 cat >optdef.sh <<EOS
1547 $startsh
1548 EOS
1549
1550
1551 : option parsing
1552 while test $# -gt 0; do
1553         case "$1" in
1554         -d) shift; fastread=yes;;
1555         -e) shift; alldone=cont;;
1556         -f)
1557                 shift
1558                 cd ..
1559                 if test -r "$1"; then
1560                         config_sh="$1"
1561                 else
1562                         echo "$me: cannot read config file $1." >&2
1563                         error=true
1564                 fi
1565                 cd UU
1566                 shift;;
1567         --help|\
1568         -h) shift; error=true;;
1569         -r) shift; reuseval=true;;
1570         -s) shift; silent=true; realsilent=true;;
1571         -E) shift; alldone=exit;;
1572         -K) shift; knowitall=true;;
1573         -O) shift; override=true;;
1574         -S) shift; silent=true; extractsh=true;;
1575         -D)
1576                 shift
1577                 case "$1" in
1578                 *=)
1579                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1580                         echo "$me: ignoring -D $1" >&2
1581                         ;;
1582                 *=*) echo "$1" | \
1583                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1584                 *) echo "$1='define'" >> optdef.sh;;
1585                 esac
1586                 shift
1587                 ;;
1588         -U)
1589                 shift
1590                 case "$1" in
1591                 *=) echo "$1" >> optdef.sh;;
1592                 *=*)
1593                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1594                         echo "$me: ignoring -U $1" >&2
1595                         ;;
1596                 *) echo "$1='undef'" >> optdef.sh;;
1597                 esac
1598                 shift
1599                 ;;
1600         -A)
1601             shift
1602             xxx=''
1603             yyy="$1"
1604             zzz=''
1605             uuu=undef
1606             case "$yyy" in
1607             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1608                  case "$zzz" in
1609                  *:*) zzz='' ;;
1610                  *)   xxx=append
1611                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1612                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1613                  esac
1614                  ;;
1615             esac
1616             case "$xxx" in
1617             '')  case "$yyy" in
1618                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1619                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1620                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1621                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1622                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1623                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1624                  esac
1625                  ;;
1626             esac
1627             case "$xxx" in
1628             append)
1629                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1630             clear)
1631                 echo "$yyy=''"                  >> posthint.sh ;;
1632             define)
1633                 case "$zzz" in
1634                 '') zzz=define ;;
1635                 esac
1636                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1637             eval)
1638                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1639             prepend)
1640                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1641             undef)
1642                 case "$zzz" in
1643                 '') zzz="$uuu" ;;
1644                 esac
1645                 echo "$yyy=$zzz"                >> posthint.sh ;;
1646             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1647             esac
1648             shift
1649             ;;
1650         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1651             exit 0;;
1652         --) break;;
1653         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1654         *) break;;
1655         esac
1656 done
1657
1658 case "$error" in
1659 true)
1660         cat >&2 <<EOM
1661 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1662                  [-U symbol] [-U symbol=] [-A command:symbol...]
1663   -d : use defaults for all answers.
1664   -e : go on without questioning past the production of config.sh.
1665   -f : specify an alternate default configuration file.
1666   -h : print this help message and exit (with an error status).
1667   -r : reuse C symbols value if possible (skips costly nm extraction).
1668   -s : silent mode, only echoes questions and essential information.
1669   -D : define symbol to have some value:
1670          -D symbol         symbol gets the value 'define'
1671          -D symbol=value   symbol gets the value 'value'
1672        common used examples (see INSTALL for more info):
1673          -Duse64bitint            use 64bit integers
1674          -Duse64bitall            use 64bit integers and pointers
1675          -Dusethreads             use thread support
1676          -Dinc_version_list=none  do not include older perl trees in @INC
1677          -DEBUGGING=none          DEBUGGING options
1678          -Dcc=gcc                 choose your compiler
1679          -Dprefix=/opt/perl5      choose your destination
1680   -E : stop at the end of questions, after having produced config.sh.
1681   -K : do not use unless you know what you are doing.
1682   -O : let -D and -U override definitions from loaded configuration file.
1683   -S : perform variable substitutions on all .SH files (can mix with -f)
1684   -U : undefine symbol:
1685          -U symbol    symbol gets the value 'undef'
1686          -U symbol=   symbol gets completely empty
1687        e.g.:  -Uversiononly
1688   -A : manipulate symbol after the platform specific hints have been applied:
1689          -A append:symbol=value   append value to symbol
1690          -A symbol=value          like append:, but with a separating space
1691          -A define:symbol=value   define symbol to have value
1692          -A clear:symbol          define symbol to be ''
1693          -A define:symbol         define symbol to be 'define'
1694          -A eval:symbol=value     define symbol to be eval of value
1695          -A prepend:symbol=value  prepend value to symbol
1696          -A undef:symbol          define symbol to be 'undef'
1697          -A undef:symbol=         define symbol to be ''
1698        e.g.:  -A prepend:libswanted='cl pthread '
1699               -A ccflags=-DSOME_MACRO
1700   -V : print version number and exit (with a zero status).
1701 EOM
1702         exit 1
1703         ;;
1704 esac
1705
1706 : Sanity checks
1707 case "$fastread$alldone" in
1708 yescont|yesexit) ;;
1709 *)
1710         case "$extractsh" in
1711         true) ;;
1712         *)
1713                 if test ! -t 0; then
1714                         echo "Say 'sh Configure', not 'sh <Configure'"
1715                         exit 1
1716                 fi
1717                 ;;
1718         esac
1719         ;;
1720 esac
1721
1722 exec 4>&1
1723 case "$silent" in
1724 true) exec 1>/dev/null;;
1725 esac
1726
1727 : run the defines and the undefines, if any, but leave the file out there...
1728 touch optdef.sh
1729 . ./optdef.sh
1730 : create the posthint manipulation script and leave the file out there...
1731 touch posthint.sh
1732
1733 : set package name
1734 package='perl5'
1735 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1736 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1737 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1738 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1739 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1740 esac
1741
1742 : Some greps do not return status, grrr.
1743 echo "grimblepritz" >grimble
1744 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1745         contains=contains
1746 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1747         contains=grep
1748 else
1749         contains=contains
1750 fi
1751 rm -f grimble
1752 : the following should work in any shell
1753 case "$contains" in
1754 contains*)
1755         echo " "
1756         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1757         cat >contains <<'EOSS'
1758 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1759 EOSS
1760 chmod +x contains
1761 esac
1762
1763 : Find the path to the source tree
1764 case "$src" in
1765 '') case "$0" in
1766     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1767          case "$src" in
1768          /*)    ;;
1769          .)     ;;
1770          *)     src=`cd ../$src && pwd` ;;
1771          esac
1772          ;;
1773     *)   src='.';;
1774     esac;;
1775 esac
1776 case "$src" in
1777 '')     src=/
1778         rsrc=/
1779         ;;
1780 /*)     rsrc="$src";;
1781 *)      rsrc="../$src";;
1782 esac
1783 if test -f $rsrc/Configure && \
1784         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1785 then
1786    : found it, so we are ok.
1787 else
1788         rsrc=''
1789         for src in . .. ../.. ../../.. ../../../..; do
1790                 if test -f ../$src/Configure && \
1791                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1792                 then
1793                         rsrc=../$src
1794                         break
1795                 fi
1796         done
1797 fi
1798 case "$rsrc" in
1799 '')
1800         cat <<EOM >&4
1801
1802 Sorry, I can't seem to locate the source dir for $package.  Please start
1803 Configure with an explicit path -- i.e. /some/path/Configure.
1804
1805 EOM
1806         exit 1
1807         ;;
1808 ../.)   rsrc='..';;
1809 *)
1810         echo " "
1811         echo "Sources for $package found in \"$src\"." >&4
1812         ;;
1813 esac
1814
1815 : script used to extract .SH files with variable substitutions
1816 cat >extract <<'EOS'
1817 PERL_CONFIG_SH=true
1818 echo "Doing variable substitutions on .SH files..."
1819 if test -f MANIFEST; then
1820         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1821 else
1822         echo "(Looking for .SH files under the source directory.)"
1823         set x `(cd "$src"; find . -name "*.SH" -print)`
1824 fi
1825 shift
1826 case $# in
1827 0) set x `(cd "$src"; echo *.SH)`; shift;;
1828 esac
1829 if test ! -f "$src/$1"; then
1830         shift
1831 fi
1832 mkdir_p='
1833 name=$1;
1834 create="";
1835 while test $name; do
1836         if test ! -d "$name"; then
1837                 create="$name $create";
1838                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1839                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1840         else
1841                 name="";
1842         fi;
1843 done;
1844 for file in $create; do
1845         mkdir $file;
1846 done
1847 '
1848 for file in $*; do
1849         case "$src" in
1850         ".")
1851                 case "$file" in
1852                 */*)
1853                         dir=`expr X$file : 'X\(.*\)/'`
1854                         file=`expr X$file : 'X.*/\(.*\)'`
1855                         (cd "$dir" && . ./$file)
1856                         ;;
1857                 *)
1858                         . ./$file
1859                         ;;
1860                 esac
1861                 ;;
1862         *)
1863                 case "$file" in
1864                 */*)
1865                         dir=`expr X$file : 'X\(.*\)/'`
1866                         file=`expr X$file : 'X.*/\(.*\)'`
1867                         (set x $dir; shift; eval $mkdir_p)
1868                         sh <"$src/$dir/$file"
1869                         ;;
1870                 *)
1871                         sh <"$src/$file"
1872                         ;;
1873                 esac
1874                 ;;
1875         esac
1876 done
1877 if test -f "$src/config_h.SH"; then
1878         if test ! -f config.h; then
1879         : oops, they left it out of MANIFEST, probably, so do it anyway.
1880         . "$src/config_h.SH"
1881         fi
1882 fi
1883 EOS
1884
1885 : extract files and exit if asked to do so
1886 case "$extractsh" in
1887 true)
1888         case "$realsilent" in
1889         true) ;;
1890         *) exec 1>&4;;
1891         esac
1892         case "$config_sh" in
1893         '') config_sh='config.sh';;
1894         esac
1895         echo " "
1896         echo "Fetching answers from $config_sh..."
1897         cd ..
1898         . $config_sh
1899         test "$override" && . ./optdef.sh
1900         echo " "
1901         . UU/extract
1902         rm -rf UU
1903         echo "Extraction done."
1904         exit 0
1905         ;;
1906 esac
1907
1908 : Eunice requires " " instead of "", can you believe it
1909 echo " "
1910 : Here we go...
1911 echo "Beginning of configuration questions for $package."
1912
1913 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1914
1915 : first determine how to suppress newline on echo command
1916 echo " "
1917 echo "Checking echo to see how to suppress newlines..."
1918 (echo "hi there\c" ; echo " ") >.echotmp
1919 if $contains c .echotmp >/dev/null 2>&1 ; then
1920         echo "...using -n."
1921         n='-n'
1922         c=''
1923 else
1924         cat <<'EOM'
1925 ...using \c
1926 EOM
1927         n=''
1928         c='\c'
1929 fi
1930 echo $n "The star should be here-->$c"
1931 echo '*'
1932 rm -f .echotmp
1933
1934 : Now test for existence of everything in MANIFEST
1935 echo " "
1936 if test -f "$rsrc/MANIFEST"; then
1937         echo "First let's make sure your kit is complete.  Checking..." >&4
1938         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1939                 (split -l 50 2>/dev/null || split -50)
1940         rm -f missing
1941         tmppwd=`pwd`
1942         for filelist in x??; do
1943                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1944                         >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 : Find the appropriate value for a newline for tr
1979 echo " "
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 : See if we are using a devel version and want that
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                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 ar
2322 bison
2323 byacc
2324 cpp
2325 csh
2326 date
2327 egrep
2328 gmake
2329 gzip
2330 less
2331 ln
2332 make
2333 more
2334 nm
2335 nroff
2336 pg
2337 test
2338 uname
2339 zip
2340 "
2341 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2342 pth="$pth /lib /usr/lib"
2343 for file in $loclist; do
2344         eval xxx=\$$file
2345         case "$xxx" in
2346         /*|?:[\\/]*)
2347                 if test -f "$xxx"; then
2348                         : ok
2349                 else
2350                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2351                         xxx=`./loc $file $file $pth`
2352                 fi
2353                 ;;
2354         '') xxx=`./loc $file $file $pth`;;
2355         *) xxx=`./loc $xxx $xxx $pth`;;
2356         esac
2357         eval $file=$xxx$_exe
2358         eval _$file=$xxx
2359         case "$xxx" in
2360         /*)
2361                 echo $file is in $xxx.
2362                 ;;
2363         ?:[\\/]*)
2364                 echo $file is in $xxx.
2365                 ;;
2366         *)
2367                 echo "I don't know where '$file' is, and my life depends on it." >&4
2368                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2369                 exit 1
2370                 ;;
2371         esac
2372 done
2373 echo " "
2374 echo "Don't worry if any of the following aren't found..."
2375 say=offhand
2376 for file in $trylist; do
2377         eval xxx=\$$file
2378         case "$xxx" in
2379         /*|?:[\\/]*)
2380                 if test -f "$xxx"; then
2381                         : ok
2382                 else
2383                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2384                         xxx=`./loc $file $file $pth`
2385                 fi
2386                 ;;
2387         '') xxx=`./loc $file $file $pth`;;
2388         *) xxx=`./loc $xxx $xxx $pth`;;
2389         esac
2390         eval $file=$xxx$_exe
2391         eval _$file=$xxx
2392         case "$xxx" in
2393         /*)
2394                 echo $file is in $xxx.
2395                 ;;
2396         ?:[\\/]*)
2397                 echo $file is in $xxx.
2398                 ;;
2399         *)
2400                 echo "I don't see $file out there, $say."
2401                 say=either
2402                 ;;
2403         esac
2404 done
2405 case "$egrep" in
2406 egrep)
2407         echo "Substituting grep for egrep."
2408         egrep=$grep
2409         _egrep=$grep
2410         ;;
2411 esac
2412 case "$ln" in
2413 ln)
2414         echo "Substituting cp for ln."
2415         ln=$cp
2416         _ln=$cp
2417         ;;
2418 esac
2419 case "$make" in
2420 make)
2421         case "$gmake" in
2422         gmake)
2423         echo "I can't find make or gmake, and my life depends on it." >&4
2424         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2425         exit 1
2426         ;;
2427         esac
2428         ;;
2429 esac
2430 case "$gmake" in
2431 gmake)  ;;
2432 *)      # We can't have osname yet.
2433         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2434                 # Assume that gmake, if found, is definitely GNU make
2435                 # and prefer it over the system make.
2436                 echo "Substituting gmake for make."
2437                 make=$gmake
2438                 _make=$gmake
2439         fi
2440         ;;
2441 esac
2442 case "$test" in
2443 test)
2444         echo "Hopefully test is built into your sh."
2445         ;;
2446 *)
2447         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2448                 echo "Using the test built into your sh."
2449                 test=test
2450                 _test=test
2451         fi
2452         ;;
2453 esac
2454 case "$echo" in
2455 echo)
2456         echo "Hopefully echo is built into your sh."
2457         ;;
2458 '') ;;
2459 *)
2460         echo " "
2461 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2462         $echo $n "hi there$c" >foo1
2463         echo $n "hi there$c" >foo2
2464         if cmp foo1 foo2 >/dev/null 2>&1; then
2465                 echo "They are compatible.  In fact, they may be identical."
2466         else
2467                 case "$n" in
2468                 '-n') n='' c='\c';;
2469                 *) n='-n' c='';;
2470                 esac
2471                 cat <<FOO
2472 They are not compatible!  You are probably running ksh on a non-USG system.
2473 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2474 have echo built in and we may have to run some Bourne shell scripts.  That
2475 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2476
2477 FOO
2478                 $echo $n "The star should be here-->$c"
2479                 $echo "*"
2480         fi
2481         $rm -f foo1 foo2
2482         ;;
2483 esac
2484
2485 # This question was auctioned at YAPC::Europe-2007 in Vienna
2486 # I never promised you could answer it. I only auctioned the question.
2487 cat <<FOO
2488 The following message is sponsored by
2489
2490   Dresden.pm<--The stars should be here.
2491
2492 Dear Perl user, system administrator or package
2493 maintainer, the Perl community sends greetings to
2494 you. Do you (emblematical) greet back [Y/n]? n
2495
2496 FOO
2497
2498 : Check what type of C compiler we use
2499 cat <<EOS >trygcc
2500 $startsh
2501 EOS
2502 cat <<'EOSC' >>trygcc
2503 case "$cc" in
2504 '') ;;
2505 *)  $rm -f try try.*
2506     $cat >try.c <<EOM
2507 int main(int argc, char *argv[]) {
2508   return 0;
2509 }
2510 EOM
2511     if $cc -o try $ccflags $ldflags try.c; then
2512        :
2513     else
2514         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2515         despair=yes
2516         trygcc=yes
2517         case "$cc" in
2518         *gcc*) trygcc=no ;;
2519         esac
2520         # Skip this test because it gives a false match on output like:
2521         #    ./trygcc: line 23: cc: command not found
2522         # case "`$cc -v -c try.c 2>&1`" in
2523         # *gcc*) trygcc=no ;;
2524         # esac
2525         if $test X"$trygcc" = Xyes; then
2526             if gcc -o try -c try.c; then
2527                 echo " "
2528                 echo "You seem to have a working gcc, though." >&4
2529                 # Switching compilers may undo the work of hints files.
2530                 # The most common problem is -D_REENTRANT for threads.
2531                 # This heuristic catches that case, but gets false positives
2532                 # if -Dusethreads was not actually specified.  Better to
2533                 # bail out here with a useful message than fail 
2534                 # mysteriously later. Should we perhaps just try to
2535                 # re-invoke Configure -Dcc=gcc config_args ?
2536                 if $test -f usethreads.cbu; then
2537                         $cat >&4 <<EOM 
2538
2539 *** However, any setting of the C compiler flags (e.g. for thread support)
2540 *** will be lost.  It may be necessary for you to restart Configure and
2541 *** add -Dcc=gcc to your Configure command line.
2542
2543 EOM
2544                         rp="Would you like to go ahead and try gcc anyway?"
2545                         dflt=n
2546                 else
2547                         rp="Would you like to use it?"
2548                         dflt=y
2549                 fi
2550                 if $test -f myread; then
2551                     . ./myread
2552                 else
2553                     if $test -f UU/myread; then
2554                         . ./UU/myread
2555                     else
2556                         echo "Cannot find myread, sorry.  Aborting." >&2
2557                         exit 1
2558                     fi
2559                 fi  
2560                 case "$ans" in
2561                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2562                 esac
2563             fi
2564         fi
2565     fi
2566     $rm -f try try.*
2567     ;;
2568 esac
2569 EOSC
2570
2571 cat <<EOS >checkcc
2572 $startsh
2573 EOS
2574 cat <<'EOSC' >>checkcc
2575 case "$cc" in        
2576 '') ;;
2577 *)  $rm -f try try.*              
2578     $cat >try.c <<EOM
2579 int main(int argc, char *argv[]) {
2580   return 0;
2581 }
2582 EOM
2583     if $cc -o try $ccflags $ldflags try.c; then
2584        :
2585     else
2586         if $test X"$despair" = Xyes; then
2587            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2588         fi
2589         $cat >&4 <<EOM         
2590 You need to find a working C compiler.
2591 Either (purchase and) install the C compiler supplied by your OS vendor,
2592 or for a free C compiler try http://gcc.gnu.org/
2593 I cannot continue any further, aborting.
2594 EOM
2595         exit 1
2596     fi
2597     $rm -f try try.*
2598     ;;
2599 esac
2600 EOSC
2601
2602 : determine whether symbolic links are supported
2603 echo " "
2604 $touch blurfl
2605 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2606         echo "Symbolic links are supported." >&4
2607         lns="$ln -s"
2608 else
2609         echo "Symbolic links are NOT supported." >&4
2610         lns="$ln"
2611 fi
2612 $rm -f blurfl sym
2613
2614 : determine whether symbolic links are supported
2615 echo " "
2616 case "$lns" in
2617 *"ln"*" -s")
2618         echo "Checking how to test for symbolic links..." >&4
2619         $lns blurfl sym
2620         if $test "X$issymlink" = X; then
2621                 case "$newsh" in
2622                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 esac
2625                 if test $? = 0; then
2626                         issymlink="test -h"
2627                 else
2628                         echo "Your builtin 'test -h' may be broken." >&4
2629                         case "$test" in
2630                         /*)     ;;
2631                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2632                                 for p in $pth
2633                                 do
2634                                         if test -f "$p/$test"; then
2635                                                 test="$p/$test"
2636                                                 break
2637                                         fi
2638                                 done
2639                                 ;;
2640                         esac
2641                         case "$test" in
2642                         /*)
2643                                 echo "Trying external '$test -h'." >&4
2644                                 issymlink="$test -h"
2645                                 if $test ! -h sym >/dev/null 2>&1; then
2646                                         echo "External '$test -h' is broken, too." >&4
2647                                         issymlink=''
2648                                 fi
2649                                 ;;
2650                         *)      issymlink='' ;;
2651                         esac
2652                 fi              
2653         fi
2654         if $test "X$issymlink" = X; then
2655                 if $test -L sym 2>/dev/null; then
2656                         issymlink="$test -L"
2657                         echo "The builtin '$test -L' worked." >&4
2658                 fi
2659         fi
2660         if $test "X$issymlink" != X; then
2661                 echo "You can test for symbolic links with '$issymlink'." >&4
2662         else
2663                 echo "I do not know how you can test for symbolic links." >&4
2664         fi
2665         $rm -f blurfl sym
2666         ;;
2667 *)      echo "No symbolic links, so not testing for their testing..." >&4
2668         ;;
2669 esac
2670 echo " "
2671
2672 : Make symlinks util
2673 case "$mksymlinks" in
2674 $define|true|[yY]*)
2675         case "$src" in
2676         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2677                 exit 1
2678                 ;;
2679         *)      case "$lns:$issymlink" in
2680                 *"ln"*" -s:"*"test -"?)
2681                         echo "Creating the symbolic links..." >&4
2682                         echo "(First creating the subdirectories...)" >&4
2683                         cd ..
2684                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2685                                 read directory
2686                                 test -z "$directory" && break
2687                                 mkdir -p $directory
2688                         done
2689                         # Sanity check 1.
2690                         if test ! -d t/base; then
2691                                 echo "Failed to create the subdirectories.  Aborting." >&4
2692                                 exit 1
2693                         fi
2694                         echo "(Then creating the symlinks...)" >&4
2695                         awk '{print $1}' $src/MANIFEST | while true; do
2696                                 read filename
2697                                 test -z "$filename" && break
2698                                 if test -f $filename; then
2699                                         if $issymlink $filename; then
2700                                                 rm -f $filename
2701                                         fi
2702                                 fi
2703                                 if test -f $filename; then
2704                                         echo "$filename already exists, not symlinking."
2705                                 else
2706                                         ln -s $src/$filename $filename
2707                                 fi
2708                         done
2709                         # Sanity check 2.
2710                         if test ! -f t/base/lex.t; then
2711                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2712                                 exit 1
2713                         fi
2714                         cd UU
2715                         ;;
2716                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2717                         ;;
2718                 esac
2719                 ;;
2720         esac
2721         ;;
2722 esac
2723
2724 : Check for Cross-Compilation
2725 case "$usecrosscompile" in
2726 $define|true|[yY]*)
2727         $echo "Cross-compiling..."
2728         croak=''
2729         case "$cc" in
2730         *-*-gcc) # A cross-compiling gcc, probably.
2731             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2732             ar=$targetarch-ar
2733             # leave out ld, choosing it is more complex
2734             nm=$targetarch-nm
2735             ranlib=$targetarch-ranlib
2736             $echo 'extern int foo;' > try.c
2737             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2738             shift
2739             if $test $# -gt 0; then
2740                 incpth="$incpth $*"
2741                 incpth="`$echo $incpth|$sed 's/^ //'`"
2742                 echo "Guessing incpth '$incpth'." >&4
2743                 for i in $*; do
2744                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2745                     if $test -d $j; then
2746                         libpth="$libpth $j"
2747                     fi
2748                 done   
2749                 libpth="`$echo $libpth|$sed 's/^ //'`"
2750                 echo "Guessing libpth '$libpth'." >&4
2751             fi
2752             $rm -f try.c
2753             ;;
2754         esac
2755         case "$targetarch" in
2756         '') echo "Targetarch not defined." >&4; croak=y ;;
2757         *)  echo "Using targetarch $targetarch." >&4 ;;
2758         esac
2759         case "$incpth" in
2760         '') echo "Incpth not defined." >&4; croak=y ;;
2761         *)  echo "Using incpth '$incpth'." >&4 ;;
2762         esac
2763         case "$libpth" in
2764         '') echo "Libpth not defined." >&4; croak=y ;;
2765         *)  echo "Using libpth '$libpth'." >&4 ;;
2766         esac
2767         case "$usrinc" in
2768         '') for i in $incpth; do
2769                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2770                     usrinc=$i
2771                     echo "Guessing usrinc $usrinc." >&4
2772                     break
2773                 fi
2774             done
2775             case "$usrinc" in
2776             '') echo "Usrinc not defined." >&4; croak=y ;;
2777             esac
2778             ;;
2779         *)  echo "Using usrinc $usrinc." >&4 ;;
2780         esac
2781         case "$targethost" in
2782         '') echo "Targethost not defined." >&4; croak=y ;;
2783         *)  echo "Using targethost $targethost." >&4
2784         esac
2785         locincpth=' '
2786         loclibpth=' '
2787         case "$croak" in
2788         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2789         esac
2790         case "$src" in
2791         /*) run=$src/Cross/run
2792             targetmkdir=$src/Cross/mkdir
2793             to=$src/Cross/to
2794             from=$src/Cross/from
2795             ;;
2796         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2797             run=$pwd/Cross/run
2798             targetmkdir=$pwd/Cross/mkdir
2799             to=$pwd/Cross/to
2800             from=$pwd/Cross/from
2801             ;;
2802         esac
2803         case "$targetrun" in
2804         '') targetrun=ssh ;;
2805         esac
2806         case "$targetto" in
2807         '') targetto=scp ;;
2808         esac
2809         case "$targetfrom" in
2810         '') targetfrom=scp ;;
2811         esac
2812         run=$run-$targetrun
2813         to=$to-$targetto
2814         from=$from-$targetfrom
2815         case "$targetdir" in
2816         '')  targetdir=/tmp
2817              echo "Guessing targetdir $targetdir." >&4
2818              ;;
2819         esac
2820         case "$targetuser" in
2821         '')  targetuser=root
2822              echo "Guessing targetuser $targetuser." >&4
2823              ;;
2824         esac
2825         case "$targetfrom" in
2826         scp)    q=-q ;;
2827         *)      q='' ;;
2828         esac
2829         case "$targetrun" in
2830         ssh|rsh)
2831             cat >$run <<EOF
2832 #!/bin/sh
2833 case "\$1" in
2834 -cwd)
2835   shift
2836   cwd=\$1
2837   shift
2838   ;;
2839 esac
2840 case "\$cwd" in
2841 '') cwd=$targetdir ;;
2842 esac
2843 exe=\$1
2844 shift
2845 if $test ! -f \$exe.xok; then
2846   $to \$exe
2847   $touch \$exe.xok
2848 fi
2849 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2850 EOF
2851             ;;
2852         *)  echo "Unknown targetrun '$targetrun'" >&4
2853             exit 1
2854             ;;
2855         esac
2856         case "$targetmkdir" in
2857         */Cross/mkdir)
2858             cat >$targetmkdir <<EOF
2859 #!/bin/sh
2860 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2861 EOF
2862             $chmod a+rx $targetmkdir
2863             ;;
2864         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2865             exit 1
2866             ;;
2867         esac
2868         case "$targetto" in
2869         scp|rcp)
2870             cat >$to <<EOF
2871 #!/bin/sh
2872 for f in \$@
2873 do
2874   case "\$f" in
2875   /*)
2876     $targetmkdir \`dirname \$f\`
2877     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2878     ;;
2879   *)
2880     $targetmkdir $targetdir/\`dirname \$f\`
2881     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2882     ;;
2883   esac
2884 done
2885 exit 0
2886 EOF
2887             ;;
2888         cp) cat >$to <<EOF
2889 #!/bin/sh
2890 for f in \$@
2891 do
2892   case "\$f" in
2893   /*)
2894     $mkdir -p $targetdir/\`dirname \$f\`
2895     $cp \$f $targetdir/\$f || exit 1
2896     ;;
2897   *)
2898     $targetmkdir $targetdir/\`dirname \$f\`
2899     $cp \$f $targetdir/\$f || exit 1
2900     ;;
2901   esac
2902 done
2903 exit 0
2904 EOF
2905             ;;
2906         *)  echo "Unknown targetto '$targetto'" >&4
2907             exit 1
2908             ;;
2909         esac
2910         case "$targetfrom" in
2911         scp|rcp)
2912           cat >$from <<EOF
2913 #!/bin/sh
2914 for f in \$@
2915 do
2916   $rm -f \$f
2917   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2918 done
2919 exit 0
2920 EOF
2921             ;;
2922         cp) cat >$from <<EOF
2923 #!/bin/sh
2924 for f in \$@
2925 do
2926   $rm -f \$f
2927   cp $targetdir/\$f . || exit 1
2928 done
2929 exit 0
2930 EOF
2931             ;;
2932         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2933             exit 1
2934             ;;
2935         esac
2936         if $test ! -f $run; then
2937             echo "Target 'run' script '$run' not found." >&4
2938         else
2939             $chmod a+rx $run
2940         fi
2941         if $test ! -f $to; then
2942             echo "Target 'to' script '$to' not found." >&4
2943         else
2944             $chmod a+rx $to
2945         fi
2946         if $test ! -f $from; then
2947             echo "Target 'from' script '$from' not found." >&4
2948         else
2949             $chmod a+rx $from
2950         fi
2951         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2952             exit 1
2953         fi
2954         cat >&4 <<EOF
2955 Using '$run' for remote execution,
2956 and '$from' and '$to'
2957 for remote file transfer.
2958 EOF
2959         ;;
2960 *)      run=''
2961         to=:
2962         from=:
2963         usecrosscompile='undef'
2964         targetarch=''
2965         ;;
2966 esac
2967
2968 : see whether [:lower:] and [:upper:] are supported character classes
2969 echo " "
2970 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2971 ABYZ)
2972         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2973         up='[:upper:]'
2974         low='[:lower:]'
2975         ;;
2976 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2977         # (0xd9 and 0xe2), therefore that is a nice testing point.
2978         if test "X$up" = X -o "X$low" = X; then
2979             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2980             rs) up='[A-Z]'
2981                 low='[a-z]'
2982                 ;;
2983             esac
2984         fi
2985         if test "X$up" = X -o "X$low" = X; then
2986             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2987             rs) up='A-Z'
2988                 low='a-z'
2989                 ;;
2990             esac
2991         fi
2992         if test "X$up" = X -o "X$low" = X; then
2993             case "`echo RS | od -x 2>/dev/null`" in
2994             *D9E2*|*d9e2*)
2995                 echo "Hey, this might be EBCDIC." >&4
2996                 if test "X$up" = X -o "X$low" = X; then
2997                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2998                     rs) up='[A-IJ-RS-Z]'
2999                         low='[a-ij-rs-z]'
3000                         ;;
3001                     esac
3002                 fi
3003                 if test "X$up" = X -o "X$low" = X; then
3004                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3005                     rs) up='A-IJ-RS-Z'
3006                         low='a-ij-rs-z'
3007                         ;;
3008                     esac
3009                 fi
3010                 ;;
3011             esac
3012         fi
3013 esac
3014 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3015 rs)
3016     echo "Using $up and $low to convert case." >&4
3017     ;;
3018 *)
3019     echo "I don't know how to translate letters from upper to lower case." >&4
3020     echo "Your tr is not acting any way I know of." >&4
3021     exit 1
3022     ;;
3023 esac
3024 : set up the translation script tr, must be called with ./tr of course
3025 cat >tr <<EOSC
3026 $startsh
3027 case "\$1\$2" in
3028 '[A-Z][a-z]') exec $tr '$up' '$low';;
3029 '[a-z][A-Z]') exec $tr '$low' '$up';;
3030 esac
3031 exec $tr "\$@"
3032 EOSC
3033 chmod +x tr
3034 $eunicefix tr
3035
3036 : Try to determine whether config.sh was made on this system
3037 case "$config_sh" in
3038 '')
3039 myuname=`$uname -a 2>/dev/null`
3040 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3041 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3042 # because the A-Z/a-z are not consecutive.
3043 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3044         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3045 newmyuname="$myuname"
3046 dflt=n
3047 case "$knowitall" in
3048 '')
3049         if test -f ../config.sh; then
3050                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3051                         eval "`grep myuname= ../config.sh`"
3052                 fi
3053                 if test "X$myuname" = "X$newmyuname"; then
3054                         dflt=y
3055                 fi
3056         fi
3057         ;;
3058 *) dflt=y;;
3059 esac
3060
3061 : Get old answers from old config file if Configure was run on the
3062 : same system, otherwise use the hints.
3063 hint=default
3064 cd ..
3065 if test -f config.sh; then
3066         echo " "
3067         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3068         . UU/myread
3069         case "$ans" in
3070         n*|N*) echo "OK, I'll ignore it."
3071                 mv config.sh config.sh.old
3072                 myuname="$newmyuname"
3073                 ;;
3074         *)  echo "Fetching default answers from your old config.sh file..." >&4
3075                 tmp_n="$n"
3076                 tmp_c="$c"
3077                 tmp_sh="$sh"
3078                 . ./config.sh
3079                 cp config.sh UU
3080                 n="$tmp_n"
3081                 c="$tmp_c"
3082                 : Older versions did not always set $sh.  Catch re-use of such
3083                 : an old config.sh.
3084                 case "$sh" in
3085                 '') sh="$tmp_sh" ;;
3086                 esac
3087                 hint=previous
3088                 ;;
3089         esac
3090 fi
3091 . ./UU/checkcc
3092 if test ! -f config.sh; then
3093         $cat <<EOM
3094
3095 First time through, eh?  I have some defaults handy for some systems
3096 that need some extra help getting the Configure answers right:
3097
3098 EOM
3099         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3100         dflt=''
3101         : Half the following guesses are probably wrong... If you have better
3102         : tests or hints, please send them to perlbug@perl.org
3103         : The metaconfig authors would also appreciate a copy...
3104         $test -f /irix && osname=irix
3105         $test -f /xenix && osname=sco_xenix
3106         $test -f /dynix && osname=dynix
3107         $test -f /dnix && osname=dnix
3108         $test -f /lynx.os && osname=lynxos
3109         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3110         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3111         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /bin/mips && /bin/mips && osname=mips
3113         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3114                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3115         $test -d /usr/apollo/bin && osname=apollo
3116         $test -f /etc/saf/_sactab && osname=svr4
3117         $test -d /usr/include/minix && osname=minix
3118         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3119         if $test -d /MachTen -o -d /MachTen_Folder; then
3120                 osname=machten
3121                 if $test -x /sbin/version; then
3122                         osvers=`/sbin/version | $awk '{print $2}' |
3123                         $sed -e 's/[A-Za-z]$//'`
3124                 elif $test -x /usr/etc/version; then
3125                         osvers=`/usr/etc/version | $awk '{print $2}' |
3126                         $sed -e 's/[A-Za-z]$//'`
3127                 else
3128                         osvers="$2.$3"
3129                 fi
3130         fi
3131
3132         $test -f /sys/posix.dll &&
3133                 $test -f /usr/bin/what &&
3134                 set X `/usr/bin/what /sys/posix.dll` &&
3135                 $test "$3" = UWIN &&
3136                 osname=uwin &&
3137                 osvers="$5"
3138
3139         if $test -f $uname; then
3140                 set X $myuname
3141                 shift
3142
3143                 case "$5" in
3144                 fps*) osname=fps ;;
3145                 mips*)
3146                         case "$4" in
3147                         umips) osname=umips ;;
3148                         *) osname=mips ;;
3149                         esac;;
3150                 [23]100) osname=mips ;;
3151                 next*) osname=next ;;
3152                 i386*)
3153                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3154                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3155                                 osname='sco'
3156                                 osvers=$tmp
3157                         elif $test -f /etc/kconfig; then
3158                                 osname=isc
3159                                 if test "$lns" = "$ln -s"; then
3160                                         osvers=4
3161                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3162                                         osvers=3
3163                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3164                                         osvers=2
3165                                 fi
3166                         fi
3167                         tmp=''
3168                         ;;
3169                 pc*)
3170                         if test -n "$DJGPP"; then
3171                                 osname=dos
3172                                 osvers=djgpp
3173                         fi
3174                         ;;
3175                 esac
3176
3177                 case "$1" in
3178                 aix) osname=aix
3179                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3180                         case "$tmp" in
3181                         # oslevel can fail with:
3182                         # oslevel: Unable to acquire lock.
3183                         *not\ found) osvers="$4"."$3" ;;
3184                         '<3240'|'<>3240') osvers=3.2.0 ;;
3185                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3186                         '=3250'|'>3250') osvers=3.2.5 ;;
3187                         *) osvers=$tmp;;
3188                         esac
3189                         ;;
3190                 bsd386) osname=bsd386
3191                         osvers=`$uname -r`
3192                         ;;
3193                 cygwin*) osname=cygwin
3194                         osvers="$3"
3195                         ;;
3196                 *dc.osx) osname=dcosx
3197                         osvers="$3"
3198                         ;;
3199                 dnix) osname=dnix
3200                         osvers="$3"
3201                         ;;
3202                 domainos) osname=apollo
3203                         osvers="$3"
3204                         ;;
3205                 dgux)   osname=dgux
3206                         osvers="$3"
3207                         ;;
3208                 dragonfly) osname=dragonfly
3209                         osvers="$3"
3210                         ;;
3211                 dynixptx*) osname=dynixptx
3212                         osvers=`echo "$4"|sed 's/^v//'`
3213                         ;;
3214                 freebsd) osname=freebsd
3215                         osvers="$3" ;;
3216                 genix)  osname=genix ;;
3217                 gnu)    osname=gnu
3218                         osvers="$3" ;;
3219                 hp*)    osname=hpux
3220                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3221                         ;;
3222                 irix*)  osname=irix
3223                         case "$3" in
3224                         4*) osvers=4 ;;
3225                         5*) osvers=5 ;;
3226                         *)      osvers="$3" ;;
3227                         esac
3228                         ;;
3229                 linux)  osname=linux
3230                         case "$3" in
3231                         *)      osvers="$3" ;;
3232                         esac
3233                         ;;
3234                 MiNT)   osname=mint
3235                         ;;
3236                 netbsd*) osname=netbsd
3237                         osvers="$3"
3238                         ;;
3239                 news-os) osvers="$3"
3240                         case "$3" in
3241                         4*) osname=newsos4 ;;
3242                         *) osname=newsos ;;
3243                         esac
3244                         ;;
3245                 next*) osname=next ;;
3246                 nonstop-ux) osname=nonstopux ;;
3247                 openbsd) osname=openbsd
3248                         osvers="$3"
3249                         ;;
3250                 os2)    osname=os2
3251                         osvers="$4"
3252                         ;;
3253                 POSIX-BC | posix-bc ) osname=posix-bc
3254                         osvers="$3"
3255                         ;;
3256                 powerux | power_ux | powermax_os | powermaxos | \
3257                 powerunix | power_unix) osname=powerux
3258                         osvers="$3"
3259                         ;;
3260                 qnx) osname=qnx
3261                         osvers="$4"
3262                         ;;
3263                 solaris) osname=solaris
3264                         case "$3" in
3265                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3266                         *)      osvers="$3" ;;
3267                         esac
3268                         ;;
3269                 sunos) osname=sunos
3270                         case "$3" in
3271                         5*) osname=solaris
3272                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 titanos) osname=titanos
3277                         case "$3" in
3278                         1*) osvers=1 ;;
3279                         2*) osvers=2 ;;
3280                         3*) osvers=3 ;;
3281                         4*) osvers=4 ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 ultrix) osname=ultrix
3286                         osvers="$3"
3287                         ;;
3288                 osf1|mls+)      case "$5" in
3289                                 alpha)
3290                                         osname=dec_osf
3291                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3292                                         case "$osvers" in
3293                                         [1-9].[0-9]*) ;;
3294                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3295                                         esac
3296                                         ;;
3297                         hp*)    osname=hp_osf1  ;;
3298                         mips)   osname=mips_osf1 ;;
3299                         esac
3300                         ;;
3301                 # UnixWare 7.1.2 is known as Open UNIX 8
3302                 openunix|unixware) osname=svr5
3303                         osvers="$4"
3304                         ;;
3305                 uts)    osname=uts
3306                         osvers="$3"
3307                         ;;
3308                 vos) osvers="$3"
3309                         ;;
3310                 $2) case "$osname" in
3311                         *isc*) ;;
3312                         *freebsd*) ;;
3313                         svr*)
3314                                 : svr4.x or possibly later
3315                                 case "svr$3" in
3316                                 ${osname}*)
3317                                         osname=svr$3
3318                                         osvers=$4
3319                                         ;;
3320                                 esac
3321                                 case "$osname" in
3322                                 svr4.0)
3323                                         : Check for ESIX
3324                                         if test -f /stand/boot ; then
3325                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3326                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3327                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3328                                                         if test -n "$isesix"; then
3329                                                                 osname=esix4
3330                                                         fi
3331                                                 fi
3332                                         fi
3333                                         ;;
3334                                 esac
3335                                 ;;
3336                         *)      if test -f /etc/systemid; then
3337                                         osname=sco
3338                                         set `echo $3 | $sed 's/\./ /g'` $4
3339                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3340                                                 osvers=$1.$2.$3
3341                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3342                                                 osvers=$1.$2
3343                                         elif $test -f $src/hints/sco_$1.sh; then
3344                                                 osvers=$1
3345                                         fi
3346                                 else
3347                                         case "$osname" in
3348                                         '') : Still unknown.  Probably a generic Sys V.
3349                                                 osname="sysv"
3350                                                 osvers="$3"
3351                                                 ;;
3352                                         esac
3353                                 fi
3354                                 ;;
3355                         esac
3356                         ;;
3357                 *)      case "$osname" in
3358                         '') : Still unknown.  Probably a generic BSD.
3359                                 osname="$1"
3360                                 osvers="$3"
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365         else
3366                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3367                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3368                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3369                                 osname=news_os
3370                         fi
3371                         $rm -f UU/kernel.what
3372                 elif test -d c:/. -o -n "$is_os2" ; then
3373                         set X $myuname
3374                         osname=os2
3375                         osvers="$5"
3376                 fi
3377         fi
3378
3379         case "$targetarch" in
3380         '') ;;
3381         *)  hostarch=$osname
3382             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3383             osvers=''
3384             ;;
3385         esac
3386
3387         : Now look for a hint file osname_osvers, unless one has been
3388         : specified already.
3389         case "$hintfile" in
3390         ''|' ')
3391                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3392                 : Also try without trailing minor version numbers.
3393                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3394                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3395                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3397                 case "$file" in
3398                 '') dflt=none ;;
3399                 *)  case "$osvers" in
3400                         '') dflt=$file
3401                                 ;;
3402                         *)  if $test -f $src/hints/$file.sh ; then
3403                                         dflt=$file
3404                                 elif $test -f $src/hints/$xfile.sh ; then
3405                                         dflt=$xfile
3406                                 elif $test -f $src/hints/$xxfile.sh ; then
3407                                         dflt=$xxfile
3408                                 elif $test -f $src/hints/$xxxfile.sh ; then
3409                                         dflt=$xxxfile
3410                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3411                                         dflt=$xxxxfile
3412                                 elif $test -f "$src/hints/${osname}.sh" ; then
3413                                         dflt="${osname}"
3414                                 else
3415                                         dflt=none
3416                                 fi
3417                                 ;;
3418                         esac
3419                         ;;
3420                 esac
3421                 if $test -f Policy.sh ; then
3422                         case "$dflt" in
3423                         *Policy*) ;;
3424                         none) dflt="Policy" ;;
3425                         *) dflt="Policy $dflt" ;;
3426                         esac
3427                 fi
3428                 ;;
3429         *)
3430                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3431                 ;;
3432         esac
3433
3434         if $test -f Policy.sh ; then
3435                 $cat <<EOM
3436
3437 There's also a Policy hint file available, which should make the
3438 site-specific (policy) questions easier to answer.
3439 EOM
3440
3441         fi
3442
3443         $cat <<EOM
3444
3445 You may give one or more space-separated answers, or "none" if appropriate.
3446 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3447 previous run of Configure, you may specify it as well as or instead of
3448 OS-specific hints.  If hints are provided for your OS, you should use them:
3449 although Perl can probably be built without hints on many platforms, using
3450 hints often improve performance and may enable features that Configure can't
3451 set up on its own. If there are no hints that match your OS, specify "none";
3452 DO NOT give a wrong version or a wrong OS.
3453
3454 EOM
3455
3456         rp="Which of these apply, if any?"
3457         . UU/myread
3458         tans=$ans
3459         for file in $tans; do
3460                 if $test X$file = XPolicy -a -f Policy.sh; then
3461                         . Policy.sh
3462                         $cat Policy.sh >> UU/config.sh
3463                 elif $test -f $src/hints/$file.sh; then
3464                         . $src/hints/$file.sh
3465                         $cat $src/hints/$file.sh >> UU/config.sh
3466                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3467                         : nothing
3468                 else
3469                         : Give one chance to correct a possible typo.
3470                         echo "$file.sh does not exist"
3471                         dflt=$file
3472                         rp="hint to use instead?"
3473                         . UU/myread
3474                         for file in $ans; do
3475                                 if $test -f "$src/hints/$file.sh"; then
3476                                         . $src/hints/$file.sh
3477                                         $cat $src/hints/$file.sh >> UU/config.sh
3478                                 elif $test X$ans = X -o X$ans = Xnone ; then
3479                                         : nothing
3480                                 else
3481                                         echo "$file.sh does not exist -- ignored."
3482                                 fi
3483                         done
3484                 fi
3485         done
3486
3487         hint=recommended
3488         : Remember our hint file for later.
3489         if $test -f "$src/hints/$file.sh" ; then
3490                 hintfile="$file"
3491         else
3492                 hintfile=''
3493         fi
3494 fi
3495 cd UU
3496 ;;
3497 *)
3498         echo " "
3499         echo "Fetching default answers from $config_sh..." >&4
3500         tmp_n="$n"
3501         tmp_c="$c"
3502         cd ..
3503         cp $config_sh config.sh 2>/dev/null
3504         chmod +w config.sh
3505         . ./config.sh
3506         cd UU
3507         cp ../config.sh .
3508         n="$tmp_n"
3509         c="$tmp_c"
3510         hint=previous
3511         ;;
3512 esac
3513 test "$override" && . ./optdef.sh
3514
3515 : Restore computed paths
3516 for file in $loclist $trylist; do
3517         eval $file="\$_$file"
3518 done
3519
3520 cat << EOM
3521
3522 Configure uses the operating system name and version to set some defaults.
3523 The default value is probably right if the name rings a bell. Otherwise,
3524 since spelling matters for me, either accept the default or answer "none"
3525 to leave it blank.
3526
3527 EOM
3528 case "$osname" in
3529         ''|' ')
3530                 case "$hintfile" in
3531                 ''|' '|none) dflt=none ;;
3532                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3533                 esac
3534                 ;;
3535         *) dflt="$osname" ;;
3536 esac
3537 rp="Operating system name?"
3538 . ./myread
3539 case "$ans" in
3540 none)  osname='' ;;
3541 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3542 esac
3543 echo " "
3544 case "$osvers" in
3545         ''|' ')
3546                 case "$hintfile" in
3547                 ''|' '|none) dflt=none ;;
3548                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3549                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3550                         case "$dflt" in
3551                         ''|' ') dflt=none ;;
3552                         esac
3553                         ;;
3554                 esac
3555                 ;;
3556         *) dflt="$osvers" ;;
3557 esac
3558 rp="Operating system version?"
3559 . ./myread
3560 case "$ans" in
3561 none)  osvers='' ;;
3562 *) osvers="$ans" ;;
3563 esac
3564
3565
3566 . ./posthint.sh
3567
3568 : who configured the system
3569 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3570 case "$cf_by" in
3571 "")
3572         cf_by=`(logname) 2>/dev/null`
3573         case "$cf_by" in
3574         "")
3575                 cf_by=`(whoami) 2>/dev/null`
3576                 case "$cf_by" in
3577                 "") cf_by=unknown ;;
3578                 esac ;;
3579         esac ;;
3580 esac
3581
3582 : decide how portable to be.  Allow command line overrides.
3583 case "$d_portable" in
3584 "$undef") ;;
3585 *)      d_portable="$define" ;;
3586 esac
3587
3588 : set up shell script to do ~ expansion
3589 cat >filexp <<EOSS
3590 $startsh
3591 : expand filename
3592 case "\$1" in
3593  \~/*|\~)
3594         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3595         ;;
3596  \~*)
3597         if $test -f /bin/csh; then
3598                 /bin/csh -f -c "glob \$1"
3599                 failed=\$?
3600                 echo ""
3601                 exit \$failed
3602         else
3603                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3604                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3605                 if $test ! -d "\$dir"; then
3606                         me=\`basename \$0\`
3607                         echo "\$me: can't locate home directory for: \$name" >&2
3608                         exit 1
3609                 fi
3610                 case "\$1" in
3611                 */*)
3612                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3613                         ;;
3614                 *)
3615                         echo \$dir
3616                         ;;
3617                 esac
3618         fi
3619         ;;
3620 *)
3621         echo \$1
3622         ;;
3623 esac
3624 EOSS
3625 chmod +x filexp
3626 $eunicefix filexp
3627
3628 : now set up to get a file name
3629 cat <<EOS >getfile
3630 $startsh
3631 EOS
3632 cat <<'EOSC' >>getfile
3633 tilde=''
3634 fullpath=''
3635 already=''
3636 skip=''
3637 none_ok=''
3638 exp_file=''
3639 nopath_ok=''
3640 orig_rp="$rp"
3641 orig_dflt="$dflt"
3642 case "$gfpth" in
3643 '') gfpth='.' ;;
3644 esac
3645
3646 case "$fn" in
3647 *\(*)
3648         : getfile will accept an answer from the comma-separated list
3649         : enclosed in parentheses even if it does not meet other criteria.
3650         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3651         fn=`echo $fn | sed 's/(.*)//'`
3652         ;;
3653 esac
3654
3655 case "$fn" in
3656 *:*)
3657         loc_file=`expr $fn : '.*:\(.*\)'`
3658         fn=`expr $fn : '\(.*\):.*'`
3659         ;;
3660 esac
3661
3662 case "$fn" in
3663 *~*) tilde=true;;
3664 esac
3665 case "$fn" in
3666 */*) fullpath=true;;
3667 esac
3668 case "$fn" in
3669 *+*) skip=true;;
3670 esac
3671 case "$fn" in
3672 *n*) none_ok=true;;
3673 esac
3674 case "$fn" in
3675 *e*) exp_file=true;;
3676 esac
3677 case "$fn" in
3678 *p*) nopath_ok=true;;
3679 esac
3680
3681 case "$fn" in
3682 *f*) type='File';;
3683 *d*) type='Directory';;
3684 *l*) type='Locate';;
3685 esac
3686
3687 what="$type"
3688 case "$what" in
3689 Locate) what='File';;
3690 esac
3691
3692 case "$exp_file" in
3693 '')
3694         case "$d_portable" in
3695         "$define") ;;
3696         *) exp_file=true;;
3697         esac
3698         ;;
3699 esac
3700
3701 cd ..
3702 while test "$type"; do
3703         redo=''
3704         rp="$orig_rp"
3705         dflt="$orig_dflt"
3706         case "$tilde" in
3707         true) rp="$rp (~name ok)";;
3708         esac
3709         . UU/myread
3710         if test -f UU/getfile.ok && \
3711                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3712         then
3713                 value="$ans"
3714                 ansexp="$ans"
3715                 break
3716         fi
3717         case "$ans" in
3718         none)
3719                 value=''
3720                 ansexp=''
3721                 case "$none_ok" in
3722                 true) type='';;
3723                 esac
3724                 ;;
3725         *)
3726                 case "$tilde" in
3727                 '') value="$ans"
3728                         ansexp="$ans";;
3729                 *)
3730                         value=`UU/filexp $ans`
3731                         case $? in
3732                         0)
3733                                 if test "$ans" != "$value"; then
3734                                         echo "(That expands to $value on this system.)"
3735                                 fi
3736                                 ;;
3737                         *) value="$ans";;
3738                         esac
3739                         ansexp="$value"
3740                         case "$exp_file" in
3741                         '') value="$ans";;
3742                         esac
3743                         ;;
3744                 esac
3745                 case "$fullpath" in
3746                 true)
3747                         case "$ansexp" in
3748                         /*) value="$ansexp" ;;
3749                         [a-zA-Z]:/*) value="$ansexp" ;;
3750                         *)
3751                                 redo=true
3752                                 case "$already" in
3753                                 true)
3754                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3755                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3756                                         ;;
3757                                 *)
3758                                 echo "Please give a full path name, starting with slash." >&4
3759                                         case "$tilde" in
3760                                         true)
3761                                 echo "Note that using ~name is ok provided it expands well." >&4
3762                                                 already=true
3763                                                 ;;
3764                                         esac
3765                                 esac
3766                                 ;;
3767                         esac
3768                         ;;
3769                 esac
3770                 case "$redo" in
3771                 '')
3772                         case "$type" in
3773                         File)
3774                                 for fp in $gfpth; do
3775                                         if test "X$fp" = X.; then
3776                                             pf="$ansexp"
3777                                         else    
3778                                             pf="$fp/$ansexp"
3779                                         fi
3780                                         if test -f "$pf"; then
3781                                                 type=''
3782                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3783                                         then
3784                                                 echo "($value is not a plain file, but that's ok.)"
3785                                                 type=''
3786                                         fi
3787                                         if test X"$type" = X; then
3788                                             value="$pf"
3789                                             break
3790                                         fi
3791                                 done
3792                                 ;;
3793                         Directory)
3794                                 for fp in $gfpth; do
3795                                         if test "X$fp" = X.; then
3796                                             dir="$ans"
3797                                             direxp="$ansexp"
3798                                         else    
3799                                             dir="$fp/$ansexp"
3800                                             direxp="$fp/$ansexp"
3801                                         fi
3802                                         if test -d "$direxp"; then
3803                                                 type=''
3804                                                 value="$dir"
3805                                                 break
3806                                         fi
3807                                 done
3808                                 ;;
3809                         Locate)
3810                                 if test -d "$ansexp"; then
3811                                         echo "(Looking for $loc_file in directory $value.)"
3812                                         value="$value/$loc_file"
3813                                         ansexp="$ansexp/$loc_file"
3814                                 fi
3815                                 if test -f "$ansexp"; then
3816                                         type=''
3817                                 fi
3818                                 case "$nopath_ok" in
3819                                 true)   case "$value" in
3820                                         */*) ;;
3821                                         *)      echo "Assuming $value will be in people's path."
3822                                                 type=''
3823                                                 ;;
3824                                         esac
3825                                         ;;
3826                                 esac
3827                                 ;;
3828                         esac
3829
3830                         case "$skip" in
3831                         true) type='';
3832                         esac
3833
3834                         case "$type" in
3835                         '') ;;
3836                         *)
3837                                 if test "$fastread" = yes; then
3838                                         dflt=y
3839                                 else
3840                                         dflt=n
3841                                 fi
3842                                 rp="$what $value doesn't exist.  Use that name anyway?"
3843                                 . UU/myread
3844                                 dflt=''
3845                                 case "$ans" in
3846                                 y*) type='';;
3847                                 *) echo " ";;
3848                                 esac
3849                                 ;;
3850                         esac
3851                         ;;
3852                 esac
3853                 ;;
3854         esac
3855 done
3856 cd UU
3857 ans="$value"
3858 rp="$orig_rp"
3859 dflt="$orig_dflt"
3860 rm -f getfile.ok
3861 test "X$gfpthkeep" != Xy && gfpth=""
3862 EOSC
3863
3864 : determine root of directory hierarchy where package will be installed.
3865 case "$prefix" in
3866 '')
3867         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3868         ;;
3869 *?/)
3870         dflt=`echo "$prefix" | sed 's/.$//'`
3871         ;;
3872 *)
3873         dflt="$prefix"
3874         ;;
3875 esac
3876 $cat <<EOM
3877
3878 By default, $package will be installed in $dflt/bin, manual pages
3879 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3880 installation directories. Typically this is something like /usr/local.
3881 If you wish to have binaries under /usr/bin but other parts of the
3882 installation under /usr/local, that's ok: you will be prompted
3883 separately for each of the installation directories, the prefix being
3884 only used to set the defaults.
3885
3886 EOM
3887 fn=d~
3888 rp='Installation prefix to use?'
3889 . ./getfile
3890 oldprefix=''
3891 case "$prefix" in
3892 '') ;;
3893 *)
3894         case "$ans" in
3895         "$prefix") ;;
3896         *) oldprefix="$prefix";;
3897         esac
3898         ;;
3899 esac
3900 prefix="$ans"
3901 prefixexp="$ansexp"
3902
3903 : allow them to override the AFS root
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 : Check is we will use socks
4025 case "$usesocks" in
4026 $define|true|[yY]*)     dflt='y';;
4027 *) dflt='n';;
4028 esac
4029 cat <<EOM
4030
4031 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4032 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4033 to use the PerlIO abstraction layer, this will be implicitly selected.
4034
4035 If this doesn't make any sense to you, just accept the default '$dflt'.
4036 EOM
4037 rp='Build Perl for SOCKS?'
4038 . ./myread
4039 case "$ans" in
4040 y|Y)    val="$define" ;;
4041 *)      val="$undef" ;;
4042 esac
4043 set usesocks
4044 eval $setvar
4045
4046 case "$usesocks" in
4047 $define|true|[yY]*) useperlio="$define";;
4048 esac
4049
4050 : Check if we want perlio
4051 case "$useperlio" in
4052 $define|true|[yY]*|'')  dflt='y';;
4053 *) dflt='n';;
4054 esac
4055 cat <<EOM
4056
4057 Previous version of $package used the standard IO mechanisms as
4058 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4059 alternate IO mechanisms via the PerlIO abstraction layer, but the
4060 stdio mechanism is still available if needed.  The abstraction layer
4061 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4062 Using PerlIO with sfio may cause problems with some extension modules.
4063
4064 If this doesn't make any sense to you, just accept the default '$dflt'.
4065 EOM
4066 rp='Use the PerlIO abstraction layer?'
4067 . ./myread
4068 case "$ans" in
4069 y|Y)
4070         val="$define"
4071         ;;
4072 *)
4073         echo "Ok, doing things the stdio way."
4074         val="$undef"
4075         ;;
4076 esac
4077 set useperlio
4078 eval $setvar
4079
4080 case "$usesocks" in
4081 $define|true|[yY]*)
4082         case "$useperlio" in
4083         $define|true|[yY]*) ;;
4084         *)      cat >&4 <<EOM
4085
4086 You are using the SOCKS proxy protocol library which means that you
4087 should also use the PerlIO layer.  You may be headed for trouble.
4088
4089 EOM
4090                 ;;
4091         esac
4092         ;;
4093 esac
4094
4095 : get the patchlevel
4096 echo " "
4097 echo "Getting the current patchlevel..." >&4
4098 if $test -r $rsrc/patchlevel.h;then
4099         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4103         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4104         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4105         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4106 else
4107         revision=0
4108         patchlevel=0
4109         subversion=0
4110         api_revision=0
4111         api_version=0
4112         api_subversion=0
4113         perl_patchlevel=0
4114         $echo "(You do not have patchlevel.h.  Eek.)"
4115 fi
4116 if $test -r $rsrc/.patch ; then
4117         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4118                 perl_patchlevel=`cat $rsrc/.patch`
4119         fi
4120 fi
4121 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4122 version_patchlevel_string="version $patchlevel subversion $subversion"
4123 case "$perl_patchlevel" in
4124 0|'') ;;
4125 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4126 esac
4127
4128 $echo "(You have $package $version_patchlevel_string.)"
4129
4130 case "$osname" in
4131 dos|vms)
4132         : XXX Should be a Configure test for double-dots in filenames.
4133         version=`echo $revision $patchlevel $subversion | \
4134                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4137         ;;
4138 *)
4139         version=`echo $revision $patchlevel $subversion | \
4140                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4142                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4143         ;;
4144 esac
4145 : Special case the 5.005_xx maintenance series, which used 5.005
4146 : without any subversion label as a subdirectory in $sitelib
4147 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4148         api_versionstring='5.005'
4149 fi
4150
4151 : Do we want threads support and if so, what type
4152 case "$usethreads" in
4153 $define|true|[yY]*)     dflt='y';;
4154 *)     # Catch case where user specified ithreads or 5005threads but
4155        # forgot -Dusethreads (A.D. 4/2002)
4156        case "$useithreads$use5005threads" in
4157        *$define*)
4158                 case "$useperlio" in
4159                 "$define")      dflt='y' ;;
4160                 *)              dflt='n' ;;
4161                 esac
4162                 ;;
4163        *)       dflt='n';;
4164        esac
4165        ;;
4166 esac
4167 cat <<EOM
4168
4169 Perl can be built to take advantage of threads on some systems.
4170 To do so, Configure can be run with -Dusethreads.
4171
4172 Note that Perl built with threading support runs slightly slower
4173 and uses more memory than plain Perl. The current implementation
4174 is believed to be stable, but it is fairly new, and so should be
4175 treated with caution.
4176
4177 If this doesn't make any sense to you, just accept the default '$dflt'.
4178 EOM
4179 rp='Build a threading Perl?'
4180 . ./myread
4181 case "$ans" in
4182 y|Y)    val="$define" ;;
4183 *)      val="$undef" ;;
4184 esac
4185 set usethreads
4186 eval $setvar
4187
4188 if $test $patchlevel -lt 9; then
4189     case "$usethreads" in
4190     $define)
4191         $cat <<EOM
4192
4193 Since release 5.6, Perl has had two different threading implementations,
4194 the newer interpreter-based version (ithreads) with one interpreter per
4195 thread, and the older 5.005 version (5005threads).
4196 The 5005threads version is effectively unmaintained and will probably be
4197 removed in Perl 5.10, so there should be no need to build a Perl using it
4198 unless needed for backwards compatibility with some existing 5.005threads
4199 code.
4200
4201 EOM
4202         : Default to ithreads unless overridden on command line or with
4203         : old config.sh
4204         dflt='y'
4205         case "$use5005threads" in
4206                 $define|true|[yY]*) dflt='n';;
4207         esac
4208         case "$useithreads" in
4209                 $undef|false|[nN]*) dflt='n';;
4210         esac
4211         rp='Use the newer interpreter-based ithreads?'
4212         . ./myread
4213         case "$ans" in
4214         y|Y)    val="$define" ;;
4215         *)      val="$undef" ;;
4216         esac
4217         set useithreads
4218         eval $setvar
4219         : Now set use5005threads to the opposite value.
4220         case "$useithreads" in
4221         $define) val="$undef" ;;
4222         *) val="$define" ;;
4223         esac
4224         set use5005threads
4225         eval $setvar
4226         ;;
4227     *)
4228         useithreads="$undef"
4229         use5005threads="$undef"
4230         ;;
4231     esac
4232
4233     case "$useithreads$use5005threads" in
4234     "$define$define")
4235         $cat >&4 <<EOM
4236
4237 You cannot have both the ithreads and the 5.005 threads enabled
4238 at the same time.  Disabling the 5.005 threads since they are
4239 much less stable than the ithreads.
4240
4241 EOM
4242         use5005threads="$undef"
4243         ;;
4244     esac
4245
4246 else
4247 : perl-5.9.x and later
4248
4249     if test X"$usethreads" = "X$define"; then
4250         case "$use5005threads" in
4251             $define|true|[yY]*)
4252                 $cat >&4 <<EOM
4253
4254 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4255
4256 EOM
4257             ;;
4258         esac
4259     fi
4260
4261     use5005threads="$undef"
4262     useithreads="$usethreads"
4263 fi
4264
4265 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4266         cat >&4 <<EOF
4267 ***
4268 *** To build with ithreads you must also use the PerlIO layer.
4269 *** Cannot continue, aborting.
4270 ***
4271 EOF
4272         exit 1
4273 fi
4274
4275 case "$d_oldpthreads" in
4276 '')     : Configure tests would be welcome here.  For now, assume undef.
4277         val="$undef" ;;
4278 *)      val="$d_oldpthreads" ;;
4279 esac
4280 set d_oldpthreads
4281 eval $setvar
4282
4283
4284 : Look for a hint-file generated 'call-back-unit'.  If the
4285 : user has specified that a threading perl is to be built,
4286 : we may need to set or change some other defaults.
4287 if $test -f usethreads.cbu; then
4288     echo "Your platform has some specific hints regarding threaded builds, using them..."
4289     . ./usethreads.cbu
4290 else
4291     case "$usethreads" in
4292         "$define"|true|[yY]*)
4293                 $cat <<EOM
4294 (Your platform does not have any specific hints for threaded builds.
4295  Assuming POSIX threads, then.)
4296 EOM
4297         ;;
4298     esac
4299 fi
4300
4301 : Check if multiplicity is required
4302 cat <<EOM
4303
4304 Perl can be built so that multiple Perl interpreters can coexist
4305 within the same Perl executable.
4306 EOM
4307
4308 case "$useithreads" in
4309 $define)
4310         cat <<EOM
4311 This multiple interpreter support is required for interpreter-based threads.
4312 EOM
4313         val="$define"
4314         ;;
4315 *)      case "$usemultiplicity" in
4316         $define|true|[yY]*)     dflt='y';;
4317         *) dflt='n';;
4318         esac
4319         echo " "
4320         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4321         rp='Build Perl for multiplicity?'
4322         . ./myread
4323         case "$ans" in
4324         y|Y)    val="$define" ;;
4325         *)      val="$undef" ;;
4326         esac
4327         ;;
4328 esac
4329 set usemultiplicity
4330 eval $setvar
4331
4332 : Check if morebits is requested
4333 case "$usemorebits" in
4334 "$define"|true|[yY]*)
4335         use64bitint="$define"
4336         uselongdouble="$define"
4337         usemorebits="$define"
4338         ;;
4339 *)      usemorebits="$undef"
4340         ;;
4341 esac
4342
4343 : Determine the C compiler to be used
4344 echo " "
4345 case "$cc" in
4346 '') dflt=cc;;
4347 *) dflt="$cc";;
4348 esac
4349 rp="Use which C compiler?"
4350 . ./myread
4351 cc="$ans"
4352
4353 : See whether they have no cc but they do have gcc
4354 . ./trygcc
4355 if $test -f cc.cbu; then
4356     . ./cc.cbu
4357 fi
4358 . ./checkcc
4359
4360 : make some quick guesses about what we are up against
4361 echo " "
4362 $echo $n "Hmm...  $c"
4363 echo exit 1 >bsd
4364 echo exit 1 >usg
4365 echo exit 1 >v7
4366 echo exit 1 >osf1
4367 echo exit 1 >eunice
4368 echo exit 1 >xenix
4369 echo exit 1 >venix
4370 echo exit 1 >os2
4371 d_bsd="$undef"
4372 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4373 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4374 then
4375         echo "Looks kind of like an OSF/1 system, but we'll see..."
4376         echo exit 0 >osf1
4377 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4378         xxx=`./loc addbib blurfl $pth`
4379         if $test -f $xxx; then
4380         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4381                 echo exit 0 >bsd
4382                 echo exit 0 >usg
4383         else
4384                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4385                         echo "Looks kind of like an extended USG system, but we'll see..."
4386                 else
4387                         echo "Looks kind of like a USG system, but we'll see..."
4388                 fi
4389                 echo exit 0 >usg
4390         fi
4391 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4392         echo "Looks kind of like a BSD system, but we'll see..."
4393         d_bsd="$define"
4394         echo exit 0 >bsd
4395 else
4396         echo "Looks kind of like a Version 7 system, but we'll see..."
4397         echo exit 0 >v7
4398 fi
4399 case "$eunicefix" in
4400 *unixtovms*)
4401         $cat <<'EOI'
4402 There is, however, a strange, musty smell in the air that reminds me of
4403 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4404 EOI
4405         echo exit 0 >eunice
4406         d_eunice="$define"
4407 : it so happens the Eunice I know will not run shell scripts in Unix format
4408         ;;
4409 *)
4410         echo " "
4411         echo "Congratulations.  You aren't running Eunice."
4412         d_eunice="$undef"
4413         ;;
4414 esac
4415 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4416 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4417 : semicolon as a patch separator
4418 case "$p_" in
4419 :) ;;
4420 *)
4421         $cat <<'EOI'
4422 I have the feeling something is not exactly right, however...don't tell me...
4423 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4424 (Or you may be running DOS with DJGPP.)
4425 EOI
4426         echo exit 0 >os2
4427         ;;
4428 esac
4429 if test -f /xenix; then
4430         echo "Actually, this looks more like a XENIX system..."
4431         echo exit 0 >xenix
4432         d_xenix="$define"
4433 else
4434         echo " "
4435         echo "It's not Xenix..."
4436         d_xenix="$undef"
4437 fi
4438 chmod +x xenix
4439 $eunicefix xenix
4440 if test -f /venix; then
4441         echo "Actually, this looks more like a VENIX system..."
4442         echo exit 0 >venix
4443 else
4444         echo " "
4445         if ./xenix; then
4446                 : null
4447         else
4448                 echo "Nor is it Venix..."
4449         fi
4450 fi
4451 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4452 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4453 $rm -f foo
4454
4455 : Check if we are using GNU gcc and what its version is
4456 echo " "
4457 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4458 $cat >try.c <<EOM
4459 #include <stdio.h>
4460 int main() {
4461 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4462 #ifdef __VERSION__
4463         printf("%s\n", __VERSION__);
4464 #else
4465         printf("%s\n", "1");
4466 #endif
4467 #endif
4468         return(0);
4469 }
4470 EOM
4471 if $cc -o try $ccflags $ldflags try.c; then
4472         gccversion=`$run ./try`
4473         case "$gccversion" in
4474         '') echo "You are not using GNU cc." ;;
4475         *)  echo "You are using GNU cc $gccversion."
4476             ccname=gcc
4477             ;;
4478         esac
4479 else
4480         echo " "
4481         echo "*** WHOA THERE!!! ***" >&4
4482         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4483         case "$knowitall" in
4484         '')
4485         echo "    You'd better start hunting for one and let me know about it." >&4
4486                 exit 1
4487                 ;;
4488         esac
4489 fi
4490 $rm -f try try.*
4491 case "$gccversion" in
4492 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4493 esac
4494 case "$gccversion" in
4495 '') gccosandvers='' ;;
4496 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4497    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4498    gccshortvers=''
4499    case "$gccosandvers" in
4500    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4501    $osname$osvers) ;; # looking good
4502    $osname*) cat <<EOM >&4
4503
4504 *** WHOA THERE!!! ***
4505
4506     Your gcc has not been compiled for the exact release of
4507     your operating system ($gccosandvers versus $osname$osvers).
4508
4509     In general it is a good idea to keep gcc synchronized with
4510     the operating system because otherwise serious problems
4511     may ensue when trying to compile software, like Perl.
4512
4513     I'm trying to be optimistic here, though, and will continue.
4514     If later during the configuration and build icky compilation
4515     problems appear (headerfile conflicts being the most common
4516     manifestation), I suggest reinstalling the gcc to match
4517     your operating system release.
4518
4519 EOM
4520       ;;
4521    *) gccosandvers='' ;; # failed to parse, better be silent
4522    esac
4523    ;;
4524 esac
4525 case "$ccname" in
4526 '') ccname="$cc" ;;
4527 esac
4528
4529 # gcc 3.* complain about adding -Idirectories that they already know about,
4530 # so we will take those off from locincpth.
4531 case "$gccversion" in
4532 3*)
4533     echo "main(){}">try.c
4534     for incdir in $locincpth; do
4535        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4536              grep '^c[cp]p*[01]: warning: changing search order '`
4537        if test "X$warn" != X; then
4538            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4539        fi
4540     done
4541     $rm -f try try.*
4542 esac
4543
4544 : What should the include directory be ?
4545 echo " "
4546 $echo $n "Hmm...  $c"
4547 dflt='/usr/include'
4548 incpath=''
4549 mips_type=''
4550 if $test -f /bin/mips && /bin/mips; then
4551         echo "Looks like a MIPS system..."
4552         $cat >usr.c <<'EOCP'
4553 #ifdef SYSTYPE_BSD43
4554 /bsd43
4555 #endif
4556 EOCP
4557         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4558                 dflt='/bsd43/usr/include'
4559                 incpath='/bsd43'
4560                 mips_type='BSD 4.3'
4561         else
4562                 mips_type='System V'
4563         fi
4564         $rm -f usr.c usr.out
4565         echo "and you're compiling with the $mips_type compiler and libraries."
4566         xxx_prompt=y
4567         echo "exit 0" >mips
4568 else
4569         echo "Doesn't look like a MIPS system."
4570         xxx_prompt=n
4571         echo "exit 1" >mips
4572 fi
4573 chmod +x mips
4574 $eunicefix mips
4575 case "$usrinc" in
4576 '') ;;
4577 *) dflt="$usrinc";;
4578 esac
4579 case "$xxx_prompt" in
4580 y)      fn=d/
4581         echo " "
4582         rp='Where are the include files you want to use?'
4583         . ./getfile
4584         usrinc="$ans"
4585         ;;
4586 *)      usrinc="$dflt"
4587         ;;
4588 esac
4589
4590 : see how we invoke the C preprocessor
4591 echo " "
4592 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4593 cat <<'EOT' >testcpp.c
4594 #define ABC abc
4595 #define XYZ xyz
4596 ABC.XYZ
4597 EOT
4598 cd ..
4599 if test ! -f cppstdin; then
4600         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4601                 # AIX cc -E doesn't show the absolute headerfile
4602                 # locations but we'll cheat by using the -M flag.
4603                 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
4604         else
4605                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4606         fi
4607 else
4608         echo "Keeping your $hint cppstdin wrapper."
4609 fi
4610 chmod 755 cppstdin
4611 wrapper=`pwd`/cppstdin
4612 ok='false'
4613 cd UU
4614
4615 if $test "X$cppstdin" != "X" && \
4616         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4617         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4618 then
4619         echo "You used to use $cppstdin $cppminus so we'll use that again."
4620         case "$cpprun" in
4621         '') echo "But let's see if we can live without a wrapper..." ;;
4622         *)
4623                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4624                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4625                 then
4626                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4627                         ok='true'
4628                 else
4629                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4630                 fi
4631                 ;;
4632         esac
4633 else
4634         case "$cppstdin" in
4635         '') ;;
4636         *)
4637                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4638                 ;;
4639         esac
4640 fi
4641
4642 if $ok; then
4643         : nothing
4644 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4645         $cc -E <testcpp.c >testcpp.out 2>&1; \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647         echo "Yup, it does."
4648         x_cpp="$cc -E"
4649         x_minus='';
4650 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4651         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4653         echo "Yup, it does."
4654         x_cpp="$cc -E"
4655         x_minus='-';
4656 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4657         $cc -P <testcpp.c >testcpp.out 2>&1; \
4658         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4659         echo "Yipee, that works!"
4660         x_cpp="$cc -P"
4661         x_minus='';
4662 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4663         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4665         echo "At long last!"
4666         x_cpp="$cc -P"
4667         x_minus='-';
4668 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4669         $cpp <testcpp.c >testcpp.out 2>&1; \
4670         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4671         echo "It works!"
4672         x_cpp="$cpp"
4673         x_minus='';
4674 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4675         $cpp - <testcpp.c >testcpp.out 2>&1; \
4676         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677         echo "Hooray, it works!  I was beginning to wonder."
4678         x_cpp="$cpp"
4679         x_minus='-';
4680 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4681         $wrapper <testcpp.c >testcpp.out 2>&1; \
4682         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4683         x_cpp="$wrapper"
4684         x_minus=''
4685         echo "Eureka!"
4686 else
4687         dflt=''
4688         rp="No dice.  I can't find a C preprocessor.  Name one:"
4689         . ./myread
4690         x_cpp="$ans"
4691         x_minus=''
4692         $x_cpp <testcpp.c >testcpp.out 2>&1
4693         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694                 echo "OK, that will do." >&4
4695         else
4696 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4697                 exit 1
4698         fi
4699 fi
4700
4701 case "$ok" in
4702 false)
4703         cppstdin="$x_cpp"
4704         cppminus="$x_minus"
4705         cpprun="$x_cpp"
4706         cpplast="$x_minus"
4707         set X $x_cpp
4708         shift
4709         case "$1" in
4710         "$cpp")
4711                 echo "Perhaps can we force $cc -E using a wrapper..."
4712                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4713                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4714                 then
4715                         echo "Yup, we can."
4716                         cppstdin="$wrapper"
4717                         cppminus='';
4718                 else
4719                         echo "Nope, we'll have to live without it..."
4720                 fi
4721                 ;;
4722         esac
4723         case "$cpprun" in
4724         "$wrapper")
4725                 cpprun=''
4726                 cpplast=''
4727                 ;;
4728         esac
4729         ;;
4730 esac
4731
4732 case "$cppstdin" in
4733 "$wrapper"|'cppstdin') ;;
4734 *) $rm -f $wrapper;;
4735 esac
4736 $rm -f testcpp.c testcpp.out
4737
4738 : Set private lib path
4739 case "$plibpth" in
4740 '') if ./mips; then
4741                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4742         fi;;
4743 esac
4744 case "$libpth" in
4745 ' ') dlist='';;
4746 '') dlist="$loclibpth $plibpth $glibpth";;
4747 *) dlist="$libpth";;
4748 esac
4749
4750 : Now check and see which directories actually exist, avoiding duplicates
4751 libpth=''
4752 for xxx in $dlist
4753 do
4754     if $test -d $xxx; then
4755                 case " $libpth " in
4756                 *" $xxx "*) ;;
4757                 *) libpth="$libpth $xxx";;
4758                 esac
4759     fi
4760 done
4761 $cat <<'EOM'
4762
4763 Some systems have incompatible or broken versions of libraries.  Among
4764 the directories listed in the question below, please remove any you
4765 know not to be holding relevant libraries, and add any that are needed.
4766 Say "none" for none.
4767
4768 EOM
4769 case "$libpth" in
4770 '') dflt='none';;
4771 *)
4772         set X $libpth
4773         shift
4774         dflt=${1+"$@"}
4775         ;;
4776 esac
4777 rp="Directories to use for library searches?"
4778 . ./myread
4779 case "$ans" in
4780 none) libpth=' ';;
4781 *) libpth="$ans";;
4782 esac
4783
4784 : compute shared library extension
4785 case "$so" in
4786 '')
4787         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4788                 dflt='sl'
4789         else
4790                 dflt='so'
4791         fi
4792         ;;
4793 *) dflt="$so";;
4794 esac
4795 $cat <<EOM
4796
4797 On some systems, shared libraries may be available.  Answer 'none' if
4798 you want to suppress searching of shared libraries for the remainder
4799 of this configuration.
4800
4801 EOM
4802 rp='What is the file extension used for shared libraries?'
4803 . ./myread
4804 so="$ans"
4805
4806 : Define several unixisms.
4807 : Hints files or command line option can be used to override them.
4808 : The convoluted testing is in case hints files set either the old
4809 : or the new name.
4810 case "$_exe" in
4811 '')     case "$exe_ext" in
4812         '')     ;;
4813         *)      _exe="$exe_ext" ;;
4814         esac
4815         ;;
4816 esac
4817 case "$_a" in
4818 '')     case "$lib_ext" in
4819     '') _a='.a';;
4820         *)      _a="$lib_ext" ;;
4821         esac
4822         ;;
4823 esac
4824 case "$_o" in
4825 '') case "$obj_ext" in
4826         '')     _o='.o';;
4827         *)      _o="$obj_ext";;
4828         esac
4829         ;;
4830 esac
4831 case "$p_" in
4832 '') case "$path_sep" in
4833         '')     p_=':';;
4834         *)      p_="$path_sep";;
4835         esac
4836         ;;
4837 esac
4838 exe_ext=$_exe
4839 lib_ext=$_a
4840 obj_ext=$_o
4841 path_sep=$p_
4842
4843 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4844
4845 : Which makefile gets called first.  This is used by make depend.
4846 case "$firstmakefile" in
4847 '') firstmakefile='makefile';;
4848 esac
4849
4850 : Check for uselongdouble support
4851 case "$ccflags" in
4852 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4853 esac
4854
4855 case "$uselongdouble" in
4856 $define|true|[yY]*)     dflt='y';;
4857 *) dflt='n';;
4858 esac
4859 cat <<EOM
4860
4861 Perl can be built to take advantage of long doubles which
4862 (if available) may give more accuracy and range for floating point numbers.
4863
4864 If this doesn't make any sense to you, just accept the default '$dflt'.
4865 EOM
4866 rp='Try to use long doubles if available?'
4867 . ./myread
4868 case "$ans" in
4869 y|Y)    val="$define"   ;;
4870 *)      val="$undef"    ;;
4871 esac
4872 set uselongdouble
4873 eval $setvar
4874
4875 case "$uselongdouble" in
4876 true|[yY]*) uselongdouble="$define" ;;
4877 esac
4878
4879 : Look for a hint-file generated 'call-back-unit'.  If the
4880 : user has specified that long doubles should be used,
4881 : we may need to set or change some other defaults.
4882 if $test -f uselongdouble.cbu; then
4883     echo "Your platform has some specific hints regarding long doubles, using them..."
4884     . ./uselongdouble.cbu
4885 else
4886     case "$uselongdouble" in
4887         $define)
4888                 $cat <<EOM
4889 (Your platform does not have any specific hints for long doubles.)
4890 EOM
4891         ;;
4892     esac
4893 fi
4894
4895 : Looking for optional libraries
4896 echo " "
4897 echo "Checking for optional libraries..." >&4
4898 case "$libs" in
4899 ' '|'') dflt='';;
4900 *) dflt="$libs";;
4901 esac
4902 case "$libswanted" in
4903 '') libswanted='c_s';;
4904 esac
4905 case "$usesocks" in
4906 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4907 esac
4908 libsfound=''
4909 libsfiles=''
4910 libsdirs=''
4911 libspath=''
4912 for thisdir in $libpth $xlibpth; do
4913   test -d $thisdir && libspath="$libspath $thisdir"
4914 done
4915 for thislib in $libswanted; do
4916         for thisdir in $libspath; do
4917             xxx=''
4918             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4919                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=shared
4922             fi
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib$thislib.$so
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=shared
4927             fi
4928             if test ! -f "$xxx"; then
4929                 xxx=$thisdir/lib$thislib$_a
4930                 $test -f "$xxx" && eval $libscheck
4931                 $test -f "$xxx" && libstyle=static
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/$thislib$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937             fi
4938             if test ! -f "$xxx"; then
4939                 xxx=$thisdir/lib${thislib}_s$_a
4940                 $test -f "$xxx" && eval $libscheck
4941                 $test -f "$xxx" && libstyle=static
4942                 $test -f "$xxx" && thislib=${thislib}_s
4943             fi
4944             if test ! -f "$xxx"; then
4945                 xxx=$thisdir/Slib$thislib$_a
4946                 $test -f "$xxx" && eval $libscheck
4947                 $test -f "$xxx" && libstyle=static
4948             fi
4949             if $test -f "$xxx"; then
4950                 case "$libstyle" in
4951                 shared) echo "Found -l$thislib (shared)." ;;
4952                 static) echo "Found -l$thislib." ;;
4953                 *)      echo "Found -l$thislib ($libstyle)." ;;
4954                 esac
4955                 case " $dflt " in
4956                 *"-l$thislib "*);;
4957                 *) dflt="$dflt -l$thislib"
4958                    libsfound="$libsfound $xxx"
4959                    yyy=`basename $xxx`
4960                    libsfiles="$libsfiles $yyy"
4961                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4962                    case " $libsdirs " in
4963                    *" $yyy "*) ;;
4964                    *) libsdirs="$libsdirs $yyy" ;;
4965                    esac
4966                    ;;
4967                 esac
4968                 break
4969             fi
4970         done
4971         if $test ! -f "$xxx"; then
4972             echo "No -l$thislib."
4973         fi
4974 done
4975 set X $dflt
4976 shift
4977 dflt="$*"
4978 case "$libs" in
4979 '') dflt="$dflt";;
4980 *) dflt="$libs";;
4981 esac
4982 case "$dflt" in
4983 ' '|'') dflt='none';;
4984 esac
4985
4986 $cat <<EOM
4987
4988 In order to compile $package on your machine, a number of libraries
4989 are usually needed.  Include any other special libraries here as well.
4990 Say "none" for none.  The default list is almost always right.
4991 EOM
4992
4993 echo " "
4994 rp="What libraries to use?"
4995 . ./myread
4996 case "$ans" in
4997 none) libs=' ';;
4998 *) libs="$ans";;
4999 esac
5000
5001 : determine optimization, if desired, or use for debug flag also
5002 case "$optimize" in
5003 ' '|$undef) dflt='none';;
5004 '') dflt='-O';;
5005 *) dflt="$optimize";;
5006 esac
5007 $cat <<EOH
5008
5009 By default, $package compiles with the -O flag to use the optimizer.
5010 Alternately, you might want to use the symbolic debugger, which uses
5011 the -g flag (on traditional Unix systems).  Either flag can be
5012 specified here.  To use neither flag, specify the word "none".
5013
5014 EOH
5015 rp="What optimizer/debugger flag should be used?"
5016 . ./myread
5017 optimize="$ans"
5018 case "$optimize" in
5019 'none') optimize=" ";;
5020 esac
5021
5022 : Check what DEBUGGING is required from the command line
5023 : -DEBUGGING      or -DDEBUGGING or
5024 : -DEBUGGING=both                       = -g + -DDEBUGGING
5025 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5026 : -DEBUGGING=none or -UDEBUGGING        =
5027 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5028 case "$EBUGGING" in
5029 '')     ;;
5030 *)      DEBUGGING=$EBUGGING ;;
5031 esac
5032
5033 case "$DEBUGGING" in
5034 -g|both|$define)
5035     case "$optimize" in
5036         *-g*) ;;
5037         *)    optimize="$optimize -g" ;;
5038     esac ;;
5039 none|$undef)
5040     case "$optimize" in
5041         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5042                 shift
5043                 optimize="$*"
5044                 ;;
5045     esac ;;
5046 esac
5047
5048 dflt=''
5049 case "$DEBUGGING" in
5050 both|$define) dflt='-DDEBUGGING'
5051 esac
5052
5053 : argument order is deliberate, as the flag will start with - which set could
5054 : think is an option
5055 checkccflag='check=$1; flag=$2; callback=$3;
5056 echo " ";
5057 echo "Checking if your compiler accepts $flag" 2>&1;
5058 echo "int main(void) { return 0; }" > gcctest.c;
5059 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5060     echo "Yes, it does." 2>&1;
5061     if $test -s gcctest.out ; then
5062         echo "But your platform does not like it:";
5063         cat gcctest.out;
5064     else
5065         case "$ccflags" in
5066         *$check*)
5067             echo "Leaving current flags $ccflags alone." 2>&1
5068             ;;
5069         *) dflt="$dflt $flag";
5070             eval $callback
5071             ;;
5072         esac
5073     fi
5074 else
5075     echo "Nope, it does not, but that is ok." 2>&1;
5076 fi
5077 '
5078
5079 : We will not override a previous value, but we might want to
5080 : augment a hint file
5081 case "$hint" in
5082 default|recommended)
5083         case "$gccversion" in
5084         1*) dflt="$dflt -fpcc-struct-return" ;;
5085         esac
5086         case "$optimize:$DEBUGGING" in
5087         *-g*:old) dflt="$dflt -DDEBUGGING";;
5088         esac
5089         case "$gccversion" in
5090         2*) if $test -d /etc/conf/kconfig.d &&
5091                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5092                 then
5093                         # Interactive Systems (ISC) POSIX mode.
5094                         dflt="$dflt -posix"
5095                 fi
5096                 ;;
5097         esac
5098         case "$gccversion" in
5099         1*) ;;
5100         2.[0-8]*) ;;
5101         ?*)     set strict-aliasing -fno-strict-aliasing
5102                 eval $checkccflag
5103                 ;;
5104         esac
5105         # For gcc, adding -pipe speeds up compilations for some, but apparently
5106         # some assemblers can't read from stdin.  (It also slows down compilations
5107         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5108         case "$gccversion" in
5109         ?*)     set pipe -pipe
5110                 eval $checkccflag
5111                 ;;
5112         esac
5113
5114         # on x86_64 (at least) we require an extra library (libssp) in the
5115         # link command line. This library is not named, so I infer that it is
5116         # an implementation detail that may change. Hence the safest approach
5117         # is to add the flag to the flags passed to the compiler at link time,
5118         # as that way the compiler can do the right implementation dependant
5119         # thing. (NWC)
5120         case "$gccversion" in
5121         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5122                 eval $checkccflag
5123                 ;;
5124         esac
5125         ;;
5126 esac
5127
5128 case "$mips_type" in
5129 *BSD*|'') inclwanted="$locincpth $usrinc";;
5130 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5131 esac
5132 for thisincl in $inclwanted; do
5133         if $test -d $thisincl; then
5134                 if $test x$thisincl != x$usrinc; then
5135                         case "$dflt" in
5136                         *" -I$thisincl "*);;
5137                         *) dflt="$dflt -I$thisincl ";;
5138                         esac
5139                 fi
5140         fi
5141 done
5142
5143 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5144         xxx=true;
5145 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5146         xxx=true;
5147 else
5148         xxx=false;
5149 fi;
5150 if $xxx; then
5151         case "$dflt" in
5152         *$2*);;
5153         *) dflt="$dflt -D$2";;
5154         esac;
5155 fi'
5156
5157 set signal.h LANGUAGE_C; eval $inctest
5158
5159 case "$usesocks" in
5160 $define)
5161         ccflags="$ccflags -DSOCKS"
5162         ;;
5163 esac
5164
5165 case "$hint" in
5166 default|recommended) dflt="$ccflags $dflt" ;;
5167 *) dflt="$ccflags";;
5168 esac
5169
5170 case "$dflt" in
5171 ''|' ') dflt=none;;
5172 esac
5173
5174 $cat <<EOH
5175
5176 Your C compiler may want other flags.  For this question you should include
5177 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5178 but you should NOT include libraries or ld flags like -lwhatever.  If you
5179 want $package to honor its debug switch, you should include -DDEBUGGING here.
5180 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5181
5182 To use no flags, specify the word "none".
5183
5184 EOH
5185 set X $dflt
5186 shift
5187 dflt=${1+"$@"}
5188 rp="Any additional cc flags?"
5189 . ./myread
5190 case "$ans" in
5191 none) ccflags='';;
5192 *) ccflags="$ans";;
5193 esac
5194
5195 : the following weeds options from ccflags that are of no interest to cpp
5196 case "$cppflags" in
5197 '') cppflags="$ccflags" ;;
5198 *)  cppflags="$cppflags $ccflags" ;;
5199 esac
5200 case "$gccversion" in
5201 1*) cppflags="$cppflags -D__GNUC__"
5202 esac
5203 case "$mips_type" in
5204 '');;
5205 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5206 esac
5207 case "$cppflags" in
5208 '');;
5209 *)
5210         echo " "
5211         echo "Let me guess what the preprocessor flags are..." >&4
5212         set X $cppflags
5213         shift
5214         cppflags=''
5215         $cat >cpp.c <<'EOM'
5216 #define BLURFL foo
5217
5218 BLURFL xx LFRULB
5219 EOM
5220         previous=''
5221         for flag in $*
5222         do
5223                 case "$flag" in
5224                 -*) ftry="$flag";;
5225                 *) ftry="$previous $flag";;
5226                 esac
5227                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5228                         >cpp1.out 2>/dev/null && \
5229                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5230                         >cpp2.out 2>/dev/null && \
5231                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5232                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5233                 then
5234                         cppflags="$cppflags $ftry"
5235                         previous=''
5236                 else
5237                         previous="$flag"
5238                 fi
5239         done
5240         set X $cppflags
5241         shift
5242         cppflags=${1+"$@"}
5243         case "$cppflags" in
5244         *-*)  echo "They appear to be: $cppflags";;
5245         esac
5246         $rm -f cpp.c cpp?.out
5247         ;;
5248 esac
5249
5250 : flags used in final linking phase
5251 case "$ldflags" in
5252 '') if ./venix; then
5253                 dflt='-i -z'
5254         else
5255                 dflt=''
5256         fi
5257         case "$ccflags" in
5258         *-posix*) dflt="$dflt -posix" ;;
5259         esac
5260         ;;
5261 *) dflt="$ldflags";;
5262 esac
5263
5264 : Try to guess additional flags to pick up local libraries.
5265 for thislibdir in $libpth; do
5266         case " $loclibpth " in
5267         *" $thislibdir "*)
5268                 case "$dflt " in
5269                 *"-L$thislibdir "*) ;;
5270                 *)  dflt="$dflt -L$thislibdir" ;;
5271                 esac
5272                 ;;
5273         esac
5274 done
5275
5276 case "$dflt" in
5277 '') dflt='none' ;;
5278 esac
5279
5280 $cat <<EOH
5281
5282 Your C linker may need flags.  For this question you should
5283 include -L/whatever and any other flags used by the C linker, but you
5284 should NOT include libraries like -lwhatever.
5285
5286 Make sure you include the appropriate -L/path flags if your C linker
5287 does not normally search all of the directories you specified above,
5288 namely
5289         $libpth
5290 To use no flags, specify the word "none".
5291
5292 EOH
5293
5294 rp="Any additional ld flags (NOT including libraries)?"
5295 . ./myread
5296 case "$ans" in
5297 none) ldflags='';;
5298 *) ldflags="$ans";;
5299 esac
5300 rmlist="$rmlist pdp11"
5301
5302 : coherency check
5303 echo " "
5304 echo "Checking your choice of C compiler and flags for coherency..." >&4
5305 $cat > try.c <<'EOF'
5306 #include <stdio.h>
5307 int main() { printf("Ok\n"); return(0); }
5308 EOF
5309 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5310 shift
5311 $cat >try.msg <<'EOM'
5312 I've tried to compile and run the following simple program:
5313
5314 EOM
5315 $cat try.c >> try.msg
5316
5317 $cat >> try.msg <<EOM
5318
5319 I used the command:
5320
5321         $*
5322         $run ./try
5323
5324 and I got the following output:
5325
5326 EOM
5327 dflt=y
5328 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5329         if $sh -c "$run ./try " >>try.msg 2>&1; then
5330                 xxx=`$run ./try`
5331                 case "$xxx" in
5332                 "Ok") dflt=n ;;
5333                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5334                         case " $libs " in
5335                         *" -lsfio "*)
5336                                 cat >> try.msg <<'EOQS'
5337 If $libs contains -lsfio, and sfio is mis-configured, then it
5338 sometimes (apparently) runs and exits with a 0 status, but with no
5339 output!  It may have to do with sfio's use of _exit vs. exit.
5340
5341 EOQS
5342                                 rp="You have a big problem.  Shall I abort Configure"
5343                                 dflt=y
5344                                 ;;
5345                         esac
5346                         ;;
5347                 esac
5348         else
5349                 echo "The program compiled OK, but exited with status $?." >>try.msg
5350                 rp="You have a problem.  Shall I abort Configure"
5351                 dflt=y
5352         fi
5353 else
5354         echo "I can't compile the test program." >>try.msg
5355         rp="You have a BIG problem.  Shall I abort Configure"
5356         dflt=y
5357 fi
5358 case "$dflt" in
5359 y)
5360         $cat try.msg >&4
5361         case "$knowitall" in
5362         '')
5363                 echo "(The supplied flags or libraries might be incorrect.)"
5364                 ;;
5365         *) dflt=n;;
5366         esac
5367         echo " "
5368         . ./myread
5369         case "$ans" in
5370         n*|N*) ;;
5371         *)      echo "Ok.  Stopping Configure." >&4
5372                 exit 1
5373                 ;;
5374         esac
5375         ;;
5376 n) echo "OK, that should do.";;
5377 esac
5378 $rm_try gcctest gcctest.out
5379
5380 : define a shorthand compile call
5381 compile='
5382 mc_file=$1;
5383 shift;
5384 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5385 : define a shorthand compile call for compilations that should be ok.
5386 compile_ok='
5387 mc_file=$1;
5388 shift;
5389 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5390
5391 : determine filename position in cpp output
5392 echo " "
5393 echo "Computing filename position in cpp output for #include directives..." >&4
5394 case "$osname" in
5395 vos) testaccess=-e ;;
5396 *)   testaccess=-r ;;
5397 esac
5398 echo '#include <stdio.h>' > foo.c
5399 $cat >fieldn <<EOF
5400 $startsh
5401 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5402 $grep '^[       ]*#.*stdio\.h' | \
5403 while read cline; do
5404         pos=1
5405         set \$cline
5406         while $test \$# -gt 0; do
5407                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5408                         echo "\$pos"
5409                         exit 0
5410                 fi
5411                 shift
5412                 pos=\`expr \$pos + 1\`
5413         done
5414 done
5415 EOF
5416 chmod +x fieldn
5417 fieldn=`./fieldn`
5418 $rm -f foo.c fieldn
5419 case $fieldn in
5420 '') pos='???';;
5421 1) pos=first;;
5422 2) pos=second;;
5423 3) pos=third;;
5424 *) pos="${fieldn}th";;
5425 esac
5426 echo "Your cpp writes the filename in the $pos field of the line."
5427
5428 case "$osname" in
5429 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5430 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5431 *)   cppfilter='' ;;
5432 esac
5433 : locate header file
5434 $cat >findhdr <<EOF
5435 $startsh
5436 wanted=\$1
5437 name=''
5438 for usrincdir in $usrinc
5439 do
5440         if test -f \$usrincdir/\$wanted; then
5441                 echo "\$usrincdir/\$wanted"
5442                 exit 0
5443         fi
5444 done
5445 awkprg='{ print \$$fieldn }'
5446 echo "#include <\$wanted>" > foo\$\$.c
5447 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5448 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5449 while read cline; do
5450         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5451         case "\$name" in
5452         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5453         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5454         *) exit 2;;
5455         esac;
5456 done;
5457 #
5458 # status = 0: grep returned 0 lines, case statement not executed
5459 # status = 1: headerfile found
5460 # status = 2: while loop executed, no headerfile found
5461 #
5462 status=\$?
5463 $rm -f foo\$\$.c;
5464 if test \$status -eq 1; then
5465         exit 0;
5466 fi
5467 exit 1
5468 EOF
5469 chmod +x findhdr
5470
5471 : define an alternate in-header-list? function
5472 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5473 cont=true; xxf="echo \"<\$1> found.\" >&4";
5474 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5475 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5476 esac;
5477 case $# in 4) instead=instead;; *) instead="at last";; esac;
5478 while $test "$cont"; do
5479         xxx=`./findhdr $1`
5480         var=$2; eval "was=\$$2";
5481         if $test "$xxx" && $test -r "$xxx";
5482         then eval $xxf;
5483         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5484                 cont="";
5485         else eval $xxnf;
5486         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5487         set $yyy; shift; shift; yyy=$@;
5488         case $# in 0) cont="";;
5489         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5490                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5491         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5492                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5493         esac;
5494 done;
5495 while $test "$yyy";
5496 do set $yyy; var=$2; eval "was=\$$2";
5497         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5498         set $yyy; shift; shift; yyy=$@;
5499 done'
5500
5501 : see if stdlib is available
5502 set stdlib.h i_stdlib
5503 eval $inhdr
5504
5505 : check for lengths of integral types
5506 echo " "
5507 case "$intsize" in
5508 '')
5509         echo "Checking to see how big your integers are..." >&4
5510         $cat >try.c <<EOCP
5511 #include <stdio.h>
5512 #$i_stdlib I_STDLIB
5513 #ifdef I_STDLIB
5514 #include <stdlib.h>
5515 #endif
5516 int main()
5517 {
5518         printf("intsize=%d;\n", (int)sizeof(int));
5519         printf("longsize=%d;\n", (int)sizeof(long));
5520         printf("shortsize=%d;\n", (int)sizeof(short));
5521         exit(0);
5522 }
5523 EOCP
5524         set try
5525         if eval $compile_ok && $run ./try > /dev/null; then
5526                 eval `$run ./try`
5527                 echo "Your integers are $intsize bytes long."
5528                 echo "Your long integers are $longsize bytes long."
5529                 echo "Your short integers are $shortsize bytes long."
5530         else
5531                 $cat >&4 <<EOM
5532 !
5533 Help! I can't compile and run the intsize test program: please enlighten me!
5534 (This is probably a misconfiguration in your system or libraries, and
5535 you really ought to fix it.  Still, I'll try anyway.)
5536 !
5537 EOM
5538                 dflt=4
5539                 rp="What is the size of an integer (in bytes)?"
5540                 . ./myread
5541                 intsize="$ans"
5542                 dflt=$intsize
5543                 rp="What is the size of a long integer (in bytes)?"
5544                 . ./myread
5545                 longsize="$ans"
5546                 dflt=2
5547                 rp="What is the size of a short integer (in bytes)?"
5548                 . ./myread
5549                 shortsize="$ans"
5550         fi
5551         ;;
5552 esac
5553 $rm_try
5554
5555 : check for long long
5556 echo " "
5557 echo "Checking to see if you have long long..." >&4
5558 echo 'int main() { long long x = 7; return 0; }' > try.c
5559 set try
5560 if eval $compile; then
5561         val="$define"
5562         echo "You have long long."
5563 else
5564         val="$undef"
5565         echo "You do not have long long."
5566 fi
5567 $rm_try
5568 set d_longlong
5569 eval $setvar
5570
5571 : check for length of long long
5572 case "${d_longlong}${longlongsize}" in
5573 $define)
5574         echo " "
5575         echo "Checking to see how big your long longs are..." >&4
5576         $cat >try.c <<'EOCP'
5577 #include <stdio.h>
5578 int main()
5579 {
5580     printf("%d\n", (int)sizeof(long long));
5581     return(0);
5582 }
5583 EOCP
5584         set try
5585         if eval $compile_ok; then
5586                 longlongsize=`$run ./try`
5587                 echo "Your long longs are $longlongsize bytes long."
5588         else
5589                 dflt='8'
5590                 echo " "
5591                 echo "(I can't seem to compile the test program.  Guessing...)"
5592                 rp="What is the size of a long long (in bytes)?"
5593                 . ./myread
5594                 longlongsize="$ans"
5595         fi
5596         if $test "X$longsize" = "X$longlongsize"; then
5597                 echo "(That isn't any different from an ordinary long.)"
5598         fi
5599         ;;
5600 esac
5601 $rm_try
5602
5603 : see if inttypes.h is available
5604 : we want a real compile instead of Inhdr because some systems
5605 : have an inttypes.h which includes non-existent headers
5606 echo " "
5607 $cat >try.c <<EOCP
5608 #include <inttypes.h>
5609 int main() {
5610         static int32_t foo32 = 0x12345678;
5611 }
5612 EOCP
5613 set try
5614 if eval $compile; then
5615         echo "<inttypes.h> found." >&4
5616         val="$define"
5617 else
5618         echo "<inttypes.h> NOT found." >&4
5619         val="$undef"
5620 fi
5621 $rm_try
5622 set i_inttypes
5623 eval $setvar
5624
5625 : check for int64_t
5626 echo " "
5627 echo "Checking to see if you have int64_t..." >&4
5628 $cat >try.c <<EOCP
5629 #include <sys/types.h>
5630 #$i_inttypes I_INTTYPES
5631 #ifdef I_INTTYPES
5632 #include <inttypes.h>
5633 #endif
5634 int main() { int64_t x = 7; }
5635 EOCP
5636 set try
5637 if eval $compile; then
5638         val="$define"
5639         echo "You have int64_t."
5640 else
5641         val="$undef"
5642         echo "You do not have int64_t."
5643 fi
5644 $rm_try
5645 set d_int64_t
5646 eval $setvar
5647
5648 : Check if 64bit ints have a quad type
5649 echo " "
5650 echo "Checking which 64-bit integer type we could use..." >&4
5651
5652 case "$intsize" in
5653 8) val=int
5654    set quadtype
5655    eval $setvar
5656    val='"unsigned int"'
5657    set uquadtype
5658    eval $setvar
5659    quadkind=1
5660    ;;
5661 *) case "$longsize" in
5662    8) val=long
5663       set quadtype
5664       eval $setvar
5665       val='"unsigned long"'
5666       set uquadtype
5667       eval $setvar
5668       quadkind=2
5669       ;;
5670    *) case "$d_longlong:$longlongsize" in
5671       define:8)
5672         val='"long long"'
5673         set quadtype
5674         eval $setvar
5675         val='"unsigned long long"'
5676         set uquadtype
5677         eval $setvar
5678         quadkind=3
5679         ;;
5680       *) case "$d_int64_t" in
5681          define)
5682            val=int64_t
5683            set quadtype
5684            eval $setvar
5685            val=uint64_t
5686            set uquadtype
5687            eval $setvar
5688            quadkind=4
5689            ;;
5690          esac
5691          ;;
5692       esac
5693       ;;
5694    esac
5695    ;;
5696 esac
5697
5698 case "$quadtype" in
5699 '')     echo "Alas, no 64-bit integer types in sight." >&4
5700         d_quad="$undef"
5701         ;;
5702 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5703         d_quad="$define"
5704         ;;
5705 esac
5706
5707 : Do we want 64bit support
5708 case "$uselonglong" in
5709 "$define"|true|[yY]*)
5710         cat <<EOM >&4
5711
5712 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5713 EOM
5714         use64bitint="$define"
5715         ;;
5716 esac
5717 case "$use64bits" in
5718 "$define"|true|[yY]*)
5719         cat <<EOM >&4
5720
5721 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5722 EOM
5723         use64bitint="$define"
5724         ;;
5725 esac
5726 case "$use64bitints" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac
5735 case "$use64bitsint" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac
5744 case "$uselonglongs" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$use64bitsall" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5758 EOM
5759         use64bitall="$define"
5760         ;;
5761 esac
5762
5763 case "$ccflags" in
5764 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5765 esac
5766 case "$use64bitall" in
5767 "$define"|true|[yY]*) use64bitint="$define" ;;
5768 esac
5769
5770 case "$longsize" in
5771 8) cat <<EOM
5772
5773 You have natively 64-bit long integers.
5774 EOM
5775    val="$define"
5776    ;;
5777 *) case "$use64bitint" in
5778    "$define"|true|[yY]*) dflt='y';;
5779    *) dflt='n';;
5780    esac
5781    case "$d_quad" in
5782    "$define") ;;
5783    *) dflt='n' ;;
5784    esac
5785    cat <<EOM
5786
5787 Perl can be built to take advantage of 64-bit integer types
5788 on some systems.  To do so, Configure can be run with -Duse64bitint.
5789 Choosing this option will most probably introduce binary incompatibilities.
5790
5791 If this doesn't make any sense to you, just accept the default '$dflt'.
5792 (The default has been chosen based on your configuration.)
5793 EOM
5794    rp='Try to use 64-bit integers, if available?'
5795    . ./myread
5796    case "$ans" in
5797    [yY]*) val="$define" ;;
5798    *)     val="$undef"  ;;
5799    esac
5800    ;;
5801 esac
5802 set use64bitint
5803 eval $setvar
5804
5805 case "$use64bitall" in
5806 "$define"|true|[yY]*) dflt='y' ;;
5807 *) case "$longsize" in
5808    8) dflt='y' ;;
5809    *) dflt='n' ;;
5810    esac
5811    ;;
5812 esac
5813 cat <<EOM
5814
5815 You may also choose to try maximal 64-bitness.  It means using as much
5816 64-bitness as possible on the platform.  This in turn means even more
5817 binary incompatibilities.  On the other hand, your platform may not
5818 have any more 64-bitness available than what you already have chosen.
5819
5820 If this doesn't make any sense to you, just accept the default '$dflt'.
5821 (The default has been chosen based on your configuration.)
5822 EOM
5823 rp='Try to use maximal 64-bit support, if available?'
5824 . ./myread
5825 case "$ans" in
5826 [yY]*) val="$define" ;;
5827 *)     val="$undef"  ;;
5828 esac
5829 set use64bitall
5830 eval $setvar
5831 case "$use64bitall" in
5832 "$define")
5833         case "$use64bitint" in
5834         "$undef")
5835                 cat <<EOM
5836
5837 Since you have chosen a maximally 64-bit build, I'm also turning on
5838 the use of 64-bit integers.
5839 EOM
5840                 use64bitint="$define" ;;
5841         esac
5842         ;;
5843 esac
5844
5845 : Look for a hint-file generated 'call-back-unit'.  If the
5846 : user has specified that a 64-bit perl is to be built,
5847 : we may need to set or change some other defaults.
5848 if $test -f use64bitint.cbu; then
5849         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5850         . ./use64bitint.cbu
5851 fi
5852 case "$use64bitint" in
5853 "$define"|true|[yY]*)
5854         case "$longsize" in
5855         4) case "$archname64" in
5856            '') archname64=64int ;;
5857            esac
5858            ;;
5859         esac
5860         ;;
5861 esac
5862
5863 : Look for a hint-file generated 'call-back-unit'.  If the
5864 : user has specified that a maximally 64-bit perl is to be built,
5865 : we may need to set or change some other defaults.
5866 if $test -f use64bitall.cbu; then
5867         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5868         . ./use64bitall.cbu
5869 fi
5870 case "$use64bitall" in
5871 "$define"|true|[yY]*)
5872         case "$longsize" in
5873         4) case "$archname64" in
5874            ''|64int) archname64=64all ;;
5875            esac
5876            ;;
5877         esac
5878         ;;
5879 esac
5880
5881 case "$d_quad:$use64bitint" in
5882 $undef:$define)
5883         cat >&4 <<EOF
5884
5885 *** You have chosen to use 64-bit integers,
5886 *** but none can be found.
5887 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5888 *** Cannot continue, aborting.
5889
5890 EOF
5891         exit 1
5892         ;;
5893 esac
5894
5895 : check for length of double
5896 echo " "
5897 case "$doublesize" in
5898 '')
5899         echo "Checking to see how big your double precision numbers are..." >&4
5900         $cat >try.c <<EOCP
5901 #include <stdio.h>
5902 #$i_stdlib I_STDLIB
5903 #ifdef I_STDLIB
5904 #include <stdlib.h>
5905 #endif
5906 int main()
5907 {
5908     printf("%d\n", (int)sizeof(double));
5909     exit(0);
5910 }
5911 EOCP
5912         set try
5913         if eval $compile_ok; then
5914                 doublesize=`$run ./try`
5915                 echo "Your double is $doublesize bytes long."
5916         else
5917                 dflt='8'
5918                 echo "(I can't seem to compile the test program.  Guessing...)"
5919                 rp="What is the size of a double precision number (in bytes)?"
5920                 . ./myread
5921                 doublesize="$ans"
5922         fi
5923         ;;
5924 esac
5925 $rm_try
5926
5927 : check for long doubles
5928 echo " "
5929 echo "Checking to see if you have long double..." >&4
5930 echo 'int main() { long double x = 7.0; }' > try.c
5931 set try
5932 if eval $compile; then
5933         val="$define"
5934         echo "You have long double."
5935 else
5936         val="$undef"
5937         echo "You do not have long double."
5938 fi
5939 $rm_try
5940 set d_longdbl
5941 eval $setvar
5942
5943 : check for length of long double
5944 case "${d_longdbl}${longdblsize}" in
5945 $define)
5946         echo " "
5947         echo "Checking to see how big your long doubles are..." >&4
5948         $cat >try.c <<'EOCP'
5949 #include <stdio.h>
5950 int main()
5951 {
5952         printf("%d\n", sizeof(long double));
5953 }
5954 EOCP
5955         set try
5956         set try
5957         if eval $compile; then
5958                 longdblsize=`$run ./try`
5959                 echo "Your long doubles are $longdblsize bytes long."
5960         else
5961                 dflt='8'
5962                 echo " "
5963                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5964                 rp="What is the size of a long double (in bytes)?"
5965                 . ./myread
5966                 longdblsize="$ans"
5967         fi
5968         if $test "X$doublesize" = "X$longdblsize"; then
5969                 echo "That isn't any different from an ordinary double."
5970                 echo "I'll keep your setting anyway, but you may see some"
5971                 echo "harmless compilation warnings."
5972         fi
5973         ;;
5974 esac
5975 $rm_try
5976
5977 : determine the architecture name
5978 echo " "
5979 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5980         tarch=`arch`"-$osname"
5981 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5982         if uname -m > tmparch 2>&1 ; then
5983                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5984                         -e 's/$/'"-$osname/" tmparch`
5985         else
5986                 tarch="$osname"
5987         fi
5988         $rm -f tmparch
5989 else
5990         tarch="$osname"
5991 fi
5992 case "$myarchname" in
5993 ''|"$tarch") ;;
5994 *)
5995         echo "(Your architecture name used to be $myarchname.)"
5996         archname=''
5997         ;;
5998 esac
5999 case "$targetarch" in
6000 '') ;;
6001 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6002 esac
6003 myarchname="$tarch"
6004 case "$archname" in
6005 '') dflt="$tarch";;
6006 *) dflt="$archname";;
6007 esac
6008 rp='What is your architecture name'
6009 . ./myread
6010 archname="$ans"
6011 case "$usethreads" in
6012 $define)
6013         echo "Threads selected." >&4
6014         case "$archname" in
6015         *-thread*) echo "...and architecture name already has -thread." >&4
6016                 ;;
6017         *)      archname="$archname-thread"
6018                 echo "...setting architecture name to $archname." >&4
6019                 ;;
6020         esac
6021         ;;
6022 esac
6023 case "$usemultiplicity" in
6024 $define)
6025         echo "Multiplicity selected." >&4
6026         case "$archname" in
6027         *-multi*) echo "...and architecture name already has -multi." >&4
6028                 ;;
6029         *)      archname="$archname-multi"
6030                 echo "...setting architecture name to $archname." >&4
6031                 ;;
6032         esac
6033         ;;
6034 esac
6035 case "$use64bitint$use64bitall" in
6036 *"$define"*)
6037         case "$archname64" in
6038         '')
6039                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6040                 ;;
6041         *)
6042                 case "$use64bitint" in
6043                 "$define") echo "64 bit integers selected." >&4 ;;
6044                 esac
6045                 case "$use64bitall" in
6046                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6047                 esac
6048                 case "$archname" in
6049                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6050                         ;;
6051                 *)      archname="$archname-$archname64"
6052                         echo "...setting architecture name to $archname." >&4
6053                         ;;
6054                 esac
6055                 ;;
6056         esac
6057 esac
6058 case "$uselongdouble" in
6059 $define)
6060         echo "Long doubles selected." >&4
6061         case "$longdblsize" in
6062         $doublesize)
6063                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6064                 ;;
6065         *)
6066                 case "$archname" in
6067                 *-ld*) echo "...and architecture name already has -ld." >&4
6068                         ;;
6069                 *)      archname="$archname-ld"
6070                         echo "...setting architecture name to $archname." >&4
6071                         ;;
6072                 esac
6073                 ;;
6074         esac
6075         ;;
6076 esac
6077 case "$useperlio" in
6078 $define)
6079         echo "Perlio selected." >&4
6080         ;;
6081 *)
6082         echo "Perlio not selected, using stdio." >&4
6083         case "$archname" in
6084         *-stdio*) echo "...and architecture name already has -stdio." >&4
6085                 ;;
6086         *)      archname="$archname-stdio"
6087                 echo "...setting architecture name to $archname." >&4
6088                 ;;
6089         esac
6090         ;;
6091 esac
6092 if $test -f archname.cbu; then
6093         echo "Your platform has some specific hints for architecture name, using them..."
6094         . ./archname.cbu
6095 fi
6096
6097 : set the prefixit variable, to compute a suitable default value
6098 prefixit='case "$3" in
6099 ""|none)
6100         case "$oldprefix" in
6101         "") eval "$1=\"\$$2\"";;
6102         *)
6103                 case "$3" in
6104                 "") eval "$1=";;
6105                 none)
6106                         eval "tp=\"\$$2\"";
6107                         case "$tp" in
6108                         ""|" ") eval "$1=\"\$$2\"";;
6109                         *) eval "$1=";;
6110                         esac;;
6111                 esac;;
6112         esac;;
6113 *)
6114         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6115         case "$tp" in
6116         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6117         /*-$oldprefix/*|\~*-$oldprefix/*)
6118                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6119         *) eval "$1=\"\$$2\"";;
6120         esac;;
6121 esac'
6122
6123 : determine installation style
6124 : For now, try to deduce it from prefix unless it is already set.
6125 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6126 case "$installstyle" in
6127 '')     case "$prefix" in
6128                 *perl*) dflt='lib';;
6129                 *) dflt='lib/perl5' ;;
6130         esac
6131         ;;
6132 *)      dflt="$installstyle" ;;
6133 esac
6134 : Probably not worth prompting for this since we prompt for all
6135 : the directories individually, and the prompt would be too long and
6136 : confusing anyway.
6137 installstyle=$dflt
6138
6139 : determine where public executables go
6140 echo " "
6141 set dflt bin bin
6142 eval $prefixit
6143 fn=d~
6144 rp='Pathname where the public executables will reside?'
6145 . ./getfile
6146 if $test "X$ansexp" != "X$binexp"; then
6147         installbin=''
6148 fi
6149 prefixvar=bin
6150 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6151 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6152 :     this via initialinstalllocation
6153 . ./setprefixvar
6154
6155 case "$userelocatableinc" in
6156 $define|true|[yY]*)     dflt='y' ;;
6157 *)                      dflt='n' ;;
6158 esac
6159 cat <<EOM
6160
6161 Would you like to build Perl so that the installation is relocatable, so that
6162 library paths in @INC are determined relative to the path of the perl binary?
6163 This is not advised for system Perl installs, or if you need to run setid
6164 scripts or scripts under taint mode.
6165
6166 If this doesn't make any sense to you, just accept the default '$dflt'.
6167 EOM
6168 rp='Use relocatable @INC?'
6169 . ./myread
6170 case "$ans" in
6171 y|Y)    val="$define" ;;
6172 *)      val="$undef"  ;;
6173 esac
6174 set userelocatableinc
6175 eval $setvar
6176
6177 initialinstalllocation="$binexp"
6178 : Default prefix is now "up one level from where the binaries are"
6179 case "$userelocatableinc" in
6180 $define|true|[yY]*)
6181     bin=".../"
6182     binexp=".../"
6183     prefix=".../.."
6184     prefixexp=".../.."
6185     installprefixexp=".../.."
6186     ;;
6187 esac
6188
6189 : determine where private library files go
6190 : Usual default is /usr/local/lib/perl5/$version.
6191 : Also allow things like /opt/perl/lib/$version, since
6192 : /opt/perl/lib/perl5... would be redundant.
6193 : The default "style" setting is made in installstyle.U
6194 case "$installstyle" in
6195 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6196 *)       set dflt privlib lib/$version ;;
6197 esac
6198 eval $prefixit
6199 $cat <<EOM
6200
6201 There are some auxiliary files for $package that need to be put into a
6202 private library directory that is accessible by everyone.
6203
6204 EOM
6205 fn=$binexp
6206 fn=d~+
6207 rp='Pathname where the private library files will reside?'
6208 . ./getfile
6209 prefixvar=privlib
6210 . ./setprefixvar
6211
6212 : set the prefixup variable, to restore leading tilda escape
6213 prefixup='case "$prefixexp" in
6214 "$prefix") ;;
6215 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6216 esac'
6217
6218 : determine where public architecture dependent libraries go
6219 set archlib archlib
6220 eval $prefixit
6221 : privlib default is /usr/local/lib/$package/$version
6222 : archlib default is /usr/local/lib/$package/$version/$archname
6223 : privlib may have an optional trailing /share.
6224 tdflt=`echo $privlib | $sed 's,/share$,,'`
6225 tdflt=$tdflt/$archname
6226 case "$archlib" in
6227 '')     dflt=$tdflt
6228         ;;
6229 *)      dflt="$archlib"
6230     ;;
6231 esac
6232 $cat <<EOM
6233
6234 $spackage contains architecture-dependent library files.  If you are
6235 sharing libraries in a heterogeneous environment, you might store
6236 these files in a separate location.  Otherwise, you can just include
6237 them with the rest of the public library files.
6238
6239 EOM
6240 fn=$binexp
6241 fn=d+~
6242 rp='Where do you want to put the public architecture-dependent libraries?'
6243 . ./getfile
6244 prefixvar=archlib
6245 . ./setprefixvar
6246 if $test X"$archlib" = X"$privlib"; then
6247         d_archlib="$undef"
6248 else
6249         d_archlib="$define"
6250 fi
6251
6252 : see if setuid scripts can be secure
6253 $cat <<EOM
6254
6255 Some kernels have a bug that prevents setuid #! scripts from being
6256 secure.  Some sites have disabled setuid #! scripts because of this.
6257
6258 First let's decide if your kernel supports secure setuid #! scripts.
6259 (If setuid #! scripts would be secure but have been disabled anyway,
6260 don't say that they are secure if asked.)
6261
6262 EOM
6263
6264 val="$undef"
6265 if $test -d /dev/fd; then
6266         echo "#!$ls" >reflect
6267         chmod +x,u+s reflect
6268         ./reflect >flect 2>&1
6269         if $contains "/dev/fd" flect >/dev/null; then
6270                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6271                 val="$define"
6272         else
6273                 $cat <<EOM
6274 If you are not sure if they are secure, I can check but I'll need a
6275 username and password different from the one you are using right now.
6276 If you don't have such a username or don't want me to test, simply
6277 enter 'none'.
6278
6279 EOM
6280                 rp='Other username to test security of setuid scripts with?'
6281                 dflt='none'
6282                 . ./myread
6283                 case "$ans" in
6284                 n|none)
6285                         case "$d_suidsafe" in
6286                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6287                                 dflt=n;;
6288                         "$undef")
6289                                 echo "Well, the $hint value is *not* secure." >&4
6290                                 dflt=n;;
6291                         *)      echo "Well, the $hint value *is* secure." >&4
6292                                 dflt=y;;
6293                         esac
6294                         ;;
6295                 *)
6296                         $rm -f reflect flect
6297                         echo "#!$ls" >reflect
6298                         chmod +x,u+s reflect
6299                         echo >flect
6300                         chmod a+w flect
6301                         echo '"su" will (probably) prompt you for '"$ans's password."
6302                         su $ans -c './reflect >flect'
6303                         if $contains "/dev/fd" flect >/dev/null; then
6304                                 echo "Okay, it looks like setuid scripts are secure." >&4
6305                                 dflt=y
6306                         else
6307                                 echo "I don't think setuid scripts are secure." >&4
6308                                 dflt=n
6309                         fi
6310                         ;;
6311                 esac
6312                 rp='Does your kernel have *secure* setuid scripts?'
6313                 . ./myread
6314                 case "$ans" in
6315                 [yY]*)  val="$define";;
6316                 *)      val="$undef";;
6317                 esac
6318         fi
6319 else
6320         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6321         echo "(That's for file descriptors, not floppy disks.)"
6322         val="$undef"
6323 fi
6324 set d_suidsafe
6325 eval $setvar
6326
6327 $rm -f reflect flect
6328
6329 : now see if they want to do setuid emulation
6330 echo " "
6331 val="$undef"
6332 case "$d_suidsafe" in
6333 "$define")
6334         val="$undef"
6335         echo "No need to emulate SUID scripts since they are secure here." >&4
6336         ;;
6337 *)
6338         $cat <<EOM
6339 Some systems have disabled setuid scripts, especially systems where
6340 setuid scripts cannot be secure.  On systems where setuid scripts have
6341 been disabled, the setuid/setgid bits on scripts are currently
6342 useless.  It is possible for $package to detect those bits and emulate
6343 setuid/setgid in a secure fashion.  This emulation will only work if
6344 setuid scripts have been disabled in your kernel.
6345
6346 EOM
6347         case "$d_dosuid" in
6348         "$define") dflt=y ;;
6349         *) dflt=n ;;
6350         esac
6351         rp="Do you want to do setuid/setgid emulation?"
6352         . ./myread
6353         case "$ans" in
6354         [yY]*)  val="$define";;
6355         *)      val="$undef";;
6356         esac
6357         ;;
6358 esac
6359 set d_dosuid
6360 eval $setvar
6361
6362 : Find perl5.005 or later.
6363 echo "Looking for a previously installed perl5.005 or later... "
6364 case "$perl5" in
6365 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6366                 : Check if this perl is recent and can load a simple module
6367                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6368                         perl5=$tdir/perl
6369                         break;
6370                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371                         perl5=$tdir/perl5
6372                         break;
6373                 fi
6374         done
6375         ;;
6376 *)      perl5="$perl5"
6377         ;;
6378 esac
6379 case "$perl5" in
6380 '')     echo "None found.  That's ok.";;
6381 *)      echo "Using $perl5." ;;
6382 esac
6383
6384 : Set the siteprefix variables
6385 $cat <<EOM
6386
6387 After $package is installed, you may wish to install various
6388 add-on modules and utilities.  Typically, these add-ons will
6389 be installed under $prefix with the rest
6390 of this package.  However, you may wish to install such add-ons
6391 elsewhere under a different prefix.
6392
6393 If you do not wish to put everything under a single prefix, that's
6394 ok.  You will be prompted for the individual locations; this siteprefix
6395 is only used to suggest the defaults.
6396
6397 The default should be fine for most people.
6398
6399 EOM
6400 fn=d~+
6401 rp='Installation prefix to use for add-on modules and utilities?'
6402 : XXX Here might be another good place for an installstyle setting.
6403 case "$siteprefix" in
6404 '') dflt=$prefix ;;
6405 *)  dflt=$siteprefix ;;
6406 esac
6407 . ./getfile
6408 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6409 oldsiteprefix=''
6410 case "$siteprefix" in
6411 '') ;;
6412 *)      case "$ans" in
6413         "$prefix") ;;
6414         *) oldsiteprefix="$prefix";;
6415         esac
6416         ;;
6417 esac
6418 siteprefix="$ans"
6419 siteprefixexp="$ansexp"
6420
6421 : determine where site specific libraries go.
6422 : Usual default is /usr/local/lib/perl5/site_perl/$version
6423 : The default "style" setting is made in installstyle.U
6424 : XXX No longer works with Prefixit stuff.
6425 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6426 case "$sitelib" in
6427 '') case "$installstyle" in
6428         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6429         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6430         esac
6431         ;;
6432 *)      dflt="$sitelib"
6433         ;;
6434 esac
6435 $cat <<EOM
6436
6437 The installation process will create a directory for
6438 site-specific extensions and modules.  Most users find it convenient
6439 to place all site-specific files in this directory rather than in the
6440 main distribution directory.
6441
6442 EOM
6443 fn=d~+
6444 rp='Pathname for the site-specific library files?'
6445 . ./getfile
6446 prefixvar=sitelib
6447 . ./setprefixvar
6448 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6449
6450 : Determine list of previous versions to include in @INC
6451 $cat > getverlist <<EOPL
6452 #!$perl5 -w
6453 use File::Basename;
6454 \$api_versionstring = "$api_versionstring";
6455 \$version = "$version";
6456 \$stem = "$sitelib_stem";
6457 \$archname = "$archname";
6458 EOPL
6459         $cat >> getverlist <<'EOPL'
6460 # The list found is store twice for each entry: the original name, and
6461 # the binary broken down version as pack "sss", so sorting is easy and
6462 # unambiguous. This will work for all versions that have a maximum of
6463 # three digit groups, separate by '.'s or '_'s. Names are extended with
6464 # ".0.0" to ensure at least three elements for the pack.
6465 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6466
6467 # Can't have leading @ because metaconfig interprets it as a command!
6468 ;@inc_version_list=();
6469 # XXX Redo to do opendir/readdir?
6470 if (-d $stem) {
6471     chdir($stem);
6472     ;@candidates = map {
6473         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6474 }
6475 else {
6476     ;@candidates = ();
6477 }
6478
6479 ($pversion, $aversion, $vsn5005) = map {
6480     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6481 foreach $d (@candidates) {
6482     if ($d->[1] lt $pversion) {
6483         if ($d->[1] ge $aversion) {
6484             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6485         }
6486         elsif ($d->[1] ge $vsn5005) {
6487             unshift(@inc_version_list, grep { -d } $d->[0]);
6488         }
6489     }
6490     else {
6491         # Skip newer version.  I.e. don't look in
6492         # 5.7.0 if we're installing 5.6.1.
6493     }
6494 }
6495
6496 if (@inc_version_list) {
6497     print join(' ', @inc_version_list);
6498 }
6499 else {
6500     # Blank space to preserve value for next Configure run.
6501     print " ";
6502 }
6503 EOPL
6504 chmod +x getverlist
6505 case "$inc_version_list" in
6506 '')     if test -x "$perl5$exe_ext"; then
6507                 dflt=`$perl5 getverlist`
6508         else
6509                 dflt='none'
6510         fi
6511         ;;
6512 $undef) dflt='none' ;;
6513 *)  eval dflt=\"$inc_version_list\" ;;
6514 esac
6515 case "$dflt" in
6516 ''|' ') dflt=none ;;
6517 esac
6518 case "$dflt" in
6519 5.005) dflt=none ;;
6520 esac
6521 $cat <<EOM
6522
6523 In order to ease the process of upgrading, this version of perl
6524 can be configured to use modules built and installed with earlier
6525 versions of perl that were installed under $prefix.  Specify here
6526 the list of earlier versions that this version of perl should check.
6527 If Configure detected no earlier versions of perl installed under
6528 $prefix, then the list will be empty.  Answer 'none' to tell perl
6529 to not search earlier versions.
6530
6531 The default should almost always be sensible, so if you're not sure,
6532 just accept the default.
6533 EOM
6534
6535 rp='List of earlier versions to include in @INC?'
6536 . ./myread
6537 case "$ans" in
6538 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6539 *) inc_version_list="$ans" ;;
6540 esac
6541 case "$inc_version_list" in
6542 ''|' ')
6543         inc_version_list_init='0'
6544         d_inc_version_list="$undef"
6545         ;;
6546 *)      inc_version_list_init=`echo $inc_version_list |
6547                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6548         d_inc_version_list="$define"
6549         ;;
6550 esac
6551 $rm -f getverlist
6552
6553 : see if this is a malloc.h system
6554 : we want a real compile instead of Inhdr because some systems have a
6555 : malloc.h that just gives a compile error saying to use stdlib.h instead
6556 echo " "
6557 $cat >try.c <<EOCP
6558 #include <stdlib.h>
6559 #include <malloc.h>
6560 int main () { return 0; }
6561 EOCP
6562 set try
6563 if eval $compile; then
6564     echo "<malloc.h> found." >&4
6565     val="$define"
6566 else
6567     echo "<malloc.h> NOT found." >&4
6568     val="$undef"
6569 fi
6570 $rm_try
6571 set i_malloc
6572 eval $setvar
6573
6574 : check for void type
6575 echo " "
6576 echo "Checking to see how well your C compiler groks the void type..." >&4
6577 case "$voidflags" in
6578 '')
6579         $cat >try.c <<EOCP
6580 #$i_stdlib I_STDLIB
6581 #ifdef I_STDLIB
6582 #include <stdlib.h>
6583 #endif
6584 #if TRY & 1
6585 void sub() {
6586 #else
6587 sub() {
6588 #endif
6589         extern void moo();      /* function returning void */
6590         void (*goo)();          /* ptr to func returning void */
6591 #if TRY & 8
6592         void *hue;              /* generic ptr */
6593 #endif
6594 #if TRY & 2
6595         void (*foo[10])();
6596 #endif
6597
6598 #if TRY & 4
6599         if(goo == moo) {
6600                 exit(0);
6601         }
6602 #endif
6603         exit(0);
6604 }
6605 int main() { sub(); }
6606 EOCP
6607         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6608                 voidflags=$defvoidused
6609         echo "Good.  It appears to support void to the level $package wants.">&4
6610                 if $contains warning .out >/dev/null 2>&1; then
6611                         echo "However, you might get some warnings that look like this:"
6612                         $cat .out
6613                 fi
6614         else
6615 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6616                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6617                         echo "It supports 1..."
6618                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6619                                 echo "It also supports 2..."
6620                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6621                                         voidflags=7
6622                                         echo "And it supports 4 but not 8 definitely."
6623                                 else
6624                                         echo "It doesn't support 4..."
6625                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6626                                                 voidflags=11
6627                                                 echo "But it supports 8."
6628                                         else
6629                                                 voidflags=3
6630                                                 echo "Neither does it support 8."
6631                                         fi
6632                                 fi
6633                         else
6634                                 echo "It does not support 2..."
6635                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6636                                         voidflags=13
6637                                         echo "But it supports 4 and 8."
6638                                 else
6639                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6640                                                 voidflags=5
6641                                                 echo "And it supports 4 but has not heard about 8."
6642                                         else
6643                                                 echo "However it supports 8 but not 4."
6644                                         fi
6645                                 fi
6646                         fi
6647                 else
6648                         echo "There is no support at all for void."
6649                         voidflags=0
6650                 fi
6651         fi
6652 esac
6653 case "$voidflags" in
6654 "$defvoidused") ;;
6655 *)      $cat >&4 <<'EOM'
6656   Support flag bits are:
6657     1: basic void declarations.
6658     2: arrays of pointers to functions returning void.
6659     4: operations between pointers to and addresses of void functions.
6660     8: generic void pointers.
6661 EOM
6662         dflt="$voidflags";
6663         rp="Your void support flags add up to what?"
6664         . ./myread
6665         voidflags="$ans"
6666         ;;
6667 esac
6668 $rm_try
6669
6670 : check for length of pointer
6671 echo " "
6672 case "$ptrsize" in
6673 '')
6674         echo "Checking to see how big your pointers are..." >&4
6675         if test "$voidflags" -gt 7; then
6676                 echo '#define VOID_PTR char *' > try.c
6677         else
6678                 echo '#define VOID_PTR void *' > try.c
6679         fi
6680         $cat >>try.c <<EOCP
6681 #include <stdio.h>
6682 #$i_stdlib I_STDLIB
6683 #ifdef I_STDLIB
6684 #include <stdlib.h>
6685 #endif
6686 int main()
6687 {
6688     printf("%d\n", (int)sizeof(VOID_PTR));
6689     exit(0);
6690 }
6691 EOCP
6692         set try
6693         if eval $compile_ok; then
6694                 ptrsize=`$run ./try`
6695                 echo "Your pointers are $ptrsize bytes long."
6696         else
6697                 dflt='4'
6698                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6699                 rp="What is the size of a pointer (in bytes)?"
6700                 . ./myread
6701                 ptrsize="$ans"
6702         fi
6703         ;;
6704 esac
6705 $rm_try
6706 case "$use64bitall" in
6707 "$define"|true|[yY]*)
6708         case "$ptrsize" in
6709         4)      cat <<EOM >&4
6710
6711 *** You have chosen a maximally 64-bit build,
6712 *** but your pointers are only 4 bytes wide.
6713 *** Please rerun Configure without -Duse64bitall.
6714 EOM
6715                 case "$d_quad" in
6716                 define)
6717                         cat <<EOM >&4
6718 *** Since you have quads, you could possibly try with -Duse64bitint.
6719 EOM
6720                         ;;
6721                 esac
6722                 cat <<EOM >&4
6723 *** Cannot continue, aborting.
6724
6725 EOM
6726
6727                 exit 1
6728                 ;;
6729         esac
6730         ;;
6731 esac
6732
6733
6734 : determine whether to use malloc wrapping
6735 echo " "
6736 case "$usemallocwrap" in
6737 [yY]*|true|$define)     dflt='y' ;;
6738 [nN]*|false|$undef)     dflt='n' ;;
6739 *)      case "$usedevel" in
6740         [yY]*|true|$define)     dflt='y' ;;
6741         *) dflt='n' ;;
6742         esac
6743         ;;
6744 esac
6745 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6746 . ./myread
6747 usemallocwrap="$ans"
6748 case "$ans" in
6749 y*|true)
6750         usemallocwrap="$define" ;;
6751 *)
6752         usemallocwrap="$undef" ;;
6753 esac
6754
6755 : determine which malloc to compile in
6756 echo " "
6757 case "$usemymalloc" in
6758 [yY]*|true|$define)     dflt='y' ;;
6759 [nN]*|false|$undef)     dflt='n' ;;
6760 *)      case "$ptrsize" in
6761         4) dflt='y' ;;
6762         *) dflt='n' ;;
6763         esac
6764         ;;
6765 esac
6766 rp="Do you wish to attempt to use the malloc that comes with $package?"
6767 . ./myread
6768 usemymalloc="$ans"
6769 case "$ans" in
6770 y*|true)
6771         usemymalloc='y'
6772         mallocsrc='malloc.c'
6773         mallocobj="malloc$_o"
6774         d_mymalloc="$define"
6775         case "$libs" in
6776         *-lmalloc*)
6777                 : Remove malloc from list of libraries to use
6778                 echo "Removing unneeded -lmalloc from library list" >&4
6779                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6780                 shift
6781                 libs="$*"
6782                 echo "libs = $libs" >&4
6783                 ;;
6784         esac
6785         ;;
6786 *)
6787         usemymalloc='n'
6788         mallocsrc=''
6789         mallocobj=''
6790         d_mymalloc="$undef"
6791         ;;
6792 esac
6793
6794 : compute the return types of malloc and free
6795 echo " "
6796 $cat >malloc.c <<END
6797 #$i_malloc I_MALLOC
6798 #$i_stdlib I_STDLIB
6799 #include <stdio.h>
6800 #include <sys/types.h>
6801 #ifdef I_MALLOC
6802 #include <malloc.h>
6803 #endif
6804 #ifdef I_STDLIB
6805 #include <stdlib.h>
6806 #endif
6807 #ifdef TRY_MALLOC
6808 void *malloc();
6809 #endif
6810 #ifdef TRY_FREE
6811 void free();
6812 #endif
6813 END
6814 case "$malloctype" in
6815 '')
6816         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6817                 malloctype='void *'
6818         else
6819                 malloctype='char *'
6820         fi
6821         ;;
6822 esac
6823 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6824
6825 case "$freetype" in
6826 '')
6827         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6828                 freetype='void'
6829         else
6830                 freetype='int'
6831         fi
6832         ;;
6833 esac
6834 echo "Your system uses $freetype free(), it would seem." >&4
6835 $rm -f malloc.[co]
6836 : determine where site specific architecture-dependent libraries go.
6837 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6838 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6839 : sitelib may have an optional trailing /share.
6840 case "$sitearch" in
6841 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6842         dflt="$dflt/$archname"
6843         ;;
6844 *)      dflt="$sitearch"
6845         ;;
6846 esac
6847 set sitearch sitearch none
6848 eval $prefixit
6849 $cat <<EOM
6850
6851 The installation process will also create a directory for
6852 architecture-dependent site-specific extensions and modules.
6853
6854 EOM
6855 fn=d~+
6856 rp='Pathname for the site-specific architecture-dependent library files?'
6857 . ./getfile
6858 prefixvar=sitearch
6859 . ./setprefixvar
6860 if $test X"$sitearch" = X"$sitelib"; then
6861         d_sitearch="$undef"
6862 else
6863         d_sitearch="$define"
6864 fi
6865
6866 : Set the vendorprefix variables
6867 $cat <<EOM
6868
6869 The installation process will also create a directory for
6870 vendor-supplied add-ons.  Vendors who supply perl with their system
6871 may find it convenient to place all vendor-supplied files in this
6872 directory rather than in the main distribution directory.  This will
6873 ease upgrades between binary-compatible maintenance versions of perl.
6874
6875 Of course you may also use these directories in whatever way you see
6876 fit.  For example, you might use them to access modules shared over a
6877 company-wide network.
6878
6879 The default answer should be fine for most people.
6880 This causes further questions about vendor add-ons to be skipped
6881 and no vendor-specific directories will be configured for perl.
6882
6883 EOM
6884 rp='Do you want to configure vendor-specific add-on directories?'
6885 case "$usevendorprefix" in
6886 define|true|[yY]*) dflt=y ;;
6887 *)      : User may have set vendorprefix directly on Configure command line.
6888         case "$vendorprefix" in
6889         ''|' ') dflt=n ;;
6890         *)      dflt=y ;;
6891         esac
6892         ;;
6893 esac
6894 . ./myread
6895 case "$ans" in
6896 [yY]*)  fn=d~+
6897         rp='Installation prefix to use for vendor-supplied add-ons?'
6898         case "$vendorprefix" in
6899         '') dflt='' ;;
6900         *)  dflt=$vendorprefix ;;
6901         esac
6902         . ./getfile
6903         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6904         oldvendorprefix=''
6905         case "$vendorprefix" in
6906         '') ;;
6907         *)      case "$ans" in
6908                 "$prefix") ;;
6909                 *) oldvendorprefix="$prefix";;
6910                 esac
6911                 ;;
6912         esac
6913         usevendorprefix="$define"
6914         vendorprefix="$ans"
6915         vendorprefixexp="$ansexp"
6916         ;;
6917 *)      usevendorprefix="$undef"
6918         vendorprefix=''
6919         vendorprefixexp=''
6920         ;;
6921 esac
6922
6923 : Set the vendorlib variables
6924 case "$vendorprefix" in
6925 '')     d_vendorlib="$undef"
6926         vendorlib=''
6927         vendorlibexp=''
6928         ;;
6929 *)      d_vendorlib="$define"
6930         : determine where vendor-supplied modules go.
6931         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6932         case "$vendorlib" in
6933         '')
6934                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6935                 case "$installstyle" in
6936                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6937                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6938                 esac
6939                 ;;
6940         *)      dflt="$vendorlib"
6941                 ;;
6942         esac
6943         fn=d~+
6944         rp='Pathname for the vendor-supplied library files?'
6945         . ./getfile
6946         vendorlib="$ans"
6947         vendorlibexp="$ansexp"
6948         ;;
6949 esac
6950 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6951 prefixvar=vendorlib
6952 . ./installprefix
6953
6954 : Set the vendorarch variables
6955 case "$vendorprefix" in
6956 '')     d_vendorarch="$undef"
6957         vendorarch=''
6958         vendorarchexp=''
6959         ;;
6960 *)      d_vendorarch="$define"
6961         : determine where vendor-supplied architecture-dependent libraries go.
6962         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6963         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6964         : vendorlib may have an optional trailing /share.
6965         case "$vendorarch" in
6966         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6967                 dflt="$dflt/$archname"
6968                 ;;
6969         *)      dflt="$vendorarch" ;;
6970         esac
6971         fn=d~+
6972         rp='Pathname for vendor-supplied architecture-dependent files?'
6973         . ./getfile
6974         vendorarch="$ans"
6975         vendorarchexp="$ansexp"
6976         ;;
6977 esac
6978 prefixvar=vendorarch
6979 . ./installprefix
6980
6981 : Final catch-all directories to search
6982 $cat <<EOM
6983
6984 Lastly, you can have perl look in other directories for extensions and
6985 modules in addition to those already specified.
6986 These directories will be searched after 
6987         $sitearch 
6988         $sitelib 
6989 EOM
6990 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6991 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6992 echo ' '
6993 case "$otherlibdirs" in
6994 ''|' ') dflt='none' ;;
6995 *)      dflt="$otherlibdirs" ;;
6996 esac
6997 $cat <<EOM
6998 Enter a colon-separated set of extra paths to include in perl's @INC
6999 search path, or enter 'none' for no extra paths.
7000
7001 EOM
7002
7003 rp='Colon-separated list of additional directories for perl to search?'
7004 . ./myread
7005 case "$ans" in
7006 ' '|''|none)    otherlibdirs=' ' ;;     
7007 *)      otherlibdirs="$ans" ;;
7008 esac
7009 case "$otherlibdirs" in
7010 ' ') val=$undef ;;
7011 *)      val=$define ;;
7012 esac
7013 set d_perl_otherlibdirs
7014 eval $setvar
7015
7016 : Cruising for prototypes
7017 echo " "
7018 echo "Checking out function prototypes..." >&4
7019 $cat >prototype.c <<EOCP
7020 #$i_stdlib I_STDLIB
7021 #ifdef I_STDLIB
7022 #include <stdlib.h>
7023 #endif
7024 int main(int argc, char *argv[]) {
7025         exit(0);}
7026 EOCP
7027 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7028         echo "Your C compiler appears to support function prototypes."
7029         val="$define"
7030 else
7031         echo "Your C compiler doesn't seem to understand function prototypes."
7032         val="$undef"
7033 fi
7034 set prototype
7035 eval $setvar
7036 $rm -f prototype*
7037
7038 : Check if ansi2knr is required
7039 case "$prototype" in
7040 "$define") ;;
7041 *)      ansi2knr='ansi2knr'
7042         echo " "
7043         cat <<EOM >&4
7044
7045 $me:  FATAL ERROR:
7046 This version of $package can only be compiled by a compiler that 
7047 understands function prototypes.  Unfortunately, your C compiler 
7048         $cc $ccflags
7049 doesn't seem to understand them.  Sorry about that.
7050
7051 If GNU cc is available for your system, perhaps you could try that instead.  
7052
7053 Eventually, we hope to support building Perl with pre-ANSI compilers.
7054 If you would like to help in that effort, please contact <perlbug@perl.org>.
7055
7056 Aborting Configure now.
7057 EOM
7058         exit 2
7059         ;;
7060 esac
7061
7062 : DTrace support
7063 dflt_dtrace='/usr/sbin/dtrace'
7064 cat <<EOM
7065
7066 Perl can be built to support DTrace on platforms that support it.
7067 DTrace is a diagnosis and performance analysis tool from Sun.
7068
7069 If this doesn't make any sense to you, just accept the default '$dflt'.
7070 EOM
7071
7072 while $test 1 ; do
7073         case "$usedtrace" in
7074         $define|true|[yY]*)
7075                 dflt='y'
7076                 ;;
7077         ?*)
7078                 dflt='y'
7079                 dflt_dtrace=$usedtrace
7080                 ;;
7081         *)
7082                 dflt='n'
7083                 ;;
7084         esac
7085
7086         rp='Support DTrace if available?'
7087         . ./myread
7088         case "$ans" in
7089         y|Y)    val="$define" ;;
7090         *)      val="$undef" ;;
7091         esac
7092         set usedtrace
7093         eval $setvar
7094
7095         test "X$usedtrace" != "X$define" && break
7096
7097         echo " "
7098         rp='Where is the dtrace executable?'
7099         dflt=$dflt_dtrace
7100         . ./getfile
7101         val="$ans"
7102         set dtrace
7103         eval $setvar
7104
7105         if $test -f $dtrace
7106         then
7107                 if $dtrace -h -s ../perldtrace.d \
7108                         -o perldtrace.tmp >/dev/null 2>&1 \
7109                         && rm -f perldtrace.tmp
7110                 then
7111                         echo " "
7112                         echo "Good: your $dtrace knows about the -h flag."
7113                 else
7114                         cat >&2 <<EOM
7115
7116 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7117 ***
7118 *** Your installed dtrace doesn't support the -h switch to compile a D
7119 *** program into a C header. Can't continue.
7120
7121 EOM
7122                         exit 1
7123                 fi
7124                 break;
7125         fi
7126
7127         case "$fastread" in
7128         yes)
7129                 cat >&2 <<EOM
7130
7131 *** $me:  Fatal Error:  $dtrace not found.
7132 *** Can't continue.
7133
7134 EOM
7135                 exit 1
7136                 ;;
7137         *)
7138                 echo "*** $dtrace was not found."
7139                 echo " "
7140                 ;;
7141         esac
7142 done
7143
7144 : See if we want extra modules installed
7145 echo " "
7146 case "$extras" in
7147 '') dflt='n';;
7148 *) dflt='y';;
7149 esac
7150 cat <<EOM
7151 Perl can be built with extra modules or bundles of modules which
7152 will be fetched from the CPAN and installed alongside Perl.
7153
7154 Notice that you will need access to the CPAN; either via the Internet,
7155 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7156 be asked later to configure the CPAN.pm module which will in turn do
7157 the installation of the rest of the extra modules or bundles.)
7158
7159 Notice also that if the modules require any external software such as
7160 libraries and headers (the libz library and the zlib.h header for the
7161 Compress::Zlib module, for example) you MUST have any such software
7162 already installed, this configuration process will NOT install such
7163 things for you.
7164
7165 If this doesn't make any sense to you, just accept the default '$dflt'.
7166 EOM
7167 rp='Install any extra modules (y or n)?'
7168 . ./myread
7169 case "$ans" in
7170 y|Y)
7171         cat <<EOM
7172
7173 Please list any extra modules or bundles to be installed from CPAN,
7174 with spaces between the names.  The names can be in any format the
7175 'install' command of CPAN.pm will understand.  (Answer 'none',
7176 without the quotes, to install no extra modules or bundles.)
7177 EOM
7178         rp='Extras?'
7179         dflt="$extras"
7180         . ./myread
7181         extras="$ans"
7182 esac
7183 case "$extras" in
7184 ''|'none')
7185         val=''
7186         $rm -f ../extras.lst
7187         ;;
7188 *)      echo "(Saving the list of extras for later...)"
7189         echo "$extras" > ../extras.lst
7190         val="'$extras'"
7191         ;;
7192 esac
7193 set extras
7194 eval $setvar
7195 echo " "
7196
7197 : determine where html pages for programs go
7198 set html1dir html1dir none
7199 eval $prefixit
7200 $cat <<EOM
7201
7202 If you wish to install html files for programs in $spackage, indicate
7203 the appropriate directory here.  To skip installing html files,
7204 answer "none".
7205 EOM
7206 case "$html1dir" in
7207 ''|none|$undef|' ') dflt=none ;;
7208 *) dflt=$html1dir ;;
7209 esac
7210 fn=dn+~
7211 rp="Directory for the main $spackage html pages?"
7212 . ./getfile
7213 prefixvar=html1dir
7214 . ./setprefixvar
7215 : Use ' ' for none so value is preserved next time through Configure
7216 $test X"$html1dir" = "X" && html1dir=' '
7217
7218 : determine where html pages for libraries and modules go
7219 set html3dir html3dir none
7220 eval $prefixit
7221 $cat <<EOM
7222
7223 If you wish to install html files for modules associated with $spackage,
7224 indicate the appropriate directory here.  To skip installing html files,
7225 answer "none".
7226 EOM
7227 : There is no obvious default.  If they have specified html1dir, then
7228 : try to key off that, possibly changing .../html1 into .../html3.
7229 case "$html3dir" in
7230 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7231 *) dflt=$html3dir ;;
7232 esac
7233 fn=dn+~
7234 rp="Directory for the $spackage module html pages?"
7235 . ./getfile
7236 prefixvar=html3dir
7237 . ./setprefixvar
7238 : Use ' ' for none so value is preserved next time through Configure
7239 $test X"$html3dir" = "X" && html3dir=' '
7240
7241 : determine whether to install perl also as /usr/bin/perl
7242
7243 echo " "
7244 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7245         $cat <<EOM
7246 Many scripts expect perl to be installed as /usr/bin/perl.
7247
7248 If you want to, I can install the perl you are about to compile
7249 as /usr/bin/perl (in addition to $bin/perl).
7250 EOM
7251         if test -f /usr/bin/perl; then
7252             $cat <<EOM
7253
7254 However, please note that because you already have a /usr/bin/perl,
7255 overwriting that with a new Perl would very probably cause problems.
7256 Therefore I'm assuming you don't want to do that (unless you insist).
7257
7258 EOM
7259             case "$installusrbinperl" in
7260             "$define"|[yY]*)    dflt='y';;
7261             *)                  dflt='n';;
7262             esac
7263         else
7264             $cat <<EOM
7265
7266 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7267
7268 EOM
7269             case "$installusrbinperl" in
7270             "$undef"|[nN]*)     dflt='n';;
7271             *)                  dflt='y';;
7272             esac
7273         fi
7274         rp="Do you want to install perl as /usr/bin/perl?"
7275         . ./myread
7276         case "$ans" in
7277         [yY]*)  val="$define";;
7278         *)      val="$undef" ;;
7279         esac
7280 else
7281         val="$undef"
7282 fi
7283 set installusrbinperl
7284 eval $setvar
7285
7286 : Check if we are using the GNU C library
7287 echo " "
7288 echo "Checking for GNU C Library..." >&4
7289 cat >try.c <<'EOCP'
7290 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7291    alone are insufficient to distinguish different versions, such as
7292    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7293    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7294 */
7295 #include <stdio.h>
7296 int main(void)
7297 {
7298 #ifdef __GLIBC__
7299 #   ifdef __GLIBC_MINOR__
7300 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7301 #           include <gnu/libc-version.h>
7302             printf("%s\n",  gnu_get_libc_version());
7303 #       else
7304             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7305 #       endif
7306 #   else
7307         printf("%d\n",  __GLIBC__);
7308 #   endif
7309     return 0;
7310 #else
7311     return 1;
7312 #endif
7313 }
7314 EOCP
7315 set try
7316 if eval $compile_ok && $run ./try > glibc.ver; then
7317         val="$define"
7318         gnulibc_version=`$cat glibc.ver`
7319         echo "You are using the GNU C Library version $gnulibc_version"
7320 else
7321         val="$undef"
7322         gnulibc_version=''
7323         echo "You are not using the GNU C Library"
7324 fi
7325 $rm_try glibc.ver
7326 set d_gnulibc
7327 eval $setvar
7328
7329 : see if nm is to be used to determine whether a symbol is defined or not
7330 case "$usenm" in
7331 '')
7332         dflt=''
7333         case "$d_gnulibc" in
7334         "$define")
7335                 echo " "
7336                 echo "nm probably won't work on the GNU C Library." >&4
7337                 dflt=n
7338                 ;;
7339         esac
7340         case "$dflt" in
7341         '') 
7342                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7343                         echo " "
7344                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7345                         echo "'nm' won't be sufficient on this sytem." >&4
7346                         dflt=n
7347                 fi
7348                 ;;
7349         esac
7350         case "$dflt" in
7351         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7352                 if $test $dflt -gt 20; then
7353                         dflt=y
7354                 else
7355                         dflt=n
7356                 fi
7357                 ;;
7358         esac
7359         ;;
7360 *)
7361         case "$usenm" in
7362         true|$define) dflt=y;;
7363         *) dflt=n;;
7364         esac
7365         ;;
7366 esac
7367 $cat <<EOM
7368
7369 I can use $nm to extract the symbols from your C libraries. This
7370 is a time consuming task which may generate huge output on the disk (up
7371 to 3 megabytes) but that should make the symbols extraction faster. The
7372 alternative is to skip the 'nm' extraction part and to compile a small
7373 test program instead to determine whether each symbol is present. If
7374 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7375 this may be the best solution.
7376
7377 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7378
7379 EOM
7380 rp="Shall I use $nm to extract C symbols from the libraries?"
7381 . ./myread
7382 case "$ans" in
7383 [Nn]*) usenm=false;;
7384 *) usenm=true;;
7385 esac
7386
7387 runnm=$usenm
7388 case "$reuseval" in
7389 true) runnm=false;;
7390 esac
7391
7392 : nm options which may be necessary
7393 case "$nm_opt" in
7394 '') if $test -f /mach_boot; then
7395                 nm_opt=''       # Mach
7396         elif $test -d /usr/ccs/lib; then
7397                 nm_opt='-p'     # Solaris (and SunOS?)
7398         elif $test -f /dgux; then
7399                 nm_opt='-p'     # DG-UX
7400         elif $test -f /lib64/rld; then
7401                 nm_opt='-p'     # 64-bit Irix
7402         else
7403                 nm_opt=''
7404         fi;;
7405 esac
7406
7407 : nm options which may be necessary for shared libraries but illegal
7408 : for archive libraries.  Thank you, Linux.
7409 case "$nm_so_opt" in
7410 '')     case "$myuname" in
7411         *linux*|gnu*)
7412                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7413                         nm_so_opt='--dynamic'
7414                 fi
7415                 ;;
7416         esac
7417         ;;
7418 esac
7419
7420 : get list of predefined functions in a handy place
7421 case "$runnm" in
7422 true)
7423 echo " "
7424 case "$libc" in
7425 '') libc=unknown
7426         case "$libs" in
7427         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7428         esac
7429         ;;
7430 esac
7431 case "$libs" in
7432 '') ;;
7433 *)  for thislib in $libs; do
7434         case "$thislib" in
7435         -lc|-lc_s)
7436                 : Handle C library specially below.
7437                 ;;
7438         -l*)
7439                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7440                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7441                         :
7442                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7443                         :
7444                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7445                         :
7446                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7447                         :
7448                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7449                         :
7450                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7451                         :
7452                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7453                         :
7454                 else
7455                         try=''
7456                 fi
7457                 libnames="$libnames $try"
7458                 ;;
7459         *) libnames="$libnames $thislib" ;;
7460         esac
7461         done
7462         ;;
7463 esac
7464 xxx=normal
7465 case "$libc" in
7466 unknown)
7467         set /lib/libc.$so
7468         for xxx in $libpth; do
7469                 $test -r $1 || set $xxx/libc.$so
7470                 : The messy sed command sorts on library version numbers.
7471                 $test -r $1 || \
7472                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7473                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7474                                 h
7475                                 s/[0-9][0-9]*/0000&/g
7476                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7477                                 G
7478                                 s/\n/ /' | \
7479                          $sort | $sed -e 's/^.* //'`
7480                 eval set \$$#
7481         done
7482         $test -r $1 || set /usr/ccs/lib/libc.$so
7483         $test -r $1 || set /lib/libsys_s$_a
7484         ;;
7485 *)
7486         set blurfl
7487         ;;
7488 esac
7489 if $test -r "$1"; then
7490         echo "Your (shared) C library seems to be in $1."
7491         libc="$1"
7492 elif $test -r /lib/libc && $test -r /lib/clib; then
7493         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7494         xxx=apollo
7495         libc='/lib/clib /lib/libc'
7496         if $test -r /lib/syslib; then
7497                 echo "(Your math library is in /lib/syslib.)"
7498                 libc="$libc /lib/syslib"
7499         fi
7500 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7501         echo "Your C library seems to be in $libc, as you said before."
7502 elif $test -r $incpath/usr/lib/libc$_a; then
7503         libc=$incpath/usr/lib/libc$_a;
7504         echo "Your C library seems to be in $libc.  That's fine."
7505 elif $test -r /lib/libc$_a; then
7506         libc=/lib/libc$_a;
7507         echo "Your C library seems to be in $libc.  You're normal."
7508 else
7509         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7510                 :
7511         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7512                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7513         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7514                 :
7515         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7516                 :
7517         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7518                 :
7519         else
7520                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7521         fi
7522         if $test -r "$tans"; then
7523                 echo "Your C library seems to be in $tans, of all places."
7524                 libc=$tans
7525         else
7526                 libc='blurfl'
7527         fi
7528 fi
7529 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7530         dflt="$libc"
7531         cat <<EOM
7532
7533 If the guess above is wrong (which it might be if you're using a strange
7534 compiler, or your machine supports multiple models), you can override it here.
7535
7536 EOM
7537 else
7538         dflt=''
7539         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7540         cat >&4 <<EOM
7541 I can't seem to find your C library.  I've looked in the following places:
7542
7543 EOM
7544         $sed 's/^/      /' libpath
7545         cat <<EOM
7546
7547 None of these seems to contain your C library. I need to get its name...
7548
7549 EOM
7550 fi
7551 fn=f
7552 rp='Where is your C library?'
7553 . ./getfile
7554 libc="$ans"
7555
7556 echo " "
7557 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7558 set X `cat libnames`
7559 shift
7560 xxx=files
7561 case $# in 1) xxx=file; esac
7562 echo "Extracting names from the following $xxx for later perusal:" >&4
7563 echo " "
7564 $sed 's/^/      /' libnames >&4
7565 echo " "
7566 $echo $n "This may take a while...$c" >&4
7567
7568 for file in $*; do
7569         case $file in
7570         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7571         *) $nm $nm_opt $file 2>/dev/null;;
7572         esac
7573 done >libc.tmp
7574
7575 $echo $n ".$c"
7576 $grep fprintf libc.tmp > libc.ptf
7577 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7578 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7579 xxx='[ADTSIW]'
7580 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7581         eval $xscan;\
7582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7583                 eval $xrun
7584 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7585         eval $xscan;\
7586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7587                 eval $xrun
7588 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7589         eval $xscan;\
7590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7591                 eval $xrun
7592 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7593         eval $xscan;\
7594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7595                 eval $xrun
7596 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7597         eval $xscan;\
7598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7599                 eval $xrun
7600 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7601         eval $xscan;\
7602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7603                 eval $xrun
7604 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7605                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7606         eval $xscan;\
7607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7608                 eval $xrun
7609 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7610         eval $xscan;\
7611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7612                 eval $xrun
7613 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7614         eval $xscan;\
7615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7616                 eval $xrun
7617 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7618         eval $xscan;\
7619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620                 eval $xrun
7621 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7622         eval $xscan;\
7623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7624                 eval $xrun
7625 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7626         eval $xscan;\
7627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628                 eval $xrun
7629 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7630         eval $xscan;\
7631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632                 eval $xrun
7633 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 else
7638         $nm -p $* 2>/dev/null >libc.tmp
7639         $grep fprintf libc.tmp > libc.ptf
7640         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7641                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7642         then
7643                 nm_opt='-p'
7644                 eval $xrun
7645         else
7646                 echo " "
7647                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7648                 com=''
7649                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7650                         for thisname in $libnames $libc; do
7651                                 $ar t $thisname >>libc.tmp
7652                         done
7653                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7654                         echo "Ok." >&4
7655                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7656                         # Repeat libc to extract forwarders to DLL entries too
7657                         for thisname in $libnames $libc; do
7658                                 $ar tv $thisname >>libc.tmp
7659                                 # Revision 50 of EMX has bug in $ar.
7660                                 # it will not extract forwarders to DLL entries
7661                                 # Use emximp which will extract exactly them.
7662                                 emximp -o tmp.imp $thisname \
7663                                     2>/dev/null && \
7664                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7665                                     < tmp.imp >>libc.tmp
7666                                 $rm tmp.imp
7667                         done
7668                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7669                         echo "Ok." >&4
7670                 else
7671                         echo "$ar didn't seem to work right." >&4
7672                         echo "Maybe this is a Cray...trying bld instead..." >&4
7673                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7674                         then
7675                                 for thisname in $libnames; do
7676                                         bld t $libnames | \
7677                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7678                                         $ar t $thisname >>libc.tmp
7679                                 done
7680                                 echo "Ok." >&4
7681                         else
7682                                 echo "That didn't work either.  Giving up." >&4
7683                                 exit 1
7684                         fi
7685                 fi
7686         fi
7687 fi
7688 nm_extract="$com"
7689 case "$PASE" in
7690 define)
7691     echo " "
7692     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7693     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7694     ;;
7695 *)  if $test -f /lib/syscalls.exp; then
7696         echo " "
7697         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7698         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7699     fi
7700     ;;
7701 esac
7702 ;;
7703 esac
7704 $rm -f libnames libpath
7705
7706 : see if dld is available
7707 set dld.h i_dld
7708 eval $inhdr
7709
7710 : Check if we are using C++
7711 echo " "
7712 echo "Checking for C++..." >&4
7713 $cat >try.c <<'EOCP'
7714 #include <stdio.h>
7715 int main(void)
7716 {
7717 #ifdef __cplusplus
7718     return 0;
7719 #else
7720     return 1;
7721 #endif
7722 }
7723 EOCP
7724 set try
7725 if eval $compile_ok && $run ./try; then
7726         val="$define"
7727         echo "You are using a C++ compiler."
7728 else
7729         val="$undef"
7730         echo "You are not using a C++ compiler."
7731 fi
7732 $rm_try cplusplus$$
7733 set d_cplusplus
7734 eval $setvar
7735
7736 : is a C symbol defined?
7737 csym='tlook=$1;
7738 case "$3" in
7739 -v) tf=libc.tmp; tdc="";;
7740 -a) tf=libc.tmp; tdc="[]";;
7741 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7742 esac;
7743 tx=yes;
7744 case "$reuseval-$4" in
7745 true-) ;;
7746 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7747 esac;
7748 case "$tx" in
7749 yes)
7750         tval=false;
7751         case "$d_cplusplus" in
7752                 $define) extern_C=\"C\";;
7753         esac;
7754         if $test "$runnm" = true; then
7755                 if $contains $tlook $tf >/dev/null 2>&1; then
7756                         tval=true;
7757                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7758                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7759                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7760                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7761                         $rm_try;
7762                 fi;
7763         else
7764                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7765                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7766                 $rm_try;
7767         fi;
7768         ;;
7769 *)
7770         case "$tval" in
7771         $define) tval=true;;
7772         *) tval=false;;
7773         esac;
7774         ;;
7775 esac;
7776 eval "$2=$tval"'
7777
7778 : define an is-in-libc? function
7779 inlibc='echo " "; td=$define; tu=$undef;
7780 sym=$1; var=$2; eval "was=\$$2";
7781 tx=yes;
7782 case "$reuseval$was" in
7783 true) ;;
7784 true*) tx=no;;
7785 esac;
7786 case "$tx" in
7787 yes)
7788         set $sym tres -f;
7789         eval $csym;
7790         case "$tres" in
7791         true)
7792                 echo "$sym() found." >&4;
7793                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7794         *)
7795                 echo "$sym() NOT found." >&4;
7796                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7797         esac;;
7798 *)
7799         case "$was" in
7800         $define) echo "$sym() found." >&4;;
7801         *) echo "$sym() NOT found." >&4;;
7802         esac;;
7803 esac'
7804
7805 : see if dlopen exists
7806 xxx_runnm="$runnm"
7807 xxx_ccflags="$ccflags"
7808 runnm=false
7809 : with g++ one needs -shared to get is-in-libc to work for dlopen
7810 case "$gccversion" in
7811 '')     ;;
7812 *)      case "$d_cplusplus" in
7813         "$define") ccflags="$ccflags -shared" ;;
7814         esac
7815         ;;
7816 esac
7817 set dlopen d_dlopen
7818 eval $inlibc
7819 runnm="$xxx_runnm"
7820 ccflags="$xxx_ccflags"
7821
7822 : see if this is a unistd.h system
7823 set unistd.h i_unistd
7824 eval $inhdr
7825
7826 : determine which dynamic loading, if any, to compile in
7827 echo " "
7828 dldir="ext/DynaLoader"
7829 case "$usedl" in
7830 $define|y|true)
7831         dflt='y'
7832         usedl="$define"
7833         ;;
7834 $undef|n|false)
7835         dflt='n'
7836         usedl="$undef"
7837         ;;
7838 *)
7839         dflt='n'
7840         case "$d_dlopen" in
7841             $define) dflt='y' ;;
7842         esac
7843         case "$i_dld" in
7844             $define) dflt='y' ;;
7845         esac
7846         : Does a dl_xxx.xs file exist for this operating system
7847         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7848         ;;
7849 esac
7850 rp="Do you wish to use dynamic loading?"
7851 . ./myread
7852 usedl="$ans"
7853 case "$ans" in
7854 y*) usedl="$define"
7855         case "$dlsrc" in
7856         '')
7857                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7858                         dflt="$dldir/dl_${osname}.xs"
7859                 elif $test "$d_dlopen" = "$define" ; then
7860                         dflt="$dldir/dl_dlopen.xs"
7861                 elif $test "$i_dld" = "$define" ; then
7862                         dflt="$dldir/dl_dld.xs"
7863                 else
7864                         dflt=''
7865                 fi
7866                 ;;
7867         *)      dflt="$dldir/$dlsrc"
7868                 ;;
7869         esac
7870     echo "The following dynamic loading files are available:"
7871         : Can not go over to $dldir because getfile has path hard-coded in.
7872         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7873         rp="Source file to use for dynamic loading"
7874         fn="fne"
7875         gfpth="$src"
7876         . ./getfile
7877         usedl="$define"
7878         : emulate basename
7879         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7880
7881         $cat << EOM
7882
7883 Some systems may require passing special flags to $cc -c to
7884 compile modules that will be used to create a shared library.
7885 To use no flags, say "none".
7886
7887 EOM
7888     case "$cccdlflags" in
7889     '') case "$gccversion" in
7890                 '') case "$osname" in
7891                         hpux)   dflt='+z' ;;
7892                         next)   dflt='none' ;;
7893                         irix*)  dflt='-KPIC' ;;
7894                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7895                         sunos)  dflt='-pic' ;;
7896                         *)      dflt='none' ;;
7897                     esac
7898                         ;;
7899                 *)  case "$osname" in
7900                         darwin) dflt='none' ;;
7901                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7902                         *)      dflt='-fpic' ;;
7903                     esac ;;
7904             esac ;;
7905         ' ') dflt='none' ;;
7906     *)  dflt="$cccdlflags" ;;
7907     esac
7908     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7909     . ./myread
7910     case "$ans" in
7911     none) cccdlflags=' ' ;;
7912     *) cccdlflags="$ans" ;;
7913     esac
7914
7915     cat << EOM
7916
7917 Some systems use ld to create libraries that can be dynamically loaded,
7918 while other systems (such as those using ELF) use $cc.
7919
7920 EOM
7921         case "$ld" in
7922         '')     $cat >try.c <<EOM
7923 /* Test for whether ELF binaries are produced */
7924 #include <fcntl.h>
7925 #$i_stdlib I_STDLIB
7926 #ifdef I_STDLIB
7927 #include <stdlib.h>
7928 #endif
7929 #$i_unistd I_UNISTD
7930 #ifdef I_UNISTD
7931 #include <unistd.h>
7932 #endif
7933 int main() {
7934         char b[4];
7935         int i = open("a.out",O_RDONLY);
7936         if(i == -1)
7937                 exit(1); /* fail */
7938         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7939                 exit(0); /* succeed (yes, it's ELF) */
7940         else
7941                 exit(1); /* fail */
7942 }
7943 EOM
7944                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7945                         cat <<EOM
7946 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7947 EOM
7948                         dflt="$cc"
7949                 else
7950                         echo "I'll use ld to build dynamic libraries."
7951                         dflt='ld'
7952                 fi
7953                 $rm_try
7954                 ;;
7955         *)      dflt="$ld"
7956                 ;;
7957         esac
7958
7959     rp="What command should be used to create dynamic libraries?"
7960     . ./myread
7961         ld="$ans"
7962
7963     cat << EOM
7964
7965 Some systems may require passing special flags to $ld to create a
7966 library that can be dynamically loaded.  If your ld flags include
7967 -L/other/path options to locate libraries outside your loader's normal
7968 search path, you may need to specify those -L options here as well.  To
7969 use no flags, say "none".
7970
7971 EOM
7972     case "$lddlflags" in
7973     '') case "$osname" in
7974                         beos) dflt='-nostart' ;;
7975                         hpux) dflt='-b';
7976                               case "$gccversion" in
7977                               '') dflt="$dflt +vnocompatwarnings" ;;
7978                               esac
7979                               ;;
7980                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7981                         next)  dflt='none' ;;
7982                         solaris) dflt='-G' ;;
7983                         sunos) dflt='-assert nodefinitions' ;;
7984                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7985                 *)     dflt='none' ;;
7986                         esac
7987                         ;;
7988     *) dflt="$lddlflags" ;;
7989     esac
7990
7991         : Try to guess additional flags to pick up local libraries.
7992         : Be careful not to append to a plain 'none'
7993         case "$dflt" in
7994         none) dflt='' ;;
7995         esac
7996         for thisflag in $ldflags; do
7997                 case "$thisflag" in
7998                 -L*|-R*|-Wl,-R*)
7999                         case " $dflt " in
8000                         *" $thisflag "*) ;;
8001                         *) dflt="$dflt $thisflag" ;;
8002                         esac
8003                         ;;
8004                 esac
8005         done
8006
8007         case "$dflt" in
8008         ''|' ') dflt='none' ;;
8009         esac
8010
8011     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8012     . ./myread
8013     case "$ans" in
8014     none) lddlflags=' ' ;;
8015     *) lddlflags="$ans" ;;
8016     esac
8017
8018         cat <<EOM
8019
8020 Some systems may require passing special flags to $cc to indicate that
8021 the resulting executable will use dynamic linking.  To use no flags,
8022 say "none".
8023
8024 EOM
8025     case "$ccdlflags" in
8026     '') case "$osname" in
8027             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8028             next|sunos) dflt='none' ;;
8029             *)          dflt='none' ;;
8030             esac ;;
8031     ' ')  dflt='none' ;;
8032     *)  dflt="$ccdlflags" ;;
8033     esac
8034     rp="Any special flags to pass to $cc to use dynamic linking?"
8035     . ./myread
8036     case "$ans" in
8037     none) ccdlflags=' ' ;;
8038     *) ccdlflags="$ans" ;;
8039     esac
8040     ;;
8041 *)  usedl="$undef"
8042         ld='ld'
8043     dlsrc='dl_none.xs'
8044     lddlflags=''
8045     ccdlflags=''
8046     ;;
8047 esac
8048
8049 : Do we want a shared libperl?
8050 also=''
8051 case "$usedl" in
8052 $undef)
8053         # No dynamic loading being used, so don't bother even to prompt.
8054         useshrplib='false'
8055         ;;
8056 *)      case "$useshrplib" in
8057         '')     case "$osname" in
8058                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8059                         dflt=y
8060                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8061                         ;;
8062                 next*)
8063                         case "$osvers" in
8064                         4*)     dflt=y
8065                                 also='Building a shared libperl is needed for MAB support.'
8066                                 ;;
8067                         *)      dflt=n
8068                                 ;;
8069                         esac
8070                         ;;
8071                 *)      dflt=n
8072                         ;;
8073                 esac
8074                 ;;
8075         $define|true|[Yy]*)
8076                 dflt=y
8077                 ;;
8078         *)      dflt=n
8079                 ;;
8080         esac
8081         $cat << EOM
8082
8083 The perl executable is normally obtained by linking perlmain.c with
8084 libperl${_a}, any static extensions (usually just DynaLoader), and
8085 any other libraries needed on this system (such as -lm, etc.).  Since
8086 your system supports dynamic loading, it is probably possible to build
8087 a shared libperl.$so.  If you will have more than one executable linked
8088 to libperl.$so, this will significantly reduce the size of each
8089 executable, but it may have a noticeable effect on performance.  The
8090 default is probably sensible for your system.
8091 $also
8092
8093 EOM
8094         rp="Build a shared libperl.$so (y/n)"
8095         . ./myread
8096         case "$ans" in
8097         true|$define|[Yy]*)
8098                 useshrplib='true'  ;;
8099         *)      useshrplib='false' ;;
8100         esac
8101         ;;
8102 esac
8103
8104 case "$useshrplib" in
8105 true)
8106         case "$libperl" in
8107         '')
8108                 # Figure out a good name for libperl.so.  Since it gets stored in
8109                 # a version-specific architecture-dependent library, the version
8110                 # number isn't really that important, except for making cc/ld happy.
8111                 #
8112                 # A name such as libperl.so.3.1
8113                 majmin="libperl.$so.$patchlevel.$subversion"
8114                 # A name such as libperl.so.301
8115                 majonly=`echo $patchlevel $subversion |
8116                         $awk '{printf "%d%02d", $1, $2}'`
8117                 majonly=libperl.$so.$majonly
8118                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8119                 # rely on figuring it out from the naming of libc.
8120                 case "${osname}${osvers}" in
8121                 next4*)
8122                         dflt=libperl.5.$so
8123                         # XXX How handle the --version stuff for MAB?
8124                         ;;
8125                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8126                         dflt=libperl.$so
8127                         ;;
8128                 cygwin*) # ld links against an importlib
8129                         dflt=libperl$lib_ext
8130                         ;;
8131                 *)      # Try to guess based on whether libc has major.minor.
8132                         case "$libc" in
8133                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8134                         *libc.$so.[0-9]*) dflt=$majonly ;;
8135                         *)      dflt=libperl.$so ;;
8136                         esac
8137                         ;;
8138                 esac
8139                 ;;
8140         *)      dflt=$libperl
8141                 ;;
8142         esac
8143         cat << EOM
8144
8145 I need to select a good name for the shared libperl.  If your system uses
8146 library names with major and minor numbers, then you might want something
8147 like $majmin.  Alternatively, if your system uses a single version
8148 number for shared libraries, then you might want to use $majonly.
8149 Or, your system might be quite happy with a simple libperl.$so.
8150
8151 Since the shared libperl will get installed into a version-specific
8152 architecture-dependent directory, the version number of the shared perl
8153 library probably isn't important, so the default should be o.k.
8154
8155 EOM
8156         rp='What name do you want to give to the shared libperl?'
8157         . ./myread
8158         libperl=$ans
8159         echo "Ok, I'll use $libperl"
8160         ;;
8161 *)
8162         libperl="libperl${_a}"
8163         ;;
8164 esac
8165
8166 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8167 case "$shrpdir" in
8168 '') ;;
8169 *)      $cat >&4 <<EOM
8170 WARNING:  Use of the shrpdir variable for the installation location of
8171 the shared $libperl is not supported.  It was never documented and
8172 will not work in this version.  Let me (perlbug@perl.org)
8173 know of any problems this may cause.
8174
8175 EOM
8176         case "$shrpdir" in
8177         "$archlibexp/CORE")
8178                 $cat >&4 <<EOM
8179 But your current setting of $shrpdir is
8180 the default anyway, so it's harmless.
8181 EOM
8182                 ;;
8183         *)
8184                 $cat >&4 <<EOM
8185 Further, your current attempted setting of $shrpdir
8186 conflicts with the value of $archlibexp/CORE
8187 that installperl will use.
8188 EOM
8189                 ;;
8190         esac
8191         ;;
8192 esac
8193
8194 # How will the perl executable find the installed shared $libperl?
8195 # Add $xxx to ccdlflags.
8196 # If we can't figure out a command-line option, use $shrpenv to
8197 # set env LD_RUN_PATH.  The main perl makefile uses this.
8198 shrpdir=$archlibexp/CORE
8199 xxx=''
8200 tmp_shrpenv=''
8201 if "$useshrplib"; then
8202     case "$osname" in
8203         aix)
8204                 # We'll set it in Makefile.SH...
8205                 ;;
8206         solaris)
8207                 xxx="-R $shrpdir"
8208                 ;;
8209         freebsd|netbsd|openbsd|interix|dragonfly)
8210                 xxx="-Wl,-R$shrpdir"
8211                 ;;
8212         bsdos|linux|irix*|dec_osf|gnu*)
8213                 xxx="-Wl,-rpath,$shrpdir"
8214                 ;;
8215         next)
8216                 # next doesn't like the default...
8217                 ;;
8218         beos)
8219                 # beos doesn't like the default, either.
8220                 ;;
8221         hpux*)
8222                 # hpux doesn't like the default, either.
8223                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8224                 ;;
8225         *)
8226                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8227                 ;;
8228         esac
8229         case "$xxx" in
8230         '') ;;
8231         *)
8232                 # Only add $xxx if it isn't already in ccdlflags.
8233                 case " $ccdlflags " in
8234                 *" $xxx "*)     ;;
8235                 *)      ccdlflags="$ccdlflags $xxx"
8236                         cat <<EOM >&4
8237
8238 Adding $xxx to the flags
8239 passed to $ld so that the perl executable will find the
8240 installed shared $libperl.
8241
8242 EOM
8243                         ;;
8244                 esac
8245                 ;;
8246         esac
8247 fi
8248 # Fix ccdlflags in AIX for building external extensions.
8249 # (For building Perl itself bare -bE:perl.exp is needed,
8250 #  Makefile.SH takes care of this.)
8251 case "$osname" in
8252 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8253 esac
8254 # Respect a hint or command-line value.
8255 case "$shrpenv" in
8256 '') shrpenv="$tmp_shrpenv" ;;
8257 esac
8258 case "$ldlibpthname" in
8259 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8260 none)   ldlibpthname='' ;;
8261 esac
8262
8263 : determine where manual pages are on this system
8264 echo " "
8265 case "$sysman" in
8266 '') 
8267         syspath='/usr/share/man/man1 /usr/man/man1'
8268         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8269         syspath="$syspath /usr/man/u_man/man1"
8270         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8271         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8272         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8273         sysman=`./loc . /usr/man/man1 $syspath`
8274         ;;
8275 esac
8276 if $test -d "$sysman"; then
8277         echo "System manual is in $sysman." >&4
8278 else
8279         echo "Could not find manual pages in source form." >&4
8280 fi
8281
8282 : determine where manual pages go
8283 set man1dir man1dir none
8284 eval $prefixit
8285 $cat <<EOM
8286
8287 $spackage has manual pages available in source form.
8288 EOM
8289 case "$nroff" in
8290 nroff)
8291         echo "However, you don't have nroff, so they're probably useless to you."
8292         case "$man1dir" in
8293         '') man1dir="none";;
8294         esac;;
8295 esac
8296 echo "If you don't want the manual sources installed, answer 'none'."
8297 case "$man1dir" in
8298 ' ') dflt=none
8299         ;;
8300 '')
8301         lookpath="$prefixexp/share/man/man1"
8302         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8303         lookpath="$lookpath $prefixexp/man/p_man/man1"
8304         lookpath="$lookpath $prefixexp/man/u_man/man1"
8305         lookpath="$lookpath $prefixexp/man/man.1"
8306         case "$sysman" in
8307         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8308         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8309         esac
8310         set dflt
8311         eval $prefixup
8312         ;;
8313 *)  dflt="$man1dir"
8314         ;;
8315 esac
8316 echo " "
8317 fn=dn+~
8318 rp="Where do the main $spackage manual pages (source) go?"
8319 . ./getfile
8320 if $test "X$man1direxp" != "X$ansexp"; then
8321         installman1dir=''
8322 fi
8323 prefixvar=man1dir
8324 . ./setprefixvar
8325
8326 case "$man1dir" in
8327 '')     man1dir=' '
8328         installman1dir='';;
8329 esac
8330
8331 : What suffix to use on installed man pages
8332
8333 case "$man1dir" in
8334 ' ')
8335         man1ext='0'
8336         ;;
8337 *)
8338         rp="What suffix should be used for the main $spackage man pages?"
8339         case "$man1ext" in
8340         '')     case "$man1dir" in
8341                 *1)  dflt=1 ;;
8342                 *1p) dflt=1p ;;
8343                 *1pm) dflt=1pm ;;
8344                 *l) dflt=l;;
8345                 *n) dflt=n;;
8346                 *o) dflt=o;;
8347                 *p) dflt=p;;
8348                 *C) dflt=C;;
8349                 *L) dflt=L;;
8350                 *L1) dflt=L1;;
8351                 *) dflt=1;;
8352                 esac
8353                 ;;
8354         *)      dflt="$man1ext";;
8355         esac
8356         . ./myread
8357         man1ext="$ans"
8358         ;;
8359 esac
8360
8361 : see if we can have long filenames
8362 echo " "
8363 first=123456789abcdef
8364 $rm -f $first
8365 if (echo hi >$first) 2>/dev/null; then
8366         if $test -f 123456789abcde; then
8367                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8368                 val="$undef"
8369         else
8370                 echo 'You can have filenames longer than 14 characters.'>&4
8371                 val="$define"
8372         fi
8373 else
8374         $cat <<'EOM'
8375 You can't have filenames longer than 14 chars.
8376 You can't even think about them!
8377 EOM
8378         val="$undef"
8379 fi
8380 set d_flexfnam
8381 eval $setvar
8382 $rm -rf 123456789abcde*
8383
8384 : determine where library module manual pages go
8385 set man3dir man3dir none
8386 eval $prefixit
8387 $cat <<EOM
8388
8389 $spackage has manual pages for many of the library modules.
8390 EOM
8391
8392 case "$nroff" in
8393 nroff)
8394         $cat <<'EOM'
8395 However, you don't have nroff, so they're probably useless to you.
8396 EOM
8397         case "$man3dir" in
8398         '') man3dir="none";;
8399         esac;;
8400 esac
8401
8402 case "$d_flexfnam" in
8403 undef)
8404         $cat <<'EOM'
8405 However, your system can't handle the long file names like File::Basename.3.
8406 EOM
8407         case "$man3dir" in
8408         '') man3dir="none";;
8409         esac;;
8410 esac
8411
8412 echo "If you don't want the manual sources installed, answer 'none'."
8413 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8414 case "$man3dir" in
8415 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8416         if $test -d "$privlib/man/man3"; then
8417                 cat <<EOM >&4
8418
8419 WARNING:  Previous versions of perl installed man3 pages into
8420 $privlib/man/man3.  This version will suggest a
8421 new default of $dflt.
8422 EOM
8423                 tdflt=$dflt
8424                 dflt='n'
8425                 rp='Do you wish to preserve the old behavior?(y/n)'
8426                 . ./myread
8427                 case "$ans" in
8428                 y*) dflt="$privlib/man/man3" ;;
8429                 *)  dflt=$tdflt ;;
8430                 esac
8431     fi
8432         ;;
8433 *)      dflt="$man3dir" ;;
8434 esac
8435 case "$dflt" in
8436 ' ') dflt=none ;;
8437 esac
8438 echo " "
8439 fn=dn+~
8440 rp="Where do the $package library man pages (source) go?"
8441 . ./getfile
8442 prefixvar=man3dir
8443 . ./setprefixvar
8444
8445 case "$man3dir" in
8446 '')     man3dir=' '
8447         installman3dir='';;
8448 esac
8449
8450 : What suffix to use on installed man pages
8451 case "$man3dir" in
8452 ' ')
8453         man3ext='0'
8454         ;;
8455 *)
8456         rp="What suffix should be used for the $package library man pages?"
8457         case "$man3ext" in
8458         '')     case "$man3dir" in
8459                 *3)  dflt=3 ;;
8460                 *3p) dflt=3p ;;
8461                 *3pm) dflt=3pm ;;
8462                 *l) dflt=l;;
8463                 *n) dflt=n;;
8464                 *o) dflt=o;;
8465                 *p) dflt=p;;
8466                 *C) dflt=C;;
8467                 *L) dflt=L;;
8468                 *L3) dflt=L3;;
8469                 *) dflt=3;;
8470                 esac
8471                 ;;
8472         *)      dflt="$man3ext";;
8473         esac
8474         . ./myread
8475         man3ext="$ans"
8476         ;;
8477 esac
8478
8479 : see if we have to deal with yellow pages, now NIS.
8480 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8481         if $test -f /usr/etc/nibindd; then
8482                 echo " "
8483                 echo "I'm fairly confident you're on a NeXT."
8484                 echo " "
8485                 rp='Do you get the hosts file via NetInfo?'
8486                 dflt=y
8487                 case "$hostcat" in
8488                 nidump*) ;;
8489                 '') ;;
8490                 *) dflt=n;;
8491                 esac
8492                 . ./myread
8493                 case "$ans" in
8494                 y*) hostcat='nidump hosts .';;
8495                 *)      case "$hostcat" in
8496                         nidump*) hostcat='';;
8497                         esac
8498                         ;;
8499                 esac
8500         fi
8501         case "$hostcat" in
8502         nidump*) ;;
8503         *)
8504                 case "$hostcat" in
8505                 *ypcat*) dflt=y;;
8506                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8507                                 dflt=y
8508                         else
8509                                 dflt=n
8510                         fi;;
8511                 *) dflt=n;;
8512                 esac
8513                 echo " "
8514                 rp='Are you getting the hosts file via yellow pages?'
8515                 . ./myread
8516                 case "$ans" in
8517                 y*) hostcat='ypcat hosts';;
8518                 *) hostcat='cat /etc/hosts';;
8519                 esac
8520                 ;;
8521         esac
8522 fi
8523 case "$hostcat" in
8524 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8525 esac
8526 case "$groupcat" in
8527 '') test -f /etc/group && groupcat='cat /etc/group';;
8528 esac
8529 case "$passcat" in
8530 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8531 esac
8532
8533 : now get the host name
8534 echo " "
8535 echo "Figuring out host name..." >&4
8536 case "$myhostname" in
8537 '') cont=true
8538         echo 'Maybe "hostname" will work...'
8539         if tans=`sh -c hostname 2>&1` ; then
8540                 myhostname=$tans
8541                 phostname=hostname
8542                 cont=''
8543         fi
8544         ;;
8545 *) cont='';;
8546 esac
8547 if $test "$cont"; then
8548         if ./xenix; then
8549                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8550                 if tans=`cat /etc/systemid 2>&1` ; then
8551                         myhostname=$tans
8552                         phostname='cat /etc/systemid'
8553                         echo "Whadyaknow.  Xenix always was a bit strange..."
8554                         cont=''
8555                 fi
8556         elif $test -r /etc/systemid; then
8557                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8558         fi
8559 fi
8560 if $test "$cont"; then
8561         echo 'No, maybe "uuname -l" will work...'
8562         if tans=`sh -c 'uuname -l' 2>&1` ; then
8563                 myhostname=$tans
8564                 phostname='uuname -l'
8565         else
8566                 echo 'Strange.  Maybe "uname -n" will work...'
8567                 if tans=`sh -c 'uname -n' 2>&1` ; then
8568                         myhostname=$tans
8569                         phostname='uname -n'
8570                 else
8571                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8572                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8573                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8574                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8575                         else
8576                                 case "$myhostname" in
8577                                 '') echo "Does this machine have an identity crisis or something?"
8578                                         phostname='';;
8579                                 *)
8580                                         echo "Well, you said $myhostname before..."
8581                                         phostname='echo $myhostname';;
8582                                 esac
8583                         fi
8584                 fi
8585         fi
8586 fi
8587 case "$myhostname" in
8588 '') myhostname=noname ;;
8589 esac
8590 : you do not want to know about this
8591 set $myhostname
8592 myhostname=$1
8593
8594 : verify guess
8595 if $test "$myhostname" ; then
8596         dflt=y
8597         rp='Your host name appears to be "'$myhostname'".'" Right?"
8598         . ./myread
8599         case "$ans" in
8600         y*) ;;
8601         *) myhostname='';;
8602         esac
8603 fi
8604
8605 : bad guess or no guess
8606 while $test "X$myhostname" = X ; do
8607         dflt=''
8608         rp="Please type the (one word) name of your host:"
8609         . ./myread
8610         myhostname="$ans"
8611 done
8612
8613 : translate upper to lower if necessary
8614 case "$myhostname" in
8615 *[A-Z]*)
8616         echo "(Normalizing case in your host name)"
8617         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8618         ;;
8619 esac
8620
8621 case "$myhostname" in
8622 *.*)
8623         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8624         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8625         echo "(Trimming domain name from host name--host name is now $myhostname)"
8626         ;;
8627 *) case "$mydomain" in
8628         '')
8629                 {
8630                         test "X$hostcat" = "Xypcat hosts" &&
8631                         ypmatch "$myhostname" hosts 2>/dev/null |\
8632                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8633                         $test -s hosts
8634                 } || {
8635                         test "X$hostcat" != "X" &&
8636                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8637                                         /[       ]$myhostname[  . ]/p" > hosts
8638                 }
8639                 tmp_re="[       . ]"
8640                 if $test -f hosts; then
8641                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8642                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8643                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8644                                 hosts | $sort | $uniq | \
8645                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8646                         case `$echo X$dflt` in
8647                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8648                                 dflt=.
8649                                 ;;
8650                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8651                                 ;;
8652                         esac
8653                 else
8654                         echo "(I cannot locate a hosts database anywhere)"
8655                         dflt=.
8656                 fi
8657                 case "$dflt" in
8658                 .)
8659                         tans=`./loc resolv.conf X /etc /usr/etc`
8660                         if $test -f "$tans"; then
8661                                 echo "(Attempting domain name extraction from $tans)"
8662                                 dflt=.`$sed -n -e 's/   / /g' \
8663                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8664                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8665                                 case "$dflt" in
8666                                 .) dflt=.`$sed -n -e 's/        / /g' \
8667                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8668                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8669                                         ;;
8670                                 esac
8671                         fi
8672                         ;;
8673                 esac
8674                 case "$dflt" in
8675                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8676                         dflt=.`sh -c domainname 2>/dev/null`
8677                         case "$dflt" in
8678                         '') dflt='.';;
8679                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8680                         esac
8681                         ;;
8682                 esac
8683                 case "$dflt$osname" in
8684                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8685                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8686                         ;;
8687                 esac
8688                 case "$dflt" in
8689                 .) echo "(Lost all hope -- silly guess then)"
8690                         dflt='.nonet'
8691                         ;;
8692                 esac
8693                 $rm -f hosts
8694                 ;;
8695         *) dflt="$mydomain";;
8696         esac;;
8697 esac
8698 echo " "
8699 rp="What is your domain name?"
8700 . ./myread
8701 tans="$ans"
8702 case "$ans" in
8703 '') ;;
8704 .*) ;;
8705 *) tans=".$tans";;
8706 esac
8707 mydomain="$tans"
8708
8709 : translate upper to lower if necessary
8710 case "$mydomain" in
8711 *[A-Z]*)
8712         echo "(Normalizing case in your domain name)"
8713         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8714         ;;
8715 esac
8716
8717 : a little sanity check here
8718 case "$phostname" in
8719 '') ;;
8720 *)
8721         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8722         $myhostname$mydomain|$myhostname) ;;
8723         *)
8724                 case "$phostname" in
8725                 sed*)
8726                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8727                         ;;
8728                 *)
8729                         echo "(That doesn't agree with your $phostname command, by the way.)"
8730                         ;;
8731                 esac
8732         ;;
8733         esac
8734         ;;
8735 esac
8736
8737 : determine the e-mail address of the user who is running us
8738 $cat <<EOM
8739
8740 I need to get your e-mail address in Internet format if possible, i.e.
8741 something like user@host.domain. Please answer accurately since I have
8742 no easy means to double check it. The default value provided below
8743 is most probably close to reality but may not be valid from outside
8744 your organization...
8745
8746 EOM
8747 cont=x
8748 while test "$cont"; do
8749         case "$cf_email" in
8750         '') dflt="$cf_by@$myhostname$mydomain";;
8751         *) dflt="$cf_email";;
8752         esac
8753         rp='What is your e-mail address?'
8754         . ./myread
8755         cf_email="$ans"
8756         case "$cf_email" in
8757         *@*.*) cont='' ;;
8758         *)
8759                 rp='Address does not look like an Internet one.  Use it anyway?'
8760                 case "$fastread" in
8761                 yes) dflt=y ;;
8762                 *) dflt=n ;;
8763                 esac
8764                 . ./myread
8765                 case "$ans" in
8766                 y*) cont='' ;;
8767                 *) echo " " ;;
8768                 esac
8769                 ;;
8770         esac
8771 done
8772
8773 : Ask e-mail of administrator
8774 $cat <<EOM
8775
8776 If you or somebody else will be maintaining perl at your site, please
8777 fill in the correct e-mail address here so that they may be contacted
8778 if necessary. Currently, the "perlbug" program included with perl
8779 will send mail to this address in addition to perlbug@perl.org. You may
8780 enter "none" for no administrator.
8781
8782 EOM
8783 case "$perladmin" in
8784 '') dflt="$cf_email";;
8785 *) dflt="$perladmin";;
8786 esac
8787 rp='Perl administrator e-mail address'
8788 . ./myread
8789 perladmin="$ans"
8790
8791 : determine whether to only install version-specific parts.
8792 echo " "
8793 $cat <<EOM
8794 Do you want to install only the version-specific parts of the perl
8795 distribution?  Usually you do *not* want to do this.
8796 EOM
8797 case "$versiononly" in
8798 "$define"|[Yy]*|true) dflt='y' ;;
8799 *) dflt='n';
8800 esac
8801 rp="Do you want to install only the version-specific parts of perl?"
8802 . ./myread
8803 case "$ans" in
8804 [yY]*)  val="$define";;
8805 *)      val="$undef" ;;
8806 esac
8807 set versiononly
8808 eval $setvar
8809
8810 case "$versiononly" in
8811 "$define") inc_version_list=''
8812            inc_version_list_init=0
8813            ;;
8814 esac
8815
8816 : figure out how to guarantee perl startup
8817 : XXX Note that this currently takes advantage of the bug that binexp ignores
8818 :     the Configure -Dinstallprefix setting, which in turn means that under
8819 :     relocatable @INC, initialinstalllocation is what binexp started as.
8820 case "$startperl" in
8821 '')
8822         case "$sharpbang" in
8823         *!)
8824                 $cat <<EOH
8825
8826 I can use the #! construct to start perl on your system. This will
8827 make startup of perl scripts faster, but may cause problems if you
8828 want to share those scripts and perl is not in a standard place
8829 ($initialinstalllocation/perl) on all your platforms. The alternative
8830 is to force a shell by starting the script with a single ':' character.
8831
8832 EOH
8833                 case "$versiononly" in
8834                 "$define")      dflt="$initialinstalllocation/perl$version";;
8835                 *)              dflt="$initialinstalllocation/perl";;
8836                 esac
8837                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8838                 . ./myread
8839                 case "$ans" in
8840                 none)   startperl=": # use perl";;
8841                 *)      startperl="#!$ans"
8842                         if $test 30 -lt `echo "$ans" | wc -c`; then
8843                                 $cat >&4 <<EOM
8844
8845 WARNING:  Some systems limit the #! command to 32 characters.
8846 If you experience difficulty running Perl scripts with #!, try
8847 installing Perl in a directory with a shorter pathname.
8848
8849 EOM
8850                         fi ;;
8851                 esac
8852                 ;;
8853         *) startperl=": # use perl"
8854                 ;;
8855         esac
8856         ;;
8857 esac
8858 echo "I'll use $startperl to start perl scripts."
8859
8860 : figure best path for perl in scripts
8861 case "$perlpath" in
8862 '')
8863         case "$versiononly" in
8864         "$define")      perlpath="$initialinstalllocation/perl$version";;
8865         *)              perlpath="$initialinstalllocation/perl";;
8866         esac
8867         case "$startperl" in
8868         *!*) ;;
8869         *)
8870                 $cat <<EOH
8871
8872 I will use the "eval 'exec'" idiom to start Perl on your system.
8873 I can use the full path of your Perl binary for this purpose, but
8874 doing so may cause problems if you want to share those scripts and
8875 Perl is not always in a standard place ($initialinstalllocation/perl).
8876
8877 EOH
8878                 dflt="$initialinstalllocation/perl"
8879                 rp="What path shall I use in \"eval 'exec'\"?"
8880                 . ./myread
8881                 perlpath="$ans"
8882                 ;;
8883         esac
8884         ;;
8885 esac
8886 case "$startperl" in
8887 *!*)    ;;
8888 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8889 esac
8890
8891 : determine where public executable scripts go
8892 set scriptdir scriptdir
8893 eval $prefixit
8894 case "$scriptdir" in
8895 '')
8896         dflt="$bin"
8897         : guess some guesses
8898         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8899         $test -d /usr/share/bin     && dflt=/usr/share/bin
8900         $test -d /usr/local/script  && dflt=/usr/local/script
8901         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8902         $test -d $prefixexp/script  && dflt=$prefixexp/script
8903         set dflt
8904         eval $prefixup
8905         ;;
8906 *)  dflt="$scriptdir"
8907         ;;
8908 esac
8909 $cat <<EOM
8910
8911 Some installations have a separate directory just for executable scripts so
8912 that they can mount it across multiple architectures but keep the scripts in
8913 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8914 Or you might just lump your scripts in with all your other executables.
8915
8916 EOM
8917 fn=d~
8918 rp='Where do you keep publicly executable scripts?'
8919 . ./getfile
8920 if $test "X$ansexp" != "X$scriptdirexp"; then
8921         installscript=''
8922 fi
8923 installscriptdir=''
8924 prefixvar=scriptdir
8925 . ./setprefixvar
8926 : A little fix up for an irregularly named variable.
8927 installscript="$installscriptdir"
8928
8929 : determine where add-on public executables go
8930 case "$sitebin" in
8931 '')     dflt=$siteprefix/bin ;;
8932 *)      dflt=$sitebin ;;
8933 esac
8934 fn=d~
8935 rp='Pathname where the add-on public executables should be installed?'
8936 . ./getfile
8937 prefixvar=sitebin
8938 . ./setprefixvar
8939
8940 : determine where add-on html pages go
8941 : There is no standard location, so try to copy the previously-selected
8942 : directory structure for the core html pages.
8943 case "$sitehtml1dir" in
8944 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8945 *)     dflt=$sitehtml1dir ;;
8946 esac
8947 case "$dflt" in
8948 ''|' ') dflt=none ;;
8949 esac
8950 fn=dn+~
8951 rp='Pathname where the site-specific html pages should be installed?'
8952 . ./getfile
8953 prefixvar=sitehtml1dir
8954 . ./setprefixvar
8955
8956 : determine where add-on library html pages go
8957 : There is no standard location, so try to copy the previously-selected
8958 : directory structure for the core html pages.
8959 case "$sitehtml3dir" in
8960 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8961 *)     dflt=$sitehtml3dir ;;
8962 esac
8963 case "$dflt" in
8964 ''|' ') dflt=none ;;
8965 esac
8966 fn=dn+~
8967 rp='Pathname where the site-specific library html pages should be installed?'
8968 . ./getfile
8969 prefixvar=sitehtml3dir
8970 . ./setprefixvar
8971
8972 : determine where add-on manual pages go
8973 case "$siteman1dir" in
8974 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8975 *)      dflt=$siteman1dir ;;
8976 esac
8977 case "$dflt" in
8978 ''|' ') dflt=none ;;
8979 esac
8980 fn=dn+~
8981 rp='Pathname where the site-specific manual pages should be installed?'
8982 . ./getfile
8983 prefixvar=siteman1dir
8984 . ./setprefixvar
8985
8986 : determine where add-on library man pages go
8987 case "$siteman3dir" in
8988 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8989 *)      dflt=$siteman3dir ;;
8990 esac
8991 case "$dflt" in
8992 ''|' ') dflt=none ;;
8993 esac
8994 fn=dn+~
8995 rp='Pathname where the site-specific library manual pages should be installed?'
8996 . ./getfile
8997 prefixvar=siteman3dir
8998 . ./setprefixvar
8999
9000 : determine where add-on public executable scripts go
9001 case "$sitescript" in
9002 '')     dflt=$siteprefix/script
9003         $test -d $dflt || dflt=$sitebin ;;
9004 *)  dflt="$sitescript" ;;
9005 esac
9006 fn=d~+
9007 rp='Pathname where add-on public executable scripts should be installed?'
9008 . ./getfile
9009 prefixvar=sitescript
9010 . ./setprefixvar
9011
9012 : Check if faststdio is requested and available
9013 case "$usefaststdio" in
9014 $define|true|[yY]*|'')
9015         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9016         case "$xversion" in
9017         [68])   dflt='y' ;;
9018         *)      dflt='n' ;;
9019         esac
9020         ;;
9021 *) dflt='n';;
9022 esac
9023 cat <<EOM
9024
9025 Perl can be built to use 'fast stdio', which means using the stdio
9026 library but also directly manipulating the stdio buffers to enable
9027 faster I/O.  Using stdio is better for backward compatibility (especially
9028 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9029 interface has been preferred instead of stdio.
9030
9031 If this doesn't make any sense to you, just accept the default '$dflt'.
9032 EOM
9033 rp='Use the "fast stdio" if available?'
9034 . ./myread
9035 case "$ans" in
9036 y|Y)    val="$define" ;;
9037 *)      val="$undef" ;;
9038 esac
9039 set usefaststdio
9040 eval $setvar
9041
9042
9043 : define an is-a-typedef? function
9044 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9045 case "$inclist" in
9046 "") inclist="sys/types.h";;
9047 esac;
9048 eval "varval=\$$var";
9049 case "$varval" in
9050 "")
9051         $rm -f temp.c;
9052         for inc in $inclist; do
9053                 echo "#include <$inc>" >>temp.c;
9054         done;
9055         echo "#ifdef $type" >> temp.c;
9056         echo "printf(\"We have $type\");" >> temp.c;
9057         echo "#endif" >> temp.c;
9058         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9059         if $contains $type temp.E >/dev/null 2>&1; then
9060                 eval "$var=\$type";
9061         else
9062                 eval "$var=\$def";
9063         fi;
9064         $rm -f temp.?;;
9065 *) eval "$var=\$varval";;
9066 esac'
9067
9068 : define an is-a-typedef? function that prompts if the type is not available.
9069 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9070 case "$inclist" in
9071 "") inclist="sys/types.h";;
9072 esac;
9073 eval "varval=\$$var";
9074 case "$varval" in
9075 "")
9076         $rm -f temp.c;
9077         for inc in $inclist; do
9078                 echo "#include <$inc>" >>temp.c;
9079         done;
9080         echo "#ifdef $type" >> temp.c;
9081         echo "printf(\"We have $type\");" >> temp.c;
9082         echo "#endif" >> temp.c;
9083         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9084         echo " " ;
9085         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9086         if $contains $type temp.E >/dev/null 2>&1; then
9087                 echo "$type found." >&4;
9088                 eval "$var=\$type";
9089         else
9090                 echo "$type NOT found." >&4;
9091                 dflt="$def";
9092                 . ./myread ;
9093                 eval "$var=\$ans";
9094         fi;
9095         $rm -f temp.?;;
9096 *) eval "$var=\$varval";;
9097 esac'
9098
9099 : see what type lseek is declared as in the kernel
9100 rp="What is the type used for lseek's offset on this system?"
9101 set off_t lseektype long stdio.h sys/types.h
9102 eval $typedef_ask
9103
9104 echo " "
9105 echo "Checking to see how big your file offsets are..." >&4
9106 $cat >try.c <<EOCP
9107 #include <sys/types.h>
9108 #include <stdio.h>
9109 int main()
9110 {
9111     printf("%d\n", (int)sizeof($lseektype));
9112     return(0);
9113 }
9114 EOCP
9115 set try
9116 if eval $compile_ok; then
9117         lseeksize=`$run ./try`
9118         echo "Your file offsets are $lseeksize bytes long."
9119 else
9120         dflt=$longsize
9121         echo " "
9122         echo "(I can't seem to compile the test program.  Guessing...)"
9123         rp="What is the size of your file offsets (in bytes)?"
9124         . ./myread
9125         lseeksize="$ans"
9126 fi
9127 $rm_try
9128
9129 : see what type file positions are declared as in the library
9130 rp="What is the type for file position used by fsetpos()?"
9131 set fpos_t fpostype long stdio.h sys/types.h
9132 eval $typedef_ask
9133
9134 : Check size for Fpos_t
9135 echo " "
9136 case "$fpostype" in
9137 *_t) zzz="$fpostype"    ;;
9138 *)   zzz="fpos_t"       ;;
9139 esac
9140 echo "Checking the size of $zzz..." >&4
9141 cat > try.c <<EOCP
9142 #include <sys/types.h>
9143 #include <stdio.h>
9144 #$i_stdlib I_STDLIB
9145 #ifdef I_STDLIB
9146 #include <stdlib.h>
9147 #endif
9148 int main() {
9149     printf("%d\n", (int)sizeof($fpostype));
9150     exit(0);
9151 }
9152 EOCP
9153 set try
9154 if eval $compile_ok; then
9155         yyy=`$run ./try`
9156         case "$yyy" in
9157         '')     fpossize=4
9158                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9159                 ;;
9160         *)      fpossize=$yyy
9161                 echo "Your $zzz is $fpossize bytes long."
9162                 ;;
9163         esac
9164 else
9165         dflt="$longsize"
9166         echo " " >&4
9167         echo "(I can't compile the test program.  Guessing...)" >&4
9168         rp="What is the size of your file positions (in bytes)?"
9169         . ./myread
9170         fpossize="$ans"
9171 fi
9172
9173 : Check for large file support
9174 # Backward compatibility (uselfs is deprecated).
9175 case "$uselfs" in
9176 "$define"|true|[yY]*)
9177         cat <<EOM >&4
9178
9179 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9180 EOM
9181         uselargefiles="$define"
9182         ;;
9183 esac
9184
9185 case "$lseeksize:$fpossize" in
9186 8:8) cat <<EOM
9187
9188 You can have files larger than 2 gigabytes.
9189 EOM
9190    val="$define" ;;
9191 *)    case "$uselargefiles" in
9192    "$undef"|false|[nN]*) dflt='n' ;;
9193    *)   dflt='y' ;;
9194    esac
9195    cat <<EOM
9196
9197 Perl can be built to understand large files (files larger than 2 gigabytes)
9198 on some systems.  To do so, Configure can be run with -Duselargefiles.
9199
9200 If this doesn't make any sense to you, just accept the default '$dflt'.
9201 EOM
9202    rp='Try to understand large files, if available?'
9203    . ./myread
9204    case "$ans" in
9205    y|Y)         val="$define" ;;
9206    *)           val="$undef"  ;;
9207    esac
9208    ;;
9209 esac
9210 set uselargefiles
9211 eval $setvar
9212 : Look for a hint-file generated 'call-back-unit'.  If the
9213 : user has specified that a large files perl is to be built,
9214 : we may need to set or change some other defaults.
9215 if $test -f uselargefiles.cbu; then
9216         echo "Your platform has some specific hints regarding large file builds, using them..."
9217         . ./uselargefiles.cbu
9218 fi
9219 case "$uselargefiles" in
9220 "$define")
9221         if $test -f uselargefiles.cbu; then
9222                 echo " "
9223                 echo "Rechecking to see how big your file offsets are..." >&4
9224                 $cat >try.c <<EOCP
9225 #include <sys/types.h>
9226 #include <stdio.h>
9227 int main()
9228 {
9229     printf("%d\n", (int)sizeof($lseektype));
9230     return(0);
9231 }
9232 EOCP
9233                 set try
9234                 if eval $compile_ok; then
9235                         lseeksize=`$run ./try`
9236                         $echo "Your file offsets are now $lseeksize bytes long."
9237                 else
9238                         dflt="$lseeksize"
9239                         echo " "
9240                         echo "(I can't seem to compile the test program.  Guessing...)"
9241                         rp="What is the size of your file offsets (in bytes)?"
9242                         . ./myread
9243                         lseeksize="$ans"
9244                 fi
9245                 case "$fpostype" in
9246                 *_t) zzz="$fpostype"    ;;
9247                 *)   zzz="fpos_t"       ;;
9248                 esac
9249                 $echo $n "Rechecking the size of $zzz...$c" >&4
9250                 $cat > try.c <<EOCP
9251 #include <sys/types.h>
9252 #include <stdio.h>
9253 #$i_stdlib I_STDLIB
9254 #ifdef I_STDLIB
9255 #include <stdlib.h>
9256 #endif
9257 int main() {
9258     printf("%d\n", (int)sizeof($fpostype));
9259     return(0);
9260 }
9261 EOCP
9262                 set try
9263                 if eval $compile_ok; then
9264                         yyy=`$run ./try`
9265                         dflt="$lseeksize"
9266                         case "$yyy" in
9267                         '')     echo " "
9268                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9269                                 ;;
9270                         *)      fpossize=$yyy
9271                                 echo " $fpossize bytes." >&4
9272                                 ;;
9273                         esac
9274                 else
9275                         dflt="$fpossize"
9276                         echo " "
9277                         echo "(I can't compile the test program.  Guessing...)" >&4
9278                         rp="What is the size of your file positions (in bytes)?"
9279                         . ./myread
9280                         fpossize="$ans"
9281                 fi
9282                 $rm_try
9283         fi
9284         ;;
9285 esac
9286
9287 : Set the vendorbin variables
9288 case "$vendorprefix" in
9289 '')     d_vendorbin="$undef"
9290         vendorbin=''
9291         vendorbinexp=''
9292         ;;
9293 *)      d_vendorbin="$define"
9294         : determine where vendor-supplied executables go.
9295         case "$vendorbin" in
9296         '') dflt=$vendorprefix/bin ;;
9297         *)      dflt="$vendorbin" ;;
9298         esac
9299         fn=d~+
9300         rp='Pathname for the vendor-supplied executables directory?'
9301         . ./getfile
9302         vendorbin="$ans"
9303         vendorbinexp="$ansexp"
9304         ;;
9305 esac
9306 prefixvar=vendorbin
9307 . ./installprefix
9308
9309 : Set the vendorhtml1dir variables
9310 case "$vendorprefix" in
9311 '')     vendorhtml1dir=''
9312         vendorhtml1direxp=''
9313         ;;
9314 *)      : determine where vendor-supplied html pages go.
9315         : There is no standard location, so try to copy the previously-selected
9316         : directory structure for the core html pages.
9317         : XXX Better default suggestions would be welcome.
9318         case "$vendorhtml1dir" in
9319         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9320         *)      dflt=$vendorhtml1dir ;;
9321         esac
9322         case "$dflt" in
9323         ''|' ') dflt=none ;;
9324         esac
9325         fn=dn+~
9326         rp='Pathname for the vendor-supplied html pages?'
9327         . ./getfile
9328         vendorhtml1dir="$ans"
9329         vendorhtml1direxp="$ansexp"
9330         ;;
9331 esac
9332 : Use ' ' for none so value is preserved next time through Configure
9333 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9334 prefixvar=vendorhtml1dir
9335 . ./installprefix
9336
9337 : Set the vendorhtml3dir variables
9338 case "$vendorprefix" in
9339 '')     vendorhtml3dir=''
9340         vendorhtml3direxp=''
9341         ;;
9342 *)      : determine where vendor-supplied module html pages go.
9343         : There is no standard location, so try to copy the previously-selected
9344         : directory structure for the core html pages.
9345         : XXX Better default suggestions would be welcome.
9346         case "$vendorhtml3dir" in
9347         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9348         *)      dflt=$vendorhtml3dir ;;
9349         esac
9350         case "$dflt" in
9351         ''|' ') dflt=none ;;
9352         esac
9353         fn=dn+~
9354         rp='Pathname for the vendor-supplied html pages?'
9355         . ./getfile
9356         vendorhtml3dir="$ans"
9357         vendorhtml3direxp="$ansexp"
9358         ;;
9359 esac
9360 : Use ' ' for none so value is preserved next time through Configure
9361 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9362 prefixvar=vendorhtml3dir
9363 . ./installprefix
9364
9365 : Set the vendorman1dir variables
9366 case "$vendorprefix" in
9367 '')     vendorman1dir=''
9368         vendorman1direxp=''
9369         ;;
9370 *)      : determine where vendor-supplied manual pages go.
9371         case "$vendorman1dir" in
9372         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9373         *)      dflt=$vendorman1dir ;;
9374         esac
9375         case "$dflt" in
9376         ''|' ') dflt=none ;;
9377         esac
9378         fn=nd~+
9379         rp='Pathname for the vendor-supplied manual section 1 pages?'
9380         . ./getfile
9381         vendorman1dir="$ans"
9382         vendorman1direxp="$ansexp"
9383         ;;
9384 esac
9385 : Use ' ' for none so value is preserved next time through Configure
9386 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9387 prefixvar=vendorman1dir
9388 . ./installprefix
9389
9390 : Set the vendorman3dir variables
9391 case "$vendorprefix" in
9392 '')     vendorman3dir=''
9393         vendorman3direxp=''
9394         ;;
9395 *)      : determine where vendor-supplied module manual pages go.
9396         case "$vendorman3dir" in
9397         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9398         *)      dflt=$vendorman3dir ;;
9399         esac
9400         case "$dflt" in
9401         ''|' ') dflt=none ;;
9402         esac
9403         fn=nd~+
9404         rp='Pathname for the vendor-supplied manual section 3 pages?'
9405         . ./getfile
9406         vendorman3dir="$ans"
9407         vendorman3direxp="$ansexp"
9408         ;;
9409 esac
9410 : Use ' ' for none so value is preserved next time through Configure
9411 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9412 prefixvar=vendorman3dir
9413 . ./installprefix
9414
9415 : Set the vendorscript variables
9416 case "$vendorprefix" in
9417 '')     d_vendorscript="$undef"
9418         vendorscript=''
9419         vendorscriptexp=''
9420         ;;
9421 *)      d_vendorscript="$define"
9422         : determine where vendor-supplied scripts go.
9423         case "$vendorscript" in
9424         '')     dflt=$vendorprefix/script
9425                 $test -d $dflt || dflt=$vendorbin ;;
9426         *)  dflt="$vendorscript" ;;
9427         esac
9428         $cat <<EOM
9429
9430 The installation process will create a directory for
9431 vendor-supplied scripts.
9432
9433 EOM
9434         fn=d~+
9435         rp='Pathname for the vendor-supplied scripts directory?'
9436         . ./getfile
9437         vendorscript="$ans"
9438         vendorscriptexp="$ansexp"
9439         ;;
9440 esac
9441 prefixvar=vendorscript
9442 . ./installprefix
9443
9444 : see if qgcvt exists
9445 set qgcvt d_qgcvt
9446 eval $inlibc
9447
9448 : Check print/scan long double stuff
9449 echo " "
9450
9451 if $test X"$d_longdbl" = X"$define"; then
9452
9453 echo "Checking how to print long doubles..." >&4
9454
9455 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9456         $cat >try.c <<'EOCP'
9457 #include <sys/types.h>
9458 #include <stdio.h>
9459 int main() {
9460   double d = 123.456;
9461   printf("%.3f\n", d);
9462 }
9463 EOCP
9464         set try
9465         if eval $compile; then
9466                 yyy=`$run ./try`
9467                 case "$yyy" in
9468                 123.456)
9469                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9470                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9471                         echo "We will use %f."
9472                         ;;
9473                 esac
9474         fi
9475 fi
9476
9477 if $test X"$sPRIfldbl" = X; then
9478         $cat >try.c <<'EOCP'
9479 #include <sys/types.h>
9480 #include <stdio.h>
9481 int main() {
9482   long double d = 123.456;
9483   printf("%.3Lf\n", d);
9484 }
9485 EOCP
9486         set try
9487         if eval $compile; then
9488                 yyy=`$run ./try`
9489                 case "$yyy" in
9490                 123.456)
9491                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9492                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9493                         echo "We will use %Lf."
9494                         ;;
9495                 esac
9496         fi
9497 fi
9498
9499 if $test X"$sPRIfldbl" = X; then
9500         $cat >try.c <<'EOCP'
9501 #include <sys/types.h>
9502 #include <stdio.h>
9503 int main() {
9504   long double d = 123.456;
9505   printf("%.3llf\n", d);
9506 }
9507 EOCP
9508         set try
9509         if eval $compile; then
9510                 yyy=`$run ./try`
9511                 case "$yyy" in
9512                 123.456)
9513                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9514                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9515                         echo "We will use %llf."
9516                         ;;
9517                 esac
9518         fi
9519 fi
9520
9521 if $test X"$sPRIfldbl" = X; then
9522         $cat >try.c <<'EOCP'
9523 #include <sys/types.h>
9524 #include <stdio.h>
9525 int main() {
9526   long double d = 123.456;
9527   printf("%.3lf\n", d);
9528 }
9529 EOCP
9530         set try
9531         if eval $compile; then
9532                 yyy=`$run ./try`
9533                 case "$yyy" in
9534                 123.456)
9535                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9536                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9537                         echo "We will use %lf."
9538                         ;;
9539                 esac
9540         fi
9541 fi
9542
9543 if $test X"$sPRIfldbl" = X; then
9544         echo "Cannot figure out how to print long doubles." >&4
9545 else
9546         sSCNfldbl=$sPRIfldbl    # expect consistency
9547 fi
9548
9549 $rm_try
9550
9551 fi # d_longdbl
9552
9553 case "$sPRIfldbl" in
9554 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9555         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9556         d_SCNfldbl="$undef";
9557         ;;
9558 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9559         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9560         d_SCNfldbl="$define";
9561         ;;
9562 esac
9563
9564 : Check how to convert floats to strings.
9565
9566 if test "X$d_Gconvert" = X; then
9567
9568 echo " "
9569 echo "Checking for an efficient way to convert floats to strings."
9570 echo " " > try.c
9571 case "$uselongdouble" in
9572 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9573 esac
9574 case "$d_longdbl" in
9575 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9576 esac
9577 case "$d_PRIgldbl" in
9578 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9579 esac
9580 $cat >>try.c <<EOP
9581 #ifdef TRY_gconvert
9582 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9583 char *myname = "gconvert";
9584 #endif
9585 #ifdef TRY_gcvt
9586 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9587 char *myname = "gcvt";
9588 #endif
9589 #ifdef TRY_qgcvt
9590 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9591 char *myname = "qgcvt";
9592 #define DOUBLETYPE long double
9593 #endif
9594 #ifdef TRY_sprintf
9595 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9596 #ifdef HAS_PRIgldbl
9597 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9598 #else
9599 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9600 #endif
9601 #else
9602 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9603 #endif
9604 char *myname = "sprintf";
9605 #endif
9606
9607 #ifndef DOUBLETYPE
9608 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9609 #define DOUBLETYPE long double
9610 #else
9611 #define DOUBLETYPE double
9612 #endif
9613 #endif
9614
9615 #include <stdio.h>
9616
9617 #define I_STDLIB $i_stdlib
9618 #ifdef I_STDLIB
9619 #include <stdlib.h>
9620 #endif
9621
9622 int
9623 checkit(expect, got)
9624 char *expect;
9625 char *got;
9626 {
9627     if (strcmp(expect, got)) {
9628                 printf("%s oddity:  Expected %s, got %s\n",
9629                         myname, expect, got);
9630                 exit(1);
9631         }
9632 }
9633
9634 int main()
9635 {
9636         char buf[64];
9637         buf[63] = '\0';
9638
9639         /* This must be 1st test on (which?) platform */
9640         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9641         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9642         checkit("0.1", buf);
9643
9644         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9645         checkit("0.01", buf);
9646
9647         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9648         checkit("0.001", buf);
9649
9650         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9651         checkit("0.0001", buf);
9652
9653         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9654         if (strlen(buf) > 5)
9655             checkit("9e-005", buf); /* for Microsoft ?? */
9656         else
9657             checkit("9e-05", buf);
9658
9659         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9660         checkit("1", buf);
9661
9662         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9663         checkit("1.1", buf);
9664
9665         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9666         checkit("1.01", buf);
9667
9668         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9669         checkit("1.001", buf);
9670
9671         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9672         checkit("1.0001", buf);
9673
9674         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9675         checkit("1.00001", buf);
9676
9677         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9678         checkit("1.000001", buf);
9679
9680         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9681         checkit("0", buf);
9682
9683         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9684         checkit("-1", buf);
9685
9686         /* Some Linux gcvt's give 1.e+5 here. */
9687         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9688         checkit("100000", buf);
9689
9690         /* Some Linux gcvt's give -1.e+5 here. */
9691         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9692         checkit("-100000", buf);
9693
9694         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9695         checkit("123.456", buf);
9696
9697         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9698         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9699         /* 34 should be enough to scare even long double
9700          * places into using the e notation. */
9701         if (strlen(buf) > 5)
9702             checkit("1e+034", buf); /* for Microsoft */
9703         else
9704             checkit("1e+34", buf);
9705
9706         /* For Perl, if you add additional tests here, also add them to
9707          * t/base/num.t for benefit of platforms not using Configure or
9708          * overriding d_Gconvert */
9709
9710         exit(0);
9711 }
9712 EOP
9713 : first add preferred functions to our list
9714 xxx_list=""
9715 for xxx_convert in $gconvert_preference; do
9716     case $xxx_convert in
9717     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9718     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9719     esac
9720 done
9721 : then add any others
9722 for xxx_convert in gconvert gcvt sprintf; do
9723     case "$xxx_list" in
9724     *$xxx_convert*) ;;
9725     *) xxx_list="$xxx_list $xxx_convert" ;;
9726     esac
9727 done
9728
9729 case "$d_longdbl$uselongdouble" in
9730 "$define$define")
9731     : again, add prefered functions to our list first
9732     xxx_ld_list=""
9733     for xxx_convert in $gconvert_ld_preference; do
9734         case $xxx_convert in
9735         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9736         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9737         esac
9738     done
9739     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9740     for xxx_convert in qgcvt sprintf $xxx_list; do
9741         case "$xxx_ld_list" in
9742         $xxx_convert*|*" $xxx_convert"*) ;;
9743         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9744         esac
9745     done
9746     : if sprintf cannot do long doubles, move it to the end
9747     if test "$d_PRIgldbl" != "$define"; then
9748         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9749     fi
9750     : if no qgcvt, remove it
9751     if test "$d_qgcvt" != "$define"; then
9752         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9753     fi
9754     : use the ld_list
9755     xxx_list="$xxx_ld_list"
9756     ;;
9757 esac
9758
9759 for xxx_convert in $xxx_list; do
9760         echo "Trying $xxx_convert..."
9761         $rm -f try try$_o core
9762         set try -DTRY_$xxx_convert
9763         if eval $compile; then
9764                 echo "$xxx_convert() found." >&4
9765                 if $run ./try; then
9766                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9767                         break;
9768                 else
9769                         echo "...But $xxx_convert didn't work as I expected."
9770                         xxx_convert=''
9771                 fi
9772         else
9773                 echo "$xxx_convert NOT found." >&4
9774         fi
9775 done
9776
9777 if test X$xxx_convert = X; then
9778     echo "*** WHOA THERE!!! ***" >&4
9779     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9780     xxx_convert=sprintf
9781 fi
9782
9783 case "$xxx_convert" in
9784 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9785 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9786 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9787 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9788    "$define$define$define")
9789       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9790    "$define$define$undef")
9791       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9792    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9793    esac
9794    ;;
9795 esac
9796
9797 fi
9798 $rm_try
9799
9800 : see if _fwalk exists
9801 set fwalk d__fwalk
9802 eval $inlibc
9803
9804 : Initialize h_fcntl
9805 h_fcntl=false
9806
9807 : Initialize h_sysfile
9808 h_sysfile=false
9809
9810 : access call always available on UNIX
9811 set access d_access
9812 eval $inlibc
9813
9814 : locate the flags for 'access()'
9815 case "$d_access" in
9816 "$define")
9817         echo " "
9818         $cat >access.c <<EOCP
9819 #include <sys/types.h>
9820 #ifdef I_FCNTL
9821 #include <fcntl.h>
9822 #endif
9823 #ifdef I_SYS_FILE
9824 #include <sys/file.h>
9825 #endif
9826 #ifdef I_UNISTD
9827 #include <unistd.h>
9828 #endif
9829 #$i_stdlib I_STDLIB
9830 #ifdef I_STDLIB
9831 #include <stdlib.h>
9832 #endif
9833 int main() {
9834         exit(R_OK);
9835 }
9836 EOCP
9837         : check sys/file.h first, no particular reason here
9838         if $test `./findhdr sys/file.h` && \
9839                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9840                 h_sysfile=true;
9841                 echo "<sys/file.h> defines the *_OK access constants." >&4
9842         elif $test `./findhdr fcntl.h` && \
9843                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9844                 h_fcntl=true;
9845                 echo "<fcntl.h> defines the *_OK access constants." >&4
9846         elif $test `./findhdr unistd.h` && \
9847                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9848                 echo "<unistd.h> defines the *_OK access constants." >&4
9849         else
9850                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9851         fi
9852         ;;
9853 esac
9854 $rm -f access*
9855
9856 : see if accessx exists
9857 set accessx d_accessx
9858 eval $inlibc
9859
9860 : see if aintl exists
9861 set aintl d_aintl
9862 eval $inlibc
9863
9864 : see if alarm exists
9865 set alarm d_alarm
9866 eval $inlibc
9867
9868 : see if POSIX threads are available
9869 set pthread.h i_pthread
9870 eval $inhdr
9871
9872 : define a fucntion to check prototypes
9873 $cat > protochk <<EOSH
9874 $startsh
9875 cc="$cc"
9876 optimize="$optimize"
9877 ccflags="$ccflags"
9878 prototype="$prototype"
9879 define="$define"
9880 rm_try="$rm_try"
9881 usethreads=$usethreads
9882 i_pthread=$i_pthread
9883 pthread_h_first=$pthread_h_first
9884 EOSH
9885
9886 $cat >> protochk <<'EOSH'
9887
9888 $rm_try
9889 foo="$1"
9890 shift
9891 while test $# -ge 2; do
9892         case "$1" in
9893                 $define) echo "#include <$2>" >> try.c ;;
9894                 literal) echo "$2" >> try.c ;;
9895         esac
9896     # Extra magic for the benefit of systems that need pthread.h
9897     # to be included early to correctly detect threadsafe functions.
9898     # Such functions must guarantee themselves, though, that the usethreads
9899     # and i_pthread have been defined, before calling protochk.
9900     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9901         echo "#include <pthread.h>" >> try.c
9902         pthread_h_done=yes
9903     fi
9904     shift 2
9905 done
9906 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9907 cat >> try.c <<'EOCP'
9908 #ifdef CAN_PROTOTYPE
9909 #define _(args) args
9910 #else
9911 #define _(args) ()
9912 #endif
9913 EOCP
9914 echo "$foo" >> try.c
9915 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9916 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9917 status=$?
9918 $rm_try
9919 exit $status
9920 EOSH
9921 chmod +x protochk
9922 $eunicefix protochk
9923
9924 : Define hasproto macro for Configure internal use
9925 hasproto='varname=$1; func=$2; shift; shift;
9926 while $test $# -ge 2; do
9927         case "$1" in
9928         $define) echo "#include <$2>";;
9929         esac ;
9930     shift 2;
9931 done > try.c;
9932 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9933 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9934         echo "$func() prototype found.";
9935         val="$define";
9936 else
9937         echo "$func() prototype NOT found.";
9938         val="$undef";
9939 fi;
9940 set $varname;
9941 eval $setvar;
9942 $rm_try tryout.c'
9943
9944 : see if sys/types.h has to be included
9945 set sys/types.h i_systypes
9946 eval $inhdr
9947
9948 : see if sys/select.h has to be included
9949 set sys/select.h i_sysselct
9950 eval $inhdr
9951
9952 : Define hasfield macro for Configure internal use
9953 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9954 while $test $# -ge 2; do
9955         case "$1" in
9956         $define) echo "#include <$2>";;
9957         esac ;
9958     shift 2;
9959 done > try.c;
9960 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9961 set try;
9962 if eval $compile; then
9963         val="$define";
9964 else
9965         val="$undef";
9966 fi;
9967 set $varname;
9968 eval $setvar;
9969 $rm_try'
9970
9971 : see if we should include time.h, sys/time.h, or both
9972 echo " "
9973 if test "X$timeincl" = X; then
9974         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9975         $echo $n "I'm now running the test program...$c"
9976         $cat >try.c <<EOCP
9977 #include <sys/types.h>
9978 #ifdef I_TIME
9979 #include <time.h>
9980 #endif
9981 #ifdef I_SYSTIME
9982 #ifdef SYSTIMEKERNEL
9983 #define KERNEL
9984 #endif
9985 #include <sys/time.h>
9986 #endif
9987 #ifdef I_SYSSELECT
9988 #include <sys/select.h>
9989 #endif
9990 #$i_stdlib I_STDLIB
9991 #ifdef I_STDLIB
9992 #include <stdlib.h>
9993 #endif
9994 int main()
9995 {
9996         struct tm foo;
9997 #ifdef S_TIMEVAL
9998         struct timeval bar;
9999 #endif
10000 #ifdef S_TIMEZONE
10001         struct timezone tzp;
10002 #endif
10003         if (foo.tm_sec == foo.tm_sec)
10004                 exit(0);
10005 #ifdef S_TIMEVAL
10006         if (bar.tv_sec == bar.tv_sec)
10007                 exit(0);
10008 #endif
10009         exit(1);
10010 }
10011 EOCP
10012         flags=''
10013         for s_timezone in '-DS_TIMEZONE' ''; do
10014         sysselect=''
10015         for s_timeval in '-DS_TIMEVAL' ''; do
10016         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10017         for i_time in '' '-DI_TIME'; do
10018         for i_systime in '-DI_SYSTIME' ''; do
10019                 case "$flags" in
10020                 '') $echo $n ".$c"
10021                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10022                         if eval $compile; then
10023                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10024                                 shift
10025                                 flags="$*"
10026                                 echo " "
10027                                 $echo $n "Succeeded with $flags$c"
10028                         fi
10029                         ;;
10030                 esac
10031         done
10032         done
10033         done
10034         done
10035         done
10036         timeincl=''
10037         echo " "
10038         case "$flags" in
10039         *SYSTIMEKERNEL*) i_systimek="$define"
10040                 timeincl=`./findhdr sys/time.h`
10041                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10042         *) i_systimek="$undef";;
10043         esac
10044         case "$flags" in
10045         *I_TIME*) i_time="$define"
10046                 timeincl=`./findhdr time.h`" $timeincl"
10047                 echo "We'll include <time.h>." >&4;;
10048         *) i_time="$undef";;
10049         esac
10050         case "$flags" in
10051         *I_SYSTIME*) i_systime="$define"
10052                 timeincl=`./findhdr sys/time.h`" $timeincl"
10053                 echo "We'll include <sys/time.h>." >&4;;
10054         *) i_systime="$undef";;
10055         esac
10056         $rm_try
10057 fi
10058 : see if struct tm knows about tm_zone
10059 case "$i_systime$i_time" in
10060 *$define*)
10061         echo " "
10062         echo "Checking to see if your struct tm has tm_zone field..." >&4
10063         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10064         eval $hasfield
10065         ;;
10066 *)      val="$undef"
10067         set d_tm_tm_zone
10068         eval $setvar
10069         ;;
10070 esac
10071 case "$d_tm_tm_zone" in
10072 "$define")      echo "Yes, it does."   ;;
10073 *)              echo "No, it doesn't." ;;
10074 esac
10075 : see if struct tm knows about tm_gmtoff
10076 case "$i_systime$i_time" in
10077 *$define*)
10078         echo " "
10079         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10080         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10081         eval $hasfield
10082         ;;
10083 *)      val="$undef"
10084         set d_tm_tm_gmtoff
10085         eval $setvar
10086         ;;
10087 esac
10088 case "$d_tm_tm_gmtoff" in
10089 "$define")      echo "Yes, it does."   ;;
10090 *)              echo "No, it doesn't." ;;
10091 esac
10092
10093 : see if asctime_r exists
10094 set asctime_r d_asctime_r
10095 eval $inlibc
10096 case "$d_asctime_r" in
10097 "$define")
10098         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10099         case "$d_asctime_r_proto:$usethreads" in
10100         ":define")      d_asctime_r_proto=define
10101                 set d_asctime_r_proto asctime_r $hdrs
10102                 eval $hasproto ;;
10103         *)      ;;
10104         esac
10105         case "$d_asctime_r_proto" in
10106         define)
10107         case "$asctime_r_proto" in
10108         ''|0) try='char* asctime_r(const struct tm*, char*);'
10109         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10110         esac
10111         case "$asctime_r_proto" in
10112         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10113         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10114         esac
10115         case "$asctime_r_proto" in
10116         ''|0) try='int asctime_r(const struct tm*, char*);'
10117         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10118         esac
10119         case "$asctime_r_proto" in
10120         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10121         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10122         esac
10123         case "$asctime_r_proto" in
10124         ''|0)   d_asctime_r=undef
10125                 asctime_r_proto=0
10126                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10127         * )     case "$asctime_r_proto" in
10128                 REENTRANT_PROTO*) ;;
10129                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10130                 esac
10131                 echo "Prototype: $try" ;;
10132         esac
10133         ;;
10134         *)      case "$usethreads" in
10135                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10136                 esac
10137                 d_asctime_r=undef
10138                 asctime_r_proto=0
10139                 ;;
10140         esac
10141         ;;
10142 *)      asctime_r_proto=0
10143         ;;
10144 esac
10145
10146 : see if atolf exists
10147 set atolf d_atolf
10148 eval $inlibc
10149
10150 : see if atoll exists
10151 set atoll d_atoll
10152 eval $inlibc
10153
10154 : Look for GCC-style attribute format
10155 case "$d_attribute_format" in
10156 '')
10157 echo " "
10158 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10159 $cat >attrib.c <<'EOCP'
10160 #include <stdio.h>
10161 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10162 EOCP
10163 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10164         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10165                 echo "Your C compiler doesn't support __attribute__((format))."
10166                 val="$undef"
10167         else
10168                 echo "Your C compiler supports __attribute__((format))."
10169                 val="$define"
10170         fi
10171 else
10172         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10173         val="$undef"
10174 fi
10175 ;;
10176 *) val="$d_attribute_format" ;;
10177 esac
10178 set d_attribute_format
10179 eval $setvar
10180 $rm -f attrib*
10181
10182 : Look for GCC-style attribute format with null format allowed
10183 case "$d_printf_format_null" in
10184 '') case "$d_attribute_format" in
10185     $define)
10186         echo " "
10187         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10188 $cat >attrib.c <<EOCP
10189 #include <stdio.h>
10190 #$i_stdlib I_STDLIB
10191 #ifdef I_STDLIB
10192 #include <stdlib.h>
10193 #endif
10194 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10195 int null_printf (char* pat,...) { return (int)pat; }
10196 int main () { exit(null_printf(NULL)); }
10197 EOCP
10198         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10199             : run the executable in case it produces a run-time warning
10200             if $run ./attrib >>attrib.out 2>&1; then
10201                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10202                     echo "Your C compiler doesn't allow __printf__ format to be null."
10203                     val="$undef"
10204                 else
10205                     echo "Your C compiler allows __printf__ format to be null."
10206                     val="$define"
10207                 fi
10208             else
10209             echo "Your C compiler executable failed with __printf__ format null."
10210             val="$undef"
10211         fi
10212     else
10213         echo "Your C compiler fails with __printf__ format null."
10214         val="$undef"
10215     fi
10216     ;;
10217     *)  val="$undef" ;;
10218     esac
10219 ;;
10220 *)  val="$d_printf_format_null" ;;
10221 esac
10222 set d_printf_format_null
10223 eval $setvar
10224 $rm -f attrib*
10225
10226 : Look for GCC-style attribute malloc
10227 case "$d_attribute_malloc" in
10228 '')
10229 echo " "
10230 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10231 $cat >attrib.c <<'EOCP'
10232 #include <stdio.h>
10233 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10234 EOCP
10235 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10236         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10237                 echo "Your C compiler doesn't support __attribute__((malloc))."
10238                 val="$undef"
10239         else
10240                 echo "Your C compiler supports __attribute__((malloc))."
10241                 val="$define"
10242         fi
10243 else
10244         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10245         val="$undef"
10246 fi
10247 ;;
10248 *) val="$d_attribute_malloc" ;;
10249 esac
10250 set d_attribute_malloc
10251 eval $setvar
10252 $rm -f attrib*
10253
10254 : Look for GCC-style attribute nonnull
10255 case "$d_attribute_nonnull" in
10256 '')
10257 echo " "
10258 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10259 $cat >attrib.c <<'EOCP'
10260 #include <stdio.h>
10261 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10262 EOCP
10263 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10264         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10265                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10266                 val="$undef"
10267         else
10268                 echo "Your C compiler supports __attribute__((nonnull))."
10269                 val="$define"
10270         fi
10271 else
10272         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10273         val="$undef"
10274 fi
10275 ;;
10276 *) val="$d_attribute_nonnull" ;;
10277 esac
10278 set d_attribute_nonnull
10279 eval $setvar
10280 $rm -f attrib*
10281
10282 : Look for GCC-style attribute noreturn
10283 case "$d_attribute_noreturn" in
10284 '')
10285 echo " "
10286 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10287 $cat >attrib.c <<'EOCP'
10288 #include <stdio.h>
10289 void fall_over_dead( void ) __attribute__((noreturn));
10290 EOCP
10291 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10292         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10293                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10294                 val="$undef"
10295         else
10296                 echo "Your C compiler supports __attribute__((noreturn))."
10297                 val="$define"
10298         fi
10299 else
10300         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10301         val="$undef"
10302 fi
10303 ;;
10304 *) val="$d_attribute_noreturn" ;;
10305 esac
10306 set d_attribute_noreturn
10307 eval $setvar
10308 $rm -f attrib*
10309
10310 : Look for GCC-style attribute pure
10311 case "$d_attribute_pure" in
10312 '')
10313 echo " "
10314 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10315 $cat >attrib.c <<'EOCP'
10316 #include <stdio.h>
10317 int square( int n ) __attribute__((pure));
10318 EOCP
10319 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10320         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10321                 echo "Your C compiler doesn't support __attribute__((pure))."
10322                 val="$undef"
10323         else
10324                 echo "Your C compiler supports __attribute__((pure))."
10325                 val="$define"
10326         fi
10327 else
10328         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10329         val="$undef"
10330 fi
10331 ;;
10332 *) val="$d_attribute_pure" ;;
10333 esac
10334 set d_attribute_pure
10335 eval $setvar
10336 $rm -f attrib*
10337
10338 : Look for GCC-style attribute unused
10339 case "$d_attribute_unused" in
10340 '')
10341 echo " "
10342 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10343 $cat >attrib.c <<'EOCP'
10344 #include <stdio.h>
10345 int do_something( int dummy __attribute__((unused)), int n );
10346 EOCP
10347 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10348         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10349                 echo "Your C compiler doesn't support __attribute__((unused))."
10350                 val="$undef"
10351         else
10352                 echo "Your C compiler supports __attribute__((unused))."
10353                 val="$define"
10354         fi
10355 else
10356         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10357         val="$undef"
10358 fi
10359 ;;
10360 *) val="$d_attribute_unused" ;;
10361 esac
10362 set d_attribute_unused
10363 eval $setvar
10364 $rm -f attrib*
10365
10366 : Look for GCC-style attribute warn_unused_result
10367 case "$d_attribute_warn_unused_result" in
10368 '')
10369 echo " "
10370 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10371 $cat >attrib.c <<'EOCP'
10372 #include <stdio.h>
10373 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10374 EOCP
10375 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10376         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10377                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10378                 val="$undef"
10379         else
10380                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10381                 val="$define"
10382         fi
10383 else
10384         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10385         val="$undef"
10386 fi
10387 ;;
10388 *) val="$d_attribute_warn_unused_result" ;;
10389 esac
10390 set d_attribute_warn_unused_result
10391 eval $setvar
10392 $rm -f attrib*
10393
10394 : see if bcmp exists
10395 set bcmp d_bcmp
10396 eval $inlibc
10397
10398 : see if bcopy exists
10399 set bcopy d_bcopy
10400 eval $inlibc
10401
10402 : see if getpgrp exists
10403 set getpgrp d_getpgrp
10404 eval $inlibc
10405
10406 case "$d_getpgrp" in
10407 "$define")
10408         echo " "
10409         echo "Checking to see which flavor of getpgrp is in use..."
10410         $cat >try.c <<EOP
10411 #$i_unistd I_UNISTD
10412 #include <sys/types.h>
10413 #ifdef I_UNISTD
10414 #  include <unistd.h>
10415 #endif
10416 #$i_stdlib I_STDLIB
10417 #ifdef I_STDLIB
10418 #include <stdlib.h>
10419 #endif
10420 int main()
10421 {
10422         if (getuid() == 0) {
10423                 printf("(I see you are running Configure as super-user...)\n");
10424                 setuid(1);
10425         }
10426 #ifdef TRY_BSD_PGRP
10427         if (getpgrp(1) == 0)
10428                 exit(0);
10429 #else
10430         if (getpgrp() > 0)
10431                 exit(0);
10432 #endif
10433         exit(1);
10434 }
10435 EOP
10436         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10437                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10438                 val="$define"
10439         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10440                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10441                 val="$undef"
10442         else
10443                 echo "I can't seem to compile and run the test program."
10444                 if ./usg; then
10445                         xxx="a USG one, i.e. you use getpgrp()."
10446                 else
10447                         # SVR4 systems can appear rather BSD-ish.
10448                         case "$i_unistd" in
10449                         $undef)
10450                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10451                                 val="$define"
10452                                 ;;
10453                         $define)
10454                                 xxx="probably a USG one, i.e. you use getpgrp()."
10455                                 val="$undef"
10456                                 ;;
10457                         esac
10458                 fi
10459                 echo "Assuming your getpgrp is $xxx" >&4
10460         fi
10461         ;;
10462 *) val="$undef";;
10463 esac
10464 set d_bsdgetpgrp
10465 eval $setvar
10466 $rm_try
10467
10468 : see if setpgrp exists
10469 set setpgrp d_setpgrp
10470 eval $inlibc
10471
10472 case "$d_setpgrp" in
10473 "$define")
10474         echo " "
10475         echo "Checking to see which flavor of setpgrp is in use..."
10476         $cat >try.c <<EOP
10477 #$i_unistd I_UNISTD
10478 #include <sys/types.h>
10479 #ifdef I_UNISTD
10480 #  include <unistd.h>
10481 #endif
10482 #$i_stdlib I_STDLIB
10483 #ifdef I_STDLIB
10484 #include <stdlib.h>
10485 #endif
10486 int main()
10487 {
10488         if (getuid() == 0) {
10489                 printf("(I see you are running Configure as super-user...)\n");
10490                 setuid(1);
10491         }
10492 #ifdef TRY_BSD_PGRP
10493         if (-1 == setpgrp(1, 1))
10494                 exit(0);
10495 #else
10496         if (setpgrp() != -1)
10497                 exit(0);
10498 #endif
10499         exit(1);
10500 }
10501 EOP
10502         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10503                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10504                 val="$define"
10505         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10506                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10507                 val="$undef"
10508         else
10509                 echo "(I can't seem to compile and run the test program.)"
10510                 if ./usg; then
10511                         xxx="a USG one, i.e. you use setpgrp()."
10512                 else
10513                         # SVR4 systems can appear rather BSD-ish.
10514                         case "$i_unistd" in
10515                         $undef)
10516                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10517                                 val="$define"
10518                                 ;;
10519                         $define)
10520                                 xxx="probably a USG one, i.e. you use setpgrp()."
10521                                 val="$undef"
10522                                 ;;
10523                         esac
10524                 fi
10525                 echo "Assuming your setpgrp is $xxx" >&4
10526         fi
10527         ;;
10528 *) val="$undef";;
10529 esac
10530 set d_bsdsetpgrp
10531 eval $setvar
10532 $rm_try
10533
10534 : Look for GCC-style __builtin_choose_expr
10535 case "$d_builtin_choose_expr" in
10536 '')
10537     echo " "
10538     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10539     $cat >try.c <<'EOCP'
10540 #include <assert.h>
10541 #include <stdlib.h>
10542 #include <stdio.h>
10543
10544 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10545
10546 int main(void) {
10547     assert( SYRINX(1) == 2112 );
10548     assert( SYRINX(1) != 5150 );
10549     assert( SYRINX(0) == 5150 );
10550     assert( SYRINX(0) != 2112 );
10551     puts( "All good!" );
10552     exit(0);
10553 }
10554
10555 EOCP
10556     set try
10557     if eval $compile && $run ./try; then
10558         echo "Your C compiler supports __builtin_choose_expr."
10559         val="$define"
10560     else
10561         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10562         val="$undef"
10563     fi
10564 ;;
10565 *) val="$d_builtin_choose_expr" ;;
10566 esac
10567
10568 set d_builtin_choose_expr
10569 eval $setvar
10570 $rm_try
10571
10572 : Look for GCC-style __builtin_expect
10573 case "$d_builtin_expect" in
10574 '')
10575     echo " "
10576     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10577     $cat >try.c <<'EOCP'
10578 int main(void) {
10579     int n = 50;
10580     if ( __builtin_expect(n, 0) ) n = 1;
10581     /* Remember shell exit code truth is 0, C truth is non-zero */
10582     return !(n == 1);
10583 }
10584 EOCP
10585     set try
10586     if eval $compile && $run ./try; then
10587         echo "Your C compiler supports __builtin_expect."
10588         val="$define"
10589     else
10590         echo "Your C compiler doesn't seem to understand __builtin_expect."
10591         val="$undef"
10592     fi
10593     ;;
10594 *) val="$d_builtin_expect" ;;
10595 esac
10596
10597 set d_builtin_expect
10598 eval $setvar
10599 $rm_try
10600
10601 : see if bzero exists
10602 set bzero d_bzero
10603 eval $inlibc
10604
10605 : see if stdarg is available
10606 echo " "
10607 if $test `./findhdr stdarg.h`; then
10608         echo "<stdarg.h> found." >&4
10609         valstd="$define"
10610 else
10611         echo "<stdarg.h> NOT found." >&4
10612         valstd="$undef"
10613 fi
10614
10615 : see if varags is available
10616 echo " "
10617 if $test `./findhdr varargs.h`; then
10618         echo "<varargs.h> found." >&4
10619 else
10620         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10621 fi
10622
10623 : set up the varargs testing programs
10624 $cat > varargs.c <<EOP
10625 #ifdef I_STDARG
10626 #include <stdarg.h>
10627 #endif
10628 #ifdef I_VARARGS
10629 #include <varargs.h>
10630 #endif
10631
10632 #ifdef I_STDARG
10633 int f(char *p, ...)
10634 #else
10635 int f(va_alist)
10636 va_dcl
10637 #endif
10638 {
10639         va_list ap;
10640 #ifndef I_STDARG
10641         char *p;
10642 #endif
10643 #ifdef I_STDARG
10644         va_start(ap,p);
10645 #else
10646         va_start(ap);
10647         p = va_arg(ap, char *);
10648 #endif
10649         va_end(ap);
10650         return 0;
10651 }
10652 EOP
10653 $cat > varargs <<EOP
10654 $startsh
10655 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10656         echo "true"
10657 else
10658         echo "false"
10659 fi
10660 $rm -f varargs$_o
10661 EOP
10662 chmod +x varargs
10663
10664 : now check which varargs header should be included
10665 echo " "
10666 i_varhdr=''
10667 case "$valstd" in
10668 "$define")
10669         if `./varargs I_STDARG`; then
10670                 val='stdarg.h'
10671         elif `./varargs I_VARARGS`; then
10672                 val='varargs.h'
10673         fi
10674         ;;
10675 *)
10676         if `./varargs I_VARARGS`; then
10677                 val='varargs.h'
10678         fi
10679         ;;
10680 esac
10681 case "$val" in
10682 '')
10683 echo "I could not find the definition for va_dcl... You have problems..." >&4
10684         val="$undef"; set i_stdarg; eval $setvar
10685         val="$undef"; set i_varargs; eval $setvar
10686         ;;
10687 *)
10688         set i_varhdr
10689         eval $setvar
10690         case "$i_varhdr" in
10691         stdarg.h)
10692                 val="$define"; set i_stdarg; eval $setvar
10693                 val="$undef"; set i_varargs; eval $setvar
10694                 ;;
10695         varargs.h)
10696                 val="$undef"; set i_stdarg; eval $setvar
10697                 val="$define"; set i_varargs; eval $setvar
10698                 ;;
10699         esac
10700         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10701 esac
10702 $rm -f varargs*
10703
10704 : see if the Compiler supports C99 variadic macros
10705 case "$i_stdarg$i_stdlib" in
10706     "$define$define")
10707     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10708     $cat >try.c <<EOCP
10709 #include <stdio.h>
10710 #include <stdarg.h>
10711
10712 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10713
10714 int main() {
10715   char buf[20];
10716   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10717   puts(buf);
10718   return 0;
10719 }
10720 EOCP
10721     set try
10722     if eval $compile && $run ./try 2>&1 >/dev/null; then
10723         case "`$run ./try`" in
10724             "123 456 789")
10725             echo "You have C99 variadic macros." >&4
10726             d_c99_variadic_macros="$define"
10727             ;;
10728             *)
10729             echo "You don't have functional C99 variadic macros." >&4
10730             d_c99_variadic_macros="$undef"
10731             ;;
10732         esac
10733     else
10734         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10735         d_c99_variadic_macros="$undef"
10736     fi
10737     $rm_try
10738     ;;
10739     *)
10740     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10741     d_c99_variadic_macros="$undef"
10742     ;;
10743 esac
10744
10745 : see if signal is declared as pointer to function returning int or void
10746 echo " "
10747 xxx=`./findhdr signal.h`
10748 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10749 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10750         echo "You have int (*signal())() instead of void." >&4
10751         val="$undef"
10752 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10753         echo "You have void (*signal())()." >&4
10754         val="$define"
10755 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10756         echo "You have int (*signal())() instead of void." >&4
10757         val="$undef"
10758 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10759         echo "You have void (*signal())()." >&4
10760         val="$define"
10761 else
10762         case "$d_voidsig" in
10763         '')
10764         echo "I can't determine whether signal handler returns void or int..." >&4
10765                 dflt=void
10766                 rp="What type does your signal handler return?"
10767                 . ./myread
10768                 case "$ans" in
10769                 v*) val="$define";;
10770                 *) val="$undef";;
10771                 esac;;
10772         "$define")
10773                 echo "As you already told me, signal handler returns void." >&4
10774                 val="$define"
10775                 ;;
10776         *)      echo "As you already told me, signal handler returns int." >&4
10777                 val="$undef"
10778                 ;;
10779         esac
10780 fi
10781 set d_voidsig
10782 eval $setvar
10783 case "$d_voidsig" in
10784 "$define") signal_t="void";;
10785 *) signal_t="int";;
10786 esac
10787 $rm -f $$.tmp
10788
10789 : check for ability to cast large floats to 32-bit ints.
10790 echo " "
10791 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10792 if $test "$intsize" -ge 4; then
10793         xxx=int
10794 else
10795         xxx=long
10796 fi
10797 $cat >try.c <<EOCP
10798 #include <stdio.h>
10799 #$i_stdlib I_STDLIB
10800 #ifdef I_STDLIB
10801 #include <stdlib.h>
10802 #endif
10803 #include <sys/types.h>
10804 #include <signal.h>
10805 $signal_t blech(int s) { exit(3); }
10806 int main()
10807 {
10808         $xxx i32;
10809         double f, g;
10810         int result = 0;
10811         char str[16];
10812         signal(SIGFPE, blech);
10813
10814         /* Don't let compiler optimize the test away.  Store the number
10815            in a writable string for gcc to pass to sscanf under HP/UX.
10816         */
10817         sprintf(str, "2147483647");
10818         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10819         g = 10 * f;
10820         i32  = ($xxx) g;
10821
10822         /* x86 processors will probably give 0x8000 0000, which is a
10823            sign change.  We don't want that.  We want to mimic SPARC
10824            behavior here, which is to preserve the sign and give
10825            back 0x7fff ffff.
10826         */
10827         if (i32 != ($xxx) f)
10828                 result |= 1;
10829         exit(result);
10830 }
10831 EOCP
10832 set try
10833 if eval $compile_ok; then
10834         $run ./try
10835         yyy=$?
10836 else
10837         echo "(I can't seem to compile the test program--assuming it can't)"
10838         yyy=1
10839 fi
10840 case "$yyy" in
10841 0)      val="$define"
10842         echo "Yup, it can."
10843         ;;
10844 *)      val="$undef"
10845         echo "Nope, it can't."
10846         ;;
10847 esac
10848 set d_casti32
10849 eval $setvar
10850 $rm_try
10851
10852 : check for ability to cast negative floats to unsigned
10853 echo " "
10854 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10855 $cat >try.c <<EOCP
10856 #include <stdio.h>
10857 #$i_stdlib I_STDLIB
10858 #ifdef I_STDLIB
10859 #include <stdlib.h>
10860 #endif
10861 #include <sys/types.h>
10862 #include <signal.h>
10863 $signal_t blech(int s) { exit(7); }
10864 $signal_t blech_in_list(int s) { exit(4); }
10865 unsigned long dummy_long(unsigned long p) { return p; }
10866 unsigned int dummy_int(unsigned int p) { return p; }
10867 unsigned short dummy_short(unsigned short p) { return p; }
10868 int main()
10869 {
10870         double f;
10871         unsigned long along;
10872         unsigned int aint;
10873         unsigned short ashort;
10874         int result = 0;
10875         char str[16];
10876
10877         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10878            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10879            optimized the whole file away
10880         */
10881         /* Store the number in a writable string for gcc to pass to
10882            sscanf under HP/UX.
10883         */
10884         sprintf(str, "-123");
10885         sscanf(str, "%lf", &f);  /* f = -123.; */
10886
10887         signal(SIGFPE, blech);
10888         along = (unsigned long)f;
10889         aint = (unsigned int)f;
10890         ashort = (unsigned short)f;
10891         if (along != (unsigned long)-123)
10892                 result |= 1;
10893         if (aint != (unsigned int)-123)
10894                 result |= 1;
10895         if (ashort != (unsigned short)-123)
10896                 result |= 1;
10897         sprintf(str, "1073741824.");
10898         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10899         f = f + f;
10900         along = 0;
10901         along = (unsigned long)f;
10902         if (along != 0x80000000)
10903                 result |= 2;
10904         f -= 1.;
10905         along = 0;
10906         along = (unsigned long)f;
10907         if (along != 0x7fffffff)
10908                 result |= 1;
10909         f += 2.;
10910         along = 0;
10911         along = (unsigned long)f;
10912         if (along != 0x80000001)
10913                 result |= 2;
10914         if (result)
10915                 exit(result);
10916         signal(SIGFPE, blech_in_list);
10917         sprintf(str, "123.");
10918         sscanf(str, "%lf", &f);  /* f = 123.; */
10919         along = dummy_long((unsigned long)f);
10920         aint = dummy_int((unsigned int)f);
10921         ashort = dummy_short((unsigned short)f);
10922         if (along != (unsigned long)123)
10923                 result |= 4;
10924         if (aint != (unsigned int)123)
10925                 result |= 4;
10926         if (ashort != (unsigned short)123)
10927                 result |= 4;
10928         exit(result);
10929
10930 }
10931 EOCP
10932 set try
10933 if eval $compile_ok; then
10934         $run ./try
10935         castflags=$?
10936 else
10937         echo "(I can't seem to compile the test program--assuming it can't)"
10938         castflags=7
10939 fi
10940 case "$castflags" in
10941 0)      val="$define"
10942         echo "Yup, it can."
10943         ;;
10944 *)      val="$undef"
10945         echo "Nope, it can't."
10946         ;;
10947 esac
10948 set d_castneg
10949 eval $setvar
10950 $rm_try
10951
10952 : see if vprintf exists
10953 echo " "
10954 if set vprintf val -f d_vprintf; eval $csym; $val; then
10955         echo 'vprintf() found.' >&4
10956         val="$define"
10957         $cat >try.c <<EOF
10958 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10959 #$i_varargs I_VARARGS
10960
10961 #$i_stdlib I_STDLIB
10962 #$i_unistd I_UNISTD
10963
10964 #ifdef I_STDARG
10965 #  include <stdarg.h>
10966 #else /* I_VARARGS */
10967 #  include <varargs.h>
10968 #endif
10969
10970 #ifdef I_UNISTD
10971 #  include <unistd.h>
10972 #endif
10973
10974 #ifdef I_STDLIB
10975 #  include <stdlib.h>
10976 #endif
10977
10978 #include <stdio.h> /* vsprintf prototype */
10979
10980 #ifdef I_STDARG
10981 void xxx(int n, ...)
10982 {
10983     va_list args;
10984     char buf[10];
10985     va_start(args, n);
10986     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10987 }
10988 int main() { xxx(1, "foo"); }
10989
10990 #else /* I_VARARGS */
10991
10992 xxx(va_alist)
10993 va_dcl
10994 {
10995     va_list args;
10996     char buf[10];
10997     va_start(args);
10998     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10999 }
11000 int main() { xxx("foo"); }
11001
11002 #endif
11003
11004 EOF
11005         set try
11006         if eval $compile_ok; then
11007                 if $run ./try; then
11008                         echo "Your vsprintf() returns (int)." >&4
11009                         val2="$undef"
11010                 else
11011                         echo "Your vsprintf() returns (char*)." >&4
11012                         val2="$define"
11013                 fi
11014         else
11015                 echo 'I am unable to compile the vsprintf() test program.' >&4
11016                 # We shouldn't get here.  If we do, assume the standard signature,
11017                 # not the old BSD one.
11018                 echo 'Guessing that vsprintf() returns (int).' >&4
11019                 val2="$undef"
11020         fi
11021 else
11022         echo 'vprintf() NOT found.' >&4
11023         val="$undef"
11024         val2="$undef"
11025 fi
11026 $rm_try
11027 set d_vprintf
11028 eval $setvar
11029 val=$val2
11030 set d_charvspr
11031 eval $setvar
11032
11033 : see if chown exists
11034 set chown d_chown
11035 eval $inlibc
11036
11037 : see if chroot exists
11038 set chroot d_chroot
11039 eval $inlibc
11040
11041 : see if chsize exists
11042 set chsize d_chsize
11043 eval $inlibc
11044
11045 : see if class exists
11046 set class d_class
11047 eval $inlibc
11048
11049 : see if clearenv exists
11050 set clearenv d_clearenv
11051 eval $inlibc
11052
11053 : Define hasstruct macro for Configure internal use
11054 hasstruct='varname=$1; struct=$2; shift; shift;
11055 while $test $# -ge 2; do
11056         case "$1" in
11057         $define) echo "#include <$2>";;
11058         esac ;
11059     shift 2;
11060 done > try.c;
11061 echo "int main () { struct $struct foo; }" >> try.c;
11062 set try;
11063 if eval $compile; then
11064         val="$define";
11065 else
11066         val="$undef";
11067 fi;
11068 set $varname;
11069 eval $setvar;
11070 $rm_try'
11071
11072 : see whether socket exists
11073 socketlib=''
11074 sockethdr=''
11075 echo " "
11076 $echo $n "Hmm... $c" >&4
11077 if set socket val -f d_socket; eval $csym; $val; then
11078         echo "Looks like you have Berkeley networking support." >&4
11079         d_socket="$define"
11080         if set setsockopt val -f; eval $csym; $val; then
11081                 d_oldsock="$undef"
11082         else
11083                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11084                 d_oldsock="$define"
11085         fi
11086 else
11087         if $contains socklib libc.list >/dev/null 2>&1; then
11088                 echo "Looks like you have Berkeley networking support." >&4
11089                 d_socket="$define"
11090                 : we will have to assume that it supports the 4.2 BSD interface
11091                 d_oldsock="$undef"
11092         else
11093                 echo "You don't have Berkeley networking in libc$_a..." >&4
11094                 if test "X$d_socket" = "X$define"; then
11095                    echo "...but you seem to believe that you have sockets." >&4
11096                 else
11097                         for net in net socket
11098                         do
11099                                 if test -f /usr/lib/lib$net$_a; then
11100                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11101                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11102                                         if $contains socket libc.list >/dev/null 2>&1; then
11103                                                 d_socket="$define"
11104                                                 socketlib="-l$net"
11105                                                 case "$net" in
11106                                                 net)
11107                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11108                                                         sockethdr="-I/usr/netinclude"
11109                                                         ;;
11110                                                 esac
11111                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11112                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11113                                                         d_oldsock="$undef"
11114                                                 else
11115                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11116                                                         d_oldsock="$define"
11117                                                 fi
11118                                                 break
11119                                         fi
11120                                 fi
11121                         done
11122                         if test "X$d_socket" != "X$define"; then
11123                            echo "or anywhere else I see." >&4
11124                            d_socket="$undef"
11125                            d_oldsock="$undef"
11126                         fi
11127                 fi
11128         fi
11129 fi
11130
11131 : see if socketpair exists
11132 set socketpair d_sockpair
11133 eval $inlibc
11134
11135
11136 echo " "
11137 echo "Checking the availability of certain socket constants..." >&4
11138 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11139         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11140         $cat >try.c <<EOF
11141 #include <sys/types.h>
11142 #include <sys/socket.h>
11143 int main() {
11144     int i = $ENUM;
11145 }
11146 EOF
11147         val="$undef"
11148         set try; if eval $compile; then
11149                 val="$define"
11150         fi
11151         set d_${enum}; eval $setvar
11152         $rm_try
11153 done
11154
11155 : see if this is a sys/uio.h system
11156 set sys/uio.h i_sysuio
11157 eval $inhdr
11158
11159 : Check for cmsghdr support
11160 echo " "
11161 echo "Checking to see if your system supports struct cmsghdr..." >&4
11162 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11163 eval $hasstruct
11164 case "$d_cmsghdr_s" in
11165 "$define")      echo "Yes, it does."   ;;
11166 *)              echo "No, it doesn't." ;;
11167 esac
11168
11169
11170 : check for const keyword
11171 echo " "
11172 echo 'Checking to see if your C compiler knows about "const"...' >&4
11173 $cat >const.c <<'EOCP'
11174 typedef struct spug { int drokk; } spug;
11175 int main()
11176 {
11177         const char *foo;
11178         const spug y = { 0 };
11179 }
11180 EOCP
11181 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11182         val="$define"
11183         echo "Yup, it does."
11184 else
11185         val="$undef"
11186         echo "Nope, it doesn't."
11187 fi
11188 set d_const
11189 eval $setvar
11190
11191 : see if copysignl exists
11192 set copysignl d_copysignl
11193 eval $inlibc
11194
11195 : see if crypt exists
11196 echo " "
11197 set crypt d_crypt
11198 eval $inlibc
11199 case "$d_crypt" in
11200 $define) cryptlib='' ;;
11201 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11202                 echo 'crypt() found.' >&4
11203                 val="$define"
11204                 cryptlib=''
11205         else
11206                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11207                 if $test -z "$cryptlib"; then
11208                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11209                 else
11210                         cryptlib=-lcrypt
11211                 fi
11212                 if $test -z "$cryptlib"; then
11213                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11214                 else
11215                         cryptlib=-lcrypt
11216                 fi
11217                 if $test -z "$cryptlib"; then
11218                         cryptlib=`./loc libcrypt$_a "" $libpth`
11219                 else
11220                         cryptlib=-lcrypt
11221                 fi
11222                 if $test -z "$cryptlib"; then
11223                         echo 'crypt() NOT found.' >&4
11224                         val="$undef"
11225                 else
11226                         val="$define"
11227                 fi
11228         fi
11229         set d_crypt
11230         eval $setvar
11231         ;;
11232 esac
11233
11234 : see if this is a crypt.h system
11235 set crypt.h i_crypt
11236 eval $inhdr
11237
11238 : see if crypt_r exists
11239 set crypt_r d_crypt_r
11240 eval $inlibc
11241 case "$d_crypt_r" in
11242 "$define")
11243         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11244         case "$d_crypt_r_proto:$usethreads" in
11245         ":define")      d_crypt_r_proto=define
11246                 set d_crypt_r_proto crypt_r $hdrs
11247                 eval $hasproto ;;
11248         *)      ;;
11249         esac
11250         case "$d_crypt_r_proto" in
11251         define)
11252         case "$crypt_r_proto" in
11253         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11254         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11255         esac
11256         case "$crypt_r_proto" in
11257         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11258         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11259         esac
11260         case "$crypt_r_proto" in
11261         ''|0)   d_crypt_r=undef
11262                 crypt_r_proto=0
11263                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11264         * )     case "$crypt_r_proto" in
11265                 REENTRANT_PROTO*) ;;
11266                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11267                 esac
11268                 echo "Prototype: $try" ;;
11269         esac
11270         ;;
11271         *)      case "$usethreads" in
11272                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11273                 esac
11274                 d_crypt_r=undef
11275                 crypt_r_proto=0
11276                 ;;
11277         esac
11278         ;;
11279 *)      crypt_r_proto=0
11280         ;;
11281 esac
11282
11283 : get csh whereabouts
11284 case "$csh" in
11285 'csh') val="$undef" ;;
11286 *) val="$define" ;;
11287 esac
11288 set d_csh
11289 eval $setvar
11290 : Respect a hint or command line value for full_csh.
11291 case "$full_csh" in
11292 '') full_csh=$csh ;;
11293 esac
11294
11295 : see if ctermid exists
11296 set ctermid d_ctermid
11297 eval $inlibc
11298
11299 : see if ctermid_r exists
11300 set ctermid_r d_ctermid_r
11301 eval $inlibc
11302 case "$d_ctermid_r" in
11303 "$define")
11304         hdrs="$i_systypes sys/types.h define stdio.h "
11305         case "$d_ctermid_r_proto:$usethreads" in
11306         ":define")      d_ctermid_r_proto=define
11307                 set d_ctermid_r_proto ctermid_r $hdrs
11308                 eval $hasproto ;;
11309         *)      ;;
11310         esac
11311         case "$d_ctermid_r_proto" in
11312         define)
11313         case "$ctermid_r_proto" in
11314         ''|0) try='char* ctermid_r(char*);'
11315         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11316         esac
11317         case "$ctermid_r_proto" in
11318         ''|0)   d_ctermid_r=undef
11319                 ctermid_r_proto=0
11320                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11321         * )     case "$ctermid_r_proto" in
11322                 REENTRANT_PROTO*) ;;
11323                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11324                 esac
11325                 echo "Prototype: $try" ;;
11326         esac
11327         ;;
11328         *)      case "$usethreads" in
11329                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11330                 esac
11331                 d_ctermid_r=undef
11332                 ctermid_r_proto=0
11333                 ;;
11334         esac
11335         ;;
11336 *)      ctermid_r_proto=0
11337         ;;
11338 esac
11339
11340 : see if ctime_r exists
11341 set ctime_r d_ctime_r
11342 eval $inlibc
11343 case "$d_ctime_r" in
11344 "$define")
11345         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11346         case "$d_ctime_r_proto:$usethreads" in
11347         ":define")      d_ctime_r_proto=define
11348                 set d_ctime_r_proto ctime_r $hdrs
11349                 eval $hasproto ;;
11350         *)      ;;
11351         esac
11352         case "$d_ctime_r_proto" in
11353         define)
11354         case "$ctime_r_proto" in
11355         ''|0) try='char* ctime_r(const time_t*, char*);'
11356         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11357         esac
11358         case "$ctime_r_proto" in
11359         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11360         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11361         esac
11362         case "$ctime_r_proto" in
11363         ''|0) try='int ctime_r(const time_t*, char*);'
11364         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11365         esac
11366         case "$ctime_r_proto" in
11367         ''|0) try='int ctime_r(const time_t*, char*, int);'
11368         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11369         esac
11370         case "$ctime_r_proto" in
11371         ''|0)   d_ctime_r=undef
11372                 ctime_r_proto=0
11373                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11374         * )     case "$ctime_r_proto" in
11375                 REENTRANT_PROTO*) ;;
11376                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11377                 esac
11378                 echo "Prototype: $try" ;;
11379         esac
11380         ;;
11381         *)      case "$usethreads" in
11382                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11383                 esac
11384                 d_ctime_r=undef
11385                 ctime_r_proto=0
11386                 ;;
11387         esac
11388         ;;
11389 *)      ctime_r_proto=0
11390         ;;
11391 esac
11392
11393 : see if cuserid exists
11394 set cuserid d_cuserid
11395 eval $inlibc
11396
11397 : see if this is a limits.h system
11398 set limits.h i_limits
11399 eval $inhdr
11400
11401 : see if this is a float.h system
11402 set float.h i_float
11403 eval $inhdr
11404
11405 : See if number of significant digits in a double precision number is known
11406 echo " "
11407 $cat >dbl_dig.c <<EOM
11408 #$i_limits I_LIMITS
11409 #$i_float I_FLOAT
11410 #ifdef I_LIMITS
11411 #include <limits.h>
11412 #endif
11413 #ifdef I_FLOAT
11414 #include <float.h>
11415 #endif
11416 #ifdef DBL_DIG
11417 printf("Contains DBL_DIG");
11418 #endif
11419 EOM
11420 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11421 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11422         echo "DBL_DIG found." >&4
11423         val="$define"
11424 else
11425         echo "DBL_DIG NOT found." >&4
11426         val="$undef"
11427 fi
11428 $rm -f dbl_dig.?
11429 set d_dbl_dig
11430 eval $setvar
11431
11432 : see if dbm.h is available
11433 : see if dbmclose exists
11434 set dbmclose d_dbmclose
11435 eval $inlibc
11436
11437 case "$d_dbmclose" in
11438 $define)
11439         set dbm.h i_dbm
11440         eval $inhdr
11441         case "$i_dbm" in
11442         $define)
11443                 val="$undef"
11444                 set i_rpcsvcdbm
11445                 eval $setvar
11446                 ;;
11447         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11448                 eval $inhdr
11449                 ;;
11450         esac
11451         ;;
11452 *)      echo "We won't be including <dbm.h>"
11453         val="$undef"
11454         set i_dbm
11455         eval $setvar
11456         val="$undef"
11457         set i_rpcsvcdbm
11458         eval $setvar
11459         ;;
11460 esac
11461
11462 : see if prototype for dbminit is available
11463 echo " "
11464 set d_dbminitproto dbminit $i_dbm dbm.h
11465 eval $hasproto
11466
11467 : see if difftime exists
11468 set difftime d_difftime
11469 eval $inlibc
11470
11471 : see if this is a dirent system
11472 echo " "
11473 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11474         val="$define"
11475         echo "<dirent.h> found." >&4
11476 else
11477         val="$undef"
11478         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11479                 echo "<sys/dir.h> found." >&4
11480                 echo " "
11481         else
11482                 xinc=`./findhdr sys/ndir.h`
11483         fi
11484         echo "<dirent.h> NOT found." >&4
11485 fi
11486 set i_dirent
11487 eval $setvar
11488
11489 : Look for type of directory structure.
11490 echo " "
11491 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11492
11493 case "$direntrytype" in
11494 ''|' ')
11495         case "$i_dirent" in
11496         $define) guess1='struct dirent' ;;
11497         *) guess1='struct direct'  ;;
11498         esac
11499         ;;
11500 *)      guess1="$direntrytype"
11501         ;;
11502 esac
11503
11504 case "$guess1" in
11505 'struct dirent') guess2='struct direct' ;;
11506 *) guess2='struct dirent' ;;
11507 esac
11508
11509 if $contains "$guess1" try.c >/dev/null 2>&1; then
11510         direntrytype="$guess1"
11511         echo "Your directory entries are $direntrytype." >&4
11512 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11513         direntrytype="$guess2"
11514         echo "Your directory entries seem to be $direntrytype." >&4
11515 else
11516         echo "I don't recognize your system's directory entries." >&4
11517         rp="What type is used for directory entries on this system?"
11518         dflt="$guess1"
11519         . ./myread
11520         direntrytype="$ans"
11521 fi
11522 $rm_try
11523
11524 : see if the directory entry stores field length
11525 echo " "
11526 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11527 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11528         echo "Good, your directory entry keeps length information in d_namlen." >&4
11529         val="$define"
11530 else
11531         echo "Your directory entry does not know about the d_namlen field." >&4
11532         val="$undef"
11533 fi
11534 set d_dirnamlen
11535 eval $setvar
11536 $rm_try
11537
11538 : Look for DIR.dd_fd
11539 case "$i_dirent" in
11540 "$define")
11541     echo "Checking to see if DIR has a dd_fd member variable" >&4
11542     $cat >try.c <<EOCP
11543 #$i_stdlib I_STDLIB
11544 #ifdef I_STDLIB
11545 #include <stdlib.h>
11546 #endif
11547 #include <dirent.h>
11548
11549 int main() {
11550     DIR dir;
11551     dir.dd_fd = 1;
11552     return 0;
11553 }
11554 EOCP
11555     val=$undef
11556     set try
11557     if eval $compile; then
11558         echo "Yes, it does."
11559         val="$define"
11560     else
11561         echo "No, it does not."
11562         val="$undef"
11563     fi
11564     ;;
11565 *)
11566     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11567     val="$undef"
11568     ;;
11569 esac
11570 set d_dir_dd_fd
11571 eval $setvar
11572 $rm_try
11573
11574 : see if this is an sysdir system
11575 set sys/dir.h i_sysdir
11576 eval $inhdr
11577
11578 : see if this is an sysndir system
11579 set sys/ndir.h i_sysndir
11580 eval $inhdr
11581
11582 : Look for dirfd
11583 echo " "
11584 $cat >dirfd.c <<EOM
11585 #include <stdio.h>
11586 #$i_stdlib I_STDLIB
11587 #ifdef I_STDLIB
11588 #include <stdlib.h>
11589 #endif
11590 #$i_dirent I_DIRENT             /**/
11591 #$i_sysdir I_SYS_DIR            /**/
11592 #$i_sysndir I_SYS_NDIR          /**/
11593 #$i_systypes I_SYS_TYPES        /**/
11594 #if defined(I_SYS_TYPES)
11595 #include <sys/types.h>
11596 #endif
11597 #if defined(I_DIRENT)
11598 #include <dirent.h>
11599 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11600 #include <sys/dir.h>
11601 #endif
11602 #else
11603 #ifdef I_SYS_NDIR
11604 #include <sys/ndir.h>
11605 #else
11606 #ifdef I_SYS_DIR
11607 #ifdef hp9000s500
11608 #include <ndir.h>       /* may be wrong in the future */
11609 #else
11610 #include <sys/dir.h>
11611 #endif
11612 #endif
11613 #endif
11614 #endif 
11615 int main() {
11616         DIR *dirp = opendir(".");
11617         if (dirfd(dirp) >= 0)
11618                 exit(0);
11619         else
11620                 exit(1);
11621 }
11622 EOM
11623 val=$undef
11624 set dirfd
11625 if eval $compile; then
11626         val="$define"
11627 fi
11628 case "$val" in
11629 $define)        echo "dirfd() found." >&4       ;;
11630 *)              echo "dirfd() NOT found." >&4   ;;
11631 esac
11632 set d_dirfd
11633 eval $setvar
11634 $rm -f dirfd*
11635
11636 : see if dlerror exists
11637 xxx_runnm="$runnm"
11638 runnm=false
11639 set dlerror d_dlerror
11640 eval $inlibc
11641 runnm="$xxx_runnm"
11642
11643 : see if dlfcn is available
11644 set dlfcn.h i_dlfcn
11645 eval $inhdr
11646
11647 : Check what extension to use for shared libs
11648 case "$usedl" in
11649 $define|y|true)
11650         $cat << EOM
11651
11652 On a few systems, the dynamically loaded modules that perl generates and uses
11653 will need a different extension than shared libs. The default will probably
11654 be appropriate.
11655
11656 EOM
11657         case "$dlext" in
11658         '')     dflt="$so" ;;
11659         *)      dflt="$dlext" ;;
11660         esac
11661         rp='What is the extension of dynamically loaded modules'
11662         . ./myread
11663         dlext="$ans"
11664         ;;
11665 *)
11666         dlext="none"
11667         ;;
11668 esac
11669
11670 : Check if dlsym need a leading underscore
11671 echo " "
11672 val="$undef"
11673
11674 case "$dlsrc" in
11675 dl_dlopen.xs)
11676         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11677         $cat >dyna.c <<'EOM'
11678 fred () { }
11679 EOM
11680
11681 $cat >fred.c<<EOM
11682
11683 #include <stdio.h>
11684 #$i_stdlib I_STDLIB
11685 #ifdef I_STDLIB
11686 #include <stdlib.h>
11687 #endif
11688 #$i_dlfcn I_DLFCN
11689 #ifdef I_DLFCN
11690 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11691 #else
11692 #include <sys/types.h>
11693 #include <nlist.h>
11694 #include <link.h>
11695 #endif
11696
11697 extern int fred() ;
11698
11699 int main()
11700 {
11701     void * handle ;
11702     void * symbol ;
11703 #ifndef RTLD_LAZY
11704     int mode = 1 ;
11705 #else
11706     int mode = RTLD_LAZY ;
11707 #endif
11708     handle = dlopen("./dyna.$dlext", mode) ;
11709     if (handle == NULL) {
11710         printf ("1\n") ;
11711         fflush (stdout) ;
11712         exit(0);
11713     }
11714     symbol = dlsym(handle, "fred") ;
11715     if (symbol == NULL) {
11716         /* try putting a leading underscore */
11717         symbol = dlsym(handle, "_fred") ;
11718         if (symbol == NULL) {
11719             printf ("2\n") ;
11720             fflush (stdout) ;
11721             exit(0);
11722         }
11723         printf ("3\n") ;
11724     }
11725     else
11726         printf ("4\n") ;
11727     fflush (stdout) ;
11728     exit(0);
11729 }
11730 EOM
11731         : Call the object file tmp-dyna.o in case dlext=o.
11732         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11733                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11734                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11735                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11736                 xxx=`$run ./fred`
11737                 case $xxx in
11738                 1)      echo "Test program failed using dlopen." >&4
11739                         echo "Perhaps you should not use dynamic loading." >&4;;
11740                 2)      echo "Test program failed using dlsym." >&4
11741                         echo "Perhaps you should not use dynamic loading." >&4;;
11742                 3)      echo "dlsym needs a leading underscore" >&4
11743                         val="$define" ;;
11744                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11745                 esac
11746         else
11747                 echo "I can't compile and run the test program." >&4
11748                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11749         fi
11750         ;;
11751 esac
11752
11753 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11754
11755 set d_dlsymun
11756 eval $setvar
11757
11758 : see if drand48_r exists
11759 set drand48_r d_drand48_r
11760 eval $inlibc
11761 case "$d_drand48_r" in
11762 "$define")
11763         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11764         case "$d_drand48_r_proto:$usethreads" in
11765         ":define")      d_drand48_r_proto=define
11766                 set d_drand48_r_proto drand48_r $hdrs
11767                 eval $hasproto ;;
11768         *)      ;;
11769         esac
11770         case "$d_drand48_r_proto" in
11771         define)
11772         case "$drand48_r_proto" in
11773         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11774         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11775         esac
11776         case "$drand48_r_proto" in
11777         ''|0)   d_drand48_r=undef
11778                 drand48_r_proto=0
11779                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11780         * )     case "$drand48_r_proto" in
11781                 REENTRANT_PROTO*) ;;
11782                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11783                 esac
11784                 echo "Prototype: $try" ;;
11785         esac
11786         ;;
11787         *)      case "$usethreads" in
11788                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11789                 esac
11790                 d_drand48_r=undef
11791                 drand48_r_proto=0
11792                 ;;
11793         esac
11794         ;;
11795 *)      drand48_r_proto=0
11796         ;;
11797 esac
11798
11799 : see if prototype for drand48 is available
11800 echo " "
11801 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11802 eval $hasproto
11803
11804 : see if dup2 exists
11805 set dup2 d_dup2
11806 eval $inlibc
11807
11808 : see if eaccess exists
11809 set eaccess d_eaccess
11810 eval $inlibc
11811
11812 : see if endgrent exists
11813 set endgrent d_endgrent
11814 eval $inlibc
11815
11816 : see if this is an grp system
11817 set grp.h i_grp
11818 eval $inhdr
11819
11820 case "$i_grp" in
11821 $define)
11822         xxx=`./findhdr grp.h`
11823         $cppstdin $cppflags $cppminus < $xxx >$$.h
11824
11825         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11826                 val="$define"
11827         else
11828                 val="$undef"
11829         fi
11830         set d_grpasswd
11831         eval $setvar
11832
11833         $rm -f $$.h
11834         ;;
11835 *)
11836         val="$undef";
11837         set d_grpasswd; eval $setvar
11838         ;;
11839 esac
11840
11841 : see if endgrent_r exists
11842 set endgrent_r d_endgrent_r
11843 eval $inlibc
11844 case "$d_endgrent_r" in
11845 "$define")
11846         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11847         case "$d_endgrent_r_proto:$usethreads" in
11848         ":define")      d_endgrent_r_proto=define
11849                 set d_endgrent_r_proto endgrent_r $hdrs
11850                 eval $hasproto ;;
11851         *)      ;;
11852         esac
11853         case "$d_endgrent_r_proto" in
11854         define)
11855         case "$endgrent_r_proto" in
11856         ''|0) try='int endgrent_r(FILE**);'
11857         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11858         esac
11859         case "$endgrent_r_proto" in
11860         ''|0) try='void endgrent_r(FILE**);'
11861         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11862         esac
11863         case "$endgrent_r_proto" in
11864         ''|0)   d_endgrent_r=undef
11865                 endgrent_r_proto=0
11866                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11867         * )     case "$endgrent_r_proto" in
11868                 REENTRANT_PROTO*) ;;
11869                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11870                 esac
11871                 echo "Prototype: $try" ;;
11872         esac
11873         ;;
11874         *)      case "$usethreads" in
11875                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11876                 esac
11877                 d_endgrent_r=undef
11878                 endgrent_r_proto=0
11879                 ;;
11880         esac
11881         ;;
11882 *)      endgrent_r_proto=0
11883         ;;
11884 esac
11885
11886 : see if endhostent exists
11887 set endhostent d_endhent
11888 eval $inlibc
11889
11890 : see if this is a netdb.h system
11891 set netdb.h i_netdb
11892 eval $inhdr
11893
11894 : see if endhostent_r exists
11895 set endhostent_r d_endhostent_r
11896 eval $inlibc
11897 case "$d_endhostent_r" in
11898 "$define")
11899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11900         case "$d_endhostent_r_proto:$usethreads" in
11901         ":define")      d_endhostent_r_proto=define
11902                 set d_endhostent_r_proto endhostent_r $hdrs
11903                 eval $hasproto ;;
11904         *)      ;;
11905         esac
11906         case "$d_endhostent_r_proto" in
11907         define)
11908         case "$endhostent_r_proto" in
11909         ''|0) try='int endhostent_r(struct hostent_data*);'
11910         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11911         esac
11912         case "$endhostent_r_proto" in
11913         ''|0) try='void endhostent_r(struct hostent_data*);'
11914         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11915         esac
11916         case "$endhostent_r_proto" in
11917         ''|0)   d_endhostent_r=undef
11918                 endhostent_r_proto=0
11919                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11920         * )     case "$endhostent_r_proto" in
11921                 REENTRANT_PROTO*) ;;
11922                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11923                 esac
11924                 echo "Prototype: $try" ;;
11925         esac
11926         ;;
11927         *)      case "$usethreads" in
11928                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11929                 esac
11930                 d_endhostent_r=undef
11931                 endhostent_r_proto=0
11932                 ;;
11933         esac
11934         ;;
11935 *)      endhostent_r_proto=0
11936         ;;
11937 esac
11938
11939 : see if endnetent exists
11940 set endnetent d_endnent
11941 eval $inlibc
11942
11943 : see if endnetent_r exists
11944 set endnetent_r d_endnetent_r
11945 eval $inlibc
11946 case "$d_endnetent_r" in
11947 "$define")
11948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11949         case "$d_endnetent_r_proto:$usethreads" in
11950         ":define")      d_endnetent_r_proto=define
11951                 set d_endnetent_r_proto endnetent_r $hdrs
11952                 eval $hasproto ;;
11953         *)      ;;
11954         esac
11955         case "$d_endnetent_r_proto" in
11956         define)
11957         case "$endnetent_r_proto" in
11958         ''|0) try='int endnetent_r(struct netent_data*);'
11959         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11960         esac
11961         case "$endnetent_r_proto" in
11962         ''|0) try='void endnetent_r(struct netent_data*);'
11963         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11964         esac
11965         case "$endnetent_r_proto" in
11966         ''|0)   d_endnetent_r=undef
11967                 endnetent_r_proto=0
11968                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11969         * )     case "$endnetent_r_proto" in
11970                 REENTRANT_PROTO*) ;;
11971                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11972                 esac
11973                 echo "Prototype: $try" ;;
11974         esac
11975         ;;
11976         *)      case "$usethreads" in
11977                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11978                 esac
11979                 d_endnetent_r=undef
11980                 endnetent_r_proto=0
11981                 ;;
11982         esac
11983         ;;
11984 *)      endnetent_r_proto=0
11985         ;;
11986 esac
11987
11988 : see if endprotoent exists
11989 set endprotoent d_endpent
11990 eval $inlibc
11991
11992 : see if endprotoent_r exists
11993 set endprotoent_r d_endprotoent_r
11994 eval $inlibc
11995 case "$d_endprotoent_r" in
11996 "$define")
11997         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11998         case "$d_endprotoent_r_proto:$usethreads" in
11999         ":define")      d_endprotoent_r_proto=define
12000                 set d_endprotoent_r_proto endprotoent_r $hdrs
12001                 eval $hasproto ;;
12002         *)      ;;
12003         esac
12004         case "$d_endprotoent_r_proto" in
12005         define)
12006         case "$endprotoent_r_proto" in
12007         ''|0) try='int endprotoent_r(struct protoent_data*);'
12008         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12009         esac
12010         case "$endprotoent_r_proto" in
12011         ''|0) try='void endprotoent_r(struct protoent_data*);'
12012         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12013         esac
12014         case "$endprotoent_r_proto" in
12015         ''|0)   d_endprotoent_r=undef
12016                 endprotoent_r_proto=0
12017                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12018         * )     case "$endprotoent_r_proto" in
12019                 REENTRANT_PROTO*) ;;
12020                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12021                 esac
12022                 echo "Prototype: $try" ;;
12023         esac
12024         ;;
12025         *)      case "$usethreads" in
12026                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12027                 esac
12028                 d_endprotoent_r=undef
12029                 endprotoent_r_proto=0
12030                 ;;
12031         esac
12032         ;;
12033 *)      endprotoent_r_proto=0
12034         ;;
12035 esac
12036
12037 : see if endpwent exists
12038 set endpwent d_endpwent
12039 eval $inlibc
12040
12041 : see if this is a pwd.h system
12042 set pwd.h i_pwd
12043 eval $inhdr
12044
12045 case "$i_pwd" in
12046 $define)
12047         xxx=`./findhdr pwd.h`
12048         $cppstdin $cppflags $cppminus < $xxx >$$.h
12049
12050         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12051                 val="$define"
12052         else
12053                 val="$undef"
12054         fi
12055         set d_pwquota
12056         eval $setvar
12057
12058         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12059                 val="$define"
12060         else
12061                 val="$undef"
12062         fi
12063         set d_pwage
12064         eval $setvar
12065
12066         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12067                 val="$define"
12068         else
12069                 val="$undef"
12070         fi
12071         set d_pwchange
12072         eval $setvar
12073
12074         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12075                 val="$define"
12076         else
12077                 val="$undef"
12078         fi
12079         set d_pwclass
12080         eval $setvar
12081
12082         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12083                 val="$define"
12084         else
12085                 val="$undef"
12086         fi
12087         set d_pwexpire
12088         eval $setvar
12089
12090         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12091                 val="$define"
12092         else
12093                 val="$undef"
12094         fi
12095         set d_pwcomment
12096         eval $setvar
12097
12098         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12099                 val="$define"
12100         else
12101                 val="$undef"
12102         fi
12103         set d_pwgecos
12104         eval $setvar
12105
12106         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12107                 val="$define"
12108         else
12109                 val="$undef"
12110         fi
12111         set d_pwpasswd
12112         eval $setvar
12113
12114         $rm -f $$.h
12115         ;;
12116 *)
12117         val="$undef"; 
12118         set d_pwquota; eval $setvar
12119         set d_pwage; eval $setvar
12120         set d_pwchange; eval $setvar
12121         set d_pwclass; eval $setvar
12122         set d_pwexpire; eval $setvar
12123         set d_pwcomment; eval $setvar
12124         set d_pwgecos; eval $setvar
12125         set d_pwpasswd; eval $setvar
12126         ;;
12127 esac
12128
12129 : see if endpwent_r exists
12130 set endpwent_r d_endpwent_r
12131 eval $inlibc
12132 case "$d_endpwent_r" in
12133 "$define")
12134         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12135         case "$d_endpwent_r_proto:$usethreads" in
12136         ":define")      d_endpwent_r_proto=define
12137                 set d_endpwent_r_proto endpwent_r $hdrs
12138                 eval $hasproto ;;
12139         *)      ;;
12140         esac
12141         case "$d_endpwent_r_proto" in
12142         define)
12143         case "$endpwent_r_proto" in
12144         ''|0) try='int endpwent_r(FILE**);'
12145         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12146         esac
12147         case "$endpwent_r_proto" in
12148         ''|0) try='void endpwent_r(FILE**);'
12149         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12150         esac
12151         case "$endpwent_r_proto" in
12152         ''|0)   d_endpwent_r=undef
12153                 endpwent_r_proto=0
12154                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12155         * )     case "$endpwent_r_proto" in
12156                 REENTRANT_PROTO*) ;;
12157                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12158                 esac
12159                 echo "Prototype: $try" ;;
12160         esac
12161         ;;
12162         *)      case "$usethreads" in
12163                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12164                 esac
12165                 d_endpwent_r=undef
12166                 endpwent_r_proto=0
12167                 ;;
12168         esac
12169         ;;
12170 *)      endpwent_r_proto=0
12171         ;;
12172 esac
12173
12174 : see if endservent exists
12175 set endservent d_endsent
12176 eval $inlibc
12177
12178 : see if endservent_r exists
12179 set endservent_r d_endservent_r
12180 eval $inlibc
12181 case "$d_endservent_r" in
12182 "$define")
12183         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12184         case "$d_endservent_r_proto:$usethreads" in
12185         ":define")      d_endservent_r_proto=define
12186                 set d_endservent_r_proto endservent_r $hdrs
12187                 eval $hasproto ;;
12188         *)      ;;
12189         esac
12190         case "$d_endservent_r_proto" in
12191         define)
12192         case "$endservent_r_proto" in
12193         ''|0) try='int endservent_r(struct servent_data*);'
12194         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12195         esac
12196         case "$endservent_r_proto" in
12197         ''|0) try='void endservent_r(struct servent_data*);'
12198         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12199         esac
12200         case "$endservent_r_proto" in
12201         ''|0)   d_endservent_r=undef
12202                 endservent_r_proto=0
12203                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12204         * )     case "$endservent_r_proto" in
12205                 REENTRANT_PROTO*) ;;
12206                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12207                 esac
12208                 echo "Prototype: $try" ;;
12209         esac
12210         ;;
12211         *)      case "$usethreads" in
12212                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12213                 esac
12214                 d_endservent_r=undef
12215                 endservent_r_proto=0
12216                 ;;
12217         esac
12218         ;;
12219 *)      endservent_r_proto=0
12220         ;;
12221 esac
12222
12223 : Locate the flags for 'open()'
12224 echo " "
12225 $cat >try.c <<EOCP
12226 #include <sys/types.h>
12227 #ifdef I_FCNTL
12228 #include <fcntl.h>
12229 #endif
12230 #ifdef I_SYS_FILE
12231 #include <sys/file.h>
12232 #endif
12233 #$i_stdlib I_STDLIB
12234 #ifdef I_STDLIB
12235 #include <stdlib.h>
12236 #endif
12237 int main() {
12238         if(O_RDONLY);
12239 #ifdef O_TRUNC
12240         exit(0);
12241 #else
12242         exit(1);
12243 #endif
12244 }
12245 EOCP
12246 : check sys/file.h first to get FREAD on Sun
12247 if $test `./findhdr sys/file.h` && \
12248                 set try -DI_SYS_FILE && eval $compile; then
12249         h_sysfile=true;
12250         echo "<sys/file.h> defines the O_* constants..." >&4
12251         if $run ./try; then
12252                 echo "and you have the 3 argument form of open()." >&4
12253                 val="$define"
12254         else
12255                 echo "but not the 3 argument form of open().  Oh, well." >&4
12256                 val="$undef"
12257         fi
12258 elif $test `./findhdr fcntl.h` && \
12259                 set try -DI_FCNTL && eval $compile; then
12260         h_fcntl=true;
12261         echo "<fcntl.h> defines the O_* constants..." >&4
12262         if $run ./try; then
12263                 echo "and you have the 3 argument form of open()." >&4
12264                 val="$define"
12265         else
12266                 echo "but not the 3 argument form of open().  Oh, well." >&4
12267                 val="$undef"
12268         fi
12269 else
12270         val="$undef"
12271         echo "I can't find the O_* constant definitions!  You got problems." >&4
12272 fi
12273 set d_open3
12274 eval $setvar
12275 $rm_try
12276
12277 : script used to emit important warnings
12278 cat >warn <<EOS
12279 $startsh
12280 if test \$# -gt 0; then
12281         echo "\$@" >msg
12282 else
12283         cat >msg
12284 fi
12285 echo "*** WARNING:" >&4
12286 sed -e 's/^/*** /' <msg >&4
12287 echo "*** " >&4
12288 cat msg >>config.msg
12289 echo " " >>config.msg
12290 rm -f msg
12291 EOS
12292 chmod +x warn
12293 $eunicefix warn
12294
12295 : see which of string.h or strings.h is needed
12296 echo " "
12297 strings=`./findhdr string.h`
12298 if $test "$strings" && $test -r "$strings"; then
12299         echo "Using <string.h> instead of <strings.h>." >&4
12300         val="$define"
12301 else
12302         val="$undef"
12303         strings=`./findhdr strings.h`
12304         if $test "$strings" && $test -r "$strings"; then
12305                 echo "Using <strings.h> instead of <string.h>." >&4
12306         else
12307                 ./warn "No string header found -- You'll surely have problems."
12308         fi
12309 fi
12310 set i_string
12311 eval $setvar
12312 case "$i_string" in
12313 "$undef") strings=`./findhdr strings.h`;;
12314 *)        strings=`./findhdr string.h`;;
12315 esac
12316
12317 : see if this is a sys/file.h system
12318 val=''
12319 set sys/file.h val
12320 eval $inhdr
12321
12322 : do we need to include sys/file.h ?
12323 case "$val" in
12324 "$define")
12325         echo " "
12326         if $h_sysfile; then
12327                 val="$define"
12328                 echo "We'll be including <sys/file.h>." >&4
12329         else
12330                 val="$undef"
12331                 echo "We won't be including <sys/file.h>." >&4
12332         fi
12333         ;;
12334 *)
12335         h_sysfile=false
12336         ;;
12337 esac
12338 set i_sysfile
12339 eval $setvar
12340
12341 : see if fcntl.h is there
12342 val=''
12343 set fcntl.h val
12344 eval $inhdr
12345
12346 : see if we can include fcntl.h
12347 case "$val" in
12348 "$define")
12349         echo " "
12350         if $h_fcntl; then
12351                 val="$define"
12352                 echo "We'll be including <fcntl.h>." >&4
12353         else
12354                 val="$undef"
12355                 if $h_sysfile; then
12356         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12357                 else
12358                         echo "We won't be including <fcntl.h>." >&4
12359                 fi
12360         fi
12361         ;;
12362 *)
12363         h_fcntl=false
12364         val="$undef"
12365         ;;
12366 esac
12367 set i_fcntl
12368 eval $setvar
12369
12370 : see if fork exists
12371 set fork d_fork
12372 eval $inlibc
12373
12374 : see if pipe exists
12375 set pipe d_pipe
12376 eval $inlibc
12377
12378 : check for non-blocking I/O stuff
12379 case "$h_sysfile" in
12380 true) echo "#include <sys/file.h>" > head.c;;
12381 *)
12382        case "$h_fcntl" in
12383        true) echo "#include <fcntl.h>" > head.c;;
12384        *) echo "#include <sys/fcntl.h>" > head.c;;
12385        esac
12386        ;;
12387 esac
12388 echo " "
12389 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12390 case "$o_nonblock" in
12391 '')
12392         $cat head.c > try.c
12393         $cat >>try.c <<EOCP
12394 #include <stdio.h>
12395 #$i_stdlib I_STDLIB
12396 #ifdef I_STDLIB
12397 #include <stdlib.h>
12398 #endif
12399 #$i_fcntl I_FCNTL
12400 #ifdef I_FCNTL
12401 #include <fcntl.h>
12402 #endif
12403 int main() {
12404 #ifdef O_NONBLOCK
12405         printf("O_NONBLOCK\n");
12406         exit(0);
12407 #endif
12408 #ifdef O_NDELAY
12409         printf("O_NDELAY\n");
12410         exit(0);
12411 #endif
12412 #ifdef FNDELAY
12413         printf("FNDELAY\n");
12414         exit(0);
12415 #endif
12416         exit(0);
12417 }
12418 EOCP
12419         set try
12420         if eval $compile_ok; then
12421                 o_nonblock=`$run ./try`
12422                 case "$o_nonblock" in
12423                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12424                 *) echo "Seems like we can use $o_nonblock.";;
12425                 esac
12426         else
12427                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12428         fi
12429         ;;
12430 *) echo "Using $hint value $o_nonblock.";;
12431 esac
12432 $rm_try
12433
12434 echo " "
12435 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12436 case "$eagain" in
12437 '')
12438         case "$d_fork:$d_pipe" in
12439         define:define)
12440         $cat head.c > try.c
12441         $cat >>try.c <<EOCP
12442 #include <errno.h>
12443 #include <sys/types.h>
12444 #include <signal.h>
12445 #include <stdio.h>
12446 #$i_stdlib I_STDLIB
12447 #ifdef I_STDLIB
12448 #include <stdlib.h>
12449 #endif
12450 #$i_fcntl I_FCNTL
12451 #ifdef I_FCNTL
12452 #include <fcntl.h>
12453 #endif
12454 #define MY_O_NONBLOCK $o_nonblock
12455 #ifndef errno  /* XXX need better Configure test */
12456 extern int errno;
12457 #endif
12458 #$i_unistd I_UNISTD
12459 #ifdef I_UNISTD
12460 #include <unistd.h>
12461 #endif
12462 #$i_string I_STRING
12463 #ifdef I_STRING
12464 #include <string.h>
12465 #else
12466 #include <strings.h>
12467 #endif
12468 $signal_t blech(int x) { exit(3); }
12469 EOCP
12470         $cat >> try.c <<'EOCP'
12471 int main()
12472 {
12473         int pd[2];
12474         int pu[2];
12475         char buf[1];
12476         char string[100];
12477
12478         pipe(pd);       /* Down: child -> parent */
12479         pipe(pu);       /* Up: parent -> child */
12480         if (0 != fork()) {
12481                 int ret;
12482                 close(pd[1]);   /* Parent reads from pd[0] */
12483                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12484 #ifdef F_SETFL
12485                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12486                         exit(1);
12487 #else
12488                 exit(4);
12489 #endif
12490                 signal(SIGALRM, blech);
12491                 alarm(5);
12492                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12493                         exit(2);
12494                 sprintf(string, "%d\n", ret);
12495                 write(2, string, strlen(string));
12496                 alarm(0);
12497 #ifdef EAGAIN
12498                 if (errno == EAGAIN) {
12499                         printf("EAGAIN\n");
12500                         goto ok;
12501                 }
12502 #endif
12503 #ifdef EWOULDBLOCK
12504                 if (errno == EWOULDBLOCK)
12505                         printf("EWOULDBLOCK\n");
12506 #endif
12507         ok:
12508                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12509                 sleep(2);                               /* Give it time to close our pipe */
12510                 alarm(5);
12511                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12512                 alarm(0);
12513                 sprintf(string, "%d\n", ret);
12514                 write(4, string, strlen(string));
12515                 exit(0);
12516         }
12517
12518         close(pd[0]);                   /* We write to pd[1] */
12519         close(pu[1]);                   /* We read from pu[0] */
12520         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12521         close(pd[1]);                   /* Pipe pd is now fully closed! */
12522         exit(0);                                /* Bye bye, thank you for playing! */
12523 }
12524 EOCP
12525         set try
12526         if eval $compile_ok; then
12527                 echo "$startsh" >mtry
12528                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12529                 chmod +x mtry
12530                 ./mtry >/dev/null 2>&1
12531                 case $? in
12532                 0) eagain=`$cat try.out`;;
12533                 1) echo "Could not perform non-blocking setting!";;
12534                 2) echo "I did a successful read() for something that was not there!";;
12535                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12536                 4) echo "Could not find F_SETFL!";;
12537                 *) echo "Something terribly wrong happened during testing.";;
12538                 esac
12539                 rd_nodata=`$cat try.ret`
12540                 echo "A read() system call with no data present returns $rd_nodata."
12541                 case "$rd_nodata" in
12542                 0|-1) ;;
12543                 *)
12544                         echo "(That's peculiar, fixing that to be -1.)"
12545                         rd_nodata=-1
12546                         ;;
12547                 esac
12548                 case "$eagain" in
12549                 '')
12550                         echo "Forcing errno EAGAIN on read() with no data available."
12551                         eagain=EAGAIN
12552                         ;;
12553                 *)
12554                         echo "Your read() sets errno to $eagain when no data is available."
12555                         ;;
12556                 esac
12557                 status=`$cat try.err`
12558                 case "$status" in
12559                 0) echo "And it correctly returns 0 to signal EOF.";;
12560                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12561                 *) echo "However, your read() returns '$status' on EOF??";;
12562                 esac
12563                 val="$define"
12564                 if test "$status" = "$rd_nodata"; then
12565                         echo "WARNING: you can't distinguish between EOF and no data!"
12566                         val="$undef"
12567                 fi
12568         else
12569                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12570                 eagain=EAGAIN
12571         fi
12572         ;;
12573         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12574                 eagain=EAGAIN
12575                 val="$define"
12576                 ;;
12577         esac
12578         set d_eofnblk
12579         eval $setvar
12580         ;;
12581 *)
12582         echo "Using $hint value $eagain."
12583         echo "Your read() returns $rd_nodata when no data is present."
12584         case "$d_eofnblk" in
12585         "$define") echo "And you can see EOF because read() returns 0.";;
12586         "$undef") echo "But you can't see EOF status from read() returned value.";;
12587         *)
12588                 echo "(Assuming you can't see EOF status from read anyway.)"
12589                 d_eofnblk=$undef
12590                 ;;
12591         esac
12592         ;;
12593 esac
12594 $rm_try head.c mtry
12595
12596 : see if _ptr and _cnt from stdio act std
12597 echo " "
12598
12599 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12600         echo "(Looks like you have stdio.h from BSD.)"
12601         case "$stdio_ptr" in
12602         '') stdio_ptr='((fp)->_p)'
12603                 ptr_lval=$define
12604                 ;;
12605         *)      ptr_lval=$d_stdio_ptr_lval;;
12606         esac
12607         case "$stdio_cnt" in
12608         '') stdio_cnt='((fp)->_r)'
12609                 cnt_lval=$define
12610                 ;;
12611         *)      cnt_lval=$d_stdio_cnt_lval;;
12612         esac
12613         case "$stdio_base" in
12614         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12615         esac
12616         case "$stdio_bufsiz" in
12617         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12618         esac
12619 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12620         echo "(Looks like you have stdio.h from Linux.)"
12621         case "$stdio_ptr" in
12622         '') stdio_ptr='((fp)->_IO_read_ptr)'
12623                 ptr_lval=$define
12624                 ;;
12625         *)      ptr_lval=$d_stdio_ptr_lval;;
12626         esac
12627         case "$stdio_cnt" in
12628         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12629                 cnt_lval=$undef
12630                 ;;
12631         *)      cnt_lval=$d_stdio_cnt_lval;;
12632         esac
12633         case "$stdio_base" in
12634         '') stdio_base='((fp)->_IO_read_base)';;
12635         esac
12636         case "$stdio_bufsiz" in
12637         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12638         esac
12639 else
12640         case "$stdio_ptr" in
12641         '') stdio_ptr='((fp)->_ptr)'
12642                 ptr_lval=$define
12643                 ;;
12644         *)      ptr_lval=$d_stdio_ptr_lval;;
12645         esac
12646         case "$stdio_cnt" in
12647         '') stdio_cnt='((fp)->_cnt)'
12648                 cnt_lval=$define
12649                 ;;
12650         *)      cnt_lval=$d_stdio_cnt_lval;;
12651         esac
12652         case "$stdio_base" in
12653         '') stdio_base='((fp)->_base)';;
12654         esac
12655         case "$stdio_bufsiz" in
12656         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12657         esac
12658 fi
12659
12660 : test whether _ptr and _cnt really work
12661 echo "Checking how std your stdio is..." >&4
12662 $cat >try.c <<EOP
12663 #include <stdio.h>
12664 #$i_stdlib I_STDLIB
12665 #ifdef I_STDLIB
12666 #include <stdlib.h>
12667 #endif
12668 #define FILE_ptr(fp)    $stdio_ptr
12669 #define FILE_cnt(fp)    $stdio_cnt
12670 int main() {
12671         FILE *fp = fopen("try.c", "r");
12672         char c = getc(fp);
12673         if (
12674                 18 <= FILE_cnt(fp) &&
12675                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12676         )
12677                 exit(0);
12678         exit(1);
12679 }
12680 EOP
12681 val="$undef"
12682 set try
12683 if eval $compile && $to try.c; then
12684         if $run ./try; then
12685                 echo "Your stdio acts pretty std."
12686                 val="$define"
12687         else
12688                 echo "Your stdio isn't very std."
12689         fi
12690 else
12691         echo "Your stdio doesn't appear very std."
12692 fi
12693 $rm_try
12694
12695 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12696 # direct buffer manipulation no longer works.  The Configure tests
12697 # should be changed to correctly detect this, but until then,
12698 # the following check should at least let perl compile and run.
12699 # (This quick fix should be updated before 5.8.1.)
12700 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12701 # A. Dougherty, June 3, 2002.
12702 case "$d_gnulibc" in
12703 $define)
12704         case "$gnulibc_version" in
12705         2.[01]*)  ;;
12706         2.2) ;;
12707         2.2.[0-9]) ;;
12708         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12709                 val="$undef"
12710                 ;;
12711         esac
12712         ;;
12713 esac
12714 set d_stdstdio
12715 eval $setvar
12716
12717 : Can _ptr be used as an lvalue?
12718 case "$d_stdstdio$ptr_lval" in
12719 $define$define) val=$define ;;
12720 *) val=$undef ;;
12721 esac
12722 set d_stdio_ptr_lval
12723 eval $setvar
12724
12725 : Can _cnt be used as an lvalue?
12726 case "$d_stdstdio$cnt_lval" in
12727 $define$define) val=$define ;;
12728 *) val=$undef ;;
12729 esac
12730 set d_stdio_cnt_lval
12731 eval $setvar
12732
12733
12734 : test whether setting _ptr sets _cnt as a side effect
12735 d_stdio_ptr_lval_sets_cnt="$undef"
12736 d_stdio_ptr_lval_nochange_cnt="$undef"
12737 case "$d_stdio_ptr_lval$d_stdstdio" in
12738 $define$define)
12739         echo "Checking to see what happens if we set the stdio ptr..." >&4
12740 $cat >try.c <<EOP
12741 #include <stdio.h>
12742 /* Can we scream? */
12743 /* Eat dust sed :-) */
12744 /* In the buffer space, no one can hear you scream. */
12745 #$i_stdlib I_STDLIB
12746 #ifdef I_STDLIB
12747 #include <stdlib.h>
12748 #endif
12749 #define FILE_ptr(fp)    $stdio_ptr
12750 #define FILE_cnt(fp)    $stdio_cnt
12751 #include <sys/types.h>
12752 int main() {
12753         FILE *fp = fopen("try.c", "r");
12754         int c;
12755         char *ptr;
12756         size_t cnt;
12757         if (!fp) {
12758             puts("Fail even to read");
12759             exit(1);
12760         }
12761         c = getc(fp); /* Read away the first # */
12762         if (c == EOF) {
12763             puts("Fail even to read");
12764             exit(1);
12765         }
12766         if (!(
12767                 18 <= FILE_cnt(fp) &&
12768                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12769         )) {
12770                 puts("Fail even to read");
12771                 exit (1);
12772         }
12773         ptr = (char*) FILE_ptr(fp);
12774         cnt = (size_t)FILE_cnt(fp);
12775
12776         FILE_ptr(fp) += 42;
12777
12778         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12779                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12780                 exit (1);
12781         }
12782         if (FILE_cnt(fp) <= 20) {
12783                 printf ("Fail (<20 chars to test)");
12784                 exit (1);
12785         }
12786         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12787                 puts("Fail compare");
12788                 exit (1);
12789         }
12790         if (cnt == FILE_cnt(fp)) {
12791                 puts("Pass_unchanged");
12792                 exit (0);
12793         }
12794         if (FILE_cnt(fp) == (cnt - 42)) {
12795                 puts("Pass_changed");
12796                 exit (0);
12797         }
12798         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12799         return 1;
12800
12801 }
12802 EOP
12803         set try
12804         if eval $compile && $to try.c; then
12805                 case `$run ./try` in
12806                 Pass_changed)
12807                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12808                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12809                 Pass_unchanged)
12810                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12811                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12812                 Fail*)
12813                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12814                 *)
12815                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12816         esac
12817         else
12818                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12819         fi
12820         $rm_try
12821         ;;
12822 esac
12823
12824 : see if _base is also standard
12825 val="$undef"
12826 case "$d_stdstdio" in
12827 $define)
12828         $cat >try.c <<EOP
12829 #include <stdio.h>
12830 #$i_stdlib I_STDLIB
12831 #ifdef I_STDLIB
12832 #include <stdlib.h>
12833 #endif
12834 #define FILE_base(fp)   $stdio_base
12835 #define FILE_bufsiz(fp) $stdio_bufsiz
12836 int main() {
12837         FILE *fp = fopen("try.c", "r");
12838         char c = getc(fp);
12839         if (
12840                 19 <= FILE_bufsiz(fp) &&
12841                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12842         )
12843                 exit(0);
12844         exit(1);
12845 }
12846 EOP
12847         set try
12848         if eval $compile && $to try.c; then
12849                 if $run ./try; then
12850                         echo "And its _base field acts std."
12851                         val="$define"
12852                 else
12853                         echo "But its _base field isn't std."
12854                 fi
12855         else
12856                 echo "However, it seems to be lacking the _base field."
12857         fi
12858         $rm_try
12859         ;;
12860 esac
12861 set d_stdiobase
12862 eval $setvar
12863
12864 : see if fast_stdio exists
12865 val="$undef"
12866 case "$d_stdstdio:$d_stdio_ptr_lval" in
12867 "$define:$define")
12868         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12869         *$define*)
12870                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12871                 val="$define"
12872                 ;;
12873         esac
12874         ;;
12875 esac
12876 set d_faststdio
12877 eval $setvar
12878
12879
12880
12881 : see if fchdir exists
12882 set fchdir d_fchdir
12883 eval $inlibc
12884
12885 : see if fchmod exists
12886 set fchmod d_fchmod
12887 eval $inlibc
12888
12889 : see if fchown exists
12890 set fchown d_fchown
12891 eval $inlibc
12892
12893 : see if this is an fcntl system
12894 set fcntl d_fcntl
12895 eval $inlibc
12896
12897 : See if fcntl-based locking works.
12898 echo " "
12899 $cat >try.c <<EOCP
12900 #$i_stdlib I_STDLIB
12901 #ifdef I_STDLIB
12902 #include <stdlib.h>
12903 #endif
12904 #include <unistd.h>
12905 #include <fcntl.h>
12906 #include <signal.h>
12907 $signal_t blech(int x) { exit(3); }
12908 int main() {
12909 #if defined(F_SETLK) && defined(F_SETLKW)
12910      struct flock flock;
12911      int retval, fd;
12912      fd = open("try.c", O_RDONLY);
12913      flock.l_type = F_RDLCK;
12914      flock.l_whence = SEEK_SET;
12915      flock.l_start = flock.l_len = 0;
12916      signal(SIGALRM, blech);
12917      alarm(10);
12918      retval = fcntl(fd, F_SETLK, &flock);
12919      close(fd);
12920      (retval < 0 ? exit(2) : exit(0));
12921 #else
12922      exit(2);
12923 #endif
12924 }
12925 EOCP
12926 echo "Checking if fcntl-based file locking works... "
12927 case "$d_fcntl" in
12928 "$define")
12929         set try
12930         if eval $compile_ok; then
12931                 if $run ./try; then
12932                         echo "Yes, it seems to work."
12933                         val="$define"
12934                 else
12935                         echo "Nope, it didn't work."
12936                         val="$undef"
12937                         case "$?" in
12938                         3) $cat >&4 <<EOM
12939 ***
12940 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12941 *** This is (almost) impossible.
12942 *** If your NFS lock daemons are not feeling well, something like
12943 *** this may happen, please investigate.  Cannot continue, aborting.
12944 ***
12945 EOM
12946                                 exit 1
12947                                 ;;
12948                         esac
12949                 fi
12950         else
12951                 echo "I'm unable to compile the test program, so I'll assume not."
12952                 val="$undef"
12953         fi
12954         ;;
12955 *) val="$undef";
12956         echo "Nope, since you don't even have fcntl()."
12957         ;;
12958 esac
12959 set d_fcntl_can_lock
12960 eval $setvar
12961 $rm_try
12962
12963 : check for fd_set items
12964 $cat <<EOM
12965
12966 Checking to see how well your C compiler handles fd_set and friends ...
12967 EOM
12968 $cat >try.c <<EOCP
12969 #$i_stdlib I_STDLIB
12970 #ifdef I_STDLIB
12971 #include <stdlib.h>
12972 #endif
12973 #$i_systime I_SYS_TIME
12974 #$i_sysselct I_SYS_SELECT
12975 #$d_socket HAS_SOCKET
12976 #include <sys/types.h>
12977 #ifdef HAS_SOCKET
12978 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12979 #endif
12980 #ifdef I_SYS_TIME
12981 #include <sys/time.h>
12982 #endif
12983 #ifdef I_SYS_SELECT
12984 #include <sys/select.h>
12985 #endif
12986 int main() {
12987         fd_set fds;
12988
12989 #ifdef TRYBITS
12990         if(fds.fds_bits);
12991 #endif
12992
12993 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12994         exit(0);
12995 #else
12996         exit(1);
12997 #endif
12998 }
12999 EOCP
13000 set try -DTRYBITS
13001 if eval $compile; then
13002         d_fds_bits="$define"
13003         d_fd_set="$define"
13004         echo "Well, your system knows about the normal fd_set typedef..." >&4
13005         if $run ./try; then
13006                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13007                 d_fd_macros="$define"
13008         else
13009                 $cat >&4 <<'EOM'
13010 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13011 EOM
13012                 d_fd_macros="$undef"
13013         fi
13014 else
13015         $cat <<'EOM'
13016 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13017 EOM
13018         set try
13019         if eval $compile; then
13020                 d_fds_bits="$undef"
13021                 d_fd_set="$define"
13022                 echo "Well, your system has some sort of fd_set available..." >&4
13023                 if $run ./try; then
13024                         echo "and you have the normal fd_set macros." >&4
13025                         d_fd_macros="$define"
13026                 else
13027                         $cat <<'EOM'
13028 but not the normal fd_set macros!  Gross!  More work for me...
13029 EOM
13030                         d_fd_macros="$undef"
13031                 fi
13032         else
13033         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13034                 d_fd_set="$undef"
13035                 d_fds_bits="$undef"
13036                 d_fd_macros="$undef"
13037         fi
13038 fi
13039 $rm_try
13040
13041 : see if fgetpos exists
13042 set fgetpos d_fgetpos
13043 eval $inlibc
13044
13045 : see if finite exists
13046 set finite d_finite
13047 eval $inlibc
13048
13049 : see if finitel exists
13050 set finitel d_finitel
13051 eval $inlibc
13052
13053 : see if flock exists
13054 set flock d_flock
13055 eval $inlibc
13056
13057 : see if prototype for flock is available
13058 echo " "
13059 set d_flockproto flock $i_sysfile sys/file.h
13060 eval $hasproto
13061
13062 : see if fp_class exists
13063 set fp_class d_fp_class
13064 eval $inlibc
13065
13066 : see if pathconf exists
13067 set pathconf d_pathconf
13068 eval $inlibc
13069
13070 : see if fpathconf exists
13071 set fpathconf d_fpathconf
13072 eval $inlibc
13073
13074 : see if fpclass exists
13075 set fpclass d_fpclass
13076 eval $inlibc
13077
13078 : see if fpclassify exists
13079 set fpclassify d_fpclassify
13080 eval $inlibc
13081
13082 : see if fpclassl exists
13083 set fpclassl d_fpclassl
13084 eval $inlibc
13085
13086 : check for fpos64_t
13087 echo " "
13088 echo "Checking to see if you have fpos64_t..." >&4
13089 $cat >try.c <<EOCP
13090 #include <stdio.h>
13091 int main() { fpos64_t x = 7; }
13092 EOCP
13093 set try
13094 if eval $compile; then
13095         val="$define"
13096         echo "You have fpos64_t."
13097 else
13098         val="$undef"
13099         echo "You do not have fpos64_t."
13100         case "$fpossize" in
13101         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13102         esac
13103 fi
13104 $rm_try
13105 set d_fpos64_t
13106 eval $setvar
13107
13108 : see if frexpl exists
13109 set frexpl d_frexpl
13110 eval $inlibc
13111
13112 : see if this is a sys/param system
13113 set sys/param.h i_sysparam
13114 eval $inhdr
13115
13116 : see if this is a sys/mount.h system
13117 set sys/mount.h i_sysmount
13118 eval $inhdr
13119
13120 : Check for fs_data_s
13121 echo " "
13122 echo "Checking to see if your system supports struct fs_data..." >&4
13123 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13124 eval $hasstruct
13125 case "$d_fs_data_s" in
13126 "$define")      echo "Yes, it does."   ;;
13127 *)              echo "No, it doesn't." ;;
13128 esac
13129
13130 : see if fseeko exists
13131 set fseeko d_fseeko
13132 eval $inlibc
13133 case "$longsize" in
13134 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13135 esac
13136
13137 : see if fsetpos exists
13138 set fsetpos d_fsetpos
13139 eval $inlibc
13140
13141 : see if fstatfs exists
13142 set fstatfs d_fstatfs
13143 eval $inlibc
13144
13145 : see if statvfs exists
13146 set statvfs d_statvfs
13147 eval $inlibc
13148
13149 : see if fstatvfs exists
13150 set fstatvfs d_fstatvfs
13151 eval $inlibc
13152
13153
13154 : see if fsync exists
13155 set fsync d_fsync
13156 eval $inlibc
13157
13158 : see if ftello exists
13159 set ftello d_ftello
13160 eval $inlibc
13161 case "$longsize" in
13162 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13163 esac
13164
13165 : check for a working futimes
13166 d_futimes="$undef"
13167 echo " "
13168 echo "Checking if you have a working futimes()" >&4
13169 $cat >try.c <<EOCP
13170 #include <stdio.h>
13171 #include <sys/time.h>
13172 #include <errno.h>
13173 #include <fcntl.h>
13174
13175 int main ()
13176 {
13177     int fd, rv;
13178     fd = open ("try.c", O_RDWR);
13179     if (-1 == fd) exit (1);
13180     rv = futimes (fd, NULL);
13181     exit (rv == -1 ? errno : 0);
13182 }
13183 EOCP
13184 set try
13185 if eval $compile; then
13186     `$run ./try`
13187     rc=$?
13188     case "$rc" in
13189         0)  echo "Yes, you have" >&4
13190             d_futimes="$define"
13191             ;;
13192         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13193             ;;
13194     esac
13195 else
13196     echo "No, it does not (probably harmless)" >&4
13197 fi
13198 $rm_try
13199
13200 : see if getcwd exists
13201 set getcwd d_getcwd
13202 eval $inlibc
13203
13204 : see if getespwnam exists
13205 set getespwnam d_getespwnam
13206 eval $inlibc
13207
13208 : see if getfsstat exists
13209 set getfsstat d_getfsstat
13210 eval $inlibc
13211
13212 : see if getgrent exists
13213 set getgrent d_getgrent
13214 eval $inlibc
13215
13216 : see if getgrent_r exists
13217 set getgrent_r d_getgrent_r
13218 eval $inlibc
13219 case "$d_getgrent_r" in
13220 "$define")
13221         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13222         case "$d_getgrent_r_proto:$usethreads" in
13223         ":define")      d_getgrent_r_proto=define
13224                 set d_getgrent_r_proto getgrent_r $hdrs
13225                 eval $hasproto ;;
13226         *)      ;;
13227         esac
13228         case "$d_getgrent_r_proto" in
13229         define)
13230         case "$getgrent_r_proto" in
13231         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13232         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13233         esac
13234         case "$getgrent_r_proto" in
13235         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13236         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13237         esac
13238         case "$getgrent_r_proto" in
13239         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13240         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13241         esac
13242         case "$getgrent_r_proto" in
13243         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13244         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13245         esac
13246         case "$getgrent_r_proto" in
13247         ''|0) try='int getgrent_r(struct group*, char*, int);'
13248         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13249         esac
13250         case "$getgrent_r_proto" in
13251         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13252         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13253         esac
13254         case "$getgrent_r_proto" in
13255         ''|0)   d_getgrent_r=undef
13256                 getgrent_r_proto=0
13257                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13258         * )     case "$getgrent_r_proto" in
13259                 REENTRANT_PROTO*) ;;
13260                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13261                 esac
13262                 echo "Prototype: $try" ;;
13263         esac
13264         ;;
13265         *)      case "$usethreads" in
13266                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13267                 esac
13268                 d_getgrent_r=undef
13269                 getgrent_r_proto=0
13270                 ;;
13271         esac
13272         ;;
13273 *)      getgrent_r_proto=0
13274         ;;
13275 esac
13276
13277 : see if getgrgid_r exists
13278 set getgrgid_r d_getgrgid_r
13279 eval $inlibc
13280 case "$d_getgrgid_r" in
13281 "$define")
13282         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13283         case "$d_getgrgid_r_proto:$usethreads" in
13284         ":define")      d_getgrgid_r_proto=define
13285                 set d_getgrgid_r_proto getgrgid_r $hdrs
13286                 eval $hasproto ;;
13287         *)      ;;
13288         esac
13289         case "$d_getgrgid_r_proto" in
13290         define)
13291         case "$getgrgid_r_proto" in
13292         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13293         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13294         esac
13295         case "$getgrgid_r_proto" in
13296         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13297         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13298         esac
13299         case "$getgrgid_r_proto" in
13300         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13301         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13302         esac
13303         case "$getgrgid_r_proto" in
13304         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13305         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13306         esac
13307         case "$getgrgid_r_proto" in
13308         ''|0)   d_getgrgid_r=undef
13309                 getgrgid_r_proto=0
13310                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13311         * )     case "$getgrgid_r_proto" in
13312                 REENTRANT_PROTO*) ;;
13313                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13314                 esac
13315                 echo "Prototype: $try" ;;
13316         esac
13317         ;;
13318         *)      case "$usethreads" in
13319                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13320                 esac
13321                 d_getgrgid_r=undef
13322                 getgrgid_r_proto=0
13323                 ;;
13324         esac
13325         ;;
13326 *)      getgrgid_r_proto=0
13327         ;;
13328 esac
13329
13330 : see if getgrnam_r exists
13331 set getgrnam_r d_getgrnam_r
13332 eval $inlibc
13333 case "$d_getgrnam_r" in
13334 "$define")
13335         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13336         case "$d_getgrnam_r_proto:$usethreads" in
13337         ":define")      d_getgrnam_r_proto=define
13338                 set d_getgrnam_r_proto getgrnam_r $hdrs
13339                 eval $hasproto ;;
13340         *)      ;;
13341         esac
13342         case "$d_getgrnam_r_proto" in
13343         define)
13344         case "$getgrnam_r_proto" in
13345         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13346         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13347         esac
13348         case "$getgrnam_r_proto" in
13349         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13350         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13351         esac
13352         case "$getgrnam_r_proto" in
13353         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13354         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13355         esac
13356         case "$getgrnam_r_proto" in
13357         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13358         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13359         esac
13360         case "$getgrnam_r_proto" in
13361         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13362         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13363         esac
13364         case "$getgrnam_r_proto" in
13365         ''|0)   d_getgrnam_r=undef
13366                 getgrnam_r_proto=0
13367                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13368         * )     case "$getgrnam_r_proto" in
13369                 REENTRANT_PROTO*) ;;
13370                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13371                 esac
13372                 echo "Prototype: $try" ;;
13373         esac
13374         ;;
13375         *)      case "$usethreads" in
13376                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13377                 esac
13378                 d_getgrnam_r=undef
13379                 getgrnam_r_proto=0
13380                 ;;
13381         esac
13382         ;;
13383 *)      getgrnam_r_proto=0
13384         ;;
13385 esac
13386
13387 : see if gethostbyaddr exists
13388 set gethostbyaddr d_gethbyaddr
13389 eval $inlibc
13390
13391 : see if gethostbyname exists
13392 set gethostbyname d_gethbyname
13393 eval $inlibc
13394
13395 : see if gethostent exists
13396 set gethostent d_gethent
13397 eval $inlibc
13398
13399 : see how we will look up host name
13400 echo " "
13401 call=''
13402 if set gethostname val -f d_gethname; eval $csym; $val; then
13403         echo 'gethostname() found.' >&4
13404         d_gethname="$define"
13405         call=gethostname
13406 fi
13407 if set uname val -f d_uname; eval $csym; $val; then
13408         if ./xenix; then
13409                 $cat <<'EOM'
13410 uname() was found, but you're running xenix, and older versions of xenix
13411 have a broken uname(). If you don't really know whether your xenix is old
13412 enough to have a broken system call, use the default answer.
13413
13414 EOM
13415                 dflt=y
13416                 case "$d_uname" in
13417                 "$define") dflt=n;;
13418                 esac
13419                 rp='Is your uname() broken?'
13420                 . ./myread
13421                 case "$ans" in
13422                 n*) d_uname="$define"; call=uname;;
13423                 esac
13424         else
13425                 echo 'uname() found.' >&4
13426                 d_uname="$define"
13427                 case "$call" in
13428                 '') call=uname ;;
13429                 esac
13430         fi
13431 fi
13432 case "$d_gethname" in
13433 '') d_gethname="$undef";;
13434 esac
13435 case "$d_uname" in
13436 '') d_uname="$undef";;
13437 esac
13438 case "$d_uname$d_gethname" in
13439 *define*)
13440         dflt=n
13441         cat <<EOM
13442
13443 Every now and then someone has a $call() that lies about the hostname
13444 but can't be fixed for political or economic reasons.  If you wish, I can
13445 pretend $call() isn't there and maybe compute hostname at run-time
13446 thanks to the '$phostname' command.
13447
13448 EOM
13449         rp="Shall I ignore $call() from now on?"
13450         . ./myread
13451         case "$ans" in
13452         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13453         esac;;
13454 esac
13455 case "$phostname" in
13456 '') aphostname='';;
13457 *) case "$aphostname" in
13458         /*) ;;
13459         *) set X $phostname
13460                 shift
13461                 file=$1
13462                 shift
13463                 file=`./loc $file $file $pth`
13464                 aphostname=`echo $file $*`
13465                 ;;
13466         esac
13467         ;;
13468 esac
13469 case "$d_uname$d_gethname" in
13470 *define*) ;;
13471 *)
13472         case "$phostname" in
13473         '')
13474                 echo "There will be no way for $package to get your hostname." >&4;;
13475         *)
13476         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13477                 ;;
13478         esac;;
13479 esac
13480 case "$d_phostname" in
13481 '') d_phostname="$undef";;
13482 esac
13483
13484 : see if gethostbyaddr_r exists
13485 set gethostbyaddr_r d_gethostbyaddr_r
13486 eval $inlibc
13487 case "$d_gethostbyaddr_r" in
13488 "$define")
13489         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13490         case "$d_gethostbyaddr_r_proto:$usethreads" in
13491         ":define")      d_gethostbyaddr_r_proto=define
13492                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13493                 eval $hasproto ;;
13494         *)      ;;
13495         esac
13496         case "$d_gethostbyaddr_r_proto" in
13497         define)
13498         case "$gethostbyaddr_r_proto" in
13499         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13500         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13501         esac
13502         case "$gethostbyaddr_r_proto" in
13503         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13504         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13505         esac
13506         case "$gethostbyaddr_r_proto" in
13507         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13508         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13509         esac
13510         case "$gethostbyaddr_r_proto" in
13511         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13512         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13513         esac
13514         case "$gethostbyaddr_r_proto" in
13515         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13516         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13517         esac
13518         case "$gethostbyaddr_r_proto" in
13519         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13520         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13521         esac
13522         case "$gethostbyaddr_r_proto" in
13523         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13524         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13525         esac
13526         case "$gethostbyaddr_r_proto" in
13527         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13528         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13529         esac
13530         case "$gethostbyaddr_r_proto" in
13531         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13532         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13533         esac
13534         case "$gethostbyaddr_r_proto" in
13535         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13536         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13537         esac
13538         case "$gethostbyaddr_r_proto" in
13539         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13540         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13541         esac
13542         case "$gethostbyaddr_r_proto" in
13543         ''|0)   d_gethostbyaddr_r=undef
13544                 gethostbyaddr_r_proto=0
13545                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13546         * )     case "$gethostbyaddr_r_proto" in
13547                 REENTRANT_PROTO*) ;;
13548                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13549                 esac
13550                 echo "Prototype: $try" ;;
13551         esac
13552         ;;
13553         *)      case "$usethreads" in
13554                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13555                 esac
13556                 d_gethostbyaddr_r=undef
13557                 gethostbyaddr_r_proto=0
13558                 ;;
13559         esac
13560         ;;
13561 *)      gethostbyaddr_r_proto=0
13562         ;;
13563 esac
13564
13565 : see if gethostbyname_r exists
13566 set gethostbyname_r d_gethostbyname_r
13567 eval $inlibc
13568 case "$d_gethostbyname_r" in
13569 "$define")
13570         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13571         case "$d_gethostbyname_r_proto:$usethreads" in
13572         ":define")      d_gethostbyname_r_proto=define
13573                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13574                 eval $hasproto ;;
13575         *)      ;;
13576         esac
13577         case "$d_gethostbyname_r_proto" in
13578         define)
13579         case "$gethostbyname_r_proto" in
13580         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13581         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13582         esac
13583         case "$gethostbyname_r_proto" in
13584         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13585         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13586         esac
13587         case "$gethostbyname_r_proto" in
13588         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13589         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13590         esac
13591         case "$gethostbyname_r_proto" in
13592         ''|0)   d_gethostbyname_r=undef
13593                 gethostbyname_r_proto=0
13594                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13595         * )     case "$gethostbyname_r_proto" in
13596                 REENTRANT_PROTO*) ;;
13597                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13598                 esac
13599                 echo "Prototype: $try" ;;
13600         esac
13601         ;;
13602         *)      case "$usethreads" in
13603                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13604                 esac
13605                 d_gethostbyname_r=undef
13606                 gethostbyname_r_proto=0
13607                 ;;
13608         esac
13609         ;;
13610 *)      gethostbyname_r_proto=0
13611         ;;
13612 esac
13613
13614 : see if gethostent_r exists
13615 set gethostent_r d_gethostent_r
13616 eval $inlibc
13617 case "$d_gethostent_r" in
13618 "$define")
13619         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13620         case "$d_gethostent_r_proto:$usethreads" in
13621         ":define")      d_gethostent_r_proto=define
13622                 set d_gethostent_r_proto gethostent_r $hdrs
13623                 eval $hasproto ;;
13624         *)      ;;
13625         esac
13626         case "$d_gethostent_r_proto" in
13627         define)
13628         case "$gethostent_r_proto" in
13629         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13630         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13631         esac
13632         case "$gethostent_r_proto" in
13633         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13634         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13635         esac
13636         case "$gethostent_r_proto" in
13637         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13638         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13639         esac
13640         case "$gethostent_r_proto" in
13641         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13642         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13643         esac
13644         case "$gethostent_r_proto" in
13645         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13646         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13647         esac
13648         case "$gethostent_r_proto" in
13649         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13650         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13651         esac
13652         case "$gethostent_r_proto" in
13653         ''|0)   d_gethostent_r=undef
13654                 gethostent_r_proto=0
13655                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13656         * )     case "$gethostent_r_proto" in
13657                 REENTRANT_PROTO*) ;;
13658                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13659                 esac
13660                 echo "Prototype: $try" ;;
13661         esac
13662         ;;
13663         *)      case "$usethreads" in
13664                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13665                 esac
13666                 d_gethostent_r=undef
13667                 gethostent_r_proto=0
13668                 ;;
13669         esac
13670         ;;
13671 *)      gethostent_r_proto=0
13672         ;;
13673 esac
13674
13675 : see if prototypes for various gethostxxx netdb.h functions are available
13676 echo " "
13677 set d_gethostprotos gethostent $i_netdb netdb.h
13678 eval $hasproto
13679
13680 : see if getitimer exists
13681 set getitimer d_getitimer
13682 eval $inlibc
13683
13684 : see if getlogin exists
13685 set getlogin d_getlogin
13686 eval $inlibc
13687
13688 : see if getlogin_r exists
13689 set getlogin_r d_getlogin_r
13690 eval $inlibc
13691 case "$d_getlogin_r" in
13692 "$define")
13693         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13694         case "$d_getlogin_r_proto:$usethreads" in
13695         ":define")      d_getlogin_r_proto=define
13696                 set d_getlogin_r_proto getlogin_r $hdrs
13697                 eval $hasproto ;;
13698         *)      ;;
13699         esac
13700         case "$d_getlogin_r_proto" in
13701         define)
13702         case "$getlogin_r_proto" in
13703         ''|0) try='int getlogin_r(char*, size_t);'
13704         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13705         esac
13706         case "$getlogin_r_proto" in
13707         ''|0) try='int getlogin_r(char*, int);'
13708         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13709         esac
13710         case "$getlogin_r_proto" in
13711         ''|0) try='char* getlogin_r(char*, size_t);'
13712         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13713         esac
13714         case "$getlogin_r_proto" in
13715         ''|0) try='char* getlogin_r(char*, int);'
13716         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13717         esac
13718         case "$getlogin_r_proto" in
13719         ''|0)   d_getlogin_r=undef
13720                 getlogin_r_proto=0
13721                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13722         * )     case "$getlogin_r_proto" in
13723                 REENTRANT_PROTO*) ;;
13724                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13725                 esac
13726                 echo "Prototype: $try" ;;
13727         esac
13728         ;;
13729         *)      case "$usethreads" in
13730                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13731                 esac
13732                 d_getlogin_r=undef
13733                 getlogin_r_proto=0
13734                 ;;
13735         esac
13736         ;;
13737 *)      getlogin_r_proto=0
13738         ;;
13739 esac
13740
13741 : see if getmnt exists
13742 set getmnt d_getmnt
13743 eval $inlibc
13744
13745 : see if getmntent exists
13746 set getmntent d_getmntent
13747 eval $inlibc
13748
13749 : see if getnetbyaddr exists
13750 set getnetbyaddr d_getnbyaddr
13751 eval $inlibc
13752
13753 : see if getnetbyname exists
13754 set getnetbyname d_getnbyname
13755 eval $inlibc
13756
13757 : see if getnetent exists
13758 set getnetent d_getnent
13759 eval $inlibc
13760
13761 : see if getnetbyaddr_r exists
13762 set getnetbyaddr_r d_getnetbyaddr_r
13763 eval $inlibc
13764 case "$d_getnetbyaddr_r" in
13765 "$define")
13766         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13767         case "$d_getnetbyaddr_r_proto:$usethreads" in
13768         ":define")      d_getnetbyaddr_r_proto=define
13769                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13770                 eval $hasproto ;;
13771         *)      ;;
13772         esac
13773         case "$d_getnetbyaddr_r_proto" in
13774         define)
13775         case "$getnetbyaddr_r_proto" in
13776         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13777         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13778         esac
13779         case "$getnetbyaddr_r_proto" in
13780         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13781         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13782         esac
13783         case "$getnetbyaddr_r_proto" in
13784         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13785         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13786         esac
13787         case "$getnetbyaddr_r_proto" in
13788         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13789         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13790         esac
13791         case "$getnetbyaddr_r_proto" in
13792         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13793         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13794         esac
13795         case "$getnetbyaddr_r_proto" in
13796         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13797         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13798         esac
13799         case "$getnetbyaddr_r_proto" in
13800         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13801         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13802         esac
13803         case "$getnetbyaddr_r_proto" in
13804         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13805         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13806         esac
13807         case "$getnetbyaddr_r_proto" in
13808         ''|0)   d_getnetbyaddr_r=undef
13809                 getnetbyaddr_r_proto=0
13810                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13811         * )     case "$getnetbyaddr_r_proto" in
13812                 REENTRANT_PROTO*) ;;
13813                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13814                 esac
13815                 echo "Prototype: $try" ;;
13816         esac
13817         ;;
13818         *)      case "$usethreads" in
13819                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13820                 esac
13821                 d_getnetbyaddr_r=undef
13822                 getnetbyaddr_r_proto=0
13823                 ;;
13824         esac
13825         ;;
13826 *)      getnetbyaddr_r_proto=0
13827         ;;
13828 esac
13829
13830 : see if getnetbyname_r exists
13831 set getnetbyname_r d_getnetbyname_r
13832 eval $inlibc
13833 case "$d_getnetbyname_r" in
13834 "$define")
13835         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13836         case "$d_getnetbyname_r_proto:$usethreads" in
13837         ":define")      d_getnetbyname_r_proto=define
13838                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13839                 eval $hasproto ;;
13840         *)      ;;
13841         esac
13842         case "$d_getnetbyname_r_proto" in
13843         define)
13844         case "$getnetbyname_r_proto" in
13845         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13846         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13847         esac
13848         case "$getnetbyname_r_proto" in
13849         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13850         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13851         esac
13852         case "$getnetbyname_r_proto" in
13853         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13854         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13855         esac
13856         case "$getnetbyname_r_proto" in
13857         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13858         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13859         esac
13860         case "$getnetbyname_r_proto" in
13861         ''|0)   d_getnetbyname_r=undef
13862                 getnetbyname_r_proto=0
13863                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13864         * )     case "$getnetbyname_r_proto" in
13865                 REENTRANT_PROTO*) ;;
13866                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13867                 esac
13868                 echo "Prototype: $try" ;;
13869         esac
13870         ;;
13871         *)      case "$usethreads" in
13872                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13873                 esac
13874                 d_getnetbyname_r=undef
13875                 getnetbyname_r_proto=0
13876                 ;;
13877         esac
13878         ;;
13879 *)      getnetbyname_r_proto=0
13880         ;;
13881 esac
13882
13883 : see if getnetent_r exists
13884 set getnetent_r d_getnetent_r
13885 eval $inlibc
13886 case "$d_getnetent_r" in
13887 "$define")
13888         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13889         case "$d_getnetent_r_proto:$usethreads" in
13890         ":define")      d_getnetent_r_proto=define
13891                 set d_getnetent_r_proto getnetent_r $hdrs
13892                 eval $hasproto ;;
13893         *)      ;;
13894         esac
13895         case "$d_getnetent_r_proto" in
13896         define)
13897         case "$getnetent_r_proto" in
13898         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13899         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13900         esac
13901         case "$getnetent_r_proto" in
13902         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13903         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13904         esac
13905         case "$getnetent_r_proto" in
13906         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13907         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13908         esac
13909         case "$getnetent_r_proto" in
13910         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13911         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13912         esac
13913         case "$getnetent_r_proto" in
13914         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13915         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13916         esac
13917         case "$getnetent_r_proto" in
13918         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13919         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13920         esac
13921         case "$getnetent_r_proto" in
13922         ''|0)   d_getnetent_r=undef
13923                 getnetent_r_proto=0
13924                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13925         * )     case "$getnetent_r_proto" in
13926                 REENTRANT_PROTO*) ;;
13927                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13928                 esac
13929                 echo "Prototype: $try" ;;
13930         esac
13931         ;;
13932         *)      case "$usethreads" in
13933                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13934                 esac
13935                 d_getnetent_r=undef
13936                 getnetent_r_proto=0
13937                 ;;
13938         esac
13939         ;;
13940 *)      getnetent_r_proto=0
13941         ;;
13942 esac
13943
13944 : see if prototypes for various getnetxxx netdb.h functions are available
13945 echo " "
13946 set d_getnetprotos getnetent $i_netdb netdb.h
13947 eval $hasproto
13948
13949 : see if getpagesize exists
13950 set getpagesize d_getpagsz
13951 eval $inlibc
13952
13953 : Optional checks for getprotobyname and getprotobynumber
13954
13955 : see if getprotobyname exists
13956 set getprotobyname d_getpbyname
13957 eval $inlibc
13958
13959 : see if getprotobynumber exists
13960 set getprotobynumber d_getpbynumber
13961 eval $inlibc
13962
13963 : see if getprotoent exists
13964 set getprotoent d_getpent
13965 eval $inlibc
13966
13967 : see if getpgid exists
13968 set getpgid d_getpgid
13969 eval $inlibc
13970
13971 : see if getpgrp2 exists
13972 set getpgrp2 d_getpgrp2
13973 eval $inlibc
13974
13975 : see if getppid exists
13976 set getppid d_getppid
13977 eval $inlibc
13978
13979 : see if getpriority exists
13980 set getpriority d_getprior
13981 eval $inlibc
13982
13983 : see if getprotobyname_r exists
13984 set getprotobyname_r d_getprotobyname_r
13985 eval $inlibc
13986 case "$d_getprotobyname_r" in
13987 "$define")
13988         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13989         case "$d_getprotobyname_r_proto:$usethreads" in
13990         ":define")      d_getprotobyname_r_proto=define
13991                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13992                 eval $hasproto ;;
13993         *)      ;;
13994         esac
13995         case "$d_getprotobyname_r_proto" in
13996         define)
13997         case "$getprotobyname_r_proto" in
13998         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13999         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14000         esac
14001         case "$getprotobyname_r_proto" in
14002         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14003         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14004         esac
14005         case "$getprotobyname_r_proto" in
14006         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14007         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14008         esac
14009         case "$getprotobyname_r_proto" in
14010         ''|0)   d_getprotobyname_r=undef
14011                 getprotobyname_r_proto=0
14012                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14013         * )     case "$getprotobyname_r_proto" in
14014                 REENTRANT_PROTO*) ;;
14015                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14016                 esac
14017                 echo "Prototype: $try" ;;
14018         esac
14019         ;;
14020         *)      case "$usethreads" in
14021                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14022                 esac
14023                 d_getprotobyname_r=undef
14024                 getprotobyname_r_proto=0
14025                 ;;
14026         esac
14027         ;;
14028 *)      getprotobyname_r_proto=0
14029         ;;
14030 esac
14031
14032 : see if getprotobynumber_r exists
14033 set getprotobynumber_r d_getprotobynumber_r
14034 eval $inlibc
14035 case "$d_getprotobynumber_r" in
14036 "$define")
14037         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14038         case "$d_getprotobynumber_r_proto:$usethreads" in
14039         ":define")      d_getprotobynumber_r_proto=define
14040                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14041                 eval $hasproto ;;
14042         *)      ;;
14043         esac
14044         case "$d_getprotobynumber_r_proto" in
14045         define)
14046         case "$getprotobynumber_r_proto" in
14047         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14048         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14049         esac
14050         case "$getprotobynumber_r_proto" in
14051         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14052         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14053         esac
14054         case "$getprotobynumber_r_proto" in
14055         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14056         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14057         esac
14058         case "$getprotobynumber_r_proto" in
14059         ''|0)   d_getprotobynumber_r=undef
14060                 getprotobynumber_r_proto=0
14061                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14062         * )     case "$getprotobynumber_r_proto" in
14063                 REENTRANT_PROTO*) ;;
14064                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14065                 esac
14066                 echo "Prototype: $try" ;;
14067         esac
14068         ;;
14069         *)      case "$usethreads" in
14070                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14071                 esac
14072                 d_getprotobynumber_r=undef
14073                 getprotobynumber_r_proto=0
14074                 ;;
14075         esac
14076         ;;
14077 *)      getprotobynumber_r_proto=0
14078         ;;
14079 esac
14080
14081 : see if getprotoent_r exists
14082 set getprotoent_r d_getprotoent_r
14083 eval $inlibc
14084 case "$d_getprotoent_r" in
14085 "$define")
14086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14087         case "$d_getprotoent_r_proto:$usethreads" in
14088         ":define")      d_getprotoent_r_proto=define
14089                 set d_getprotoent_r_proto getprotoent_r $hdrs
14090                 eval $hasproto ;;
14091         *)      ;;
14092         esac
14093         case "$d_getprotoent_r_proto" in
14094         define)
14095         case "$getprotoent_r_proto" in
14096         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14097         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14098         esac
14099         case "$getprotoent_r_proto" in
14100         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14101         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14102         esac
14103         case "$getprotoent_r_proto" in
14104         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14105         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14106         esac
14107         case "$getprotoent_r_proto" in
14108         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14109         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14110         esac
14111         case "$getprotoent_r_proto" in
14112         ''|0)   d_getprotoent_r=undef
14113                 getprotoent_r_proto=0
14114                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14115         * )     case "$getprotoent_r_proto" in
14116                 REENTRANT_PROTO*) ;;
14117                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14118                 esac
14119                 echo "Prototype: $try" ;;
14120         esac
14121         ;;
14122         *)      case "$usethreads" in
14123                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14124                 esac
14125                 d_getprotoent_r=undef
14126                 getprotoent_r_proto=0
14127                 ;;
14128         esac
14129         ;;
14130 *)      getprotoent_r_proto=0
14131         ;;
14132 esac
14133
14134 : see if prototypes for various getprotoxxx netdb.h functions are available
14135 echo " "
14136 set d_getprotoprotos getprotoent $i_netdb netdb.h
14137 eval $hasproto
14138
14139 : see if getprpwnam exists
14140 set getprpwnam d_getprpwnam
14141 eval $inlibc
14142
14143 : see if getpwent exists
14144 set getpwent d_getpwent
14145 eval $inlibc
14146
14147 : see if getpwent_r exists
14148 set getpwent_r d_getpwent_r
14149 eval $inlibc
14150 case "$d_getpwent_r" in
14151 "$define")
14152         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14153         case "$d_getpwent_r_proto:$usethreads" in
14154         ":define")      d_getpwent_r_proto=define
14155                 set d_getpwent_r_proto getpwent_r $hdrs
14156                 eval $hasproto ;;
14157         *)      ;;
14158         esac
14159         case "$d_getpwent_r_proto" in
14160         define)
14161         case "$getpwent_r_proto" in
14162         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14163         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14164         esac
14165         case "$getpwent_r_proto" in
14166         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14167         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14168         esac
14169         case "$getpwent_r_proto" in
14170         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14171         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14172         esac
14173         case "$getpwent_r_proto" in
14174         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14175         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14176         esac
14177         case "$getpwent_r_proto" in
14178         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14179         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14180         esac
14181         case "$getpwent_r_proto" in
14182         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14183         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14184         esac
14185         case "$getpwent_r_proto" in
14186         ''|0)   d_getpwent_r=undef
14187                 getpwent_r_proto=0
14188                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14189         * )     case "$getpwent_r_proto" in
14190                 REENTRANT_PROTO*) ;;
14191                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14192                 esac
14193                 echo "Prototype: $try" ;;
14194         esac
14195         ;;
14196         *)      case "$usethreads" in
14197                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14198                 esac
14199                 d_getpwent_r=undef
14200                 getpwent_r_proto=0
14201                 ;;
14202         esac
14203         ;;
14204 *)      getpwent_r_proto=0
14205         ;;
14206 esac
14207
14208 : see if getpwnam_r exists
14209 set getpwnam_r d_getpwnam_r
14210 eval $inlibc
14211 case "$d_getpwnam_r" in
14212 "$define")
14213         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14214         case "$d_getpwnam_r_proto:$usethreads" in
14215         ":define")      d_getpwnam_r_proto=define
14216                 set d_getpwnam_r_proto getpwnam_r $hdrs
14217                 eval $hasproto ;;
14218         *)      ;;
14219         esac
14220         case "$d_getpwnam_r_proto" in
14221         define)
14222         case "$getpwnam_r_proto" in
14223         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14224         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14225         esac
14226         case "$getpwnam_r_proto" in
14227         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14228         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14229         esac
14230         case "$getpwnam_r_proto" in
14231         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14232         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14233         esac
14234         case "$getpwnam_r_proto" in
14235         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14236         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14237         esac
14238         case "$getpwnam_r_proto" in
14239         ''|0)   d_getpwnam_r=undef
14240                 getpwnam_r_proto=0
14241                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14242         * )     case "$getpwnam_r_proto" in
14243                 REENTRANT_PROTO*) ;;
14244                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14245                 esac
14246                 echo "Prototype: $try" ;;
14247         esac
14248         ;;
14249         *)      case "$usethreads" in
14250                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14251                 esac
14252                 d_getpwnam_r=undef
14253                 getpwnam_r_proto=0
14254                 ;;
14255         esac
14256         ;;
14257 *)      getpwnam_r_proto=0
14258         ;;
14259 esac
14260
14261 : see if getpwuid_r exists
14262 set getpwuid_r d_getpwuid_r
14263 eval $inlibc
14264 case "$d_getpwuid_r" in
14265 "$define")
14266         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14267         case "$d_getpwuid_r_proto:$usethreads" in
14268         ":define")      d_getpwuid_r_proto=define
14269                 set d_getpwuid_r_proto getpwuid_r $hdrs
14270                 eval $hasproto ;;
14271         *)      ;;
14272         esac
14273         case "$d_getpwuid_r_proto" in
14274         define)
14275         case "$getpwuid_r_proto" in
14276         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14277         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14278         esac
14279         case "$getpwuid_r_proto" in
14280         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14281         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14282         esac
14283         case "$getpwuid_r_proto" in
14284         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14285         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14286         esac
14287         case "$getpwuid_r_proto" in
14288         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14289         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14290         esac
14291         case "$getpwuid_r_proto" in
14292         ''|0)   d_getpwuid_r=undef
14293                 getpwuid_r_proto=0
14294                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14295         * )     case "$getpwuid_r_proto" in
14296                 REENTRANT_PROTO*) ;;
14297                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14298                 esac
14299                 echo "Prototype: $try" ;;
14300         esac
14301         ;;
14302         *)      case "$usethreads" in
14303                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14304                 esac
14305                 d_getpwuid_r=undef
14306                 getpwuid_r_proto=0
14307                 ;;
14308         esac
14309         ;;
14310 *)      getpwuid_r_proto=0
14311         ;;
14312 esac
14313
14314 : Optional checks for getsbyname and getsbyport
14315
14316 : see if getservbyname exists
14317 set getservbyname d_getsbyname
14318 eval $inlibc
14319
14320 : see if getservbyport exists
14321 set getservbyport d_getsbyport
14322 eval $inlibc
14323
14324 : see if getservent exists
14325 set getservent d_getsent
14326 eval $inlibc
14327
14328 : see if getservbyname_r exists
14329 set getservbyname_r d_getservbyname_r
14330 eval $inlibc
14331 case "$d_getservbyname_r" in
14332 "$define")
14333         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14334         case "$d_getservbyname_r_proto:$usethreads" in
14335         ":define")      d_getservbyname_r_proto=define
14336                 set d_getservbyname_r_proto getservbyname_r $hdrs
14337                 eval $hasproto ;;
14338         *)      ;;
14339         esac
14340         case "$d_getservbyname_r_proto" in
14341         define)
14342         case "$getservbyname_r_proto" in
14343         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14344         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14345         esac
14346         case "$getservbyname_r_proto" in
14347         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14348         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14349         esac
14350         case "$getservbyname_r_proto" in
14351         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14352         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14353         esac
14354         case "$getservbyname_r_proto" in
14355         ''|0)   d_getservbyname_r=undef
14356                 getservbyname_r_proto=0
14357                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14358         * )     case "$getservbyname_r_proto" in
14359                 REENTRANT_PROTO*) ;;
14360                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14361                 esac
14362                 echo "Prototype: $try" ;;
14363         esac
14364         ;;
14365         *)      case "$usethreads" in
14366                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14367                 esac
14368                 d_getservbyname_r=undef
14369                 getservbyname_r_proto=0
14370                 ;;
14371         esac
14372         ;;
14373 *)      getservbyname_r_proto=0
14374         ;;
14375 esac
14376
14377 : see if getservbyport_r exists
14378 set getservbyport_r d_getservbyport_r
14379 eval $inlibc
14380 case "$d_getservbyport_r" in
14381 "$define")
14382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14383         case "$d_getservbyport_r_proto:$usethreads" in
14384         ":define")      d_getservbyport_r_proto=define
14385                 set d_getservbyport_r_proto getservbyport_r $hdrs
14386                 eval $hasproto ;;
14387         *)      ;;
14388         esac
14389         case "$d_getservbyport_r_proto" in
14390         define)
14391         case "$getservbyport_r_proto" in
14392         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14393         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14394         esac
14395         case "$getservbyport_r_proto" in
14396         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14397         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14398         esac
14399         case "$getservbyport_r_proto" in
14400         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14401         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14402         esac
14403         case "$getservbyport_r_proto" in
14404         ''|0)   d_getservbyport_r=undef
14405                 getservbyport_r_proto=0
14406                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14407         * )     case "$getservbyport_r_proto" in
14408                 REENTRANT_PROTO*) ;;
14409                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14410                 esac
14411                 echo "Prototype: $try" ;;
14412         esac
14413         ;;
14414         *)      case "$usethreads" in
14415                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14416                 esac
14417                 d_getservbyport_r=undef
14418                 getservbyport_r_proto=0
14419                 ;;
14420         esac
14421         ;;
14422 *)      getservbyport_r_proto=0
14423         ;;
14424 esac
14425
14426 : see if getservent_r exists
14427 set getservent_r d_getservent_r
14428 eval $inlibc
14429 case "$d_getservent_r" in
14430 "$define")
14431         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14432         case "$d_getservent_r_proto:$usethreads" in
14433         ":define")      d_getservent_r_proto=define
14434                 set d_getservent_r_proto getservent_r $hdrs
14435                 eval $hasproto ;;
14436         *)      ;;
14437         esac
14438         case "$d_getservent_r_proto" in
14439         define)
14440         case "$getservent_r_proto" in
14441         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14442         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14443         esac
14444         case "$getservent_r_proto" in
14445         ''|0) try='int getservent_r(struct servent*, char*, int);'
14446         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14447         esac
14448         case "$getservent_r_proto" in
14449         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14450         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14451         esac
14452         case "$getservent_r_proto" in
14453         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14454         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14455         esac
14456         case "$getservent_r_proto" in
14457         ''|0)   d_getservent_r=undef
14458                 getservent_r_proto=0
14459                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14460         * )     case "$getservent_r_proto" in
14461                 REENTRANT_PROTO*) ;;
14462                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14463                 esac
14464                 echo "Prototype: $try" ;;
14465         esac
14466         ;;
14467         *)      case "$usethreads" in
14468                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14469                 esac
14470                 d_getservent_r=undef
14471                 getservent_r_proto=0
14472                 ;;
14473         esac
14474         ;;
14475 *)      getservent_r_proto=0
14476         ;;
14477 esac
14478
14479 : see if prototypes for various getservxxx netdb.h functions are available
14480 echo " "
14481 set d_getservprotos getservent $i_netdb netdb.h
14482 eval $hasproto
14483
14484 : see if getspnam exists
14485 set getspnam d_getspnam
14486 eval $inlibc
14487
14488 : see if this is a shadow.h system
14489 set shadow.h i_shadow
14490 eval $inhdr
14491
14492 : see if getspnam_r exists
14493 set getspnam_r d_getspnam_r
14494 eval $inlibc
14495 case "$d_getspnam_r" in
14496 "$define")
14497         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14498         case "$d_getspnam_r_proto:$usethreads" in
14499         ":define")      d_getspnam_r_proto=define
14500                 set d_getspnam_r_proto getspnam_r $hdrs
14501                 eval $hasproto ;;
14502         *)      ;;
14503         esac
14504         case "$d_getspnam_r_proto" in
14505         define)
14506         case "$getspnam_r_proto" in
14507         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14508         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14509         esac
14510         case "$getspnam_r_proto" in
14511         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14512         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14513         esac
14514         case "$getspnam_r_proto" in
14515         ''|0)   d_getspnam_r=undef
14516                 getspnam_r_proto=0
14517                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14518         * )     case "$getspnam_r_proto" in
14519                 REENTRANT_PROTO*) ;;
14520                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14521                 esac
14522                 echo "Prototype: $try" ;;
14523         esac
14524         ;;
14525         *)      case "$usethreads" in
14526                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14527                 esac
14528                 d_getspnam_r=undef
14529                 getspnam_r_proto=0
14530                 ;;
14531         esac
14532         ;;
14533 *)      getspnam_r_proto=0
14534         ;;
14535 esac
14536
14537 : see if gettimeofday or ftime exists
14538 set gettimeofday d_gettimeod
14539 eval $inlibc
14540 case "$d_gettimeod" in
14541 "$undef")
14542         set ftime d_ftime 
14543         eval $inlibc
14544         ;;
14545 *)
14546         val="$undef"; set d_ftime; eval $setvar
14547         ;;
14548 esac
14549 case "$d_gettimeod$d_ftime" in
14550 "$undef$undef")
14551         echo " "
14552         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14553         ;;
14554 esac
14555
14556 : see if gmtime_r exists
14557 set gmtime_r d_gmtime_r
14558 eval $inlibc
14559 case "$d_gmtime_r" in
14560 "$define")
14561         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14562         case "$d_gmtime_r_proto:$usethreads" in
14563         ":define")      d_gmtime_r_proto=define
14564                 set d_gmtime_r_proto gmtime_r $hdrs
14565                 eval $hasproto ;;
14566         *)      ;;
14567         esac
14568         case "$d_gmtime_r_proto" in
14569         define)
14570         case "$gmtime_r_proto" in
14571         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14572         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14573         esac
14574         case "$gmtime_r_proto" in
14575         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14576         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14577         esac
14578         case "$gmtime_r_proto" in
14579         ''|0)   d_gmtime_r=undef
14580                 gmtime_r_proto=0
14581                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14582         * )     case "$gmtime_r_proto" in
14583                 REENTRANT_PROTO*) ;;
14584                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14585                 esac
14586                 echo "Prototype: $try" ;;
14587         esac
14588         ;;
14589         *)      case "$usethreads" in
14590                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14591                 esac
14592                 d_gmtime_r=undef
14593                 gmtime_r_proto=0
14594                 ;;
14595         esac
14596         ;;
14597 *)      gmtime_r_proto=0
14598         ;;
14599 esac
14600
14601 : see if hasmntopt exists
14602 set hasmntopt d_hasmntopt
14603 eval $inlibc
14604
14605 : see if this is a netinet/in.h or sys/in.h system
14606 set netinet/in.h i_niin sys/in.h i_sysin
14607 eval $inhdr
14608
14609 : see if arpa/inet.h has to be included
14610 set arpa/inet.h i_arpainet
14611 eval $inhdr
14612
14613 : see if htonl --and friends-- exists
14614 val=''
14615 set htonl val
14616 eval $inlibc
14617
14618 : Maybe they are macros.
14619 case "$val" in
14620 $undef)
14621         $cat >htonl.c <<EOM
14622 #include <stdio.h>
14623 #include <sys/types.h>
14624 #$i_niin I_NETINET_IN
14625 #$i_sysin I_SYS_IN
14626 #$i_arpainet I_ARPA_INET
14627 #ifdef I_NETINET_IN
14628 #include <netinet/in.h>
14629 #endif
14630 #ifdef I_SYS_IN
14631 #include <sys/in.h>
14632 #endif
14633 #ifdef I_ARPA_INET
14634 #include <arpa/inet.h>
14635 #endif
14636 #ifdef htonl
14637 printf("Defined as a macro.");
14638 #endif
14639 EOM
14640         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14641         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14642                 val="$define"
14643                 echo "But it seems to be defined as a macro." >&4
14644         fi
14645         $rm -f htonl.?
14646         ;;
14647 esac
14648 set d_htonl
14649 eval $setvar
14650
14651 : see if ilogbl exists
14652 set ilogbl d_ilogbl
14653 eval $inlibc
14654
14655 : index or strchr
14656 echo " "
14657 if set index val -f; eval $csym; $val; then
14658         if set strchr val -f d_strchr; eval $csym; $val; then
14659                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14660                         val="$define"
14661                         vali="$undef"
14662                         echo "strchr() found." >&4
14663                 else
14664                         val="$undef"
14665                         vali="$define"
14666                         echo "index() found." >&4
14667                 fi
14668         else
14669                 val="$undef"
14670                 vali="$define"
14671                 echo "index() found." >&4
14672         fi
14673 else
14674         if set strchr val -f d_strchr; eval $csym; $val; then
14675                 val="$define"
14676                 vali="$undef"
14677                 echo "strchr() found." >&4
14678         else
14679                 echo "No index() or strchr() found!" >&4
14680                 val="$undef"
14681                 vali="$undef"
14682         fi
14683 fi
14684 set d_strchr; eval $setvar
14685 val="$vali"
14686 set d_index; eval $setvar
14687
14688 : check whether inet_aton exists
14689 set inet_aton d_inetaton
14690 eval $inlibc
14691
14692 : Look for isascii
14693 echo " "
14694 $cat >isascii.c <<EOCP
14695 #include <stdio.h>
14696 #include <ctype.h>
14697 #$i_stdlib I_STDLIB
14698 #ifdef I_STDLIB
14699 #include <stdlib.h>
14700 #endif
14701 int main() {
14702         int c = 'A';
14703         if (isascii(c))
14704                 exit(0);
14705         else
14706                 exit(1);
14707 }
14708 EOCP
14709 set isascii
14710 if eval $compile; then
14711         echo "isascii() found." >&4
14712         val="$define"
14713 else
14714         echo "isascii() NOT found." >&4
14715         val="$undef"
14716 fi
14717 set d_isascii
14718 eval $setvar
14719 $rm -f isascii*
14720
14721 : see if isfinite exists
14722 set isfinite d_isfinite
14723 eval $inlibc
14724
14725 : see if isinf exists
14726 set isinf d_isinf
14727 eval $inlibc
14728
14729 : see if isnan exists
14730 set isnan d_isnan
14731 eval $inlibc
14732
14733 : see if isnanl exists
14734 set isnanl d_isnanl
14735 eval $inlibc
14736
14737 : see if killpg exists
14738 set killpg d_killpg
14739 eval $inlibc
14740
14741 : see if lchown exists
14742 echo " "
14743 $cat > try.c <<'EOCP'
14744 /* System header to define __stub macros and hopefully few prototypes,
14745     which can conflict with char lchown(); below.  */
14746 #include <assert.h>
14747 /* Override any gcc2 internal prototype to avoid an error.  */
14748 /* We use char because int might match the return type of a gcc2
14749    builtin and then its argument prototype would still apply.  */
14750 char lchown();
14751 int main() {
14752     /*  The GNU C library defines this for functions which it implements
14753         to always fail with ENOSYS.  Some functions are actually named
14754         something starting with __ and the normal name is an alias.  */
14755 #if defined (__stub_lchown) || defined (__stub___lchown)
14756 choke me
14757 #else
14758 lchown();
14759 #endif
14760 ; return 0; }
14761 EOCP
14762 set try
14763 if eval $compile; then
14764     $echo "lchown() found." >&4
14765     val="$define"
14766 else
14767     $echo "lchown() NOT found." >&4
14768     val="$undef"
14769 fi
14770 set d_lchown
14771 eval $setvar
14772
14773 : See if number of significant digits in a double precision number is known
14774 echo " "
14775 $cat >ldbl_dig.c <<EOM
14776 #$i_limits I_LIMITS
14777 #$i_float I_FLOAT
14778 #ifdef I_LIMITS
14779 #include <limits.h>
14780 #endif
14781 #ifdef I_FLOAT
14782 #include <float.h>
14783 #endif
14784 #ifdef LDBL_DIG
14785 printf("Contains LDBL_DIG");
14786 #endif
14787 EOM
14788 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14789 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14790         echo "LDBL_DIG found." >&4
14791         val="$define"
14792 else
14793         echo "LDBL_DIG NOT found." >&4
14794         val="$undef"
14795 fi
14796 $rm -f ldbl_dig.?
14797 set d_ldbl_dig
14798 eval $setvar
14799
14800 : see if this is a math.h system
14801 set math.h i_math
14802 eval $inhdr
14803
14804 : check to see if math.h defines _LIB_VERSION
14805 d_libm_lib_version="$undef"
14806 case $i_math in
14807     $define)
14808         echo " "
14809         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14810         $cat >try.c <<EOCP
14811 #include <unistd.h>
14812 #include <math.h>
14813 int main (int argc, char *argv[])
14814 {
14815     printf ("%d\n", _LIB_VERSION);
14816     return (0);
14817     } /* main */
14818 EOCP
14819         set try
14820         if eval $compile; then
14821             foo=`$run ./try`
14822             echo "Yes, it does ($foo)" >&4
14823             d_libm_lib_version="$define"
14824         else
14825             echo "No, it does not (probably harmless)" >&4
14826             fi
14827         $rm_try
14828         ;;
14829
14830     esac
14831
14832 : see if link exists
14833 set link d_link
14834 eval $inlibc
14835
14836 : see if localtime_r exists
14837 set localtime_r d_localtime_r
14838 eval $inlibc
14839 case "$d_localtime_r" in
14840 "$define")
14841         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14842         case "$d_localtime_r_proto:$usethreads" in
14843         ":define")      d_localtime_r_proto=define
14844                 set d_localtime_r_proto localtime_r $hdrs
14845                 eval $hasproto ;;
14846         *)      ;;
14847         esac
14848         case "$d_localtime_r_proto" in
14849         define)
14850         case "$localtime_r_proto" in
14851         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14852         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14853         esac
14854         case "$localtime_r_proto" in
14855         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14856         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14857         esac
14858         case "$localtime_r_proto" in
14859         ''|0)   d_localtime_r=undef
14860                 localtime_r_proto=0
14861                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14862         * )     case "$localtime_r_proto" in
14863                 REENTRANT_PROTO*) ;;
14864                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14865                 esac
14866                 echo "Prototype: $try" ;;
14867         esac
14868         ;;
14869         *)      case "$usethreads" in
14870                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14871                 esac
14872                 d_localtime_r=undef
14873                 localtime_r_proto=0
14874                 ;;
14875         esac
14876         ;;
14877 *)      localtime_r_proto=0
14878         ;;
14879 esac
14880
14881 : see if localtime_r calls tzset
14882 case "$localtime_r_proto" in
14883 REENTRANT_PROTO*)
14884         $cat >try.c <<EOCP
14885 /*  Does our libc's localtime_r call tzset ?
14886  *  return 0 if so, 1 otherwise.
14887  */
14888 #include <sys/types.h>
14889 #include <unistd.h>
14890 #include <time.h>
14891 #include <string.h>
14892 #include <malloc.h>
14893 int main()
14894 {
14895     time_t t = time(0L);
14896     char w_tz[]="TZ" "=GMT+5",
14897          e_tz[]="TZ" "=GMT-5",
14898         *tz_e = (char*)malloc(16),
14899         *tz_w = (char*)malloc(16);
14900     struct tm tm_e, tm_w;
14901     memset(&tm_e,'\0',sizeof(struct tm));
14902     memset(&tm_w,'\0',sizeof(struct tm));
14903     strcpy(tz_e,e_tz);
14904     strcpy(tz_w,w_tz);
14905
14906     putenv(tz_e);
14907     localtime_r(&t, &tm_e);
14908
14909     putenv(tz_w);
14910     localtime_r(&t, &tm_w);
14911
14912     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14913         return 1;
14914     return 0;
14915 }
14916 EOCP
14917         set try
14918         if eval $compile; then
14919             if $run ./try; then
14920                 d_localtime_r_needs_tzset=undef;
14921             else
14922                 d_localtime_r_needs_tzset=define;
14923             fi;
14924         else
14925             d_localtime_r_needs_tzset=undef;
14926         fi;
14927      ;;
14928   *)
14929      d_localtime_r_needs_tzset=undef;
14930      ;;
14931 esac
14932 $rm_try
14933
14934 : see if localeconv exists
14935 set localeconv d_locconv
14936 eval $inlibc
14937
14938 : see if lockf exists
14939 set lockf d_lockf
14940 eval $inlibc
14941
14942 : see if prototype for lseek is available
14943 echo " "
14944 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14945 eval $hasproto
14946
14947 : see if lstat exists
14948 set lstat d_lstat
14949 eval $inlibc
14950
14951 : see if madvise exists
14952 set madvise d_madvise
14953 eval $inlibc
14954
14955 : see if malloc_size exists
14956 set malloc_size d_malloc_size
14957 eval $inlibc
14958
14959 : see if malloc_size_good exists
14960 set malloc_good_size d_malloc_good_size
14961 eval $inlibc
14962
14963 : see if mblen exists
14964 set mblen d_mblen
14965 eval $inlibc
14966
14967 : see if mbstowcs exists
14968 set mbstowcs d_mbstowcs
14969 eval $inlibc
14970
14971 : see if mbtowc exists
14972 set mbtowc d_mbtowc
14973 eval $inlibc
14974
14975 : see if memchr exists
14976 set memchr d_memchr
14977 eval $inlibc
14978
14979 : see if memcmp exists
14980 set memcmp d_memcmp
14981 eval $inlibc
14982
14983 : see if memcpy exists
14984 set memcpy d_memcpy
14985 eval $inlibc
14986
14987 : see if memmove exists
14988 set memmove d_memmove
14989 eval $inlibc
14990
14991 : see if memset exists
14992 set memset d_memset
14993 eval $inlibc
14994
14995 : see if mkdir exists
14996 set mkdir d_mkdir
14997 eval $inlibc
14998
14999 : see if mkdtemp exists
15000 set mkdtemp d_mkdtemp
15001 eval $inlibc
15002
15003 : see if mkfifo exists
15004 set mkfifo d_mkfifo
15005 eval $inlibc
15006
15007 : see if mkstemp exists
15008 set mkstemp d_mkstemp
15009 eval $inlibc
15010
15011 : see if mkstemps exists
15012 set mkstemps d_mkstemps
15013 eval $inlibc
15014
15015 : see if mktime exists
15016 set mktime d_mktime
15017 eval $inlibc
15018
15019 : see if this is a sys/mman.h system
15020 set sys/mman.h i_sysmman
15021 eval $inhdr
15022
15023 : see if mmap exists
15024 set mmap d_mmap
15025 eval $inlibc
15026 : see what shmat returns
15027 : default to something harmless
15028 mmaptype='void *'
15029 case "$i_sysmman$d_mmap" in
15030 "$define$define")
15031         $cat >mmap.c <<'END'
15032 #include <sys/mman.h>
15033 void *mmap();
15034 END
15035         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15036                 mmaptype='void *'
15037         else
15038                 mmaptype='caddr_t'
15039         fi
15040         echo "and it returns ($mmaptype)." >&4
15041         ;;
15042 esac
15043
15044
15045
15046 : see if sqrtl exists
15047 set sqrtl d_sqrtl
15048 eval $inlibc
15049
15050 : see if scalbnl exists
15051 set scalbnl d_scalbnl
15052 eval $inlibc
15053
15054 : see if modfl exists
15055 set modfl d_modfl
15056 eval $inlibc
15057
15058 : see if prototype for modfl is available
15059 echo " "
15060 set d_modflproto modfl $i_math math.h
15061 eval $hasproto
15062
15063 d_modfl_pow32_bug="$undef"
15064
15065 case "$d_longdbl$d_modfl" in
15066 $define$define)
15067         $cat <<EOM
15068 Checking to see whether your modfl() is okay for large values...
15069 EOM
15070 $cat >try.c <<EOCP
15071 #include <math.h>
15072 #include <stdio.h>
15073 EOCP
15074 if $test "X$d_modflproto" != "X$define"; then
15075         $cat >>try.c <<EOCP
15076 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15077 long double modfl (long double, long double *);
15078 EOCP
15079 fi
15080 $cat >>try.c <<EOCP
15081 int main() {
15082     long double nv = 4294967303.15;
15083     long double v, w;
15084     v = modfl(nv, &w);
15085 #ifdef __GLIBC__
15086     printf("glibc");
15087 #endif
15088     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15089     return 0;
15090 }
15091 EOCP
15092         case "$osname:$gccversion" in
15093         aix:)   saveccflags="$ccflags"
15094                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15095         esac
15096         set try
15097         if eval $compile; then
15098                 foo=`$run ./try`
15099                 case "$foo" in
15100                 *" 4294967303.150000 1.150000 4294967302.000000")
15101                         echo >&4 "Your modfl() is broken for large values."
15102                         d_modfl_pow32_bug="$define"
15103                         case "$foo" in
15104                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15105                         ;;
15106                         esac
15107                         ;;
15108                 *" 4294967303.150000 0.150000 4294967303.000000")
15109                         echo >&4 "Your modfl() seems okay for large values."
15110                         ;;
15111                 *)      echo >&4 "I don't understand your modfl() at all."
15112                         d_modfl="$undef"
15113                         ;;
15114                 esac
15115                 $rm_try
15116         else
15117                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15118                 d_modfl="$undef"
15119         fi
15120         case "$osname:$gccversion" in
15121         aix:)   ccflags="$saveccflags" ;; # restore
15122         esac
15123         ;;
15124 esac
15125
15126 if $test "$uselongdouble" = "$define"; then
15127     message=""
15128     if $test "$d_sqrtl" != "$define"; then
15129         message="$message sqrtl"
15130     fi
15131     if $test "$d_modfl" != "$define"; then
15132         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15133             echo "You have both aintl and copysignl, so I can emulate modfl."
15134         else
15135             message="$message modfl"
15136         fi
15137     fi
15138     if $test "$d_frexpl" != "$define"; then
15139         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15140             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15141         else
15142             message="$message frexpl"
15143         fi
15144     fi
15145
15146     if $test "$message" != ""; then
15147         $cat <<EOM >&4
15148
15149 *** You requested the use of long doubles but you do not seem to have
15150 *** the following mathematical functions needed for long double support:
15151 ***    $message
15152 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15153 *** Cannot continue, aborting.
15154
15155 EOM
15156
15157         exit 1
15158     fi
15159 fi
15160
15161 : see if mprotect exists
15162 set mprotect d_mprotect
15163 eval $inlibc
15164
15165 : see if msgctl exists
15166 set msgctl d_msgctl
15167 eval $inlibc
15168
15169 : see if msgget exists
15170 set msgget d_msgget
15171 eval $inlibc
15172
15173 : see if msgsnd exists
15174 set msgsnd d_msgsnd
15175 eval $inlibc
15176
15177 : see if msgrcv exists
15178 set msgrcv d_msgrcv
15179 eval $inlibc
15180
15181 : see how much of the 'msg*(2)' library is present.
15182 h_msg=true
15183 echo " "
15184 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15185 *"$undef"*) h_msg=false;;
15186 esac
15187 case "$osname" in
15188 freebsd)
15189     case "`ipcs 2>&1`" in
15190     "SVID messages"*"not configured"*)
15191         echo "Your $osname does not have the msg*(2) configured." >&4
15192         h_msg=false
15193         val="$undef"
15194         set msgctl d_msgctl
15195         eval $setvar
15196         set msgget d_msgget
15197         eval $setvar
15198         set msgsnd d_msgsnd
15199         eval $setvar
15200         set msgrcv d_msgrcv
15201         eval $setvar
15202         ;;
15203     esac
15204     ;;
15205 esac
15206 : we could also check for sys/ipc.h ...
15207 if $h_msg && $test `./findhdr sys/msg.h`; then
15208         echo "You have the full msg*(2) library." >&4
15209         val="$define"
15210 else
15211         echo "You don't have the full msg*(2) library." >&4
15212         val="$undef"
15213 fi
15214 set d_msg
15215 eval $setvar
15216
15217 : Check for msghdr_s
15218 echo " "
15219 echo "Checking to see if your system supports struct msghdr..." >&4
15220 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15221 eval $hasstruct
15222 case "$d_msghdr_s" in
15223 "$define")      echo "Yes, it does."   ;;
15224 *)              echo "No, it doesn't." ;;
15225 esac
15226
15227
15228 : see if msync exists
15229 set msync d_msync
15230 eval $inlibc
15231
15232 : see if munmap exists
15233 set munmap d_munmap
15234 eval $inlibc
15235
15236 : see if nice exists
15237 set nice d_nice
15238 eval $inlibc
15239
15240 : see if this is a langinfo.h system
15241 set langinfo.h i_langinfo
15242 eval $inhdr
15243
15244 : see if nl_langinfo exists
15245 set nl_langinfo d_nl_langinfo
15246 eval $inlibc
15247
15248 : check for volatile keyword
15249 echo " "
15250 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15251 $cat >try.c <<'EOCP'
15252 int main()
15253 {
15254         typedef struct _goo_struct goo_struct;
15255         goo_struct * volatile goo = ((goo_struct *)0);
15256         struct _goo_struct {
15257                 long long_int;
15258                 int reg_int;
15259                 char char_var;
15260         };
15261         typedef unsigned short foo_t;
15262         char *volatile foo;
15263         volatile int bar;
15264         volatile foo_t blech;
15265         foo = foo;
15266 }
15267 EOCP
15268 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15269         val="$define"
15270         echo "Yup, it does."
15271 else
15272         val="$undef"
15273         echo "Nope, it doesn't."
15274 fi
15275 set d_volatile
15276 eval $setvar
15277 $rm_try
15278
15279 : Check basic sizes
15280 echo " "
15281 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15282
15283 case "$use64bitint:$d_quad:$quadtype" in
15284 define:define:?*)
15285         ivtype="$quadtype"
15286         uvtype="$uquadtype"
15287         ivsize=8
15288         uvsize=8
15289         ;;
15290 *)      ivtype="long"
15291         uvtype="unsigned long"
15292         ivsize=$longsize
15293         uvsize=$longsize
15294         ;;
15295 esac
15296
15297 case "$uselongdouble:$d_longdbl" in
15298 define:define)
15299         nvtype="long double"
15300         nvsize=$longdblsize
15301         ;;
15302 *)      nvtype=double
15303         nvsize=$doublesize
15304         ;;
15305 esac
15306
15307 $echo "(IV will be "$ivtype", $ivsize bytes)"
15308 $echo "(UV will be "$uvtype", $uvsize bytes)"
15309 $echo "(NV will be "$nvtype", $nvsize bytes)"
15310
15311 $cat >try.c <<EOCP
15312 #$i_inttypes I_INTTYPES
15313 #ifdef I_INTTYPES
15314 #include <inttypes.h>
15315 #endif
15316 #include <stdio.h>
15317 int main() {
15318 #ifdef INT8
15319    int8_t i =  INT8_MAX;
15320   uint8_t u = UINT8_MAX;
15321   printf("int8_t\n");
15322 #endif
15323 #ifdef INT16
15324    int16_t i =  INT16_MAX;
15325   uint16_t i = UINT16_MAX;
15326   printf("int16_t\n");
15327 #endif
15328 #ifdef INT32
15329    int32_t i =  INT32_MAX;
15330   uint32_t u = UINT32_MAX;
15331   printf("int32_t\n");
15332 #endif
15333 }
15334 EOCP
15335
15336 i8type="signed char"
15337 u8type="unsigned char"
15338 i8size=1
15339 u8size=1
15340
15341 case "$i16type" in
15342 '')     case "$shortsize" in
15343         2)      i16type=short
15344                 u16type="unsigned short"
15345                 i16size=$shortsize
15346                 u16size=$shortsize
15347                 ;;
15348         esac
15349         ;;
15350 esac
15351 case "$i16type" in
15352 '')     set try -DINT16
15353         if eval $compile; then
15354                 case "`$run ./try`" in
15355                 int16_t)
15356                         i16type=int16_t
15357                         u16type=uint16_t
15358                         i16size=2
15359                         u16size=2
15360                         ;;
15361                 esac
15362         fi
15363         ;;
15364 esac
15365 case "$i16type" in
15366 '')     if $test $shortsize -ge 2; then
15367                 i16type=short
15368                 u16type="unsigned short"
15369                 i16size=$shortsize
15370                 u16size=$shortsize
15371         fi
15372         ;;
15373 esac
15374
15375 case "$i32type" in
15376 '')     case "$longsize" in
15377         4)      i32type=long
15378                 u32type="unsigned long"
15379                 i32size=$longsize
15380                 u32size=$longsize
15381                 ;;
15382         *)      case "$intsize" in
15383                 4)      i32type=int
15384                         u32type="unsigned int"
15385                         i32size=$intsize
15386                         u32size=$intsize
15387                         ;;
15388                 esac
15389                 ;;
15390         esac
15391         ;;
15392 esac
15393 case "$i32type" in
15394 '')     set try -DINT32
15395         if eval $compile; then
15396                 case "`$run ./try`" in
15397                 int32_t)
15398                         i32type=int32_t
15399                         u32type=uint32_t
15400                         i32size=4
15401                         u32size=4
15402                         ;;
15403                 esac
15404         fi
15405         ;;
15406 esac
15407 case "$i32type" in
15408 '')     if $test $intsize -ge 4; then
15409                 i32type=int
15410                 u32type="unsigned int"
15411                 i32size=$intsize
15412                 u32size=$intsize
15413         fi
15414         ;;
15415 esac
15416
15417 case "$i64type" in
15418 '')     case "$d_quad:$quadtype" in
15419         define:?*)
15420                 i64type="$quadtype"
15421                 u64type="$uquadtype"
15422                 i64size=8
15423                 u64size=8
15424                 ;;
15425         esac
15426         ;;
15427 esac
15428
15429 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15430 : volatile so that the compiler has to store it out to memory.
15431 if test X"$d_volatile" = X"$define"; then
15432         volatile=volatile
15433 fi
15434 $cat <<EOP >try.c
15435 #include <stdio.h>
15436 #$i_stdlib I_STDLIB
15437 #ifdef I_STDLIB
15438 #include <stdlib.h>
15439 #endif
15440 #include <sys/types.h>
15441 #include <signal.h>
15442 #ifdef SIGFPE
15443 $volatile int bletched = 0;
15444 $signal_t blech(int s) { bletched = 1; }
15445 #endif
15446 int main() {
15447     $uvtype u = 0;
15448     $nvtype d;
15449     int     n = 8 * $uvsize;
15450     int     i;
15451 #ifdef SIGFPE
15452     signal(SIGFPE, blech);
15453 #endif
15454
15455     for (i = 0; i < n; i++) {
15456       u = u << 1 | ($uvtype)1;
15457       d = ($nvtype)u;
15458       if (($uvtype)d != u)
15459         break;
15460       if (d <= 0)
15461         break;
15462       d = ($nvtype)(u - 1);
15463       if (($uvtype)d != (u - 1))
15464         break;
15465 #ifdef SIGFPE
15466       if (bletched)
15467         break;
15468 #endif
15469     }
15470     printf("%d\n", ((i == n) ? -n : i));
15471     exit(0);
15472 }
15473 EOP
15474 set try
15475
15476 d_nv_preserves_uv="$undef"
15477 if eval $compile; then
15478         nv_preserves_uv_bits="`$run ./try`"
15479 fi
15480 case "$nv_preserves_uv_bits" in
15481 \-[1-9]*)
15482         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15483         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15484         d_nv_preserves_uv="$define"
15485         ;;
15486 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15487         d_nv_preserves_uv="$undef" ;;
15488 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15489         nv_preserves_uv_bits="0" ;;
15490 esac
15491 $rm_try
15492
15493 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15494 : volatile so that the compiler has to store it out to memory.
15495 if test X"$d_volatile" = X"$define"; then
15496         volatile=volatile
15497 fi
15498 $cat <<EOP >try.c
15499 #include <stdio.h>
15500
15501 typedef $nvtype NV;
15502
15503 int
15504 main() {
15505   NV value = 2;
15506   int count = 1;
15507
15508   while(count < 256) {
15509     $volatile NV up = value + 1.0;
15510     $volatile NV negated = -value;
15511     $volatile NV down = negated - 1.0;
15512     $volatile NV got_up = up - value;
15513     int up_good = got_up == 1.0;
15514     int got_down = down - negated;
15515     int down_good = got_down == -1.0;
15516
15517     if (down_good != up_good) {
15518       fprintf(stderr,
15519               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15520               up_good, (double) got_up, down_good, (double) got_down,
15521               count, (double) value);
15522       return 1;
15523     }
15524     if (!up_good) {
15525       while (1) {
15526         if (count > 8) {
15527           count -= 8;
15528           fputs("256.0", stdout);
15529         } else {
15530           count--;
15531           fputs("2.0", stdout);
15532         }
15533         if (!count) {
15534           puts("");
15535           return 0;
15536         }
15537         fputs("*", stdout);
15538       }
15539     }
15540     value *= 2;
15541     ++count;
15542   }
15543   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15544           count, (double) value);
15545   return 1;
15546 }
15547 EOP
15548 set try
15549
15550 nv_overflows_integers_at='0'
15551 if eval $compile; then
15552     xxx="`$run ./try`"
15553     case "$?" in
15554         0)
15555             case "$xxx" in
15556                 2*)  cat >&4 <<EOM
15557 The largest integer your NVs can preserve is equal to $xxx
15558 EOM
15559                     nv_overflows_integers_at="$xxx"
15560                     ;;
15561                 *)  cat >&4 <<EOM
15562 Cannot determine the largest integer value your NVs can hold, unexpected output
15563 '$xxx'
15564 EOM
15565                     ;;
15566             esac
15567             ;;
15568         *)  cat >&4 <<EOM
15569 Cannot determine the largest integer value your NVs can hold
15570 EOM
15571             ;;
15572     esac
15573 fi
15574 $rm_try
15575
15576 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15577 : volatile so that the compiler has to store it out to memory.
15578 if test X"$d_volatile" = X"$define"; then
15579         volatile=volatile
15580 fi
15581 $cat <<EOP >try.c
15582 #include <stdio.h>
15583 #$i_stdlib I_STDLIB
15584 #ifdef I_STDLIB
15585 #include <stdlib.h>
15586 #endif
15587 #$i_string I_STRING
15588 #ifdef I_STRING
15589 #  include <string.h>
15590 #else
15591 #  include <strings.h>
15592 #endif
15593 #include <sys/types.h>
15594 #include <signal.h>
15595 #ifdef SIGFPE
15596 $volatile int bletched = 0;
15597 $signal_t blech(int s) { bletched = 1; }
15598 #endif
15599
15600 int checkit($nvtype d, char *where) {
15601     unsigned char *p = (char *)&d;
15602     unsigned char *end = p + sizeof(d);
15603     int fail = 0;
15604
15605     while (p < end)
15606         fail += *p++;
15607
15608     if (!fail)
15609         return 0;
15610
15611     p = (char *)&d;
15612     printf("No - %s: 0x", where);
15613     while (p < end)
15614         printf ("%02X", *p++);
15615     printf("\n");
15616     return 1;
15617 }
15618
15619 int main(int argc, char **argv) {
15620     $nvtype d = 0.0;
15621     int fail = 0;
15622     fail += checkit(d, "0.0");
15623
15624     /* The compiler shouldn't be assuming that bletched is 0  */
15625     d = bletched;
15626
15627     fail += checkit(d, "bleched");
15628
15629 #ifdef SIGFPE
15630     signal(SIGFPE, blech);
15631 #endif
15632
15633     /* Paranoia - the compiler should have no way of knowing that ANSI says
15634        that argv[argc] will always be NULL.  Actually, if it did assume this it
15635        would be buggy, as this is C and main() can be called from elsewhere in
15636        the program.  */
15637     d = argv[argc] ? 1 : 0;
15638
15639     if (d) {
15640         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15641     }
15642
15643     fail += checkit(d, "ternary");
15644
15645     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15646
15647     if (d != 0.0) {
15648         printf("No - memset doesn't give 0.0\n");
15649         /* This might just blow up:  */
15650         printf("(gives %g)\n", d);
15651         return 1;
15652     }
15653
15654 #ifdef SIGFPE
15655     if (bletched) {
15656         printf("No - something bleched\n");
15657         return 1;
15658     }
15659 #endif
15660     if (fail) {
15661       printf("No - %d fail(s)\n", fail);
15662       return 1;
15663     }
15664     printf("Yes\n");
15665     return 0;
15666 }
15667 EOP
15668 set try
15669
15670 d_nv_zero_is_allbits_zero="$undef"
15671 if eval $compile; then
15672     xxx="`$run ./try`"
15673     case "$?" in
15674         0)
15675             case "$xxx" in
15676                 Yes)  cat >&4 <<EOM
15677 0.0 is represented as all bits zero in memory
15678 EOM
15679                     d_nv_zero_is_allbits_zero="$define"
15680                     ;;
15681                 *)  cat >&4 <<EOM
15682 0.0 is not represented as all bits zero in memory
15683 EOM
15684                     d_nv_zero_is_allbits_zero="$undef"
15685                     ;;
15686             esac
15687             ;;
15688         *)  cat >&4 <<EOM
15689 0.0 is not represented as all bits zero in memory
15690 EOM
15691             d_nv_zero_is_allbits_zero="$undef"
15692             ;;
15693     esac
15694 fi
15695 $rm_try
15696
15697 : check for off64_t
15698 echo " "
15699 echo "Checking to see if you have off64_t..." >&4
15700 $cat >try.c <<EOCP
15701 #include <sys/types.h>
15702 #include <unistd.h>
15703 int main() { off64_t x = 7; }
15704 EOCP
15705 set try
15706 if eval $compile; then
15707         val="$define"
15708         echo "You have off64_t."
15709 else
15710         val="$undef"
15711         echo "You do not have off64_t."
15712         case "$lseeksize" in
15713         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15714         esac
15715 fi
15716 $rm_try
15717 set d_off64_t
15718 eval $setvar
15719
15720 : how to create joinable pthreads
15721 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15722         echo " "
15723         echo "Checking what constant to use for creating joinable pthreads..." >&4
15724         $cat >try.c <<'EOCP'
15725 #include <pthread.h>
15726 int main() {
15727     int detachstate = JOINABLE;
15728 }
15729 EOCP
15730         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15731         if eval $compile; then
15732                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15733                 val="$undef" # Yes, undef.
15734                 set d_old_pthread_create_joinable
15735                 eval $setvar
15736                 val=""
15737                 set old_pthread_create_joinable
15738                 eval $setvar
15739         else
15740                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15741                 if eval $compile; then
15742                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15743                         val="$define"
15744                         set d_old_pthread_create_joinable
15745                         eval $setvar
15746                         val=PTHREAD_CREATE_UNDETACHED
15747                         set old_pthread_create_joinable
15748                         eval $setvar
15749                 else
15750                         set try -DJOINABLE=__UNDETACHED
15751                         if eval $compile; then
15752                                 echo "You seem to use __UNDETACHED." >&4
15753                                 val="$define"
15754                                 set d_old_pthread_create_joinable
15755                                 eval $setvar
15756                                 val=__UNDETACHED
15757                                 set old_pthread_create_joinable
15758                                 eval $setvar
15759                         else
15760                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15761                                 val="$define"
15762                                 set d_old_pthread_create_joinable
15763                                 eval $setvar
15764                                 val=0
15765                                 set old_pthread_create_joinable
15766                                 eval $setvar
15767                         fi
15768                 fi
15769         fi
15770         $rm_try
15771 else
15772     d_old_pthread_create_joinable="$undef"
15773     old_pthread_create_joinable=""
15774 fi
15775
15776 : see if pause exists
15777 set pause d_pause
15778 eval $inlibc
15779
15780 : see if poll exists
15781 set poll d_poll
15782 eval $inlibc
15783
15784 : see if readlink exists
15785 set readlink d_readlink
15786 eval $inlibc
15787
15788 : Check if exe is symlink to abs path of executing program
15789 echo " "
15790 procselfexe=''
15791 val="$undef"
15792 case "$d_readlink" in
15793 "$define")
15794         if $issymlink /proc/self/exe ; then
15795                 $ls -l /proc/self/exe > reflect
15796                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15797                         echo "You have Linux-like /proc/self/exe."
15798                         procselfexe='"/proc/self/exe"'
15799                         val="$define"
15800                 fi
15801         fi
15802         if $issymlink /proc/curproc/file ; then
15803                 $ls -l /proc/curproc/file > reflect
15804                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15805                         echo "You have BSD-like /proc/curproc/file."
15806                         procselfexe='"/proc/curproc/file"'
15807                         val="$define"
15808                 fi
15809         fi
15810         ;;
15811 esac
15812 $rm -f reflect
15813 set d_procselfexe
15814 eval $setvar
15815
15816 : backward compatibility for d_hvfork
15817 if test X$d_hvfork != X; then
15818         d_vfork="$d_hvfork"
15819         d_hvfork=''
15820 fi
15821 : see if there is a vfork
15822 val=''
15823 set vfork val
15824 eval $inlibc
15825
15826 d_pseudofork=$undef
15827
15828 : Ok, but do we want to use it. vfork is reportedly unreliable in
15829 : perl on Solaris 2.x, and probably elsewhere.
15830 case "$val" in
15831 $define)
15832         echo " "
15833         case "$usevfork" in
15834         false) dflt='n';;
15835         *) dflt='y';;
15836         esac
15837         cat <<'EOM'
15838
15839 Perl can only use a vfork() that doesn't suffer from strict
15840 restrictions on calling functions or modifying global data in
15841 the child.  For example, glibc-2.1 contains such a vfork()
15842 that is unsuitable.  If your system provides a proper fork()
15843 call, chances are that you do NOT want perl to use vfork().
15844
15845 EOM
15846         rp="Do you still want to use vfork()?"
15847         . ./myread
15848         case "$ans" in
15849         y|Y) ;;
15850         *)
15851                 echo "Ok, we won't use vfork()."
15852                 val="$undef"
15853                 ;;
15854         esac
15855         ;;
15856 esac
15857 set d_vfork
15858 eval $setvar
15859 case "$d_vfork" in
15860 $define) usevfork='true';;
15861 *) usevfork='false';;
15862 esac
15863
15864 : see whether the pthread_atfork exists
15865 $cat >try.c <<EOP
15866 #include <pthread.h>
15867 #include <stdio.h>
15868 int main() {
15869 #ifdef  PTHREAD_ATFORK
15870         pthread_atfork(NULL,NULL,NULL);
15871 #endif
15872 }
15873 EOP
15874
15875 : see if pthread_atfork exists
15876 set try -DPTHREAD_ATFORK
15877 if eval $compile; then
15878     val="$define"
15879 else
15880     val="$undef"
15881 fi
15882 case "$usethreads" in
15883 $define)
15884         case "$val" in
15885         $define) echo 'pthread_atfork found.' >&4        ;;
15886         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15887         esac
15888 esac
15889 set d_pthread_atfork
15890 eval $setvar
15891
15892 : see if pthread_attr_setscope exists
15893 set pthread_attr_setscope d_pthread_attr_setscope
15894 eval $inlibc
15895
15896 : see whether the various POSIXish _yields exist
15897 $cat >try.c <<EOP
15898 #include <pthread.h>
15899 #include <stdio.h>
15900 int main() {
15901 #ifdef SCHED_YIELD
15902         sched_yield();
15903 #else
15904 #ifdef PTHREAD_YIELD
15905         pthread_yield();
15906 #else
15907 #ifdef PTHREAD_YIELD_NULL
15908         pthread_yield(NULL);
15909 #endif
15910 #endif
15911 #endif
15912 }
15913 EOP
15914 : see if sched_yield exists
15915 set try -DSCHED_YIELD
15916 if eval $compile; then
15917     val="$define"
15918     sched_yield='sched_yield()'
15919 else
15920     val="$undef"
15921 fi
15922 case "$usethreads" in
15923 $define)
15924         case "$val" in
15925         $define) echo 'sched_yield() found.' >&4        ;;
15926         *)       echo 'sched_yield() NOT found.' >&4    ;;
15927         esac
15928 esac
15929 set d_sched_yield
15930 eval $setvar
15931
15932 : see if pthread_yield exists
15933 set try -DPTHREAD_YIELD
15934 if eval $compile; then
15935     val="$define"
15936     case "$sched_yield" in
15937     '') sched_yield='pthread_yield()' ;;
15938     esac
15939 else
15940     set try -DPTHREAD_YIELD_NULL
15941     if eval $compile; then
15942         val="$define"
15943         case "$sched_yield" in
15944         '') sched_yield='pthread_yield(NULL)' ;;
15945         esac
15946     else
15947         val="$undef"
15948     fi
15949 fi
15950 case "$usethreads" in
15951 $define)
15952         case "$val" in
15953         $define) echo 'pthread_yield() found.' >&4      ;;
15954         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15955         esac
15956         ;;
15957 esac
15958 set d_pthread_yield
15959 eval $setvar
15960 case "$sched_yield" in
15961 '') sched_yield=undef ;;
15962 esac
15963 $rm_try
15964
15965 : see if random_r exists
15966 set random_r d_random_r
15967 eval $inlibc
15968 case "$d_random_r" in
15969 "$define")
15970         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15971         case "$d_random_r_proto:$usethreads" in
15972         ":define")      d_random_r_proto=define
15973                 set d_random_r_proto random_r $hdrs
15974                 eval $hasproto ;;
15975         *)      ;;
15976         esac
15977         case "$d_random_r_proto" in
15978         define)
15979         case "$random_r_proto" in
15980         ''|0) try='int random_r(int*, struct random_data*);'
15981         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15982         esac
15983         case "$random_r_proto" in
15984         ''|0) try='int random_r(long*, struct random_data*);'
15985         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15986         esac
15987         case "$random_r_proto" in
15988         ''|0) try='int random_r(struct random_data*, int32_t*);'
15989         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15990         esac
15991         case "$random_r_proto" in
15992         ''|0)   d_random_r=undef
15993                 random_r_proto=0
15994                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15995         * )     case "$random_r_proto" in
15996                 REENTRANT_PROTO*) ;;
15997                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15998                 esac
15999                 echo "Prototype: $try" ;;
16000         esac
16001         ;;
16002         *)      case "$usethreads" in
16003                 define) echo "random_r has no prototype, not using it." >&4 ;;
16004                 esac
16005                 d_random_r=undef
16006                 random_r_proto=0
16007                 ;;
16008         esac
16009         ;;
16010 *)      random_r_proto=0
16011         ;;
16012 esac
16013
16014 : see if readdir and friends exist
16015 set readdir d_readdir
16016 eval $inlibc
16017 set seekdir d_seekdir
16018 eval $inlibc
16019 set telldir d_telldir
16020 eval $inlibc
16021 set rewinddir d_rewinddir
16022 eval $inlibc
16023
16024 : see if readdir64_r exists
16025 set readdir64_r d_readdir64_r
16026 eval $inlibc
16027 case "$d_readdir64_r" in
16028 "$define")
16029         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16030         case "$d_readdir64_r_proto:$usethreads" in
16031         ":define")      d_readdir64_r_proto=define
16032                 set d_readdir64_r_proto readdir64_r $hdrs
16033                 eval $hasproto ;;
16034         *)      ;;
16035         esac
16036         case "$d_readdir64_r_proto" in
16037         define)
16038         case "$readdir64_r_proto" in
16039         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16040         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16041         esac
16042         case "$readdir64_r_proto" in
16043         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16044         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16045         esac
16046         case "$readdir64_r_proto" in
16047         ''|0)   d_readdir64_r=undef
16048                 readdir64_r_proto=0
16049                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16050         * )     case "$readdir64_r_proto" in
16051                 REENTRANT_PROTO*) ;;
16052                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16053                 esac
16054                 echo "Prototype: $try" ;;
16055         esac
16056         ;;
16057         *)      case "$usethreads" in
16058                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16059                 esac
16060                 d_readdir64_r=undef
16061                 readdir64_r_proto=0
16062                 ;;
16063         esac
16064         ;;
16065 *)      readdir64_r_proto=0
16066         ;;
16067 esac
16068
16069 : see if readdir_r exists
16070 set readdir_r d_readdir_r
16071 eval $inlibc
16072 case "$d_readdir_r" in
16073 "$define")
16074         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16075         case "$d_readdir_r_proto:$usethreads" in
16076         ":define")      d_readdir_r_proto=define
16077                 set d_readdir_r_proto readdir_r $hdrs
16078                 eval $hasproto ;;
16079         *)      ;;
16080         esac
16081         case "$d_readdir_r_proto" in
16082         define)
16083         case "$readdir_r_proto" in
16084         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16085         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16086         esac
16087         case "$readdir_r_proto" in
16088         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16089         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16090         esac
16091         case "$readdir_r_proto" in
16092         ''|0)   d_readdir_r=undef
16093                 readdir_r_proto=0
16094                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16095         * )     case "$readdir_r_proto" in
16096                 REENTRANT_PROTO*) ;;
16097                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16098                 esac
16099                 echo "Prototype: $try" ;;
16100         esac
16101         ;;
16102         *)      case "$usethreads" in
16103                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16104                 esac
16105                 d_readdir_r=undef
16106                 readdir_r_proto=0
16107                 ;;
16108         esac
16109         ;;
16110 *)      readdir_r_proto=0
16111         ;;
16112 esac
16113
16114 : see if readv exists
16115 set readv d_readv
16116 eval $inlibc
16117
16118 : see if recvmsg exists
16119 set recvmsg d_recvmsg
16120 eval $inlibc
16121
16122 : see if rename exists
16123 set rename d_rename
16124 eval $inlibc
16125
16126 : see if rmdir exists
16127 set rmdir d_rmdir
16128 eval $inlibc
16129
16130 : see if memory.h is available.
16131 val=''
16132 set memory.h val
16133 eval $inhdr
16134
16135 : See if it conflicts with string.h
16136 case "$val" in
16137 $define)
16138         case "$strings" in
16139         '') ;;
16140         *)
16141                 $cppstdin $cppflags $cppminus < $strings > mem.h
16142                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16143                         echo " "
16144                         echo "We won't be including <memory.h>."
16145                         val="$undef"
16146                 fi
16147                 $rm -f mem.h
16148                 ;;
16149         esac
16150 esac
16151 set i_memory
16152 eval $setvar
16153
16154 : can bcopy handle overlapping blocks?
16155 echo " "
16156 val="$undef"
16157 case "$d_memmove" in
16158 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16159 *)      case "$d_bcopy" in
16160         "$define")
16161                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16162                 $cat >try.c <<EOCP
16163 #$i_memory I_MEMORY
16164 #$i_stdlib I_STDLIB
16165 #$i_string I_STRING
16166 #$i_unistd I_UNISTD
16167 EOCP
16168         $cat >>try.c <<'EOCP'
16169 #include <stdio.h>
16170 #ifdef I_MEMORY
16171 #  include <memory.h>
16172 #endif
16173 #ifdef I_STDLIB
16174 #  include <stdlib.h>
16175 #endif
16176 #ifdef I_STRING
16177 #  include <string.h>
16178 #else
16179 #  include <strings.h>
16180 #endif
16181 #ifdef I_UNISTD
16182 #  include <unistd.h>  /* Needed for NetBSD */
16183 #endif
16184 int main()
16185 {
16186 char buf[128], abc[128];
16187 char *b;
16188 int len;
16189 int off;
16190 int align;
16191
16192 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16193    try to store the string in read-only memory. */
16194 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16195
16196 for (align = 7; align >= 0; align--) {
16197         for (len = 36; len; len--) {
16198                 b = buf+align;
16199                 bcopy(abc, b, len);
16200                 for (off = 1; off <= len; off++) {
16201                         bcopy(b, b+off, len);
16202                         bcopy(b+off, b, len);
16203                         if (bcmp(b, abc, len))
16204                                 exit(1);
16205                 }
16206         }
16207 }
16208 exit(0);
16209 }
16210 EOCP
16211                 set try
16212                 if eval $compile_ok; then
16213                         if $run ./try 2>/dev/null; then
16214                                 echo "Yes, it can."
16215                                 val="$define"
16216                         else
16217                                 echo "It can't, sorry."
16218                         fi
16219                 else
16220                         echo "(I can't compile the test program, so we'll assume not...)"
16221                 fi
16222                 ;;
16223         esac
16224         $rm_try
16225         ;;
16226 esac
16227 set d_safebcpy
16228 eval $setvar
16229
16230 : can memcpy handle overlapping blocks?
16231 echo " "
16232 val="$undef"
16233 case "$d_memmove" in
16234 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16235 *)      case "$d_memcpy" in
16236         "$define")
16237                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16238                 $cat >try.c <<EOCP
16239 #$i_memory I_MEMORY
16240 #$i_stdlib I_STDLIB
16241 #$i_string I_STRING
16242 #$i_unistd I_UNISTD
16243 EOCP
16244         $cat >>try.c <<'EOCP'
16245 #include <stdio.h>
16246 #ifdef I_MEMORY
16247 #  include <memory.h>
16248 #endif
16249 #ifdef I_STDLIB
16250 #  include <stdlib.h>
16251 #endif
16252 #ifdef I_STRING
16253 #  include <string.h>
16254 #else
16255 #  include <strings.h>
16256 #endif
16257 #ifdef I_UNISTD
16258 #  include <unistd.h>  /* Needed for NetBSD */
16259 #endif
16260 int main()
16261 {
16262 char buf[128], abc[128];
16263 char *b;
16264 int len;
16265 int off;
16266 int align;
16267
16268 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16269    try to store the string in read-only memory. */
16270 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16271
16272 for (align = 7; align >= 0; align--) {
16273         for (len = 36; len; len--) {
16274                 b = buf+align;
16275                 memcpy(b, abc, len);
16276                 for (off = 1; off <= len; off++) {
16277                         memcpy(b+off, b, len);
16278                         memcpy(b, b+off, len);
16279                         if (memcmp(b, abc, len))
16280                                 exit(1);
16281                 }
16282         }
16283 }
16284 exit(0);
16285 }
16286 EOCP
16287                 set try
16288                 if eval $compile_ok; then
16289                         if $run ./try 2>/dev/null; then
16290                                 echo "Yes, it can."
16291                                 val="$define"
16292                         else
16293                                 echo "It can't, sorry."
16294                         fi
16295                 else
16296                         echo "(I can't compile the test program, so we'll assume not...)"
16297                 fi
16298                 ;;
16299         esac
16300         $rm_try
16301         ;;
16302 esac
16303 set d_safemcpy
16304 eval $setvar
16305
16306 : can memcmp be trusted to compare relative magnitude?
16307 val="$undef"
16308 case "$d_memcmp" in
16309 "$define")
16310         echo " "
16311         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16312         $cat >try.c <<EOCP
16313 #$i_memory I_MEMORY
16314 #$i_stdlib I_STDLIB
16315 #$i_string I_STRING
16316 #$i_unistd I_UNISTD
16317 EOCP
16318         $cat >>try.c <<'EOCP'
16319 #include <stdio.h>
16320 #ifdef I_MEMORY
16321 #  include <memory.h>
16322 #endif
16323 #ifdef I_STDLIB
16324 #  include <stdlib.h>
16325 #endif
16326 #ifdef I_STRING
16327 #  include <string.h>
16328 #else
16329 #  include <strings.h>
16330 #endif
16331 #ifdef I_UNISTD
16332 #  include <unistd.h>  /* Needed for NetBSD */
16333 #endif
16334 int main()
16335 {
16336 char a = -1;
16337 char b = 0;
16338 if ((a < b) && memcmp(&a, &b, 1) < 0)
16339         exit(1);
16340 exit(0);
16341 }
16342 EOCP
16343         set try
16344         if eval $compile_ok; then
16345                 if $run ./try 2>/dev/null; then
16346                         echo "Yes, it can."
16347                         val="$define"
16348                 else
16349                         echo "No, it can't (it uses signed chars)."
16350                 fi
16351         else
16352                 echo "(I can't compile the test program, so we'll assume not...)"
16353         fi
16354         ;;
16355 esac
16356 $rm_try
16357 set d_sanemcmp
16358 eval $setvar
16359
16360 : see if prototype for sbrk is available
16361 echo " "
16362 set d_sbrkproto sbrk $i_unistd unistd.h
16363 eval $hasproto
16364
16365 : see if select exists
16366 set select d_select
16367 eval $inlibc
16368
16369 : see if semctl exists
16370 set semctl d_semctl
16371 eval $inlibc
16372
16373 : see if semget exists
16374 set semget d_semget
16375 eval $inlibc
16376
16377 : see if semop exists
16378 set semop d_semop
16379 eval $inlibc
16380
16381 : see how much of the 'sem*(2)' library is present.
16382 h_sem=true
16383 echo " "
16384 case "$d_semctl$d_semget$d_semop" in
16385 *"$undef"*) h_sem=false;;
16386 esac
16387 case "$osname" in
16388 freebsd)
16389     case "`ipcs 2>&1`" in
16390     "SVID messages"*"not configured"*)
16391         echo "Your $osname does not have the sem*(2) configured." >&4
16392         h_sem=false
16393         val="$undef"
16394         set semctl d_semctl
16395         eval $setvar
16396         set semget d_semget
16397         eval $setvar
16398         set semop d_semop
16399         eval $setvar
16400         ;;
16401     esac
16402     ;;
16403 esac
16404 : we could also check for sys/ipc.h ...
16405 if $h_sem && $test `./findhdr sys/sem.h`; then
16406         echo "You have the full sem*(2) library." >&4
16407         val="$define"
16408 else
16409         echo "You don't have the full sem*(2) library." >&4
16410         val="$undef"
16411 fi
16412 set d_sem
16413 eval $setvar
16414
16415 : see whether sys/sem.h defines union semun
16416 echo " "
16417 $cat > try.c <<'END'
16418 #include <sys/types.h>
16419 #include <sys/ipc.h>
16420 #include <sys/sem.h>
16421 int main () { union semun semun; semun.buf = 0; }
16422 END
16423 set try
16424 if eval $compile; then
16425     echo "You have union semun in <sys/sem.h>." >&4
16426     val="$define"
16427 else
16428     echo "You do not have union semun in <sys/sem.h>." >&4
16429     val="$undef"
16430 fi
16431 $rm_try
16432 set d_union_semun
16433 eval $setvar
16434
16435 : see how to do semctl IPC_STAT
16436 case "$d_sem" in
16437 $define)
16438     echo " "
16439     $cat > tryh.h <<END
16440 #ifndef S_IRUSR
16441 #   ifdef S_IREAD
16442 #       define S_IRUSR S_IREAD
16443 #       define S_IWUSR S_IWRITE
16444 #       define S_IXUSR S_IEXEC
16445 #   else
16446 #       define S_IRUSR 0400
16447 #       define S_IWUSR 0200
16448 #       define S_IXUSR 0100
16449 #   endif
16450 #   define S_IRGRP (S_IRUSR>>3)
16451 #   define S_IWGRP (S_IWUSR>>3)
16452 #   define S_IXGRP (S_IXUSR>>3)
16453 #   define S_IROTH (S_IRUSR>>6)
16454 #   define S_IWOTH (S_IWUSR>>6)
16455 #   define S_IXOTH (S_IXUSR>>6)
16456 #endif
16457 #ifndef S_IRWXU
16458 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16459 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16460 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16461 #endif
16462 END
16463     : see whether semctl IPC_STAT can use union semun
16464     case "$d_semctl_semun" in
16465     '')
16466       val="$undef"
16467       $cat > try.c <<END
16468 #include <sys/types.h>
16469 #include <sys/ipc.h>
16470 #include <sys/sem.h>
16471 #include <sys/stat.h>
16472 #include <stdio.h>
16473 #include <errno.h>
16474 #include "tryh.h"
16475 #ifndef errno
16476 extern int errno;
16477 #endif
16478 #$d_union_semun HAS_UNION_SEMUN
16479 int main() {
16480     union semun
16481 #ifndef HAS_UNION_SEMUN
16482     {
16483         int val;
16484         struct semid_ds *buf;
16485         unsigned short *array;
16486     }
16487 #endif
16488     arg;
16489     int sem, st;
16490
16491 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16492     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16493     if (sem > -1) {
16494         struct semid_ds argbuf;
16495         arg.buf = &argbuf;
16496 #       ifdef IPC_STAT
16497         st = semctl(sem, 0, IPC_STAT, arg);
16498         if (st == 0)
16499             printf("semun\n");
16500         else
16501 #       endif /* IPC_STAT */
16502             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16503 #       ifdef IPC_RMID
16504         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16505 #       endif /* IPC_RMID */
16506             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16507     } else
16508 #endif /* IPC_PRIVATE && ... */
16509         printf("semget failed: errno = %d\n", errno);
16510   return 0;
16511 }
16512 END
16513       set try
16514       if eval $compile; then
16515           xxx=`$run ./try`
16516           case "$xxx" in
16517           semun) val="$define" ;;
16518           esac
16519       fi
16520       $rm_try
16521       set d_semctl_semun
16522       eval $setvar
16523       ;;
16524     esac
16525     case "$d_semctl_semun" in
16526     $define)
16527         echo "You can use union semun for semctl IPC_STAT." >&4
16528         also='also'
16529         ;;
16530     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16531         also=''
16532         ;;
16533     esac
16534
16535     : see whether semctl IPC_STAT can use struct semid_ds pointer
16536     case "$d_semctl_semid_ds" in
16537     '')
16538       val="$undef"
16539       $cat > try.c <<'END'
16540 #include <sys/types.h>
16541 #include <sys/ipc.h>
16542 #include <sys/sem.h>
16543 #include <sys/stat.h>
16544 #include "tryh.h"
16545 #include <stdio.h>
16546 #include <errno.h>
16547 #ifndef errno
16548 extern int errno;
16549 #endif
16550 int main() {
16551     struct semid_ds arg;
16552     int sem, st;
16553
16554 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16555     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16556     if (sem > -1) {
16557 #       ifdef IPC_STAT
16558         st = semctl(sem, 0, IPC_STAT, &arg);
16559         if (st == 0)
16560             printf("semid_ds\n");
16561         else
16562 #       endif /* IPC_STAT */
16563             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16564 #       ifdef IPC_RMID
16565         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16566 #       endif /* IPC_RMID */
16567             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16568     } else
16569 #endif /* IPC_PRIVATE && ... */
16570         printf("semget failed: errno = %d\n", errno);
16571
16572     return 0;
16573 }
16574 END
16575       set try
16576       if eval $compile; then
16577           xxx=`$run ./try`
16578           case "$xxx" in
16579           semid_ds) val="$define" ;;
16580           esac
16581       fi
16582       $rm_try
16583       set d_semctl_semid_ds
16584       eval $setvar
16585       ;;
16586     esac
16587     case "$d_semctl_semid_ds" in
16588     $define)
16589         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16590         ;;
16591     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16592         ;;
16593     esac
16594     ;;
16595 *)  val="$undef"
16596
16597     # We do not have the full sem*(2) library, so assume we can not
16598     # use either.
16599
16600     set d_semctl_semun
16601     eval $setvar
16602
16603     set d_semctl_semid_ds
16604     eval $setvar
16605     ;;
16606 esac
16607 $rm_try tryh.h
16608
16609 : see if sendmsg exists
16610 set sendmsg d_sendmsg
16611 eval $inlibc
16612
16613 : see if setegid exists
16614 set setegid d_setegid
16615 eval $inlibc
16616
16617 : see if seteuid exists
16618 set seteuid d_seteuid
16619 eval $inlibc
16620
16621 : see if setgrent exists
16622 set setgrent d_setgrent
16623 eval $inlibc
16624
16625 : see if setgrent_r exists
16626 set setgrent_r d_setgrent_r
16627 eval $inlibc
16628 case "$d_setgrent_r" in
16629 "$define")
16630         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16631         case "$d_setgrent_r_proto:$usethreads" in
16632         ":define")      d_setgrent_r_proto=define
16633                 set d_setgrent_r_proto setgrent_r $hdrs
16634                 eval $hasproto ;;
16635         *)      ;;
16636         esac
16637         case "$d_setgrent_r_proto" in
16638         define)
16639         case "$setgrent_r_proto" in
16640         ''|0) try='int setgrent_r(FILE**);'
16641         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16642         esac
16643         case "$setgrent_r_proto" in
16644         ''|0) try='void setgrent_r(FILE**);'
16645         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16646         esac
16647         case "$setgrent_r_proto" in
16648         ''|0)   d_setgrent_r=undef
16649                 setgrent_r_proto=0
16650                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16651         * )     case "$setgrent_r_proto" in
16652                 REENTRANT_PROTO*) ;;
16653                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16654                 esac
16655                 echo "Prototype: $try" ;;
16656         esac
16657         ;;
16658         *)      case "$usethreads" in
16659                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16660                 esac
16661                 d_setgrent_r=undef
16662                 setgrent_r_proto=0
16663                 ;;
16664         esac
16665         ;;
16666 *)      setgrent_r_proto=0
16667         ;;
16668 esac
16669
16670 : see if sethostent exists
16671 set sethostent d_sethent
16672 eval $inlibc
16673
16674 : see if sethostent_r exists
16675 set sethostent_r d_sethostent_r
16676 eval $inlibc
16677 case "$d_sethostent_r" in
16678 "$define")
16679         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16680         case "$d_sethostent_r_proto:$usethreads" in
16681         ":define")      d_sethostent_r_proto=define
16682                 set d_sethostent_r_proto sethostent_r $hdrs
16683                 eval $hasproto ;;
16684         *)      ;;
16685         esac
16686         case "$d_sethostent_r_proto" in
16687         define)
16688         case "$sethostent_r_proto" in
16689         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16690         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16691         esac
16692         case "$sethostent_r_proto" in
16693         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16694         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16695         esac
16696         case "$sethostent_r_proto" in
16697         ''|0)   d_sethostent_r=undef
16698                 sethostent_r_proto=0
16699                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16700         * )     case "$sethostent_r_proto" in
16701                 REENTRANT_PROTO*) ;;
16702                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16703                 esac
16704                 echo "Prototype: $try" ;;
16705         esac
16706         ;;
16707         *)      case "$usethreads" in
16708                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16709                 esac
16710                 d_sethostent_r=undef
16711                 sethostent_r_proto=0
16712                 ;;
16713         esac
16714         ;;
16715 *)      sethostent_r_proto=0
16716         ;;
16717 esac
16718
16719 : see if setitimer exists
16720 set setitimer d_setitimer
16721 eval $inlibc
16722
16723 : see if setlinebuf exists
16724 set setlinebuf d_setlinebuf
16725 eval $inlibc
16726
16727 : see if setlocale exists
16728 set setlocale d_setlocale
16729 eval $inlibc
16730
16731 : see if locale.h is available
16732 set locale.h i_locale
16733 eval $inhdr
16734
16735 : see if setlocale_r exists
16736 set setlocale_r d_setlocale_r
16737 eval $inlibc
16738 case "$d_setlocale_r" in
16739 "$define")
16740         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16741         case "$d_setlocale_r_proto:$usethreads" in
16742         ":define")      d_setlocale_r_proto=define
16743                 set d_setlocale_r_proto setlocale_r $hdrs
16744                 eval $hasproto ;;
16745         *)      ;;
16746         esac
16747         case "$d_setlocale_r_proto" in
16748         define)
16749         case "$setlocale_r_proto" in
16750         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16751         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16752         esac
16753         case "$setlocale_r_proto" in
16754         ''|0)   d_setlocale_r=undef
16755                 setlocale_r_proto=0
16756                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16757         * )     case "$setlocale_r_proto" in
16758                 REENTRANT_PROTO*) ;;
16759                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16760                 esac
16761                 echo "Prototype: $try" ;;
16762         esac
16763         ;;
16764         *)      case "$usethreads" in
16765                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16766                 esac
16767                 d_setlocale_r=undef
16768                 setlocale_r_proto=0
16769                 ;;
16770         esac
16771         ;;
16772 *)      setlocale_r_proto=0
16773         ;;
16774 esac
16775
16776 : see if setnetent exists
16777 set setnetent d_setnent
16778 eval $inlibc
16779
16780 : see if setnetent_r exists
16781 set setnetent_r d_setnetent_r
16782 eval $inlibc
16783 case "$d_setnetent_r" in
16784 "$define")
16785         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16786         case "$d_setnetent_r_proto:$usethreads" in
16787         ":define")      d_setnetent_r_proto=define
16788                 set d_setnetent_r_proto setnetent_r $hdrs
16789                 eval $hasproto ;;
16790         *)      ;;
16791         esac
16792         case "$d_setnetent_r_proto" in
16793         define)
16794         case "$setnetent_r_proto" in
16795         ''|0) try='int setnetent_r(int, struct netent_data*);'
16796         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16797         esac
16798         case "$setnetent_r_proto" in
16799         ''|0) try='void setnetent_r(int, struct netent_data*);'
16800         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16801         esac
16802         case "$setnetent_r_proto" in
16803         ''|0)   d_setnetent_r=undef
16804                 setnetent_r_proto=0
16805                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16806         * )     case "$setnetent_r_proto" in
16807                 REENTRANT_PROTO*) ;;
16808                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16809                 esac
16810                 echo "Prototype: $try" ;;
16811         esac
16812         ;;
16813         *)      case "$usethreads" in
16814                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16815                 esac
16816                 d_setnetent_r=undef
16817                 setnetent_r_proto=0
16818                 ;;
16819         esac
16820         ;;
16821 *)      setnetent_r_proto=0
16822         ;;
16823 esac
16824
16825 : see if setprotoent exists
16826 set setprotoent d_setpent
16827 eval $inlibc
16828
16829 : see if setpgid exists
16830 set setpgid d_setpgid
16831 eval $inlibc
16832
16833 : see if setpgrp2 exists
16834 set setpgrp2 d_setpgrp2
16835 eval $inlibc
16836
16837 : see if setpriority exists
16838 set setpriority d_setprior
16839 eval $inlibc
16840
16841 : see if setproctitle exists
16842 set setproctitle d_setproctitle
16843 eval $inlibc
16844
16845 : see if setprotoent_r exists
16846 set setprotoent_r d_setprotoent_r
16847 eval $inlibc
16848 case "$d_setprotoent_r" in
16849 "$define")
16850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16851         case "$d_setprotoent_r_proto:$usethreads" in
16852         ":define")      d_setprotoent_r_proto=define
16853                 set d_setprotoent_r_proto setprotoent_r $hdrs
16854                 eval $hasproto ;;
16855         *)      ;;
16856         esac
16857         case "$d_setprotoent_r_proto" in
16858         define)
16859         case "$setprotoent_r_proto" in
16860         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16861         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16862         esac
16863         case "$setprotoent_r_proto" in
16864         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16865         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16866         esac
16867         case "$setprotoent_r_proto" in
16868         ''|0)   d_setprotoent_r=undef
16869                 setprotoent_r_proto=0
16870                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16871         * )     case "$setprotoent_r_proto" in
16872                 REENTRANT_PROTO*) ;;
16873                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16874                 esac
16875                 echo "Prototype: $try" ;;
16876         esac
16877         ;;
16878         *)      case "$usethreads" in
16879                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16880                 esac
16881                 d_setprotoent_r=undef
16882                 setprotoent_r_proto=0
16883                 ;;
16884         esac
16885         ;;
16886 *)      setprotoent_r_proto=0
16887         ;;
16888 esac
16889
16890 : see if setpwent exists
16891 set setpwent d_setpwent
16892 eval $inlibc
16893
16894 : see if setpwent_r exists
16895 set setpwent_r d_setpwent_r
16896 eval $inlibc
16897 case "$d_setpwent_r" in
16898 "$define")
16899         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16900         case "$d_setpwent_r_proto:$usethreads" in
16901         ":define")      d_setpwent_r_proto=define
16902                 set d_setpwent_r_proto setpwent_r $hdrs
16903                 eval $hasproto ;;
16904         *)      ;;
16905         esac
16906         case "$d_setpwent_r_proto" in
16907         define)
16908         case "$setpwent_r_proto" in
16909         ''|0) try='int setpwent_r(FILE**);'
16910         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16911         esac
16912         case "$setpwent_r_proto" in
16913         ''|0) try='void setpwent_r(FILE**);'
16914         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16915         esac
16916         case "$setpwent_r_proto" in
16917         ''|0)   d_setpwent_r=undef
16918                 setpwent_r_proto=0
16919                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16920         * )     case "$setpwent_r_proto" in
16921                 REENTRANT_PROTO*) ;;
16922                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16923                 esac
16924                 echo "Prototype: $try" ;;
16925         esac
16926         ;;
16927         *)      case "$usethreads" in
16928                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16929                 esac
16930                 d_setpwent_r=undef
16931                 setpwent_r_proto=0
16932                 ;;
16933         esac
16934         ;;
16935 *)      setpwent_r_proto=0
16936         ;;
16937 esac
16938
16939 : see if setregid exists
16940 set setregid d_setregid
16941 eval $inlibc
16942 set setresgid d_setresgid
16943 eval $inlibc
16944
16945 : see if setreuid exists
16946 set setreuid d_setreuid
16947 eval $inlibc
16948 set setresuid d_setresuid
16949 eval $inlibc
16950
16951 : see if setrgid exists
16952 set setrgid d_setrgid
16953 eval $inlibc
16954
16955 : see if setruid exists
16956 set setruid d_setruid
16957 eval $inlibc
16958
16959 : see if setservent exists
16960 set setservent d_setsent
16961 eval $inlibc
16962
16963 : see if setservent_r exists
16964 set setservent_r d_setservent_r
16965 eval $inlibc
16966 case "$d_setservent_r" in
16967 "$define")
16968         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16969         case "$d_setservent_r_proto:$usethreads" in
16970         ":define")      d_setservent_r_proto=define
16971                 set d_setservent_r_proto setservent_r $hdrs
16972                 eval $hasproto ;;
16973         *)      ;;
16974         esac
16975         case "$d_setservent_r_proto" in
16976         define)
16977         case "$setservent_r_proto" in
16978         ''|0) try='int setservent_r(int, struct servent_data*);'
16979         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16980         esac
16981         case "$setservent_r_proto" in
16982         ''|0) try='void setservent_r(int, struct servent_data*);'
16983         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16984         esac
16985         case "$setservent_r_proto" in
16986         ''|0)   d_setservent_r=undef
16987                 setservent_r_proto=0
16988                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16989         * )     case "$setservent_r_proto" in
16990                 REENTRANT_PROTO*) ;;
16991                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16992                 esac
16993                 echo "Prototype: $try" ;;
16994         esac
16995         ;;
16996         *)      case "$usethreads" in
16997                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16998                 esac
16999                 d_setservent_r=undef
17000                 setservent_r_proto=0
17001                 ;;
17002         esac
17003         ;;
17004 *)      setservent_r_proto=0
17005         ;;
17006 esac
17007
17008 : see if setsid exists
17009 set setsid d_setsid
17010 eval $inlibc
17011
17012 : see if setvbuf exists
17013 set setvbuf d_setvbuf
17014 eval $inlibc
17015
17016 : see if sfio.h is available
17017 set sfio.h i_sfio
17018 eval $inhdr
17019
17020 : see if sfio library is available
17021 case "$i_sfio" in
17022 $define)
17023         val=''
17024         set sfreserve val
17025         eval $inlibc
17026         ;;
17027 *)
17028         val="$undef"
17029         ;;
17030 esac
17031 : Ok, but do we want to use it.
17032 case "$val" in
17033 $define)
17034         case "$usesfio" in
17035         true|$define|[yY]*) dflt='y';;
17036         *) dflt='n';;
17037         esac
17038         echo "$package can use the sfio library, but it is experimental."
17039         case "$useperlio" in
17040         "$undef")
17041             echo "For sfio also the PerlIO abstraction layer is needed."
17042             echo "Earlier you said you wouldn't want that."
17043             ;;
17044         esac
17045         rp="You seem to have sfio available, do you want to try using it?"
17046         . ./myread
17047         case "$ans" in
17048         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17049                 useperlio="$define"
17050                 val="$define"
17051                 ;;
17052         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17053                 val="$undef"
17054                 ;;
17055         esac
17056         ;;
17057 *)      case "$usesfio" in
17058         true|$define|[yY]*)
17059                 echo "Sorry, cannot find sfio on this machine." >&4
17060                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17061                 val="$undef"
17062                 ;;
17063         esac
17064         ;;
17065 esac
17066 set d_sfio
17067 eval $setvar
17068 case "$d_sfio" in
17069 $define) usesfio='true';;
17070 *) usesfio='false';;
17071 esac
17072 case "$d_sfio" in
17073 $define) ;;
17074 *)      : Remove sfio from list of libraries to use
17075         case "$libs" in
17076         *-lsfio*)
17077                 echo "Removing unneeded -lsfio from library list" >&4
17078                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17079                 shift
17080                 libs="$*"
17081                 echo "libs = $libs" >&4
17082                 ;;
17083         esac
17084 ;;
17085 esac
17086
17087
17088 : see if shmctl exists
17089 set shmctl d_shmctl
17090 eval $inlibc
17091
17092 : see if shmget exists
17093 set shmget d_shmget
17094 eval $inlibc
17095
17096 : see if shmat exists
17097 set shmat d_shmat
17098 eval $inlibc
17099 : see what shmat returns
17100 case "$d_shmat" in
17101 "$define")
17102         $cat >shmat.c <<'END'
17103 #include <sys/shm.h>
17104 void *shmat();
17105 END
17106         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17107                 shmattype='void *'
17108         else
17109                 shmattype='char *'
17110         fi
17111         echo "and it returns ($shmattype)." >&4
17112         : see if a prototype for shmat is available
17113         xxx=`./findhdr sys/shm.h`
17114         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17115         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17116                 val="$define"
17117         else
17118                 val="$undef"
17119         fi
17120         $rm -f shmat.[co]
17121         ;;
17122 *)
17123         val="$undef"
17124         ;;
17125 esac
17126 set d_shmatprototype
17127 eval $setvar
17128
17129 : see if shmdt exists
17130 set shmdt d_shmdt
17131 eval $inlibc
17132
17133 : see how much of the 'shm*(2)' library is present.
17134 h_shm=true
17135 echo " "
17136 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17137 *"$undef"*) h_shm=false;;
17138 esac
17139 case "$osname" in
17140 freebsd)
17141     case "`ipcs 2>&1`" in
17142     "SVID shared memory"*"not configured"*)
17143         echo "Your $osname does not have the shm*(2) configured." >&4
17144         h_shm=false
17145         val="$undef"
17146         set shmctl d_shmctl
17147         evat $setvar
17148         set shmget d_shmget
17149         evat $setvar
17150         set shmat d_shmat
17151         evat $setvar
17152         set shmdt d_shmdt
17153         evat $setvar
17154         ;;
17155     esac
17156     ;;
17157 esac
17158 : we could also check for sys/ipc.h ...
17159 if $h_shm && $test `./findhdr sys/shm.h`; then
17160         echo "You have the full shm*(2) library." >&4
17161         val="$define"
17162 else
17163         echo "You don't have the full shm*(2) library." >&4
17164         val="$undef"
17165 fi
17166 set d_shm
17167 eval $setvar
17168
17169 : see if we have sigaction
17170 echo " "
17171 if set sigaction val -f d_sigaction; eval $csym; $val; then
17172         echo 'sigaction() found.' >&4
17173         $cat > try.c <<EOP
17174 #include <stdio.h>
17175 #include <sys/types.h>
17176 #include <signal.h>
17177 #$i_stdlib I_STDLIB
17178 #ifdef I_STDLIB
17179 #include <stdlib.h>
17180 #endif
17181 int main()
17182 {
17183     struct sigaction act, oact;
17184     act.sa_flags = 0;
17185     oact.sa_handler = 0;
17186     /* so that act and oact are used */
17187     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17188 }
17189 EOP
17190         set try
17191         if eval $compile_ok; then
17192                 val="$define"
17193         else
17194                 echo "But you don't seem to have a useable struct sigaction." >&4
17195                 val="$undef"
17196         fi
17197 else
17198         echo 'sigaction NOT found.' >&4
17199         val="$undef"
17200 fi
17201 set d_sigaction; eval $setvar
17202 $rm_try
17203
17204 : see if this is a sunmath.h system
17205 set sunmath.h i_sunmath
17206 eval $inhdr
17207
17208 : see if signbit exists
17209 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17210 $cat >try.c <<EOCP
17211 #$i_math I_MATH
17212 #$i_sunmath I_SUNMATH
17213 #ifdef I_MATH
17214 #  include <math.h>
17215 #endif
17216 #ifdef I_SUNMATH  /* Solaris special math library */
17217 #  include <sunmath.h>
17218 #endif
17219 #define NV $nvtype
17220 int main(int argc, char **argv)
17221 {
17222     NV x = 0.0;
17223     NV y = -0.0;
17224     if ((signbit(x) == 0) && (signbit(y) != 0))
17225         return 0;
17226     else
17227         return 1;
17228 }
17229 EOCP
17230 val="$undef"
17231 set try
17232 if eval $compile; then
17233     if $run ./try; then
17234         $echo "Yes." >&4
17235         val="$define"
17236     else
17237         $echo "Signbit seems to be available, but doesn't work as I expected."
17238         $echo "I won't use it." >&4
17239         val="$undef"
17240     fi
17241 else
17242     $echo "Nope." >&4
17243     dflt="$undef"
17244 fi
17245 set d_signbit
17246 eval $setvar
17247 $rm_try
17248
17249 : see if sigprocmask exists
17250 set sigprocmask d_sigprocmask
17251 eval $inlibc
17252
17253 : see if sigsetjmp exists
17254 echo " "
17255 case "$d_sigsetjmp" in
17256 '')
17257         $cat >try.c <<EOP
17258 #include <setjmp.h>
17259 #$i_stdlib I_STDLIB
17260 #ifdef I_STDLIB
17261 #include <stdlib.h>
17262 #endif
17263 sigjmp_buf env;
17264 int set = 1;
17265 int main()
17266 {
17267         if (sigsetjmp(env,1))
17268                 exit(set);
17269         set = 0;
17270         siglongjmp(env, 1);
17271         exit(1);
17272 }
17273 EOP
17274         set try
17275         if eval $compile; then
17276                 if $run ./try >/dev/null 2>&1; then
17277                         echo "POSIX sigsetjmp found." >&4
17278                         val="$define"
17279                 else
17280                         $cat >&4 <<EOM
17281 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17282 I'll ignore them.
17283 EOM
17284                         val="$undef"
17285                 fi
17286         else
17287                 echo "sigsetjmp not found." >&4
17288                 val="$undef"
17289         fi
17290         ;;
17291 *) val="$d_sigsetjmp"
17292         case "$d_sigsetjmp" in
17293         $define) echo "POSIX sigsetjmp found." >&4;;
17294         $undef) echo "sigsetjmp not found." >&4;;
17295         esac
17296         ;;
17297 esac
17298 set d_sigsetjmp
17299 eval $setvar
17300 $rm_try
17301
17302 : see if snprintf exists
17303 set snprintf d_snprintf
17304 eval $inlibc
17305
17306 : see if vsnprintf exists
17307 set vsnprintf d_vsnprintf
17308 eval $inlibc
17309
17310 case "$d_snprintf-$d_vsnprintf" in
17311 "$define-$define")
17312     $cat <<EOM
17313 Checking whether your snprintf() and vsnprintf() work okay...
17314 EOM
17315     $cat >try.c <<'EOCP'
17316 /* v?snprintf testing logic courtesy of Russ Allbery.
17317  * According to C99:
17318  * - if the buffer is too short it still must be \0-terminated
17319  * - if the buffer is too short the potentially required length
17320  *   must be returned and not -1
17321  * - if the buffer is NULL the potentially required length
17322  *   must be returned and not -1 or core dump
17323  */
17324 #include <stdio.h>
17325 #include <stdarg.h>
17326
17327 char buf[2];
17328
17329 int test (char *format, ...)
17330 {
17331     va_list args;
17332     int count;
17333
17334     va_start (args, format);
17335     count = vsnprintf (buf, sizeof buf, format, args);
17336     va_end (args);
17337     return count;
17338 }
17339
17340 int main ()
17341 {
17342     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17343              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17344 }
17345 EOCP
17346     set try
17347     if eval $compile; then
17348         `$run ./try`
17349         case "$?" in
17350         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17351         *) cat <<EOM >&4
17352 Your snprintf() and snprintf() don't seem to be working okay.
17353 EOM
17354            d_snprintf="$undef"
17355            d_vsnprintf="$undef"
17356            ;;
17357         esac
17358     else
17359         echo "(I can't seem to compile the test program--assuming they don't)"
17360         d_snprintf="$undef"
17361         d_vsnprintf="$undef"
17362     fi
17363     $rm_try
17364     ;;
17365 esac
17366
17367 : see if sockatmark exists
17368 set sockatmark d_sockatmark
17369 eval $inlibc
17370
17371 : see if prototype for sockatmark is available
17372 echo " "
17373 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17374 eval $hasproto
17375
17376 : see if socks5_init exists
17377 set socks5_init d_socks5_init
17378 eval $inlibc
17379
17380 : see if sprintf returns the length of the string in the buffer as per ANSI
17381 $echo "Checking whether sprintf returns the length of the string..." >&4
17382 $cat <<EOP >try.c
17383 #include <stdio.h>
17384 #$i_stdlib I_STDLIB
17385 #ifdef I_STDLIB
17386 #include <stdlib.h>
17387 #endif
17388 #$i_string I_STRING
17389 #ifdef I_STRING
17390 #  include <string.h>
17391 #else
17392 #  include <strings.h>
17393 #endif
17394 #$i_math I_MATH
17395 #ifdef I_MATH
17396 #include <math.h>
17397 #endif
17398
17399 char buffer[256];
17400
17401 int check (size_t expect, int test) {
17402   size_t got = strlen(buffer);
17403   if (expect == got)
17404     return 0;
17405
17406   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17407        test, buffer);
17408   exit (test);
17409 }
17410
17411 int main(int argc, char **argv) {
17412   int test = 0;
17413
17414   check(sprintf(buffer, ""), ++test);
17415   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17416   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17417
17418   return 0;
17419 }
17420 EOP
17421 set try
17422
17423 d_sprintf_returns_strlen="$undef"
17424 if eval $compile; then
17425     xxx="`$run ./try`"
17426     case "$?" in
17427         0) cat >&4 <<EOM
17428 sprintf returns the length of the string (as ANSI says it should)
17429 EOM
17430         d_sprintf_returns_strlen="$define"
17431         ;;
17432         *) cat >&4 <<EOM
17433 sprintf does not return the length of the string (how old is this system?)
17434 EOM
17435         d_sprintf_returns_strlen="$undef"
17436         ;;
17437     esac
17438 fi
17439 $rm_try
17440
17441 : see if srand48_r exists
17442 set srand48_r d_srand48_r
17443 eval $inlibc
17444 case "$d_srand48_r" in
17445 "$define")
17446         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17447         case "$d_srand48_r_proto:$usethreads" in
17448         ":define")      d_srand48_r_proto=define
17449                 set d_srand48_r_proto srand48_r $hdrs
17450                 eval $hasproto ;;
17451         *)      ;;
17452         esac
17453         case "$d_srand48_r_proto" in
17454         define)
17455         case "$srand48_r_proto" in
17456         ''|0) try='int srand48_r(long, struct drand48_data*);'
17457         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17458         esac
17459         case "$srand48_r_proto" in
17460         ''|0)   d_srand48_r=undef
17461                 srand48_r_proto=0
17462                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17463         * )     case "$srand48_r_proto" in
17464                 REENTRANT_PROTO*) ;;
17465                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17466                 esac
17467                 echo "Prototype: $try" ;;
17468         esac
17469         ;;
17470         *)      case "$usethreads" in
17471                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17472                 esac
17473                 d_srand48_r=undef
17474                 srand48_r_proto=0
17475                 ;;
17476         esac
17477         ;;
17478 *)      srand48_r_proto=0
17479         ;;
17480 esac
17481
17482 : see if srandom_r exists
17483 set srandom_r d_srandom_r
17484 eval $inlibc
17485 case "$d_srandom_r" in
17486 "$define")
17487         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17488         case "$d_srandom_r_proto:$usethreads" in
17489         ":define")      d_srandom_r_proto=define
17490                 set d_srandom_r_proto srandom_r $hdrs
17491                 eval $hasproto ;;
17492         *)      ;;
17493         esac
17494         case "$d_srandom_r_proto" in
17495         define)
17496         case "$srandom_r_proto" in
17497         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17498         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17499         esac
17500         case "$srandom_r_proto" in
17501         ''|0)   d_srandom_r=undef
17502                 srandom_r_proto=0
17503                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17504         * )     case "$srandom_r_proto" in
17505                 REENTRANT_PROTO*) ;;
17506                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17507                 esac
17508                 echo "Prototype: $try" ;;
17509         esac
17510         ;;
17511         *)      case "$usethreads" in
17512                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17513                 esac
17514                 d_srandom_r=undef
17515                 srandom_r_proto=0
17516                 ;;
17517         esac
17518         ;;
17519 *)      srandom_r_proto=0
17520         ;;
17521 esac
17522
17523 : see if prototype for setresgid is available
17524 echo " "
17525 set d_sresgproto setresgid $i_unistd unistd.h
17526 eval $hasproto
17527
17528 : see if prototype for setresuid is available
17529 echo " "
17530 set d_sresuproto setresuid $i_unistd unistd.h
17531 eval $hasproto
17532
17533 : see if sys/stat.h is available
17534 set sys/stat.h i_sysstat
17535 eval $inhdr
17536
17537 : see if stat knows about block sizes
17538 echo " "
17539 echo "Checking to see if your struct stat has st_blocks field..." >&4
17540 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17541 eval $hasfield
17542
17543 : see if this is a sys/vfs.h system
17544 set sys/vfs.h i_sysvfs
17545 eval $inhdr
17546
17547 : see if this is a sys/statfs.h system
17548 set sys/statfs.h i_sysstatfs
17549 eval $inhdr
17550
17551 : Check for statfs_s
17552 echo " "
17553 echo "Checking to see if your system supports struct statfs..." >&4
17554 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
17555 eval $hasstruct
17556 case "$d_statfs_s" in
17557 "$define")      echo "Yes, it does."   ;;
17558 *)              echo "No, it doesn't." ;;
17559 esac
17560
17561
17562 : see if struct statfs knows about f_flags
17563 case "$d_statfs_s" in
17564 define)
17565         echo " "
17566         echo "Checking to see if your struct statfs has f_flags field..." >&4
17567         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
17568         eval $hasfield
17569         ;;
17570 *)      val="$undef"
17571         set d_statfs_f_flags
17572         eval $setvar
17573         ;;
17574 esac
17575 case "$d_statfs_f_flags" in
17576 "$define")      echo "Yes, it does."   ;;
17577 *)              echo "No, it doesn't." ;;
17578 esac
17579
17580 : Check stream access
17581 $cat >&4 <<EOM
17582 Checking how to access stdio streams by file descriptor number...
17583 EOM
17584 case "$stdio_stream_array" in
17585 '')     $cat >try.c <<EOCP
17586 #include <stdio.h>
17587 int main() {
17588   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17589     printf("yes\n");
17590 }
17591 EOCP
17592         for s in _iob __iob __sF
17593         do
17594                 set try -DSTDIO_STREAM_ARRAY=$s
17595                 if eval $compile; then
17596                         case "`$run ./try`" in
17597                         yes)    stdio_stream_array=$s; break ;;
17598                         esac
17599                 fi
17600         done
17601         $rm_try
17602 esac
17603 case "$stdio_stream_array" in
17604 '')     $cat >&4 <<EOM
17605 I can't figure out how to access stdio streams by file descriptor number.
17606 EOM
17607         d_stdio_stream_array="$undef"
17608         ;;
17609 *)      $cat >&4 <<EOM
17610 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17611 EOM
17612         d_stdio_stream_array="$define"
17613         ;;
17614 esac
17615
17616 : see if strcoll exists
17617 set strcoll d_strcoll
17618 eval $inlibc
17619
17620 : check for structure copying
17621 echo " "
17622 echo "Checking to see if your C compiler can copy structs..." >&4
17623 $cat >try.c <<'EOCP'
17624 int main()
17625 {
17626         struct blurfl {
17627                 int dyick;
17628         } foo, bar;
17629
17630         foo = bar;
17631 }
17632 EOCP
17633 if $cc -c try.c >/dev/null 2>&1 ; then
17634         val="$define"
17635         echo "Yup, it can."
17636 else
17637         val="$undef"
17638         echo "Nope, it can't."
17639 fi
17640 set d_strctcpy
17641 eval $setvar
17642 $rm_try
17643
17644 : see if strerror and/or sys_errlist[] exist
17645 echo " "
17646 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17647     if set strerror val -f d_strerror; eval $csym; $val; then
17648                 echo 'strerror() found.' >&4
17649                 d_strerror="$define"
17650                 d_strerrm='strerror(e)'
17651                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17652                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17653                         d_syserrlst="$define"
17654                 else
17655                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17656                         d_syserrlst="$undef"
17657                 fi
17658     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17659                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17660                 echo 'strerror() found in string header.' >&4
17661                 d_strerror="$define"
17662                 d_strerrm='strerror(e)'
17663                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17664                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17665                                 d_syserrlst="$define"
17666                 else
17667                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17668                         d_syserrlst="$undef"
17669                 fi
17670     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17671                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17672                 d_strerror="$undef"
17673                 d_syserrlst="$define"
17674                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17675     else
17676                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17677                 d_strerror="$undef"
17678                 d_syserrlst="$undef"
17679                 d_strerrm='"unknown"'
17680     fi
17681 fi
17682
17683 : see if strerror_r exists
17684 set strerror_r d_strerror_r
17685 eval $inlibc
17686 case "$d_strerror_r" in
17687 "$define")
17688         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17689         case "$d_strerror_r_proto:$usethreads" in
17690         ":define")      d_strerror_r_proto=define
17691                 set d_strerror_r_proto strerror_r $hdrs
17692                 eval $hasproto ;;
17693         *)      ;;
17694         esac
17695         case "$d_strerror_r_proto" in
17696         define)
17697         case "$strerror_r_proto" in
17698         ''|0) try='int strerror_r(int, char*, size_t);'
17699         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17700         esac
17701         case "$strerror_r_proto" in
17702         ''|0) try='int strerror_r(int, char*, int);'
17703         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17704         esac
17705         case "$strerror_r_proto" in
17706         ''|0) try='char* strerror_r(int, char*, size_t);'
17707         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17708         esac
17709         case "$strerror_r_proto" in
17710         ''|0)   d_strerror_r=undef
17711                 strerror_r_proto=0
17712                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17713         * )     case "$strerror_r_proto" in
17714                 REENTRANT_PROTO*) ;;
17715                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17716                 esac
17717                 echo "Prototype: $try" ;;
17718         esac
17719         ;;
17720         *)      case "$usethreads" in
17721                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17722                 esac
17723                 d_strerror_r=undef
17724                 strerror_r_proto=0
17725                 ;;
17726         esac
17727         ;;
17728 *)      strerror_r_proto=0
17729         ;;
17730 esac
17731
17732 : see if strftime exists
17733 set strftime d_strftime
17734 eval $inlibc
17735
17736 : see if strlcat exists
17737 set strlcat d_strlcat
17738 eval $inlibc
17739
17740 : see if strlcpy exists
17741 set strlcpy d_strlcpy
17742 eval $inlibc
17743
17744 : see if strtod exists
17745 set strtod d_strtod
17746 eval $inlibc
17747
17748 : see if strtol exists
17749 set strtol d_strtol
17750 eval $inlibc
17751
17752 : see if strtold exists
17753 set strtold d_strtold
17754 eval $inlibc
17755
17756 : see if strtoll exists
17757 set strtoll d_strtoll
17758 eval $inlibc
17759
17760 case "$d_longlong-$d_strtoll" in
17761 "$define-$define")
17762         $cat <<EOM
17763 Checking whether your strtoll() works okay...
17764 EOM
17765         $cat >try.c <<'EOCP'
17766 #include <errno.h>
17767 #ifdef __hpux
17768 #define strtoll __strtoll
17769 #endif
17770 #ifdef __EMX__
17771 #define strtoll _strtoll
17772 #endif
17773 #include <stdio.h>
17774 extern long long int strtoll(char *s, char **, int);
17775 static int bad = 0;
17776 int check(char *s, long long ell, int een) {
17777         long long gll;
17778         errno = 0;
17779         gll = strtoll(s, 0, 10);
17780         if (!((gll == ell) && (errno == een)))
17781                 bad++;
17782 }
17783 int main() {
17784         check(" 1",                                      1LL, 0);
17785         check(" 0",                                      0LL, 0);
17786         check("-1",                                     -1LL, 0);
17787         check("-9223372036854775808", -9223372036854775808LL, 0);
17788         check("-9223372036854775808", -9223372036854775808LL, 0);
17789         check(" 9223372036854775807",  9223372036854775807LL, 0);
17790         check("-9223372036854775808", -9223372036854775808LL, 0);
17791         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17792         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17793         if (!bad)
17794                 printf("ok\n");
17795 }
17796 EOCP
17797         set try
17798         if eval $compile; then
17799                 yyy=`$run ./try`
17800                 case "$yyy" in
17801                 ok) echo "Your strtoll() seems to be working okay." ;;
17802                 *) cat <<EOM >&4
17803 Your strtoll() doesn't seem to be working okay.
17804 EOM
17805                    d_strtoll="$undef"
17806                    ;;
17807                 esac
17808         else
17809                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17810                 d_strtoll="$undef"
17811         fi
17812         ;;
17813 esac
17814
17815 : see if strtoq exists
17816 set strtoq d_strtoq
17817 eval $inlibc
17818
17819 : see if strtoul exists
17820 set strtoul d_strtoul
17821 eval $inlibc
17822
17823 case "$d_strtoul" in
17824 "$define")
17825         $cat <<EOM
17826 Checking whether your strtoul() works okay...
17827 EOM
17828         $cat >try.c <<'EOCP'
17829 #include <errno.h>
17830 #include <stdio.h>
17831 extern unsigned long int strtoul(char *s, char **, int);
17832 static int bad = 0;
17833 void check(char *s, unsigned long eul, int een) {
17834         unsigned long gul;
17835         errno = 0;
17836         gul = strtoul(s, 0, 10);
17837         if (!((gul == eul) && (errno == een)))
17838                 bad++;
17839 }
17840 int main() {
17841         check(" 1", 1L, 0);
17842         check(" 0", 0L, 0);
17843 EOCP
17844         case "$longsize" in
17845         8)
17846             $cat >>try.c <<'EOCP'
17847         check("18446744073709551615", 18446744073709551615UL, 0);
17848         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17849 #if 0 /* strtoul() for /^-/ strings is undefined. */
17850         check("-1", 18446744073709551615UL, 0);
17851         check("-18446744073709551614", 2, 0);
17852         check("-18446744073709551615", 1, 0);
17853         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17854         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17855 #endif
17856 EOCP
17857                 ;;
17858         4)
17859                     $cat >>try.c <<'EOCP'
17860         check("4294967295", 4294967295UL, 0);
17861         check("4294967296", 4294967295UL, ERANGE);
17862 #if 0 /* strtoul() for /^-/ strings is undefined. */
17863         check("-1", 4294967295UL, 0);
17864         check("-4294967294", 2, 0);
17865         check("-4294967295", 1, 0);
17866         check("-4294967296", 4294967295UL, ERANGE);
17867         check("-4294967297", 4294967295UL, ERANGE);
17868 #endif
17869 EOCP
17870                 ;;
17871         *)
17872 : Should we write these tests to be more portable by sprintf-ing
17873 : ~0 and then manipulating that char string as input for strtol?
17874                 ;;
17875         esac
17876         $cat >>try.c <<'EOCP'
17877         if (!bad)
17878                 printf("ok\n");
17879         return 0;
17880 }
17881 EOCP
17882         set try
17883         if eval $compile; then
17884                 case "`$run ./try`" in
17885                 ok) echo "Your strtoul() seems to be working okay." ;;
17886                 *) cat <<EOM >&4
17887 Your strtoul() doesn't seem to be working okay.
17888 EOM
17889                    d_strtoul="$undef"
17890                    ;;
17891                 esac
17892         else
17893                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17894                 d_strtoul="$undef"
17895         fi
17896         ;;
17897 esac
17898
17899 : see if strtoull exists
17900 set strtoull d_strtoull
17901 eval $inlibc
17902
17903 case "$d_longlong-$d_strtoull" in
17904 "$define-$define")
17905         $cat <<EOM
17906 Checking whether your strtoull() works okay...
17907 EOM
17908         $cat >try.c <<'EOCP'
17909 #include <errno.h>
17910 #ifdef __hpux
17911 #define strtoull __strtoull
17912 #endif
17913 #include <stdio.h>
17914 extern unsigned long long int strtoull(char *s, char **, int);
17915 static int bad = 0;
17916 int check(char *s, long long eull, int een) {
17917         long long gull;
17918         errno = 0;
17919         gull = strtoull(s, 0, 10);
17920         if (!((gull == eull) && (errno == een)))
17921                 bad++;
17922 }
17923 int main() {
17924         check(" 1",                                        1LL, 0);
17925         check(" 0",                                        0LL, 0);
17926         check("18446744073709551615",  18446744073709551615ULL, 0);
17927         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17928 #if 0 /* strtoull() for /^-/ strings is undefined. */
17929         check("-1",                    18446744073709551615ULL, 0);
17930         check("-18446744073709551614",                     2LL, 0);
17931         check("-18446744073709551615",                     1LL, 0);
17932         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17933         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17934 #endif
17935         if (!bad)
17936                 printf("ok\n");
17937 }
17938 EOCP
17939         set try
17940         if eval $compile; then
17941                 case "`$run ./try`" in
17942                 ok) echo "Your strtoull() seems to be working okay." ;;
17943                 *) cat <<EOM >&4
17944 Your strtoull() doesn't seem to be working okay.
17945 EOM
17946                    d_strtoull="$undef"
17947                    ;;
17948                 esac
17949         else
17950                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17951                 d_strtoull="$undef"
17952         fi
17953         ;;
17954 esac
17955
17956 : see if strtouq exists
17957 set strtouq d_strtouq
17958 eval $inlibc
17959
17960 case "$d_strtouq" in
17961 "$define")
17962         $cat <<EOM
17963 Checking whether your strtouq() works okay...
17964 EOM
17965         $cat >try.c <<'EOCP'
17966 #include <errno.h>
17967 #include <stdio.h>
17968 extern unsigned long long int strtouq(char *s, char **, int);
17969 static int bad = 0;
17970 void check(char *s, unsigned long long eull, int een) {
17971         unsigned long long gull;
17972         errno = 0;
17973         gull = strtouq(s, 0, 10);
17974         if (!((gull == eull) && (errno == een)))
17975                 bad++;
17976 }
17977 int main() {
17978         check(" 1",                                        1LL, 0);
17979         check(" 0",                                        0LL, 0);
17980         check("18446744073709551615",  18446744073709551615ULL, 0);
17981         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17982 #if 0 /* strtouq() for /^-/ strings is undefined. */
17983         check("-1",                    18446744073709551615ULL, 0);
17984         check("-18446744073709551614",                     2LL, 0);
17985         check("-18446744073709551615",                     1LL, 0);
17986         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17987         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17988 #endif
17989         if (!bad)
17990                 printf("ok\n");
17991         return 0;
17992 }
17993 EOCP
17994         set try
17995         if eval $compile; then
17996                 case "`$run ./try`" in
17997                 ok) echo "Your strtouq() seems to be working okay." ;;
17998                 *) cat <<EOM >&4
17999 Your strtouq() doesn't seem to be working okay.
18000 EOM
18001                    d_strtouq="$undef"
18002                    ;;
18003                 esac
18004         else
18005                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18006                 d_strtouq="$undef"
18007         fi
18008         ;;
18009 esac
18010
18011 : see if strxfrm exists
18012 set strxfrm d_strxfrm
18013 eval $inlibc
18014
18015 : see if symlink exists
18016 set symlink d_symlink
18017 eval $inlibc
18018
18019 : see if syscall exists
18020 set syscall d_syscall
18021 eval $inlibc
18022
18023 : see if prototype for syscall is available
18024 echo " "
18025 set d_syscallproto syscall $i_unistd unistd.h
18026 eval $hasproto
18027
18028 : see if sysconf exists
18029 set sysconf d_sysconf
18030 eval $inlibc
18031
18032 : see if system exists
18033 set system d_system
18034 eval $inlibc
18035
18036 : see if tcgetpgrp exists
18037 set tcgetpgrp d_tcgetpgrp
18038 eval $inlibc
18039
18040 : see if tcsetpgrp exists
18041 set tcsetpgrp d_tcsetpgrp
18042 eval $inlibc
18043
18044 : see if prototype for telldir is available
18045 echo " "
18046 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18047 eval $hasproto
18048
18049 : see if time exists
18050 echo " "
18051 if test "X$d_time" = X -o X"$timetype" = X; then
18052     if set time val -f d_time; eval $csym; $val; then
18053                 echo 'time() found.' >&4
18054                 val="$define"
18055                 rp="What is the type returned by time() on this system?"
18056                 set time_t timetype long stdio.h sys/types.h
18057                 eval $typedef_ask
18058     else
18059                 echo 'time() not found, hope that will do.' >&4
18060                 val="$undef"
18061                 timetype='int';
18062     fi
18063     set d_time
18064     eval $setvar
18065 fi
18066
18067 : see if this is a sys/times.h system
18068 set sys/times.h i_systimes
18069 eval $inhdr
18070
18071 : see if times exists
18072 echo " "
18073 if set times val -f d_times; eval $csym; $val; then
18074         echo 'times() found.' >&4
18075         d_times="$define"
18076         inc=''
18077         case "$i_systimes" in
18078         "$define") inc='sys/times.h';;
18079         esac
18080         rp="What is the type returned by times() on this system?"
18081         set clock_t clocktype long stdio.h sys/types.h $inc
18082         eval $typedef_ask
18083 else
18084         echo 'times() NOT found, hope that will do.' >&4
18085         d_times="$undef"
18086         clocktype='int'
18087 fi
18088
18089 : see if tmpnam_r exists
18090 set tmpnam_r d_tmpnam_r
18091 eval $inlibc
18092 case "$d_tmpnam_r" in
18093 "$define")
18094         hdrs="$i_systypes sys/types.h define stdio.h "
18095         case "$d_tmpnam_r_proto:$usethreads" in
18096         ":define")      d_tmpnam_r_proto=define
18097                 set d_tmpnam_r_proto tmpnam_r $hdrs
18098                 eval $hasproto ;;
18099         *)      ;;
18100         esac
18101         case "$d_tmpnam_r_proto" in
18102         define)
18103         case "$tmpnam_r_proto" in
18104         ''|0) try='char* tmpnam_r(char*);'
18105         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18106         esac
18107         case "$tmpnam_r_proto" in
18108         ''|0)   d_tmpnam_r=undef
18109                 tmpnam_r_proto=0
18110                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18111         * )     case "$tmpnam_r_proto" in
18112                 REENTRANT_PROTO*) ;;
18113                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18114                 esac
18115                 echo "Prototype: $try" ;;
18116         esac
18117         ;;
18118         *)      case "$usethreads" in
18119                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18120                 esac
18121                 d_tmpnam_r=undef
18122                 tmpnam_r_proto=0
18123                 ;;
18124         esac
18125         ;;
18126 *)      tmpnam_r_proto=0
18127         ;;
18128 esac
18129
18130 : see if truncate exists
18131 set truncate d_truncate
18132 eval $inlibc
18133
18134 : see if ttyname_r exists
18135 set ttyname_r d_ttyname_r
18136 eval $inlibc
18137 case "$d_ttyname_r" in
18138 "$define")
18139         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18140         case "$d_ttyname_r_proto:$usethreads" in
18141         ":define")      d_ttyname_r_proto=define
18142                 set d_ttyname_r_proto ttyname_r $hdrs
18143                 eval $hasproto ;;
18144         *)      ;;
18145         esac
18146         case "$d_ttyname_r_proto" in
18147         define)
18148         case "$ttyname_r_proto" in
18149         ''|0) try='int ttyname_r(int, char*, size_t);'
18150         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18151         esac
18152         case "$ttyname_r_proto" in
18153         ''|0) try='int ttyname_r(int, char*, int);'
18154         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18155         esac
18156         case "$ttyname_r_proto" in
18157         ''|0) try='char* ttyname_r(int, char*, int);'
18158         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18159         esac
18160         case "$ttyname_r_proto" in
18161         ''|0)   d_ttyname_r=undef
18162                 ttyname_r_proto=0
18163                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18164         * )     case "$ttyname_r_proto" in
18165                 REENTRANT_PROTO*) ;;
18166                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18167                 esac
18168                 echo "Prototype: $try" ;;
18169         esac
18170         ;;
18171         *)      case "$usethreads" in
18172                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18173                 esac
18174                 d_ttyname_r=undef
18175                 ttyname_r_proto=0
18176                 ;;
18177         esac
18178         ;;
18179 *)      ttyname_r_proto=0
18180         ;;
18181 esac
18182
18183 : see if tzname[] exists
18184 echo " "
18185 if set tzname val -a d_tzname; eval $csym; $val; then
18186         val="$define"
18187         echo 'tzname[] found.' >&4
18188 else
18189         val="$undef"
18190         echo 'tzname[] NOT found.' >&4
18191 fi
18192 set d_tzname
18193 eval $setvar
18194
18195 : Check if is a multiplatform env
18196 case "$osname" in
18197 next|rhapsody|darwin) multiarch="$define" ;;
18198 esac
18199 case "$multiarch" in
18200 ''|[nN]*) multiarch="$undef" ;;
18201 esac
18202
18203 : check for ordering of bytes in a UV
18204 echo " "
18205 case "$usecrosscompile$multiarch" in
18206 *$define*)
18207         $cat <<EOM
18208 You seem to be either cross-compiling or doing a multiarchitecture build,
18209 skipping the byteorder check.
18210
18211 EOM
18212         byteorder='ffff'
18213         ;;
18214 *)
18215         case "$byteorder" in
18216         '')
18217                 $cat <<'EOM'
18218 In the following, larger digits indicate more significance.  A big-endian
18219 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18220 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18221 machines may have weird orders like 3412.  A Cray will report 87654321,
18222 an Alpha will report 12345678. If the test program works the default is
18223 probably right.
18224 I'm now running the test program...
18225 EOM
18226                 $cat >try.c <<EOCP
18227 #include <stdio.h>
18228 #$i_stdlib I_STDLIB
18229 #ifdef I_STDLIB
18230 #include <stdlib.h>
18231 #endif
18232 #include <sys/types.h>
18233 typedef $uvtype UV;
18234 int main()
18235 {
18236         int i;
18237         union {
18238                 UV l;
18239                 char c[$uvsize];
18240         } u;
18241
18242         if ($uvsize > 4)
18243                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18244         else
18245                 u.l = (UV)0x04030201;
18246         for (i = 0; i < $uvsize; i++)
18247                 printf("%c", u.c[i]+'0');
18248         printf("\n");
18249         exit(0);
18250 }
18251 EOCP
18252                 xxx_prompt=y
18253                 set try
18254                 if eval $compile && $run ./try > /dev/null; then
18255                         dflt=`$run ./try`
18256                         case "$dflt" in
18257                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18258                                 echo "(The test program ran ok.)"
18259                                 echo "byteorder=$dflt"
18260                                 xxx_prompt=n
18261                         ;;
18262                         ????|????????) echo "(The test program ran ok.)" ;;
18263                         *) echo "(The test program didn't run right for some reason.)" ;;
18264                         esac
18265                 else
18266                         dflt='4321'
18267                         cat <<'EOM'
18268 (I can't seem to compile the test program.  Guessing big-endian...)
18269 EOM
18270                 fi
18271                 case "$xxx_prompt" in
18272                 y)
18273                         rp="What is the order of bytes in $uvtype?"
18274                         . ./myread
18275                         byteorder="$ans"
18276                         ;;
18277                 *)      byteorder=$dflt
18278                         ;;
18279                 esac
18280                 ;;
18281         esac
18282         $rm_try
18283         ;;
18284 esac
18285
18286 : Checking 32bit aligndness
18287 $cat <<EOM
18288
18289 Checking to see whether you can access character data unalignedly...
18290 EOM
18291 case "$d_u32align" in
18292 '')   $cat >try.c <<EOCP
18293 #include <stdio.h>
18294 #$i_stdlib I_STDLIB
18295 #ifdef I_STDLIB
18296 #include <stdlib.h>
18297 #endif
18298 #define U32 $u32type
18299 #define BYTEORDER 0x$byteorder
18300 #define U8 $u8type
18301 #include <signal.h>
18302 #ifdef SIGBUS
18303 $signal_t bletch(int s) { exit(4); }
18304 #endif
18305 int main() {
18306 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18307     U8 buf[8];
18308     U32 *up;
18309     int i;
18310
18311     if (sizeof(U32) != 4) {
18312         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18313         exit(1);
18314     }
18315
18316     fflush(stdout);
18317
18318 #ifdef SIGBUS
18319     signal(SIGBUS, bletch);
18320 #endif
18321
18322     buf[0] = 0;
18323     buf[1] = 0;
18324     buf[2] = 0;
18325     buf[3] = 1;
18326     buf[4] = 0;
18327     buf[5] = 0;
18328     buf[6] = 0;
18329     buf[7] = 1;
18330
18331     for (i = 0; i < 4; i++) {
18332         up = (U32*)(buf + i);
18333         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18334                (*up == 1 << (8*(3-i)))  /* little-endian */
18335               )
18336            )
18337         {
18338             printf("read failed (%x)\n", *up);
18339             exit(2);
18340         }
18341     }
18342
18343     /* write test */
18344     for (i = 0; i < 4; i++) {
18345         up = (U32*)(buf + i);
18346         *up = 0xBeef;
18347         if (*up != 0xBeef) {
18348             printf("write failed (%x)\n", *up);
18349             exit(3);
18350         }
18351     }
18352
18353     exit(0);
18354 #else
18355     printf("1\n");
18356     exit(1);
18357 #endif
18358     return 0;
18359 }
18360 EOCP
18361 set try
18362 if eval $compile_ok; then
18363         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18364         $run ./try 2>&1 >/dev/null
18365         case "$?" in
18366         0)      cat >&4 <<EOM
18367 You can access character data pretty unalignedly.
18368 EOM
18369                 d_u32align="$undef"
18370                 ;;
18371         *)      cat >&4 <<EOM
18372 It seems that you must access character data in an aligned manner.
18373 EOM
18374                 d_u32align="$define"
18375                 ;;
18376         esac
18377 else
18378         rp='Can you access character data at unaligned addresses?'
18379         dflt='n'
18380         . ./myread
18381         case "$ans" in
18382         [yY]*)  d_u32align="$undef"  ;;
18383         *)      d_u32align="$define" ;;
18384         esac
18385 fi
18386 $rm_try
18387 ;;
18388 esac
18389
18390 : see if ualarm exists
18391 set ualarm d_ualarm
18392 eval $inlibc
18393
18394 : see if umask exists
18395 set umask d_umask
18396 eval $inlibc
18397
18398 : see if unordered exists
18399 set unordered d_unordered
18400 eval $inlibc
18401
18402 : see if unsetenv exists
18403 set unsetenv d_unsetenv
18404 eval $inlibc
18405
18406 : see if usleep exists
18407 set usleep d_usleep
18408 eval $inlibc
18409
18410 : see if prototype for usleep is available
18411 echo " "
18412 set d_usleepproto usleep $i_unistd unistd.h
18413 eval $hasproto
18414
18415 : see if ustat exists
18416 set ustat d_ustat
18417 eval $inlibc
18418
18419 : see if closedir exists
18420 set closedir d_closedir
18421 eval $inlibc
18422
18423 case "$d_closedir" in
18424 "$define")
18425         echo " "
18426         echo "Checking whether closedir() returns a status..." >&4
18427         cat > try.c <<EOM
18428 #$i_dirent I_DIRENT             /**/
18429 #$i_sysdir I_SYS_DIR            /**/
18430 #$i_sysndir I_SYS_NDIR          /**/
18431 #$i_systypes I_SYS_TYPES        /**/
18432
18433 #if defined(I_SYS_TYPES)
18434 #include <sys/types.h>
18435 #endif
18436 #if defined(I_DIRENT)
18437 #include <dirent.h>
18438 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18439 #include <sys/dir.h>
18440 #endif
18441 #else
18442 #ifdef I_SYS_NDIR
18443 #include <sys/ndir.h>
18444 #else
18445 #ifdef I_SYS_DIR
18446 #ifdef hp9000s500
18447 #include <ndir.h>       /* may be wrong in the future */
18448 #else
18449 #include <sys/dir.h>
18450 #endif
18451 #endif
18452 #endif
18453 #endif
18454 int main() { return closedir(opendir(".")); }
18455 EOM
18456         set try
18457         if eval $compile_ok; then
18458                 if $run ./try > /dev/null 2>&1 ; then
18459                         echo "Yes, it does."
18460                         val="$undef"
18461                 else
18462                         echo "No, it doesn't."
18463                         val="$define"
18464                 fi
18465         else
18466                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18467                 val="$define"
18468         fi
18469         ;;
18470 *)
18471         val="$undef";
18472         ;;
18473 esac
18474 set d_void_closedir
18475 eval $setvar
18476 $rm_try
18477
18478 : see if there is a wait4
18479 set wait4 d_wait4
18480 eval $inlibc
18481
18482 : see if waitpid exists
18483 set waitpid d_waitpid
18484 eval $inlibc
18485
18486 : see if wcstombs exists
18487 set wcstombs d_wcstombs
18488 eval $inlibc
18489
18490 : see if wctomb exists
18491 set wctomb d_wctomb
18492 eval $inlibc
18493
18494 : see if writev exists
18495 set writev d_writev
18496 eval $inlibc
18497
18498 : preserve RCS keywords in files with variable substitution, grrr
18499 Date='$Date'
18500 Id='$Id'
18501 Log='$Log'
18502 RCSfile='$RCSfile'
18503 Revision='$Revision'
18504
18505 : check for alignment requirements
18506 echo " "
18507 case "$usecrosscompile$multiarch" in
18508 *$define*)
18509         $cat <<EOM
18510 You seem to be either cross-compiling or doing a multiarchitecture build,
18511 skipping the memory alignment check.
18512
18513 EOM
18514         case "$alignbytes" in
18515         '') alignbytes=8 ;;
18516         esac
18517         ;;
18518 *)
18519         case "$alignbytes" in
18520         '') echo "Checking alignment constraints..." >&4
18521                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18522                         $cat >try.c <<'EOCP'
18523 typedef long double NV;
18524 EOCP
18525                 else
18526                         $cat >try.c <<'EOCP'
18527 typedef double NV;
18528 EOCP
18529                 fi
18530                 $cat >>try.c <<'EOCP'
18531 #include <stdio.h>
18532 struct foobar {
18533         char foo;
18534         NV bar;
18535 } try_algn;
18536 int main()
18537 {
18538     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18539     return(0);
18540 }
18541 EOCP
18542                 set try
18543                 if eval $compile_ok; then
18544                         dflt=`$run ./try`
18545                 else
18546                         dflt='8'
18547                         echo "(I can't seem to compile the test program...)"
18548                 fi
18549                 ;;
18550         *) dflt="$alignbytes"
18551                 ;;
18552         esac
18553         rp="Doubles must be aligned on a how-many-byte boundary?"
18554         . ./myread
18555         alignbytes="$ans"
18556         $rm_try
18557         ;;
18558 esac
18559
18560
18561 : set the base revision
18562 baserev=5.0
18563
18564 : how do we concatenate cpp tokens here?
18565 echo " "
18566 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18567 $cat >cpp_stuff.c <<'EOCP'
18568 #define RCAT(a,b)a/**/b
18569 #define ACAT(a,b)a ## b
18570 RCAT(Rei,ser)
18571 ACAT(Cir,cus)
18572 EOCP
18573 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18574 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18575         echo "Oh!  Smells like ANSI's been here." >&4
18576         echo "We can catify or stringify, separately or together!"
18577         cpp_stuff=42
18578 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18579         echo "Ah, yes!  The good old days!" >&4
18580         echo "However, in the good old days we don't know how to stringify and"
18581         echo "catify at the same time."
18582         cpp_stuff=1
18583 else
18584         $cat >&4 <<EOM
18585 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18586 You're going to have to edit the values of CAT[2-5] in config.h...
18587 EOM
18588         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18589 fi
18590 $rm -f cpp_stuff.*
18591
18592 : see if this is a db.h system
18593 set db.h i_db
18594 eval $inhdr
18595
18596 case "$i_db" in
18597 $define)
18598         : Check db version.
18599         echo " "
18600         echo "Checking Berkeley DB version ..." >&4
18601         $cat >try.c <<EOCP
18602 #$d_const HASCONST
18603 #ifndef HASCONST
18604 #define const
18605 #endif
18606 #include <sys/types.h>
18607 #include <stdio.h>
18608 #$i_stdlib I_STDLIB
18609 #ifdef I_STDLIB
18610 #include <stdlib.h>
18611 #endif
18612 #include <db.h>
18613 int main(int argc, char *argv[])
18614 {
18615 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18616     int Major, Minor, Patch ;
18617     unsigned long Version ;
18618     (void)db_version(&Major, &Minor, &Patch) ;
18619     if (argc == 2) {
18620         printf("%d %d %d %d %d %d\n",
18621                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18622                Major, Minor, Patch);
18623         exit(0);
18624     }
18625     printf("You have Berkeley DB Version 2 or greater.\n");
18626
18627     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18628                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18629     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18630                 Major, Minor, Patch) ;
18631
18632     /* check that db.h & libdb are compatible */
18633     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18634         printf("db.h and libdb are incompatible.\n") ;
18635         exit(3);
18636     }
18637
18638     printf("db.h and libdb are compatible.\n") ;
18639
18640     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18641                 + DB_VERSION_PATCH ;
18642
18643     /* needs to be >= 2.3.4 */
18644     if (Version < 2003004) {
18645     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18646         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18647         exit(2);
18648     }
18649
18650     exit(0);
18651 #else
18652 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18653     if (argc == 2) {
18654         printf("1 0 0\n");
18655         exit(0);
18656     }
18657     printf("You have Berkeley DB Version 1.\n");
18658     exit(0);    /* DB version < 2: the coast is clear. */
18659 #else
18660     exit(1);    /* <db.h> not Berkeley DB? */
18661 #endif
18662 #endif
18663 }
18664 EOCP
18665         set try
18666         if eval $compile_ok && $run ./try; then
18667                 echo 'Looks OK.' >&4
18668                 set `$run ./try 1`
18669                 db_version_major=$1
18670                 db_version_minor=$2
18671                 db_version_patch=$3
18672         else
18673                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18674                 i_db=$undef
18675                 case " $libs " in
18676                 *"-ldb "*)
18677                         : Remove db from list of libraries to use
18678                         echo "Removing unusable -ldb from library list" >&4
18679                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18680                         shift
18681                         libs="$*"
18682                         echo "libs = $libs" >&4
18683                         ;;
18684                 esac
18685         fi
18686         $rm_try
18687         ;;
18688 esac
18689
18690 case "$i_db" in
18691 define)
18692         : Check the return type needed for hash
18693         echo " "
18694         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18695         $cat >try.c <<EOCP
18696 #$d_const HASCONST
18697 #ifndef HASCONST
18698 #define const
18699 #endif
18700 #include <sys/types.h>
18701 #include <db.h>
18702
18703 #ifndef DB_VERSION_MAJOR
18704 u_int32_t hash_cb (ptr, size)
18705 const void *ptr;
18706 size_t size;
18707 {
18708 }
18709 HASHINFO info;
18710 int main()
18711 {
18712         info.hash = hash_cb;
18713 }
18714 #endif
18715 EOCP
18716         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18717                 if $contains warning try.out >>/dev/null 2>&1 ; then
18718                         db_hashtype='int'
18719                 else
18720                         db_hashtype='u_int32_t'
18721                 fi
18722         else
18723                 : XXX Maybe we should just give up here.
18724                 db_hashtype=u_int32_t
18725                 $cat try.out >&4
18726                 echo "Help:  I can't seem to compile the db test program." >&4
18727                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18728         fi
18729         $rm_try
18730         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18731         ;;
18732 *)      db_hashtype=u_int32_t
18733         ;;
18734 esac
18735 case "$i_db" in
18736 define)
18737         : Check the return type needed for prefix
18738         echo " "
18739         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18740         cat >try.c <<EOCP
18741 #$d_const HASCONST
18742 #ifndef HASCONST
18743 #define const
18744 #endif
18745 #include <sys/types.h>
18746 #include <db.h>
18747
18748 #ifndef DB_VERSION_MAJOR
18749 size_t prefix_cb (key1, key2)
18750 const DBT *key1;
18751 const DBT *key2;
18752 {
18753 }
18754 BTREEINFO info;
18755 int main()
18756 {
18757         info.prefix = prefix_cb;
18758 }
18759 #endif
18760 EOCP
18761         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18762                 if $contains warning try.out >>/dev/null 2>&1 ; then
18763                         db_prefixtype='int'
18764                 else
18765                         db_prefixtype='size_t'
18766                 fi
18767         else
18768                 db_prefixtype='size_t'
18769                 : XXX Maybe we should just give up here.
18770                 $cat try.out >&4
18771                 echo "Help:  I can't seem to compile the db test program." >&4
18772                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18773         fi
18774         $rm_try
18775         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18776         ;;
18777 *)      db_prefixtype='size_t'
18778         ;;
18779 esac
18780
18781 : How can we generate normalized random numbers ?
18782 echo " "
18783 echo "Looking for a random number function..." >&4
18784 case "$randfunc" in
18785 '')
18786         if set drand48 val -f; eval $csym; $val; then
18787                 dflt="drand48"
18788                 echo "Good, found drand48()." >&4
18789         elif set random val -f; eval $csym; $val; then
18790                 dflt="random"
18791                 echo "OK, found random()." >&4
18792         else
18793                 dflt="rand"
18794                 echo "Yick, looks like I have to use rand()." >&4
18795         fi
18796         echo " "
18797         ;;
18798 *)
18799         dflt="$randfunc"
18800         ;;
18801 esac
18802 cont=true
18803
18804 case "$ccflags" in
18805 *-Dmy_rand=*|*-Dmy_srand=*)
18806         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18807         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18808         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18809         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18810         ;;
18811 esac
18812
18813 while $test "$cont"; do
18814         rp="Use which function to generate random numbers?"
18815         . ./myread
18816         if $test "$ans" = "$dflt"; then
18817                 : null
18818         else
18819                 randbits=''
18820         fi
18821         randfunc="$ans"
18822         if set $ans val -f; eval $csym; $val; then
18823                 cont=''
18824         else
18825                 dflt=y
18826                 rp="I cannot find function $ans. Use that name anyway?"
18827                 . ./myread
18828                 dflt=rand
18829                 case "$ans" in
18830                         [yY]*) cont='';;
18831                 esac
18832         fi
18833         case "$cont" in
18834         '')
18835                 case "$randfunc" in
18836                 drand48)
18837                         drand01="drand48()"
18838                         seedfunc="srand48"
18839                         randbits=48
18840                         randseedtype=long
18841                         ;;
18842                 rand|random)
18843                         case "$randbits" in
18844                         '')
18845 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18846                                 $cat >try.c <<EOCP
18847 #$i_unistd I_UNISTD
18848 #$i_stdlib I_STDLIB
18849 #include <stdio.h>
18850 #ifdef I_UNISTD
18851 #  include <unistd.h>
18852 #endif
18853 #ifdef I_STDLIB
18854 #  include <stdlib.h>
18855 #endif
18856 int main()
18857 {
18858         register int i;
18859         register unsigned long tmp;
18860         register unsigned long max = 0L;
18861
18862         for (i = 1000; i; i--) {
18863                 tmp = (unsigned long) $randfunc();
18864                 if (tmp > max) max = tmp;
18865         }
18866         for (i = 0; max; i++)
18867                 max /= 2;
18868         printf("%d\n",i);
18869 }
18870 EOCP
18871                                 set try
18872                                 if eval $compile_ok; then
18873                                         dflt=`try`
18874                                 else
18875                                         dflt='?'
18876                                         echo "(I can't seem to compile the test program...)"
18877                                 fi
18878                                 ;;
18879                         *)
18880                                 dflt="$randbits"
18881                                 ;;
18882                         esac
18883                         rp="How many bits does your $randfunc() function produce?"
18884                         . ./myread
18885                         randbits="$ans"
18886                         $rm_try
18887                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18888                         seedfunc="s$randfunc"
18889                         randseedtype=unsigned
18890                         ;;
18891                 *)
18892                         dflt="31"
18893                         rp="How many bits does your $randfunc() function produce?"
18894                         . ./myread
18895                         randbits="$ans"
18896                         seedfunc="s$randfunc"
18897                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18898                         if set $seedfunc val -f; eval $csym; $val; then
18899                                 echo "(Using $seedfunc() to seed random generator)"
18900                         else
18901                                 echo "(Warning: no $seedfunc() to seed random generator)"
18902                                 seedfunc=rand
18903                         fi
18904                         randseedtype=unsigned
18905                         ;;
18906                 esac
18907                 ;;
18908         esac
18909 done
18910
18911 : Determine if this is an EBCDIC system
18912 echo " "
18913 echo "Determining whether or not we are on an EBCDIC system..." >&4
18914 $cat >try.c <<'EOM'
18915 int main()
18916 {
18917   if ('M'==0xd4) return 0;
18918   return 1;
18919 }
18920 EOM
18921
18922 val=$undef
18923 set try
18924 if eval $compile_ok; then
18925         if $run ./try; then
18926                 echo "You seem to speak EBCDIC." >&4
18927                 val="$define"
18928         else
18929                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18930         fi
18931 else
18932         echo "I'm unable to compile the test program." >&4
18933         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18934 fi
18935 $rm_try
18936 set ebcdic
18937 eval $setvar
18938
18939 : Check how to flush
18940 echo " "
18941 $cat >&4 <<EOM
18942 Checking how to flush all pending stdio output...
18943 EOM
18944 # I only know how to find the first 32 possibly open files on SunOS.
18945 # See also hints/sunos_4_1.sh and util.c  --AD
18946 case "$osname" in
18947 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18948 esac
18949 $cat >>try.c <<EOCP
18950 #include <stdio.h>
18951 #$i_stdlib I_STDLIB
18952 #ifdef I_STDLIB
18953 #include <stdlib.h>
18954 #endif
18955 #$i_unistd I_UNISTD
18956 #ifdef I_UNISTD
18957 # include <unistd.h>
18958 #endif
18959 #$d_sysconf HAS_SYSCONF
18960 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18961 #ifdef HAS_STDIO_STREAM_ARRAY
18962 # define STDIO_STREAM_ARRAY $stdio_stream_array
18963 #endif
18964 int main() {
18965   FILE* p;
18966   unlink("try.out");
18967   p = fopen("try.out", "w");
18968 #ifdef TRY_FPUTC
18969   fputc('x', p);
18970 #else
18971 # ifdef TRY_FPRINTF
18972   fprintf(p, "x");
18973 # endif
18974 #endif
18975 #ifdef TRY_FFLUSH_NULL
18976   fflush(NULL);
18977 #endif
18978 #ifdef TRY_FFLUSH_ALL
18979   {
18980     long open_max = -1;
18981 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18982     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18983 # else
18984 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18985     open_max = sysconf(_SC_OPEN_MAX);
18986 #  else
18987 #   ifdef FOPEN_MAX
18988     open_max = FOPEN_MAX;
18989 #   else
18990 #    ifdef OPEN_MAX
18991     open_max = OPEN_MAX;
18992 #    else
18993 #     ifdef _NFILE
18994     open_max = _NFILE;
18995 #     endif
18996 #    endif
18997 #   endif
18998 #  endif
18999 # endif
19000 # ifdef HAS_STDIO_STREAM_ARRAY
19001     if (open_max > 0) {
19002       long i;
19003       for (i = 0; i < open_max; i++)
19004             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19005                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19006                 STDIO_STREAM_ARRAY[i]._flag)
19007                 fflush(&STDIO_STREAM_ARRAY[i]);
19008     }
19009   }
19010 # endif
19011 #endif
19012   _exit(42);
19013 }
19014 EOCP
19015 : first we have to find out how _not_ to flush
19016 $to try.c
19017 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19018     output=''
19019     set try -DTRY_FPUTC
19020     if eval $compile; then
19021             $run ./try 2>/dev/null
19022             code="$?"
19023             $from try.out
19024             if $test ! -s try.out -a "X$code" = X42; then
19025                 output=-DTRY_FPUTC
19026             fi
19027     fi
19028     case "$output" in
19029     '')
19030             set try -DTRY_FPRINTF
19031             if eval $compile; then
19032                     $run ./try 2>/dev/null
19033                     code="$?"
19034                     $from try.out
19035                     if $test ! -s try.out -a "X$code" = X42; then
19036                         output=-DTRY_FPRINTF
19037                     fi
19038             fi
19039         ;;
19040     esac
19041 fi
19042 : check for fflush NULL behaviour
19043 case "$fflushNULL" in
19044 '')     set try -DTRY_FFLUSH_NULL $output
19045         if eval $compile; then
19046                 $run ./try 2>/dev/null
19047                 code="$?"
19048                 $from try.out
19049                 if $test -s try.out -a "X$code" = X42; then
19050                         fflushNULL="`$cat try.out`"
19051                 else
19052                         if $test "X$code" != X42; then
19053                                 $cat >&4 <<EOM
19054 (If this test failed, don't worry, we'll try another method shortly.)
19055 EOM
19056                         fi
19057                 fi
19058         fi
19059         $rm_try
19060         case "$fflushNULL" in
19061         x)      $cat >&4 <<EOM
19062 Your fflush(NULL) works okay for output streams.
19063 Let's see if it clobbers input pipes...
19064 EOM
19065 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19066 # bug that improperly flushes the input end of pipes.  So we avoid the
19067 # autoflush on fork/system/exec support for now. :-(
19068 $cat >tryp.c <<EOCP
19069 #include <stdio.h>
19070 int
19071 main(int argc, char **argv)
19072 {
19073     char buf[1024];
19074     int i;
19075     char *bp = buf;
19076     while (1) {
19077         while ((i = getc(stdin)) != -1
19078                && (*bp++ = i) != '\n'
19079                && bp < &buf[1024])
19080         /* DO NOTHING */ ;
19081         *bp = '\0';
19082         fprintf(stdout, "%s", buf);
19083         fflush(NULL);
19084         if (i == -1)
19085             return 0;
19086         bp = buf;
19087     }
19088 }
19089 EOCP
19090                 fflushNULL="$define"
19091                 set tryp
19092                 if eval $compile; then
19093                     $rm -f tryp.out
19094                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19095                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19096                        $cat >&4 <<EOM
19097 fflush(NULL) seems to behave okay with input streams.
19098 EOM
19099                         fflushNULL="$define"
19100                     else
19101                         $cat >&4 <<EOM
19102 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19103 EOM
19104                         fflushNULL="$undef"
19105                     fi
19106                 fi
19107                 $rm -f core tryp.c tryp.core core.tryp.*
19108                 ;;
19109         '')     $cat >&4 <<EOM
19110 Your fflush(NULL) isn't working (contrary to ANSI C).
19111 EOM
19112                 fflushNULL="$undef"
19113                 ;;
19114         *)      $cat >&4 <<EOM
19115 Cannot figure out whether your fflush(NULL) works or not.
19116 I'm assuming it doesn't (contrary to ANSI C).
19117 EOM
19118                 fflushNULL="$undef"
19119                 ;;
19120         esac
19121         ;;
19122 $define|true|[yY]*)
19123         fflushNULL="$define"
19124         ;;
19125 *)
19126         fflushNULL="$undef"
19127         ;;
19128 esac
19129 : check explicit looping only if NULL did not work, and if the pipe
19130 : bug does not show up on an explicit flush too
19131 case "$fflushNULL" in
19132 "$undef")
19133         $cat >tryp.c <<EOCP
19134 #include <stdio.h>
19135 int
19136 main(int argc, char **argv)
19137 {
19138     char buf[1024];
19139     int i;
19140     char *bp = buf;
19141     while (1) {
19142         while ((i = getc(stdin)) != -1
19143                && (*bp++ = i) != '\n'
19144                && bp < &buf[1024])
19145         /* DO NOTHING */ ;
19146         *bp = '\0';
19147         fprintf(stdout, "%s", buf);
19148         fflush(stdin);
19149         if (i == -1)
19150             return 0;
19151         bp = buf;
19152     }
19153 }
19154 EOCP
19155         set tryp
19156         if eval $compile; then
19157             $rm -f tryp.out
19158             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19159             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19160                $cat >&4 <<EOM
19161 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19162 EOM
19163                 : now check for fflushall behaviour
19164                 case "$fflushall" in
19165                 '')     set try -DTRY_FFLUSH_ALL $output
19166                         if eval $compile; then
19167                                 $cat >&4 <<EOM
19168 (Now testing the other method--but note that this also may fail.)
19169 EOM
19170                                 $run ./try 2>/dev/null
19171                                 code=$?
19172                                 $from try.out
19173                                 if $test -s try.out -a "X$code" = X42; then
19174                                         fflushall="`$cat try.out`"
19175                                 fi
19176                         fi
19177                         $rm_try
19178                         case "$fflushall" in
19179                         x)      $cat >&4 <<EOM
19180 Whew. Flushing explicitly all the stdio streams works.
19181 EOM
19182                                 fflushall="$define"
19183                                 ;;
19184                         '')     $cat >&4 <<EOM
19185 Sigh. Flushing explicitly all the stdio streams doesn't work.
19186 EOM
19187                                 fflushall="$undef"
19188                                 ;;
19189                         *)      $cat >&4 <<EOM
19190 Cannot figure out whether flushing stdio streams explicitly works or not.
19191 I'm assuming it doesn't.
19192 EOM
19193                                 fflushall="$undef"
19194                                 ;;
19195                         esac
19196                         ;;
19197                 "$define"|true|[yY]*)
19198                         fflushall="$define"
19199                         ;;
19200                 *)
19201                         fflushall="$undef"
19202                         ;;
19203                 esac
19204             else
19205                 $cat >&4 <<EOM
19206 All is futile.  Even fflush(stdin) clobbers input pipes!
19207 EOM
19208                 fflushall="$undef"
19209             fi
19210         else
19211             fflushall="$undef"
19212         fi
19213         $rm -f core tryp.c tryp.core core.tryp.*
19214         ;;
19215 *)      fflushall="$undef"
19216         ;;
19217 esac
19218
19219 case "$fflushNULL$fflushall" in
19220 undefundef)
19221         $cat <<EOM
19222 OK, I give up.  I cannot figure out how to flush pending stdio output.
19223 We won't be flushing handles at all before fork/exec/popen.
19224 EOM
19225         ;;
19226 esac
19227 $rm_try tryp
19228
19229 : Store the full pathname to the ar program for use in the C program
19230 : Respect a hint or command line value for full_ar.
19231 case "$full_ar" in
19232 '') full_ar=$ar ;;
19233 esac
19234
19235 : Store the full pathname to the sed program for use in the C program
19236 full_sed=$sed
19237
19238 : see what type gids are declared as in the kernel
19239 echo " "
19240 echo "Looking for the type for group ids returned by getgid()."
19241 set gid_t gidtype xxx stdio.h sys/types.h
19242 eval $typedef
19243 case "$gidtype" in
19244 xxx)
19245         xxx=`./findhdr sys/user.h`
19246         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19247         case $1 in
19248         unsigned) dflt="$1 $2" ;;
19249         *) dflt="$1" ;;
19250         esac
19251         ;;
19252 *) dflt="$gidtype";;
19253 esac
19254 case "$gidtype" in
19255 gid_t) echo "gid_t found." ;;
19256 *)      rp="What is the type for group ids returned by getgid()?"
19257         . ./myread
19258         gidtype="$ans"
19259         ;;
19260 esac
19261
19262 : Check the size of GID
19263 echo " "
19264 case "$gidtype" in
19265 *_t) zzz="$gidtype"     ;;
19266 *)   zzz="gid"          ;;
19267 esac
19268 echo "Checking the size of $zzz..." >&4
19269 cat > try.c <<EOCP
19270 #include <sys/types.h>
19271 #include <stdio.h>
19272 #$i_stdlib I_STDLIB
19273 #ifdef I_STDLIB
19274 #include <stdlib.h>
19275 #endif
19276 int main() {
19277     printf("%d\n", (int)sizeof($gidtype));
19278     exit(0);
19279 }
19280 EOCP
19281 set try
19282 if eval $compile_ok; then
19283         yyy=`$run ./try`
19284         case "$yyy" in
19285         '')     gidsize=4
19286                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19287                 ;;
19288         *)      gidsize=$yyy
19289                 echo "Your $zzz is $gidsize bytes long."
19290                 ;;
19291         esac
19292 else
19293         gidsize=4
19294         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19295 fi
19296
19297
19298 : Check if GID is signed
19299 echo " "
19300 case "$gidtype" in
19301 *_t) zzz="$gidtype"     ;;
19302 *)   zzz="gid"          ;;
19303 esac
19304 echo "Checking the sign of $zzz..." >&4
19305 cat > try.c <<EOCP
19306 #include <sys/types.h>
19307 #include <stdio.h>
19308 int main() {
19309         $gidtype foo = -1;
19310         if (foo < 0)
19311                 printf("-1\n");
19312         else
19313                 printf("1\n");
19314 }
19315 EOCP
19316 set try
19317 if eval $compile; then
19318         yyy=`$run ./try`
19319         case "$yyy" in
19320         '')     gidsign=1
19321                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19322                 ;;
19323         *)      gidsign=$yyy
19324                 case "$gidsign" in
19325                  1) echo "Your $zzz is unsigned." ;;
19326                 -1) echo "Your $zzz is signed."   ;;
19327                 esac
19328                 ;;
19329         esac
19330 else
19331         gidsign=1
19332         echo "(I can't compile the test program--guessing unsigned.)" >&4
19333 fi
19334
19335
19336 : Check 64bit sizes
19337 echo " "
19338
19339 if $test X"$quadtype" != X; then
19340
19341 echo "Checking how to print 64-bit integers..." >&4
19342
19343 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19344         $cat >try.c <<'EOCP'
19345 #include <sys/types.h>
19346 #include <stdio.h>
19347 int main() {
19348   int q = 12345678901;
19349   printf("%ld\n", q);
19350 }
19351 EOCP
19352         set try
19353         if eval $compile; then
19354                 yyy=`$run ./try`
19355                 case "$yyy" in
19356                 12345678901)
19357                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19358                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19359                         echo "We will use %d."
19360                         ;;
19361                 esac
19362         fi
19363 fi
19364
19365 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19366         $cat >try.c <<'EOCP'
19367 #include <sys/types.h>
19368 #include <stdio.h>
19369 int main() {
19370   long q = 12345678901;
19371   printf("%ld\n", q);
19372 }
19373 EOCP
19374         set try
19375         if eval $compile; then
19376                 yyy=`$run ./try`
19377                 case "$yyy" in
19378                 12345678901)
19379                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19380                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19381                         echo "We will use %ld."
19382                         ;;
19383                 esac
19384         fi
19385 fi
19386
19387 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19388         $cat >try.c <<'EOCP'
19389 #include <sys/types.h>
19390 #include <inttypes.h>
19391 #include <stdio.h>
19392 int main() {
19393   int64_t q = 12345678901;
19394   printf("%" PRId64 "\n", q);
19395 }
19396 EOCP
19397         set try
19398         if eval $compile; then
19399                 yyy=`$run ./try`
19400                 case "$yyy" in
19401                 12345678901)
19402                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19403                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19404                         echo "We will use the C9X style."
19405                         ;;
19406                 esac
19407         fi
19408 fi
19409
19410 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19411         $cat >try.c <<EOCP
19412 #include <sys/types.h>
19413 #include <stdio.h>
19414 int main() {
19415   $quadtype q = 12345678901;
19416   printf("%Ld\n", q);
19417 }
19418 EOCP
19419         set try
19420         if eval $compile; then
19421                 yyy=`$run ./try`
19422                 case "$yyy" in
19423                 12345678901)
19424                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19425                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19426                         echo "We will use %Ld."
19427                         ;;
19428                 esac
19429         fi
19430 fi
19431
19432 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19433         $cat >try.c <<'EOCP'
19434 #include <sys/types.h>
19435 #include <stdio.h>
19436 int main() {
19437   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19438   printf("%lld\n", q);
19439 }
19440 EOCP
19441         set try
19442         if eval $compile; then
19443                 yyy=`$run ./try`
19444                 case "$yyy" in
19445                 12345678901)
19446                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19447                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19448                         echo "We will use the %lld style."
19449                         ;;
19450                 esac
19451         fi
19452 fi
19453
19454 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19455         $cat >try.c <<EOCP
19456 #include <sys/types.h>
19457 #include <stdio.h>
19458 int main() {
19459   $quadtype q = 12345678901;
19460   printf("%qd\n", q);
19461 }
19462 EOCP
19463         set try
19464         if eval $compile; then
19465                 yyy=`$run ./try`
19466                 case "$yyy" in
19467                 12345678901)
19468                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19469                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19470                         echo "We will use %qd."
19471                         ;;
19472                 esac
19473         fi
19474 fi
19475
19476 if $test X"$sPRId64" = X; then
19477         echo "Cannot figure out how to print 64-bit integers." >&4
19478 fi
19479 $rm_try
19480
19481 fi
19482
19483 case "$sPRId64" in
19484 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19485         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19486         ;;
19487 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19488         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19489         ;;
19490 esac
19491
19492 : Check format strings for internal types
19493 echo " "
19494 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19495
19496 if $test X"$ivsize" = X8; then
19497         ivdformat="$sPRId64"
19498         uvuformat="$sPRIu64"
19499         uvoformat="$sPRIo64"
19500         uvxformat="$sPRIx64"
19501         uvXUformat="$sPRIXU64"
19502 else
19503         if $test X"$ivsize" = X"$longsize"; then
19504                 ivdformat='"ld"'
19505                 uvuformat='"lu"'
19506                 uvoformat='"lo"'
19507                 uvxformat='"lx"'
19508                 uvXUformat='"lX"'
19509         else
19510                 if $test X"$ivsize" = X"$intsize"; then
19511                         ivdformat='"d"'
19512                         uvuformat='"u"'
19513                         uvoformat='"o"'
19514                         uvxformat='"x"'
19515                         uvXUformat='"X"'
19516                 else
19517                         : far out
19518                         if $test X"$ivsize" = X"$shortsize"; then
19519                                 ivdformat='"hd"'
19520                                 uvuformat='"hu"'
19521                                 uvoformat='"ho"'
19522                                 uvxformat='"hx"'
19523                                 uvXUformat='"hX"'
19524                         fi
19525                 fi
19526         fi
19527 fi
19528
19529 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19530         nveformat="$sPRIeldbl"
19531         nvfformat="$sPRIfldbl"
19532         nvgformat="$sPRIgldbl"
19533         nvEUformat="$sPRIEUldbl"
19534         nvFUformat="$sPRIFUldbl"
19535         nvGUformat="$sPRIGUldbl"
19536 else
19537         nveformat='"e"'
19538         nvfformat='"f"'
19539         nvgformat='"g"'
19540         nvEUformat='"E"'
19541         nvFUformat='"F"'
19542         nvGUformat='"G"'
19543 fi
19544
19545 case "$ivdformat" in
19546 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19547     exit 1
19548     ;;
19549 esac
19550
19551 : Check format string for GID
19552
19553 echo " "
19554 $echo "Checking the format string to be used for gids..." >&4
19555
19556 case "$gidsign" in
19557 -1)     if $test X"$gidsize" = X"$ivsize"; then
19558                 gidformat="$ivdformat"
19559         else
19560                 if $test X"$gidsize" = X"$longsize"; then
19561                         gidformat='"ld"'
19562                 else
19563                         if $test X"$gidsize" = X"$intsize"; then
19564                                 gidformat='"d"'
19565                         else
19566                                 if $test X"$gidsize" = X"$shortsize"; then
19567                                         gidformat='"hd"'
19568                                 fi
19569                         fi
19570                 fi
19571         fi
19572         ;;
19573 *)      if $test X"$gidsize" = X"$uvsize"; then
19574                 gidformat="$uvuformat"
19575         else
19576                 if $test X"$gidsize" = X"$longsize"; then
19577                         gidformat='"lu"'
19578                 else
19579                         if $test X"$gidsize" = X"$intsize"; then
19580                                 gidformat='"u"'
19581                         else
19582                                 if $test X"$gidsize" = X"$shortsize"; then
19583                                         gidformat='"hu"'
19584                                 fi
19585                         fi
19586                 fi
19587         fi
19588         ;;
19589 esac
19590
19591 : see if getgroups exists
19592 set getgroups d_getgrps
19593 eval $inlibc
19594
19595 : see if setgroups exists
19596 set setgroups d_setgrps
19597 eval $inlibc
19598
19599 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19600 echo " "
19601 case "$d_getgrps$d_setgrps" in
19602 *define*)
19603         case "$groupstype" in
19604         '') dflt="$gidtype" ;;
19605         *)  dflt="$groupstype" ;;
19606         esac
19607         $cat <<EOM
19608 What type of pointer is the second argument to getgroups() and setgroups()?
19609 Usually this is the same as group ids, $gidtype, but not always.
19610
19611 EOM
19612         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19613         . ./myread
19614         groupstype="$ans"
19615         ;;
19616 *)  groupstype="$gidtype";;
19617 esac
19618
19619 : MAD = Misc Attribute Definition
19620
19621 if $test $patchlevel -lt 9; then
19622 : MAD is not available in 5.8.x or earlier.
19623     ans=n;
19624 else
19625     case "$mad" in
19626     $define|true|[yY]*) dflt='y' ;;
19627     *)                  dflt='n' ;;
19628     esac
19629     cat <<EOM
19630
19631 Would you like to build with Misc Attribute Decoration? This is development
19632 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19633 overhead on the interpreter.
19634
19635 If this doesn't make any sense to you, just accept the default '$dflt'.
19636 EOM
19637     rp='Build Perl with MAD?'
19638     . ./myread
19639 fi
19640 case "$ans" in
19641 y|Y)    val="$define"
19642         madlyh='madly.h madly.act madly.tab'
19643         madlysrc='madly.c'
19644         madlyobj="madly$_o" ;;
19645 *)      val="$undef"
19646         madlyh=''
19647         madlysrc=''
19648         madlyobj='' ;;
19649 esac
19650 set mad
19651 eval $setvar
19652
19653 : check whether make sets MAKE
19654 echo " "
19655 echo "Checking if your $make program sets \$(MAKE)..." >&4
19656 case "$make_set_make" in
19657 '')
19658         $sed 's/^X //' > testmake.mak << 'EOF'
19659 Xall:
19660 X       @echo 'maketemp="$(MAKE)"'
19661 EOF
19662         case "`$make -f testmake.mak 2>/dev/null`" in
19663         *maketemp=*) make_set_make='#' ;;
19664         *)      make_set_make="MAKE=$make" ;;
19665         esac
19666         $rm -f testmake.mak
19667         ;;
19668 esac
19669 case "$make_set_make" in
19670 '#') echo "Yup, it does.";;
19671 *) echo "Nope, it doesn't.";;
19672 esac
19673
19674 : see what type is used for mode_t
19675 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19676 set mode_t modetype int stdio.h sys/types.h
19677 eval $typedef_ask
19678
19679 : see if we need va_copy
19680 echo " "
19681 case "$i_stdarg" in
19682 "$define")
19683         $cat >try.c <<EOCP
19684 #include <stdarg.h>
19685 #include <stdio.h>
19686 #$i_stdlib I_STDLIB
19687 #ifdef I_STDLIB
19688 #include <stdlib.h>
19689 #endif
19690 #include <signal.h>
19691
19692 int
19693 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19694 {
19695   return vfprintf(f, fmt, *valp);
19696 }
19697
19698 int
19699 myvfprintf(FILE *f, const  char *fmt, va_list val)
19700 {
19701   return ivfprintf(f, fmt, &val);
19702 }
19703
19704 int
19705 myprintf(char *fmt, ...)
19706 {
19707   va_list val;
19708   va_start(val, fmt);
19709   return myvfprintf(stdout, fmt, val);
19710 }
19711
19712 int
19713 main(int ac, char **av)
19714 {
19715   signal(SIGSEGV, exit);
19716
19717   myprintf("%s%cs all right, then\n", "that", '\'');
19718   exit(0);
19719 }
19720 EOCP
19721         set try
19722         if eval $compile && $run ./try 2>&1 >/dev/null; then
19723                 case "`$run ./try`" in
19724                 "that's all right, then")
19725                         okay=yes
19726                         ;;
19727                 esac
19728         fi
19729         case "$okay" in
19730         yes)    echo "It seems that you don't need va_copy()." >&4
19731                 need_va_copy="$undef"
19732                 ;;
19733         *)      echo "It seems that va_copy() or similar will be needed." >&4
19734                 need_va_copy="$define"
19735                 ;;
19736         esac
19737         $rm_try
19738         ;;
19739 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19740         ;;
19741 esac
19742
19743 : see what type is used for size_t
19744 rp="What is the type used for the length parameter for string functions?"
19745 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19746 eval $typedef_ask
19747
19748 : check for type of arguments to gethostbyaddr. 
19749 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19750         case "$d_gethbyaddr" in
19751         $define)
19752                 $cat <<EOM
19753
19754 Checking to see what type of arguments are accepted by gethostbyaddr().
19755 EOM
19756                 hdrs="$define sys/types.h
19757                         $d_socket sys/socket.h 
19758                         $i_niin netinet/in.h 
19759                         $i_netdb netdb.h
19760                         $i_unistd unistd.h"
19761                 : The first arg can 'char *' or 'void *'
19762                 : The second arg is some of integral type
19763                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19764                         for yyy in size_t long int; do
19765                                 case "$netdb_host_type" in
19766                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19767                                         if ./protochk "$try" $hdrs; then
19768                                                 echo "Your system accepts $xxx for the first arg."
19769                                                 echo "...and $yyy for the second arg."
19770                                                 netdb_host_type="$xxx"
19771                                                 netdb_hlen_type="$yyy"
19772                                         fi
19773                                         ;;
19774                                 esac
19775                         done
19776                 done
19777                 : In case none of those worked, prompt the user.
19778                 case "$netdb_host_type" in
19779                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19780                         dflt='char *'
19781                         . ./myread
19782                         netdb_host_type=$ans
19783                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19784                         dflt="$sizetype"
19785                         . ./myread
19786                         netdb_hlen_type=$ans
19787                         ;;
19788                 esac
19789                 ;;
19790         *)      : no gethostbyaddr, so pick harmless defaults
19791                 netdb_host_type='char *'
19792                 netdb_hlen_type="$sizetype"
19793                 ;;
19794         esac
19795         # Remove the "const" if needed. -- but then we'll have a 
19796         # prototype clash!
19797         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19798 fi
19799
19800 : check for type of argument to gethostbyname. 
19801 if test "X$netdb_name_type" = X ; then
19802         case "$d_gethbyname" in
19803         $define)
19804                 $cat <<EOM
19805
19806 Checking to see what type of argument is accepted by gethostbyname().
19807 EOM
19808                 hdrs="$define sys/types.h
19809                         $d_socket sys/socket.h 
19810                         $i_niin netinet/in.h 
19811                         $i_netdb netdb.h
19812                         $i_unistd unistd.h"
19813                 for xxx in "const char *" "char *"; do
19814                         case "$netdb_name_type" in
19815                         '')     try="extern struct hostent *gethostbyname($xxx);"
19816                                 if ./protochk "$try" $hdrs; then
19817                                         echo "Your system accepts $xxx."
19818                                         netdb_name_type="$xxx"
19819                                 fi
19820                                 ;;
19821                         esac
19822                 done
19823                 : In case none of those worked, prompt the user.
19824                 case "$netdb_name_type" in
19825                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19826                         dflt='char *'
19827                         . ./myread
19828                         netdb_name_type=$ans
19829                         ;;
19830                 esac
19831                 ;;
19832         *)      : no gethostbyname, so pick harmless default
19833                 netdb_name_type='char *'
19834                 ;;
19835         esac
19836 fi
19837
19838 : check for type of 1st argument to getnetbyaddr. 
19839 if test "X$netdb_net_type" = X ; then
19840         case "$d_getnbyaddr" in
19841         $define)
19842                 $cat <<EOM
19843
19844 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19845 EOM
19846                 hdrs="$define sys/types.h
19847                         $d_socket sys/socket.h 
19848                         $i_niin netinet/in.h 
19849                         $i_netdb netdb.h
19850                         $i_unistd unistd.h"
19851                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19852                         case "$netdb_net_type" in
19853                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19854                                 if ./protochk "$try" $hdrs; then
19855                                         echo "Your system accepts $xxx."
19856                                         netdb_net_type="$xxx"
19857                                 fi
19858                                 ;;
19859                         esac
19860                 done
19861                 : In case none of those worked, prompt the user.
19862                 case "$netdb_net_type" in
19863                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19864                         dflt='long'
19865                         . ./myread
19866                         netdb_net_type=$ans
19867                         ;;
19868                 esac
19869                 ;;
19870         *)      : no getnetbyaddr, so pick harmless default
19871                 netdb_net_type='long'
19872                 ;;
19873         esac
19874 fi
19875 : locate the preferred pager for this system
19876 fn=f/
19877 case "$pager" in
19878 '')
19879         dflt=''
19880         case "$pg" in
19881         /*) dflt=$pg;;
19882         [a-zA-Z]:/*) dflt=$pg;;
19883         esac
19884         case "$more" in
19885         /*) dflt=$more;;
19886         [a-zA-Z]:/*) dflt=$more;;
19887         esac
19888         case "$less" in
19889         /*) dflt=$less;;
19890         [a-zA-Z]:/*) dflt=$less;;
19891         esac
19892         case "$dflt" in
19893         '') dflt=/usr/ucb/more;;
19894         esac
19895         ;;
19896 *)      dflt="$pager"
19897         : Instruct ./getfile to trust the hinted or previous pager value,
19898         : even if it does not begin with a slash.  For example, on os2,
19899         : pager might be cmd /c more.  See comments in UU/getfile.
19900         fn="f/($pager)"
19901         ;;
19902 esac
19903 echo " "
19904 rp='What pager is used on your system?'
19905 . ./getfile
19906 pager="$ans"
19907
19908 : see what type pids are declared as in the kernel
19909 rp="What is the type of process ids on this system?"
19910 set pid_t pidtype int stdio.h sys/types.h
19911 eval $typedef_ask
19912
19913 : see if ar generates random libraries by itself
19914 echo " "
19915 echo "Checking how to generate random libraries on your machine..." >&4
19916 echo 'int bar1() { return bar2(); }' > bar1.c
19917 echo 'int bar2() { return 2; }' > bar2.c
19918 $cat > foo.c <<EOP
19919 #$i_stdlib I_STDLIB
19920 #ifdef I_STDLIB
19921 #include <stdlib.h>
19922 #endif
19923 int main() { printf("%d\n", bar1()); exit(0); }
19924 EOP
19925 $cc $ccflags -c bar1.c >/dev/null 2>&1
19926 $cc $ccflags -c bar2.c >/dev/null 2>&1
19927 $cc $ccflags -c foo.c >/dev/null 2>&1
19928 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19929 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19930         $run ./foobar >/dev/null 2>&1; then
19931         echo "$ar appears to generate random libraries itself."
19932         orderlib=false
19933         if [ "X$ranlib" = "X" ]; then
19934             ranlib=":"
19935         fi
19936 elif $ar s bar$_a >/dev/null 2>&1 &&
19937         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19938         $run ./foobar >/dev/null 2>&1; then
19939                 echo "a table of contents needs to be added with '$ar s'."
19940                 orderlib=false
19941                 ranlib="$ar s"
19942 elif $ar ts bar$_a >/dev/null 2>&1 &&
19943         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19944         $run ./foobar >/dev/null 2>&1; then
19945                 echo "a table of contents needs to be added with '$ar ts'."
19946                 orderlib=false
19947                 ranlib="$ar ts"
19948 else
19949         case "$ranlib" in
19950         :) ranlib='';;
19951         '')
19952                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19953                 $test -f $ranlib || ranlib=''
19954                 ;;
19955         esac
19956         if $test -n "$ranlib"; then
19957                 echo "your system has '$ranlib'; we'll use that."
19958                 orderlib=false
19959         else
19960                 echo "your system doesn't seem to support random libraries"
19961                 echo "so we'll use lorder and tsort to order the libraries."
19962                 orderlib=true
19963                 ranlib=":"
19964         fi
19965 fi
19966 $rm -f foo* bar*
19967
19968 : check for type of arguments to select.
19969 case "$selecttype" in
19970 '') case "$d_select" in
19971         $define)
19972                 echo " "
19973                 $cat <<EOM
19974 Checking to see what type of arguments are accepted by select().
19975 EOM
19976                 hdrs="$define sys/types.h
19977                         $i_systime sys/time.h
19978                         $i_sysselct sys/select.h
19979                         $d_socket sys/socket.h"
19980                 : The first arg can be int, unsigned, or size_t
19981                 : The last arg may or may not be 'const'
19982                 val=''
19983                 : void pointer has been seen but using that
19984                 : breaks the selectminbits test
19985                 for xxx in 'fd_set *' 'int *'; do
19986                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19987                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19988                                         case "$val" in
19989                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19990                                                 if ./protochk "$try" $hdrs; then
19991                                                         echo "Your system accepts $xxx."
19992                                                         val="$xxx"
19993                                                 fi
19994                                                 ;;
19995                                         esac
19996                                 done
19997                         done
19998                 done
19999                 case "$val" in
20000                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20001                         case "$d_fd_set" in
20002                                 $define) dflt="fd_set *" ;;
20003                                 *)              dflt="int *" ;;
20004                         esac
20005                         . ./myread
20006                         val=$ans
20007                         ;;
20008                 esac
20009                 selecttype="$val"
20010                 ;;
20011         *)      : no select, so pick a harmless default
20012                 selecttype='int *'
20013                 ;;
20014         esac
20015         ;;
20016 esac
20017
20018 : check for the select 'width'
20019 case "$selectminbits" in
20020 '') safebits=`expr $ptrsize \* 8`
20021     case "$d_select" in
20022         $define)
20023                 $cat <<EOM
20024
20025 Checking to see on how many bits at a time your select() operates...
20026 EOM
20027                 $cat >try.c <<EOCP
20028 #include <sys/types.h>
20029 #$i_time I_TIME
20030 #$i_systime I_SYS_TIME
20031 #$i_systimek I_SYS_TIME_KERNEL
20032 #ifdef I_TIME
20033 #   include <time.h>
20034 #endif
20035 #ifdef I_SYS_TIME
20036 #   ifdef I_SYS_TIME_KERNEL
20037 #       define KERNEL
20038 #   endif
20039 #   include <sys/time.h>
20040 #   ifdef I_SYS_TIME_KERNEL
20041 #       undef KERNEL
20042 #   endif
20043 #endif
20044 #$i_sysselct I_SYS_SELECT
20045 #ifdef I_SYS_SELECT
20046 #include <sys/select.h>
20047 #endif
20048 #$d_socket HAS_SOCKET
20049 #ifdef HAS_SOCKET
20050 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20051 #endif
20052 #include <stdio.h>
20053 #$i_stdlib I_STDLIB
20054 #ifdef I_STDLIB
20055 #include <stdlib.h>
20056 #endif
20057 $selecttype b;
20058 #define S sizeof(*(b))
20059 #define MINBITS 64
20060 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20061 #define NBITS  (NBYTES * 8)
20062 int main() {
20063     char *s = (char *)malloc(NBYTES);
20064     struct timeval t;
20065     int i;
20066     FILE* fp;
20067     int fd;
20068
20069     if (!s)
20070         exit(1);
20071     fclose(stdin);
20072     fp = fopen("try.c", "r");
20073     if (fp == 0)
20074       exit(2);
20075     fd = fileno(fp);
20076     if (fd < 0)
20077       exit(3);
20078     b = ($selecttype)s;
20079     for (i = 0; i < NBITS; i++)
20080         FD_SET(i, b);
20081     t.tv_sec  = 0;
20082     t.tv_usec = 0;
20083     select(fd + 1, b, 0, 0, &t);
20084     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20085     free(s);
20086     printf("%d\n", i + 1);
20087     return 0;
20088 }
20089 EOCP
20090                 set try
20091                 if eval $compile_ok; then
20092                         selectminbits=`$run ./try`
20093                         case "$selectminbits" in
20094                         '')     cat >&4 <<EOM
20095 Cannot figure out on how many bits at a time your select() operates.
20096 I'll play safe and guess it is $safebits bits.
20097 EOM
20098                                 selectminbits=$safebits
20099                                 bits="$safebits bits"
20100                                 ;;
20101                         1)      bits="1 bit" ;;
20102                         *)      bits="$selectminbits bits" ;;
20103                         esac
20104                         echo "Your select() operates on $bits at a time." >&4
20105                 else
20106                         rp='What is the minimum number of bits your select() operates on?'
20107                         case "$byteorder" in
20108                         12345678)       dflt=64 ;;
20109                         1234)           dflt=32 ;;
20110                         *)              dflt=1  ;;
20111                         esac
20112                         . ./myread
20113                         val=$ans
20114                         selectminbits="$val"
20115                 fi
20116                 $rm_try
20117                 ;;
20118         *)      : no select, so pick a harmless default
20119                 selectminbits=$safebits
20120                 ;;
20121         esac
20122         ;;
20123 esac
20124
20125 : Trace out the files included by signal.h, then look for SIGxxx names.
20126 if [ "X$fieldn" = X ]; then
20127         : Just make some guesses.  We check them later.
20128         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20129 else
20130         xxx=`echo '#include <signal.h>' |
20131         $cppstdin $cppminus $cppflags 2>/dev/null |
20132         $grep '^[       ]*#.*include' |
20133         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20134                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20135 fi
20136 xxxfiles=''
20137 for xx in $xxx /dev/null ; do
20138         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20139 done
20140 case "$xxxfiles" in
20141 '')     xxxfiles=`./findhdr signal.h` ;;
20142 esac
20143 xxx=`awk '
20144 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20145         print substr($2, 4, 20)
20146 }
20147 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20148         print substr($3, 4, 20)
20149 }' $xxxfiles`
20150 : Append some common names just in case the awk scan failed.
20151 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20152 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20153 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20154 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20155 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20156
20157 : generate a few handy files for later
20158 $cat > signal.c <<EOCP
20159 #include <sys/types.h>
20160 #include <signal.h>
20161 #$i_stdlib I_STDLIB
20162 #ifdef I_STDLIB
20163 #include <stdlib.h>
20164 #endif
20165 #include <stdio.h>
20166 int main() {
20167
20168 /* Strange style to avoid deeply-nested #if/#else/#endif */
20169 #ifndef NSIG
20170 #  ifdef _NSIG
20171 #    define NSIG (_NSIG)
20172 #  endif
20173 #endif
20174
20175 #ifndef NSIG
20176 #  ifdef SIGMAX
20177 #    define NSIG (SIGMAX+1)
20178 #  endif
20179 #endif
20180
20181 #ifndef NSIG
20182 #  ifdef SIG_MAX
20183 #    define NSIG (SIG_MAX+1)
20184 #  endif
20185 #endif
20186
20187 #ifndef NSIG
20188 #  ifdef _SIG_MAX
20189 #    define NSIG (_SIG_MAX+1)
20190 #  endif
20191 #endif
20192
20193 #ifndef NSIG
20194 #  ifdef MAXSIG
20195 #    define NSIG (MAXSIG+1)
20196 #  endif
20197 #endif
20198
20199 #ifndef NSIG
20200 #  ifdef MAX_SIG
20201 #    define NSIG (MAX_SIG+1)
20202 #  endif
20203 #endif
20204
20205 #ifndef NSIG
20206 #  ifdef SIGARRAYSIZE
20207 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20208 #  endif
20209 #endif
20210
20211 #ifndef NSIG
20212 #  ifdef _sys_nsig
20213 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20214 #  endif
20215 #endif
20216
20217 /* Default to some arbitrary number that's big enough to get most
20218    of the common signals.
20219 */
20220 #ifndef NSIG
20221 #    define NSIG 50
20222 #endif
20223
20224 printf("NSIG %d\n", NSIG);
20225
20226 #ifndef JUST_NSIG
20227
20228 EOCP
20229
20230 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20231 {
20232         printf "#ifdef SIG"; printf $1; printf "\n"
20233         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20234         printf $1; printf ");\n"
20235         printf "#endif\n"
20236 }
20237 END {
20238         printf "#endif /* JUST_NSIG */\n";
20239         printf "exit(0);\n}\n";
20240 }
20241 ' >>signal.c
20242 $cat >signal.awk <<'EOP'
20243 BEGIN { ndups = 0 }
20244 $1 ~ /^NSIG$/ { nsig = $2 }
20245 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20246     if ($2 > maxsig) { maxsig = $2 }
20247     if (sig_name[$2]) {
20248         dup_name[ndups] = $1
20249         dup_num[ndups] = $2
20250         ndups++
20251     }
20252     else {
20253         sig_name[$2] = $1
20254         sig_num[$2] = $2
20255     }
20256 }
20257 END {
20258     if (nsig == 0) {
20259         nsig = maxsig + 1
20260     }
20261     printf("NSIG %d\n", nsig);
20262     for (n = 1; n < nsig; n++) {
20263         if (sig_name[n]) {
20264             printf("%s %d\n", sig_name[n], sig_num[n])
20265         }
20266         else {
20267             printf("NUM%d %d\n", n, n)
20268         }
20269     }
20270     for (n = 0; n < ndups; n++) {
20271         printf("%s %d\n", dup_name[n], dup_num[n])
20272     }
20273 }
20274 EOP
20275 $cat >signal_cmd <<EOS
20276 $startsh
20277 if $test -s signal.lst; then
20278     echo "Using your existing signal.lst file"
20279         exit 0
20280 fi
20281 xxx="$xxx"
20282 EOS
20283 $cat >>signal_cmd <<'EOS'
20284
20285 set signal
20286 if eval $compile_ok; then
20287         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20288                 $uniq | $awk -f signal.awk >signal.lst
20289 else
20290         echo "(I can't seem be able to compile the whole test program)" >&4
20291         echo "(I'll try it in little pieces.)" >&4
20292         set signal -DJUST_NSIG
20293         if eval $compile_ok; then
20294                 $run ./signal$_exe > signal.nsg
20295                 $cat signal.nsg
20296         else
20297                 echo "I can't seem to figure out how many signals you have." >&4
20298                 echo "Guessing 50." >&4
20299                 echo 'NSIG 50' > signal.nsg
20300         fi
20301         : Now look at all the signal names, one at a time.
20302         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20303                 $cat > signal.c <<EOCP
20304 #include <sys/types.h>
20305 #include <signal.h>
20306 #include <stdio.h>
20307 int main() {
20308 printf("$xx %d\n", SIG${xx});
20309 return 0;
20310 }
20311 EOCP
20312                 set signal
20313                 if eval $compile; then
20314                         echo "SIG${xx} found."
20315                         $run ./signal$_exe  >> signal.ls1
20316                 else
20317                         echo "SIG${xx} NOT found."
20318                 fi
20319         done
20320         if $test -s signal.ls1; then
20321                 $cat signal.nsg signal.ls1 |
20322                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20323         fi
20324
20325 fi
20326 if $test -s signal.lst; then
20327         :
20328 else
20329         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20330         echo 'kill -l' >signal
20331         set X `csh -f <signal`
20332         $rm -f signal
20333         shift
20334         case $# in
20335         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20336         esac
20337         echo $@ | $tr ' ' $trnl | \
20338             $awk '{ printf "%s %d\n", $1, ++s; }
20339                   END { printf "NSIG %d\n", ++s }' >signal.lst
20340 fi
20341 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20342 EOS
20343 chmod a+x signal_cmd
20344 $eunicefix signal_cmd
20345
20346 : generate list of signal names
20347 echo " "
20348 case "$sig_name_init" in
20349 '') doinit=yes ;;
20350 *)  case "$sig_num_init" in
20351     ''|*,*) doinit=yes ;;
20352     esac ;;
20353 esac
20354 case "$doinit" in
20355 yes)
20356         echo "Generating a list of signal names and numbers..." >&4
20357         . ./signal_cmd
20358         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20359         sig_name=`$awk 'BEGIN { printf "ZERO " }
20360                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20361         sig_num=`$awk  'BEGIN { printf "0 " }
20362                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20363         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20364                              !/^NSIG/   { printf "\"%s\", ", $1 }
20365                              END        { printf "0\n" }' signal.lst`
20366         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20367                              !/^NSIG/   { printf "%d, ", $2}
20368                              END        { printf "0\n"}' signal.lst`
20369         ;;
20370 esac
20371 echo "The following $sig_count signals are available:"
20372 echo " "
20373 echo $sig_name | $awk \
20374 'BEGIN { linelen = 0 }
20375 {
20376         for (i = 1; i <= NF; i++) {
20377                 name = "SIG" $i " "
20378                 linelen = linelen + length(name)
20379                 if (linelen > 70) {
20380                         printf "\n"
20381                         linelen = length(name)
20382                 }
20383                 printf "%s", name
20384         }
20385         printf "\n"
20386 }'
20387 sig_size=`echo $sig_name | awk '{print NF}'`
20388 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20389
20390 : Check size of size
20391 echo " "
20392 case "$sizetype" in
20393 *_t) zzz="$sizetype"    ;;
20394 *)   zzz="filesize"     ;;
20395 esac
20396 echo "Checking the size of $zzz..." >&4
20397 cat > try.c <<EOCP
20398 #include <sys/types.h>
20399 #include <stdio.h>
20400 #$i_stdlib I_STDLIB
20401 #ifdef I_STDLIB
20402 #include <stdlib.h>
20403 #endif
20404 int main() {
20405     printf("%d\n", (int)sizeof($sizetype));
20406     exit(0);
20407 }
20408 EOCP
20409 set try
20410 if eval $compile_ok; then
20411         yyy=`$run ./try`
20412         case "$yyy" in
20413         '')     sizesize=4
20414                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20415                 ;;
20416         *)      sizesize=$yyy
20417                 echo "Your $zzz size is $sizesize bytes."
20418                 ;;
20419         esac
20420 else
20421         sizesize=4
20422         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20423 fi
20424
20425
20426 : check for socklen_t
20427 echo " "
20428 echo "Checking to see if you have socklen_t..." >&4
20429 $cat >try.c <<EOCP
20430 #include <sys/types.h>
20431 #$d_socket HAS_SOCKET
20432 #ifdef HAS_SOCKET
20433 #include <sys/socket.h>
20434 #endif
20435 int main() { socklen_t x = 16; }
20436 EOCP
20437 set try
20438 if eval $compile; then
20439         val="$define"
20440         echo "You have socklen_t."
20441 else
20442         val="$undef"
20443         echo "You do not have socklen_t."
20444         case "$sizetype" in
20445         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20446         esac
20447 fi
20448 $rm_try
20449 set d_socklen_t
20450 eval $setvar
20451
20452 : see if this is a socks.h system
20453 set socks.h i_socks
20454 eval $inhdr
20455
20456 : check for type of the size argument to socket calls
20457 case "$d_socket" in
20458 "$define")
20459         $cat <<EOM
20460
20461 Checking to see what type is the last argument of accept().
20462 EOM
20463         yyy=''
20464         case "$d_socklen_t" in
20465         "$define") yyy="$yyy socklen_t"
20466         esac
20467         yyy="$yyy $sizetype int long unsigned"
20468         for xxx in $yyy; do
20469                 case "$socksizetype" in
20470                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20471                         case "$usesocks" in
20472                         "$define")
20473                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20474                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20475                                         socksizetype="$xxx"
20476                                 fi
20477                                 ;;
20478                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20479                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20480                                         socksizetype="$xxx"
20481                                 fi
20482                                 ;;
20483                         esac
20484                         ;;
20485                 esac
20486         done
20487 : In case none of those worked, prompt the user.
20488         case "$socksizetype" in
20489         '')     rp='What is the type for socket address structure sizes?'
20490                 dflt='int'
20491                 . ./myread
20492                 socksizetype=$ans
20493                 ;;
20494         esac
20495         ;;
20496 *)      : no sockets, so pick relatively harmless default
20497         socksizetype='int'
20498         ;;
20499 esac
20500
20501 : see what type is used for signed size_t
20502 set ssize_t ssizetype int stdio.h sys/types.h
20503 eval $typedef
20504 dflt="$ssizetype"
20505 $cat > try.c <<EOM
20506 #include <stdio.h>
20507 #$i_stdlib I_STDLIB
20508 #ifdef I_STDLIB
20509 #include <stdlib.h>
20510 #endif
20511 #include <sys/types.h>
20512 #define Size_t $sizetype
20513 #define SSize_t $dflt
20514 int main()
20515 {
20516         if (sizeof(Size_t) == sizeof(SSize_t))
20517                 printf("$dflt\n");
20518         else if (sizeof(Size_t) == sizeof(int))
20519                 printf("int\n");
20520         else
20521                 printf("long\n");
20522         exit(0);
20523 }
20524 EOM
20525 echo " "
20526 set try
20527 if eval $compile_ok && $run ./try > /dev/null; then
20528         ssizetype=`$run ./try`
20529         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20530 else
20531         $cat >&4 <<EOM
20532 Help! I can't compile and run the ssize_t test program: please enlighten me!
20533 (This is probably a misconfiguration in your system or libraries, and
20534 you really ought to fix it.  Still, I'll try anyway.)
20535
20536 I need a type that is the same size as $sizetype, but is guaranteed to
20537 be signed.  Common values are ssize_t, int and long.
20538
20539 EOM
20540         rp="What signed type is the same size as $sizetype?"
20541         . ./myread
20542         ssizetype="$ans"
20543 fi
20544 $rm_try
20545
20546 : see what type of char stdio uses.
20547 echo " "
20548 echo '#include <stdio.h>' > stdio.c
20549 $cppstdin $cppminus < stdio.c > stdioh
20550 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20551         echo "Your stdio uses unsigned chars." >&4
20552         stdchar="unsigned char"
20553 else
20554         echo "Your stdio uses signed chars." >&4
20555         stdchar="char"
20556 fi
20557 $rm -f stdio.* stdioh
20558
20559 : see what type uids are declared as in the kernel
20560 echo " "
20561 echo "Looking for the type for user ids returned by getuid()."
20562 set uid_t uidtype xxx stdio.h sys/types.h
20563 eval $typedef
20564 case "$uidtype" in
20565 xxx)
20566         xxx=`./findhdr sys/user.h`
20567         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20568         case $1 in
20569         unsigned) dflt="$1 $2" ;;
20570         *) dflt="$1" ;;
20571         esac
20572         ;;
20573 *) dflt="$uidtype";;
20574 esac
20575 case "$uidtype" in
20576 uid_t)  echo "uid_t found." ;;
20577 *)      rp="What is the type for user ids returned by getuid()?"
20578         . ./myread
20579         uidtype="$ans"
20580         ;;
20581 esac
20582
20583 : Check size of UID
20584 echo " "
20585 case "$uidtype" in
20586 *_t) zzz="$uidtype"     ;;
20587 *)   zzz="uid"          ;;
20588 esac
20589 echo "Checking the size of $zzz..." >&4
20590 cat > try.c <<EOCP
20591 #include <sys/types.h>
20592 #include <stdio.h>
20593 #$i_stdlib I_STDLIB
20594 #ifdef I_STDLIB
20595 #include <stdlib.h>
20596 #endif
20597 int main() {
20598     printf("%d\n", (int)sizeof($uidtype));
20599     exit(0);
20600 }
20601 EOCP
20602 set try
20603 if eval $compile_ok; then
20604         yyy=`$run ./try`
20605         case "$yyy" in
20606         '')     uidsize=4
20607                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20608                 ;;
20609         *)      uidsize=$yyy
20610                 echo "Your $zzz is $uidsize bytes long."
20611                 ;;
20612         esac
20613 else
20614         uidsize=4
20615         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20616 fi
20617
20618 : Check if UID is signed
20619 echo " "
20620 case "$uidtype" in
20621 *_t) zzz="$uidtype"     ;;
20622 *)   zzz="uid"          ;;
20623 esac
20624 echo "Checking the sign of $zzz..." >&4
20625 cat > try.c <<EOCP
20626 #include <sys/types.h>
20627 #include <stdio.h>
20628 int main() {
20629         $uidtype foo = -1;
20630         if (foo < 0)
20631                 printf("-1\n");
20632         else
20633                 printf("1\n");
20634 }
20635 EOCP
20636 set try
20637 if eval $compile; then
20638         yyy=`$run ./try`
20639         case "$yyy" in
20640         '')     uidsign=1
20641                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20642                 ;;
20643         *)      uidsign=$yyy
20644                 case "$uidsign" in
20645                  1) echo "Your $zzz is unsigned." ;;
20646                 -1) echo "Your $zzz is signed."   ;;
20647                 esac
20648                 ;;
20649         esac
20650 else
20651         uidsign=1
20652         echo "(I can't compile the test program--guessing unsigned.)" >&4
20653 fi
20654
20655
20656 : Check format string for UID
20657 echo " "
20658 $echo "Checking the format string to be used for uids..." >&4
20659
20660 case "$uidsign" in
20661 -1)     if $test X"$uidsize" = X"$ivsize"; then
20662                 uidformat="$ivdformat"
20663         else
20664                 if $test X"$uidsize" = X"$longsize"; then
20665                         uidformat='"ld"'
20666                 else
20667                         if $test X"$uidsize" = X"$intsize"; then
20668                                 uidformat='"d"'
20669                         else
20670                                 if $test X"$uidsize" = X"$shortsize"; then
20671                                         uidformat='"hd"'
20672                                 fi
20673                         fi
20674                 fi
20675         fi
20676         ;;
20677 *)      if $test X"$uidsize" = X"$uvsize"; then
20678                 uidformat="$uvuformat"
20679         else
20680                 if $test X"$uidsize" = X"$longsize"; then
20681                         uidformat='"lu"'
20682                 else
20683                         if $test X"$uidsize" = X"$intsize"; then
20684                                 uidformat='"u"'
20685                         else
20686                                 if $test X"$uidsize" = X"$shortsize"; then
20687                                         uidformat='"hu"'
20688                                 fi
20689                         fi
20690                 fi
20691         fi
20692         ;;
20693 esac
20694
20695 : Check if site customization support was requested
20696 case "$usesitecustomize" in
20697     $define|true|[Yy]*)
20698         usesitecustomize="$define"
20699         ;;
20700     *)
20701         usesitecustomize="$undef"
20702         ;;
20703     esac
20704
20705 : determine compiler compiler
20706 case "$yacc" in
20707 '')
20708         dflt=yacc;;
20709 *)
20710         dflt="$yacc";;
20711 esac
20712 echo " "
20713 comp='yacc'
20714 if $test -f "$byacc$_exe"; then
20715         dflt="$byacc"
20716         comp="byacc or $comp"
20717 fi
20718 if $test -f "$bison$_exe"; then
20719         comp="$comp or bison -y"
20720 fi
20721 rp="Which compiler compiler ($comp) shall I use?"
20722 . ./myread
20723 yacc="$ans"
20724 case "$yacc" in
20725 *bis*)
20726         case "$yacc" in
20727         *-y*) ;;
20728         *)
20729                 yacc="$yacc -y"
20730                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20731                 ;;
20732         esac
20733         ;;
20734 esac
20735
20736 : see if this is a assert.h system
20737 set assert.h i_assert
20738 eval $inhdr
20739
20740 : see if this is a fp.h system
20741 set fp.h i_fp
20742 eval $inhdr
20743
20744 : see if this is a fp_class.h system
20745 set fp_class.h i_fp_class
20746 eval $inhdr
20747
20748 : see if gdbm.h is available
20749 set gdbm.h t_gdbm
20750 eval $inhdr
20751 case "$t_gdbm" in
20752 $define)
20753         : see if gdbm_open exists
20754         set gdbm_open d_gdbm_open
20755         eval $inlibc
20756         case "$d_gdbm_open" in
20757         $undef)
20758                 t_gdbm="$undef"
20759                 echo "We won't be including <gdbm.h>"
20760                 ;;
20761         esac
20762         ;;
20763 esac
20764 val="$t_gdbm"
20765 set i_gdbm
20766 eval $setvar
20767
20768 : see if this is a ieeefp.h system
20769 case "$i_ieeefp" in
20770 '' ) set ieeefp.h i_ieeefp
20771      eval $inhdr
20772      ;;
20773 esac
20774
20775 : see if this is a libutil.h system
20776 set libutil.h i_libutil
20777 eval $inhdr
20778
20779 : see if mach cthreads are available
20780 if test "X$usethreads" = "X$define"; then
20781         set mach/cthreads.h i_machcthr
20782         eval $inhdr
20783 else
20784         i_machcthr="$undef"
20785 fi
20786
20787 : see if this is a mntent.h system
20788 set mntent.h i_mntent
20789 eval $inhdr
20790
20791 : see if ndbm.h is available
20792 set ndbm.h t_ndbm
20793 eval $inhdr
20794
20795 case "$t_ndbm" in
20796 $undef)
20797     # Some Linux distributions such as RedHat 7.1 put the
20798     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20799     if $test -f /usr/include/gdbm/ndbm.h; then
20800         echo '<gdbm/ndbm.h> found.'
20801         ccflags="$ccflags -I/usr/include/gdbm"
20802         cppflags="$cppflags -I/usr/include/gdbm"
20803         t_ndbm=$define
20804     fi
20805     ;;
20806 esac
20807
20808 case "$t_ndbm" in
20809 $define)
20810         : see if dbm_open exists
20811         set dbm_open d_dbm_open
20812         eval $inlibc
20813         case "$d_dbm_open" in
20814         $undef)
20815                 t_ndbm="$undef"
20816                 echo "We won't be including <ndbm.h>"
20817                 ;;
20818         esac
20819         ;;
20820 esac
20821 val="$t_ndbm"
20822 set i_ndbm
20823 eval $setvar
20824
20825 : see if net/errno.h is available
20826 val=''
20827 set net/errno.h val
20828 eval $inhdr
20829
20830 : Unfortunately, it causes problems on some systems.  Arrgh.
20831 case "$val" in
20832 $define)
20833         cat > try.c <<'EOM'
20834 #include <stdio.h>
20835 #include <errno.h>
20836 #include <net/errno.h>
20837 int func()
20838 {
20839         return ENOTSOCK;
20840 }
20841 EOM
20842         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20843                 echo "We'll be including <net/errno.h>." >&4
20844         else
20845                 echo "We won't be including <net/errno.h>." >&4
20846                 val="$undef"
20847         fi
20848         $rm_try
20849         ;;
20850 esac
20851 set i_neterrno
20852 eval $setvar
20853
20854 : see if netinet/tcp.h is available
20855 set netinet/tcp.h i_netinettcp
20856 eval $inhdr
20857
20858 : see if this is a poll.h system
20859 set poll.h i_poll
20860 eval $inhdr
20861
20862 : see if this is a prot.h system
20863 set prot.h i_prot
20864 eval $inhdr
20865
20866 : Preprocessor symbols
20867 echo " "
20868 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20869 $cat <<'EOSH' > Cppsym.know
20870 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20871 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20872 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20873 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20874 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20875 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20876 bull c cadmus clipper CMU COFF COMPILER_VERSION
20877 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20878 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20879 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20880 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20881 GLIBC GLIBC_MINOR
20882 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20883 H3050R H3050RX hbullx20 hcx host_mips
20884 hp200 hp300 hp700 HP700 hp800 hp9000
20885 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20886 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20887 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20888 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20889 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20890 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20891 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20892 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20893 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20894 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20895 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20896 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20897 MATH_HAS_NO_SIDE_EFFECTS
20898 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20899 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20900 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20901 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20902 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20903 NetBSD news1500 news1700 news1800 news1900 news3700
20904 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20905 ns32016 ns32332 ns32k nsc32000
20906 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20907 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20908 pc532 pdp11 PGC PIC plexus PORTAR posix
20909 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20910 POSIX_C_SOURCE POSIX_SOURCE POWER
20911 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20912 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20913 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20914 sony sony_news sonyrisc sparc sparclite spectrum
20915 stardent stdc STDC_EXT stratos sun sun3 sun386
20916 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20917 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20918 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20919 sysV68 sysV88 Tek4132 Tek4300 titan
20920 TM3200 TM5400 TM5600
20921 tower tower32 tower32_200 tower32_600 tower32_700
20922 tower32_800 tower32_850 tss
20923 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20924 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20925 unix UNIX95 UNIX99 unixpc unos
20926 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20927 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20928 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20929 USGr4 USGr4_2
20930 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20931 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20932 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20933 z8000
20934 EOSH
20935 # Maybe put other stuff here too.
20936 cat <<EOSH >>Cppsym.know
20937 $osname
20938 EOSH
20939 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20940 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20941 $cat Cppsym.know > Cppsym.c
20942 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20943 $rm -f Cppsym.a Cppsym.b Cppsym.c
20944 cat <<EOSH > Cppsym
20945 $startsh
20946 if $test \$# -gt 0; then
20947     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20948     if $test -s Cppsym.got; then
20949         $rm -f Cppsym.got
20950         exit 0
20951     fi
20952     $rm -f Cppsym.got
20953     exit 1
20954 else
20955     $tr " " "$trnl" | ./Cppsym.try
20956     exit 0
20957 fi
20958 EOSH
20959 chmod +x Cppsym
20960 $eunicefix Cppsym
20961 cat <<EOSH > Cppsym.try
20962 $startsh
20963 cat <<'EOCP' > try.c
20964 #include <stdio.h>
20965 #if cpp_stuff == 1
20966 #define STRINGIFY(a)    "a"
20967 #endif
20968 #if cpp_stuff == 42
20969 #define StGiFy(a)  #a
20970 #define STRINGIFY(a)    StGiFy(a)
20971 #endif
20972 #if $cpp_stuff != 1 && $cpp_stuff != 42
20973 #   include "Bletch: How does this C preprocessor stringify macros?"
20974 #endif
20975 int main() {
20976 EOCP
20977 $awk \\
20978 EOSH
20979 cat <<'EOSH' >> Cppsym.try
20980 'length($1) > 0 {
20981     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20982     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20983     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20984     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20985 }'       >> try.c
20986 echo 'return 0;}' >> try.c
20987 EOSH
20988 cat <<EOSH >> Cppsym.try
20989 ccflags="$ccflags"
20990 case "$osname-$gccversion" in
20991 irix-) ccflags="\$ccflags -woff 1178" ;;
20992 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20993 esac
20994 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20995 EOSH
20996 chmod +x Cppsym.try
20997 $eunicefix Cppsym.try
20998 ./Cppsym < Cppsym.know > Cppsym.true
20999 : Add in any linux cpp "predefined macros":
21000 case "$osname::$gccversion" in
21001   *linux*::*.*)
21002     tHdrH=_tmpHdr
21003     rm -f $tHdrH'.h' $tHdrH
21004     touch $tHdrH'.h'
21005     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21006        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21007        if [ -s $tHdrH'_cppsym.real' ]; then
21008           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21009        fi
21010     fi
21011     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21012   ;;
21013 esac
21014 : now check the C compiler for additional symbols
21015 postprocess_cc_v=''
21016 case "$osname" in
21017 aix) postprocess_cc_v="|$tr , ' '" ;;
21018 esac
21019 $cat >ccsym <<EOS
21020 $startsh
21021 $cat >tmp.c <<EOF
21022 extern int foo;
21023 EOF
21024 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21025 do
21026         case "\$i" in
21027         -D*) echo "\$i" | $sed 's/^-D//';;
21028         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21029         esac
21030 done
21031 $rm_try
21032 EOS
21033 postprocess_cc_v=''
21034 chmod +x ccsym
21035 $eunicefix ccsym
21036 ./ccsym > ccsym1.raw
21037 if $test -s ccsym1.raw; then
21038        $sort ccsym1.raw | $uniq >ccsym.raw
21039 else
21040        mv ccsym1.raw ccsym.raw
21041 fi
21042
21043 $awk '/\=/ { print $0; next }
21044         { print $0"=1" }' ccsym.raw >ccsym.list
21045 $comm -13 Cppsym.true ccsym.list >ccsym.own
21046 $comm -12 Cppsym.true ccsym.list >ccsym.com
21047 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21048 also=''
21049 if $test -z ccsym.raw; then
21050         echo "Your C compiler doesn't seem to define any symbols!" >&4
21051         echo " "
21052         echo "However, your C preprocessor defines the following symbols:"
21053         $cat Cppsym.true
21054         ccsymbols=''
21055         cppsymbols=`$cat Cppsym.true`
21056         cppsymbols=`echo $cppsymbols`
21057         cppccsymbols="$cppsymbols"
21058 else
21059         if $test -s ccsym.com; then
21060                 echo "Your C compiler and pre-processor define these symbols:"
21061                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21062                 also='also '
21063                 symbols='ones'
21064                 cppccsymbols=`$cat ccsym.com`
21065                 cppccsymbols=`echo $cppccsymbols`
21066                 $test "$silent" || sleep 1
21067         fi
21068         if $test -s ccsym.cpp; then
21069                 $test "$also" && echo " "
21070                 echo "Your C pre-processor ${also}defines the following symbols:"
21071                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21072                 also='further '
21073                 cppsymbols=`$cat ccsym.cpp`
21074                 cppsymbols=`echo $cppsymbols`
21075                 $test "$silent" || sleep 1
21076         fi
21077         if $test -s ccsym.own; then
21078                 $test "$also" && echo " "
21079                 echo "Your C compiler ${also}defines the following cpp symbols:"
21080                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21081                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21082                 ccsymbols=`$cat ccsym.own`
21083                 ccsymbols=`echo $ccsymbols`
21084                 $test "$silent" || sleep 1
21085         fi
21086 fi
21087
21088 : see if this is a termio system
21089 val="$undef"
21090 val2="$undef"
21091 val3="$undef"
21092 if $test `./findhdr termios.h`; then
21093         set tcsetattr i_termios
21094         eval $inlibc
21095         val3="$i_termios"
21096 fi
21097 echo " "
21098 case "$val3" in
21099 "$define") echo "You have POSIX termios.h... good!" >&4;;
21100 *) if ./Cppsym pyr; then
21101                 case "`/bin/universe`" in
21102                 ucb) if $test `./findhdr sgtty.h`; then
21103                                 val2="$define"
21104                                 echo "<sgtty.h> found." >&4
21105                         else
21106                                 echo "System is pyramid with BSD universe."
21107                                 ./warn "<sgtty.h> not found--you could have problems."
21108                         fi;;
21109                 *) if $test `./findhdr termio.h`; then
21110                                 val="$define"
21111                                 echo "<termio.h> found." >&4
21112                         else
21113                                 echo "System is pyramid with USG universe."
21114                                 ./warn "<termio.h> not found--you could have problems."
21115                         fi;;
21116                 esac
21117         elif ./usg; then
21118                 if $test `./findhdr termio.h`; then
21119                         echo "<termio.h> found." >&4
21120                         val="$define"
21121                 elif $test `./findhdr sgtty.h`; then
21122                         echo "<sgtty.h> found." >&4
21123                         val2="$define"
21124                 else
21125                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21126                 fi
21127         else
21128                 if $test `./findhdr sgtty.h`; then
21129                         echo "<sgtty.h> found." >&4
21130                         val2="$define"
21131                 elif $test `./findhdr termio.h`; then
21132                         echo "<termio.h> found." >&4
21133                         val="$define"
21134                 else
21135                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21136                 fi
21137         fi;;
21138 esac
21139 set i_termio; eval $setvar
21140 val=$val2; set i_sgtty; eval $setvar
21141 val=$val3; set i_termios; eval $setvar
21142
21143 : see if stddef is available
21144 set stddef.h i_stddef
21145 eval $inhdr
21146
21147 : see if sys/access.h is available
21148 set sys/access.h i_sysaccess
21149 eval $inhdr
21150
21151 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21152 set sys/filio.h i_sysfilio
21153 eval $inhdr
21154 echo " "
21155 if $test `./findhdr sys/ioctl.h`; then
21156         val="$define"
21157         echo '<sys/ioctl.h> found.' >&4
21158 else
21159         val="$undef"
21160         if $test $i_sysfilio = "$define"; then
21161             echo '<sys/ioctl.h> NOT found.' >&4
21162         else
21163                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21164                 $test $i_termio = "$define" && xxx="termio.h"
21165                 $test $i_termios = "$define" && xxx="termios.h"
21166 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21167         fi
21168 fi
21169 set i_sysioctl
21170 eval $setvar
21171
21172 : see if socket ioctl defs are in sys/sockio.h
21173 echo " "
21174 xxx=`./findhdr sys/sockio.h`
21175 if $test "$xxx"; then
21176         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21177                 val="$define"
21178                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21179         else
21180                 val="$undef"
21181                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21182         fi
21183 else
21184         val="$undef"
21185         $cat <<EOM
21186 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21187 EOM
21188 fi
21189 set i_syssockio
21190 eval $setvar
21191
21192 : see if this is a syslog.h system
21193 set syslog.h i_syslog
21194 eval $inhdr
21195
21196 : see if this is a sys/mode.h system
21197 set sys/mode.h i_sysmode
21198 eval $inhdr
21199
21200 : see if there is a sys/poll.h file
21201 set sys/poll.h i_syspoll
21202 eval $inhdr
21203
21204 : see if sys/resource.h has to be included
21205 set sys/resource.h i_sysresrc
21206 eval $inhdr
21207
21208 : see if sys/security.h is available
21209 set sys/security.h i_syssecrt
21210 eval $inhdr
21211
21212 : see if this is a sys/statvfs.h system
21213 set sys/statvfs.h i_sysstatvfs
21214 eval $inhdr
21215
21216 : see if this is a sys/un.h system
21217 set sys/un.h i_sysun
21218 eval $inhdr
21219
21220 : see if this is a sys/utsname.h system
21221 set sys/utsname.h i_sysutsname
21222 eval $inhdr
21223
21224 : see if this is a syswait system
21225 set sys/wait.h i_syswait
21226 eval $inhdr
21227
21228 : see if this is a ustat.h system
21229 set ustat.h i_ustat
21230 eval $inhdr
21231
21232 : see if this is an utime system
21233 set utime.h i_utime
21234 eval $inhdr
21235
21236 : see if this is a values.h system
21237 set values.h i_values
21238 eval $inhdr
21239
21240 : see if this is a vfork system
21241 case "$d_vfork" in
21242 "$define")
21243         set vfork.h i_vfork
21244         eval $inhdr
21245         ;;
21246 *)
21247         i_vfork="$undef"
21248         ;;
21249 esac
21250
21251 : Check extensions
21252 echo " "
21253 echo "Looking for extensions..." >&4
21254 : If we are using the old config.sh, known_extensions may contain
21255 : old or inaccurate or duplicate values.
21256 known_extensions=''
21257 nonxs_extensions=''
21258 : We do not use find because it might not be available.
21259 : We do not just use MANIFEST because the user may have dropped
21260 : some additional extensions into the source tree and expect them
21261 : to be built.
21262
21263 : Function to recursively find available extensions, ignoring DynaLoader
21264 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21265 find_extensions='
21266     for xxx in *; do
21267         case "$xxx" in
21268             DynaLoader|dynaload) ;;
21269             *)
21270             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21271                 known_extensions="$known_extensions $1$xxx";
21272             elif $test -f $xxx/Makefile.PL; then
21273                 nonxs_extensions="$nonxs_extensions $1$xxx";
21274             else
21275                 if $test -d $xxx -a $# -lt 10; then
21276                     set $1$xxx/ $*;
21277                     cd "$xxx";
21278                     eval $find_extensions;
21279                     cd ..;
21280                     shift;
21281                 fi;
21282             fi
21283             ;;
21284         esac;
21285     done'
21286 tdir=`pwd`
21287 cd "$rsrc/ext"
21288 set X
21289 shift
21290 eval $find_extensions
21291 # Special case:  Add in modules that nest beyond the first level.
21292 # Currently threads/shared and Hash/Util/FieldHash, since they are
21293 # not picked up by the recursive find above (and adding in general
21294 # recursive finding breaks SDBM_File/sdbm).
21295 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21296 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21297 set X $known_extensions
21298 shift
21299 known_extensions="$*"
21300 set X $nonxs_extensions
21301 shift
21302 nonxs_extensions="$*"
21303 cd "$tdir"
21304
21305 : Now see which are supported on this system.
21306 avail_ext=''
21307 for xxx in $known_extensions ; do
21308         case "$xxx" in
21309         DB_File|db_file)
21310                 case "$i_db" in
21311                 $define) avail_ext="$avail_ext $xxx" ;;
21312                 esac
21313                 ;;
21314         GDBM_File|gdbm_fil)
21315                 case "$i_gdbm" in
21316                 $define) avail_ext="$avail_ext $xxx" ;;
21317                 esac
21318                 ;;
21319         I18N/Langinfo|i18n_lan)
21320                 case "$i_langinfo$d_nl_langinfo" in
21321                 $define$define) avail_ext="$avail_ext $xxx" ;;
21322                 esac
21323                 ;;
21324         IPC/SysV|ipc/sysv)
21325                 : XXX Do we need a useipcsysv variable here
21326                 case "${d_msg}${d_sem}${d_shm}" in
21327                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21328                 esac
21329                 ;;
21330         NDBM_File|ndbm_fil)
21331                 case "$i_ndbm" in
21332                 $define)
21333                     case "$osname-$use64bitint" in
21334                     hpux-define)
21335                         case "$libs" in
21336                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21337                         esac
21338                         ;;
21339                     *) avail_ext="$avail_ext $xxx" ;;
21340                     esac
21341                     ;;
21342                 esac
21343                 ;;
21344         ODBM_File|odbm_fil)
21345                 case "${i_dbm}${i_rpcsvcdbm}" in
21346                 *"${define}"*)
21347                     case "$d_cplusplus" in
21348                     define) ;; # delete as a function name will not work
21349                     *)  case "$osname-$use64bitint" in
21350                         hpux-define)
21351                             case "$libs" in
21352                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21353                             esac
21354                             ;;
21355                         *) avail_ext="$avail_ext $xxx" ;;
21356                         esac
21357                         ;;
21358                     esac
21359                     ;;
21360                 esac
21361                 ;;
21362         Opcode|opcode)
21363                 case "$useopcode" in
21364                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21365                 esac
21366                 ;;
21367         POSIX|posix)
21368                 case "$useposix" in
21369                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21370                 esac
21371                 ;;
21372         Socket|socket)
21373                 case "$d_socket" in
21374                 true|$define|y)
21375                     case "$osname" in
21376                     beos) ;; # not unless BONE
21377                     *) avail_ext="$avail_ext $xxx" ;;
21378                     esac
21379                     ;;
21380                 esac
21381                 ;;
21382         Sys/Syslog|sys/syslog)
21383                 : XXX syslog requires socket
21384                 case "$d_socket" in
21385                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21386                 esac
21387                 ;;
21388         Thread|thread)
21389                 case "$usethreads" in
21390                 true|$define|y)
21391                         case "$use5005threads" in
21392                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21393                         esac
21394                 esac
21395                 ;;
21396         threads|threads/shared)
21397                 # threads and threads::shared are special cases.
21398                 # To stop people from asking "Perl 5.8.0 was supposed
21399                 # to have this new fancy threads implementation but my
21400                 # perl doesn't have it" and from people trying to
21401                 # (re)install the threads module using CPAN.pm and
21402                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21403                 # the threads.pm and threads/shared.pm will always be
21404                 # there, croaking informatively ("you need to rebuild
21405                 # all of Perl with threads, sorry") when threads haven't
21406                 # been compiled in.
21407                 # --jhi
21408                 avail_ext="$avail_ext $xxx"
21409                 ;;
21410         Win32*)
21411                 case "$osname" in
21412                 cygwin) avail_ext="$avail_ext $xxx" ;;
21413                 esac
21414                 ;;
21415         XS/APItest|xs/apitest)
21416                 # This is just for testing.  Skip it unless we have dynamic loading.
21417
21418                 case "$usedl" in
21419                 $define) avail_ext="$avail_ext $xxx" ;;
21420                 esac
21421                 ;;
21422         XS/Typemap|xs/typemap)
21423                 # This is just for testing.  Skip it unless we have dynamic loading.
21424                 case "$usedl" in
21425                 $define) avail_ext="$avail_ext $xxx" ;;
21426                 esac
21427                 ;;
21428         *)      avail_ext="$avail_ext $xxx"
21429                 ;;
21430         esac
21431 done
21432
21433 set X $avail_ext
21434 shift
21435 avail_ext="$*"
21436
21437 case "$onlyextensions" in
21438 '') ;;
21439 *)  keepextensions=''
21440     echo "You have requested that only certains extensions be included..." >&4
21441     for i in $onlyextensions; do
21442         case " $avail_ext " in
21443         *" $i "*)
21444             echo "Keeping extension $i."
21445             keepextensions="$keepextensions $i"
21446             ;;
21447         *) echo "Ignoring extension $i." ;;
21448         esac
21449     done
21450     avail_ext="$keepextensions"
21451     ;;
21452 esac
21453
21454 case "$noextensions" in
21455 '') ;;
21456 *)  keepextensions=''
21457     echo "You have requested that certain extensions be ignored..." >&4
21458     for i in $avail_ext; do
21459         case " $noextensions " in
21460         *" $i "*) echo "Ignoring extension $i." ;;
21461         *) echo "Keeping extension $i.";
21462            keepextensions="$keepextensions $i"
21463            ;;
21464         esac
21465     done
21466     avail_ext="$keepextensions"
21467     ;;
21468 esac
21469
21470 : Now see which nonxs extensions are supported on this system.
21471 : For now assume all are.
21472 nonxs_ext=''
21473 for xxx in $nonxs_extensions ; do
21474         case "$xxx" in
21475         *)      nonxs_ext="$nonxs_ext $xxx"
21476                 ;;
21477         esac
21478 done
21479
21480 set X $nonxs_ext
21481 shift
21482 nonxs_ext="$*"
21483
21484 case $usedl in
21485 $define)
21486         $cat <<EOM
21487 A number of extensions are supplied with $package.  You may choose to
21488 compile these extensions for dynamic loading (the default), compile
21489 them into the $package executable (static loading), or not include
21490 them at all.  Answer "none" to include no extensions.
21491 Note that DynaLoader is always built and need not be mentioned here.
21492
21493 EOM
21494         case "$dynamic_ext" in
21495         '')
21496                 : Exclude those listed in static_ext
21497                 dflt=''
21498                 for xxx in $avail_ext; do
21499                         case " $static_ext " in
21500                         *" $xxx "*) ;;
21501                         *) dflt="$dflt $xxx" ;;
21502                         esac
21503                 done
21504                 set X $dflt
21505                 shift
21506                 dflt="$*"
21507                 ;;
21508         *)      dflt="$dynamic_ext"
21509                 # Perhaps we are reusing an old out-of-date config.sh.
21510                 case "$hint" in
21511                 previous)
21512                         if test X"$dynamic_ext" != X"$avail_ext"; then
21513                                 $cat <<EOM
21514 NOTICE:  Your previous config.sh list may be incorrect.
21515 The extensions now available to you are
21516         ${avail_ext}
21517 but the default list from your previous config.sh is
21518         ${dynamic_ext}
21519
21520 EOM
21521                         fi
21522                         ;;
21523                 esac
21524                 ;;
21525         esac
21526         case "$dflt" in
21527         '')     dflt=none;;
21528         esac
21529         rp="What extensions do you wish to load dynamically?"
21530         . ./myread
21531         case "$ans" in
21532         none) dynamic_ext=' ' ;;
21533         *) dynamic_ext="$ans" ;;
21534         esac
21535
21536         case "$static_ext" in
21537         '')
21538                 : Exclude those already listed in dynamic linking
21539                 dflt=''
21540                 for xxx in $avail_ext; do
21541                         case " $dynamic_ext " in
21542                         *" $xxx "*) ;;
21543                         *) dflt="$dflt $xxx" ;;
21544                         esac
21545                 done
21546                 set X $dflt
21547                 shift
21548                 dflt="$*"
21549                 ;;
21550         *)  dflt="$static_ext"
21551                 ;;
21552         esac
21553
21554         case "$dflt" in
21555         '')     dflt=none;;
21556         esac
21557         rp="What extensions do you wish to load statically?"
21558         . ./myread
21559         case "$ans" in
21560         none) static_ext=' ' ;;
21561         *) static_ext="$ans" ;;
21562         esac
21563         ;;
21564 *)
21565         $cat <<EOM
21566 A number of extensions are supplied with $package.  Answer "none"
21567 to include no extensions.
21568 Note that DynaLoader is always built and need not be mentioned here.
21569
21570 EOM
21571         case "$static_ext" in
21572         '') dflt="$avail_ext" ;;
21573         *)      dflt="$static_ext"
21574                 # Perhaps we are reusing an old out-of-date config.sh.
21575                 case "$hint" in
21576                 previous)
21577                         if test X"$static_ext" != X"$avail_ext"; then
21578                                 $cat <<EOM
21579 NOTICE:  Your previous config.sh list may be incorrect.
21580 The extensions now available to you are
21581         ${avail_ext}
21582 but the default list from your previous config.sh is
21583         ${static_ext}
21584
21585 EOM
21586                         fi
21587                         ;;
21588                 esac
21589                 ;;
21590         esac
21591         : Exclude those that are not xs extensions
21592         case "$dflt" in
21593         '')     dflt=none;;
21594         esac
21595         rp="What extensions do you wish to include?"
21596         . ./myread
21597         case "$ans" in
21598         none) static_ext=' ' ;;
21599         *) static_ext="$ans" ;;
21600         esac
21601         ;;
21602 esac
21603 #
21604 # Encode is a special case.  If we are building Encode as a static
21605 # extension, we need to explicitly list its subextensions as well.
21606 # For other nested extensions, this is handled automatically by
21607 # the appropriate Makefile.PL.
21608 case " $static_ext " in
21609         *" Encode "*) # Add the subextensions of Encode
21610         cd "$rsrc/ext"
21611         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21612                 static_ext="$static_ext Encode/$xxx"
21613         done
21614         cd "$tdir"
21615         ;;
21616 esac
21617
21618 set X $dynamic_ext $static_ext $nonxs_ext
21619 shift
21620 extensions="$*"
21621
21622 # Sanity check:  We require an extension suitable for use with
21623 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21624 # should show up as failures in the test suite, but it's helpful to
21625 # catch them now.) The 'extensions' list is normally sorted
21626 # alphabetically, so we need to accept either
21627 #    DB_File ... Fcntl ... IO  ....
21628 # or something like
21629 #    Fcntl ... NDBM_File ... IO  ....
21630 case " $extensions"  in
21631 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21632 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21633 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21634 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21635    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21636    ;;
21637 esac
21638
21639 : Remove libraries needed only for extensions
21640 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21641 : The exception is SunOS 4.x, which needs them.
21642 case "${osname}X${osvers}" in
21643 sunos*X4*)
21644     perllibs="$libs"
21645     ;;
21646 *) case "$usedl" in
21647     $define|true|[yY]*)
21648             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21649             shift
21650             perllibs="$*"
21651             ;;
21652     *)  perllibs="$libs"
21653             ;;
21654     esac
21655     ;;
21656 esac
21657
21658 : Remove build directory name from cppstdin so it can be used from
21659 : either the present location or the final installed location.
21660 echo " "
21661 : Get out of the UU directory to get correct path name.
21662 cd ..
21663 case "$cppstdin" in
21664 `pwd`/cppstdin)
21665         echo "Stripping down cppstdin path name"
21666         cppstdin=cppstdin
21667         ;;
21668 esac
21669 cd UU
21670
21671 : end of configuration questions
21672 echo " "
21673 echo "End of configuration questions."
21674 echo " "
21675
21676 : back to where it started
21677 if test -d ../UU; then
21678         cd ..
21679 fi
21680
21681 : configuration may be unconditionally patched via a 'config.arch' file
21682 if $test -f config.arch; then
21683         echo "I see a config.arch file, loading it." >&4
21684         . ./config.arch
21685 fi
21686
21687 : configuration may be patched via a 'config.over' file
21688 if $test -f config.over; then
21689         echo " "
21690         dflt=y
21691         rp='I see a config.over file.  Do you wish to load it?'
21692         . UU/myread
21693         case "$ans" in
21694         n*) echo "OK, I'll ignore it.";;
21695         *)      . ./config.over
21696                 echo "Configuration override changes have been loaded."
21697                 ;;
21698         esac
21699 fi
21700
21701 : in case they want portability, strip down executable paths
21702 case "$d_portable" in
21703 "$define")
21704         echo " "
21705         echo "Stripping down executable paths..." >&4
21706         for file in $loclist $trylist; do
21707                 eval temp=\$$file
21708                 eval $file=`basename $temp`
21709         done
21710         ;;
21711 esac
21712
21713 : create config.sh file
21714 echo " "
21715 echo "Creating config.sh..." >&4
21716 $spitshell <<EOT >config.sh
21717 $startsh
21718 #
21719 # This file was produced by running the Configure script. It holds all the
21720 # definitions figured out by Configure. Should you modify one of these values,
21721 # do not forget to propagate your changes by running "Configure -der". You may
21722 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21723 #
21724
21725 # Package name      : $package
21726 # Source directory  : $src
21727 # Configuration time: $cf_time
21728 # Configured by     : $cf_by
21729 # Target system     : $myuname
21730
21731 EOT
21732 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21733 $spitshell <<EOT >>config.sh
21734
21735 Author='$Author'
21736 Date='$Date'
21737 Header='$Header'
21738 Id='$Id'
21739 Locker='$Locker'
21740 Log='$Log'
21741 RCSfile='$RCSfile'
21742 Revision='$Revision'
21743 Source='$Source'
21744 State='$State'
21745 _a='$_a'
21746 _exe='$_exe'
21747 _o='$_o'
21748 afs='$afs'
21749 afsroot='$afsroot'
21750 alignbytes='$alignbytes'
21751 ansi2knr='$ansi2knr'
21752 aphostname='$aphostname'
21753 api_revision='$api_revision'
21754 api_subversion='$api_subversion'
21755 api_version='$api_version'
21756 api_versionstring='$api_versionstring'
21757 ar='$ar'
21758 archlib='$archlib'
21759 archlibexp='$archlibexp'
21760 archname64='$archname64'
21761 archname='$archname'
21762 archobjs='$archobjs'
21763 asctime_r_proto='$asctime_r_proto'
21764 awk='$awk'
21765 baserev='$baserev'
21766 bash='$bash'
21767 bin='$bin'
21768 binexp='$binexp'
21769 bison='$bison'
21770 byacc='$byacc'
21771 byteorder='$byteorder'
21772 c='$c'
21773 castflags='$castflags'
21774 cat='$cat'
21775 cc='$cc'
21776 cccdlflags='$cccdlflags'
21777 ccdlflags='$ccdlflags'
21778 ccflags='$ccflags'
21779 ccflags_uselargefiles='$ccflags_uselargefiles'
21780 ccname='$ccname'
21781 ccsymbols='$ccsymbols'
21782 ccversion='$ccversion'
21783 cf_by='$cf_by'
21784 cf_email='$cf_email'
21785 cf_time='$cf_time'
21786 chgrp='$chgrp'
21787 chmod='$chmod'
21788 chown='$chown'
21789 clocktype='$clocktype'
21790 comm='$comm'
21791 compress='$compress'
21792 contains='$contains'
21793 cp='$cp'
21794 cpio='$cpio'
21795 cpp='$cpp'
21796 cpp_stuff='$cpp_stuff'
21797 cppccsymbols='$cppccsymbols'
21798 cppflags='$cppflags'
21799 cpplast='$cpplast'
21800 cppminus='$cppminus'
21801 cpprun='$cpprun'
21802 cppstdin='$cppstdin'
21803 cppsymbols='$cppsymbols'
21804 crypt_r_proto='$crypt_r_proto'
21805 cryptlib='$cryptlib'
21806 csh='$csh'
21807 ctermid_r_proto='$ctermid_r_proto'
21808 ctime_r_proto='$ctime_r_proto'
21809 d_Gconvert='$d_Gconvert'
21810 d_PRIEUldbl='$d_PRIEUldbl'
21811 d_PRIFUldbl='$d_PRIFUldbl'
21812 d_PRIGUldbl='$d_PRIGUldbl'
21813 d_PRIXU64='$d_PRIXU64'
21814 d_PRId64='$d_PRId64'
21815 d_PRIeldbl='$d_PRIeldbl'
21816 d_PRIfldbl='$d_PRIfldbl'
21817 d_PRIgldbl='$d_PRIgldbl'
21818 d_PRIi64='$d_PRIi64'
21819 d_PRIo64='$d_PRIo64'
21820 d_PRIu64='$d_PRIu64'
21821 d_PRIx64='$d_PRIx64'
21822 d_SCNfldbl='$d_SCNfldbl'
21823 d__fwalk='$d__fwalk'
21824 d_access='$d_access'
21825 d_accessx='$d_accessx'
21826 d_aintl='$d_aintl'
21827 d_alarm='$d_alarm'
21828 d_archlib='$d_archlib'
21829 d_asctime_r='$d_asctime_r'
21830 d_atolf='$d_atolf'
21831 d_atoll='$d_atoll'
21832 d_attribute_format='$d_attribute_format'
21833 d_attribute_malloc='$d_attribute_malloc'
21834 d_attribute_nonnull='$d_attribute_nonnull'
21835 d_attribute_noreturn='$d_attribute_noreturn'
21836 d_attribute_pure='$d_attribute_pure'
21837 d_attribute_unused='$d_attribute_unused'
21838 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21839 d_bcmp='$d_bcmp'
21840 d_bcopy='$d_bcopy'
21841 d_bsd='$d_bsd'
21842 d_bsdgetpgrp='$d_bsdgetpgrp'
21843 d_bsdsetpgrp='$d_bsdsetpgrp'
21844 d_builtin_choose_expr='$d_builtin_choose_expr'
21845 d_builtin_expect='$d_builtin_expect'
21846 d_bzero='$d_bzero'
21847 d_c99_variadic_macros='$d_c99_variadic_macros'
21848 d_casti32='$d_casti32'
21849 d_castneg='$d_castneg'
21850 d_charvspr='$d_charvspr'
21851 d_chown='$d_chown'
21852 d_chroot='$d_chroot'
21853 d_chsize='$d_chsize'
21854 d_class='$d_class'
21855 d_clearenv='$d_clearenv'
21856 d_closedir='$d_closedir'
21857 d_cmsghdr_s='$d_cmsghdr_s'
21858 d_const='$d_const'
21859 d_copysignl='$d_copysignl'
21860 d_cplusplus='$d_cplusplus'
21861 d_crypt='$d_crypt'
21862 d_crypt_r='$d_crypt_r'
21863 d_csh='$d_csh'
21864 d_ctermid='$d_ctermid'
21865 d_ctermid_r='$d_ctermid_r'
21866 d_ctime_r='$d_ctime_r'
21867 d_cuserid='$d_cuserid'
21868 d_dbl_dig='$d_dbl_dig'
21869 d_dbminitproto='$d_dbminitproto'
21870 d_difftime='$d_difftime'
21871 d_dir_dd_fd='$d_dir_dd_fd'
21872 d_dirfd='$d_dirfd'
21873 d_dirnamlen='$d_dirnamlen'
21874 d_dlerror='$d_dlerror'
21875 d_dlopen='$d_dlopen'
21876 d_dlsymun='$d_dlsymun'
21877 d_dosuid='$d_dosuid'
21878 d_drand48_r='$d_drand48_r'
21879 d_drand48proto='$d_drand48proto'
21880 d_dup2='$d_dup2'
21881 d_eaccess='$d_eaccess'
21882 d_endgrent='$d_endgrent'
21883 d_endgrent_r='$d_endgrent_r'
21884 d_endhent='$d_endhent'
21885 d_endhostent_r='$d_endhostent_r'
21886 d_endnent='$d_endnent'
21887 d_endnetent_r='$d_endnetent_r'
21888 d_endpent='$d_endpent'
21889 d_endprotoent_r='$d_endprotoent_r'
21890 d_endpwent='$d_endpwent'
21891 d_endpwent_r='$d_endpwent_r'
21892 d_endsent='$d_endsent'
21893 d_endservent_r='$d_endservent_r'
21894 d_eofnblk='$d_eofnblk'
21895 d_eunice='$d_eunice'
21896 d_faststdio='$d_faststdio'
21897 d_fchdir='$d_fchdir'
21898 d_fchmod='$d_fchmod'
21899 d_fchown='$d_fchown'
21900 d_fcntl='$d_fcntl'
21901 d_fcntl_can_lock='$d_fcntl_can_lock'
21902 d_fd_macros='$d_fd_macros'
21903 d_fd_set='$d_fd_set'
21904 d_fds_bits='$d_fds_bits'
21905 d_fgetpos='$d_fgetpos'
21906 d_finite='$d_finite'
21907 d_finitel='$d_finitel'
21908 d_flexfnam='$d_flexfnam'
21909 d_flock='$d_flock'
21910 d_flockproto='$d_flockproto'
21911 d_fork='$d_fork'
21912 d_fp_class='$d_fp_class'
21913 d_fpathconf='$d_fpathconf'
21914 d_fpclass='$d_fpclass'
21915 d_fpclassify='$d_fpclassify'
21916 d_fpclassl='$d_fpclassl'
21917 d_fpos64_t='$d_fpos64_t'
21918 d_frexpl='$d_frexpl'
21919 d_fs_data_s='$d_fs_data_s'
21920 d_fseeko='$d_fseeko'
21921 d_fsetpos='$d_fsetpos'
21922 d_fstatfs='$d_fstatfs'
21923 d_fstatvfs='$d_fstatvfs'
21924 d_fsync='$d_fsync'
21925 d_ftello='$d_ftello'
21926 d_ftime='$d_ftime'
21927 d_futimes='$d_futimes'
21928 d_getcwd='$d_getcwd'
21929 d_getespwnam='$d_getespwnam'
21930 d_getfsstat='$d_getfsstat'
21931 d_getgrent='$d_getgrent'
21932 d_getgrent_r='$d_getgrent_r'
21933 d_getgrgid_r='$d_getgrgid_r'
21934 d_getgrnam_r='$d_getgrnam_r'
21935 d_getgrps='$d_getgrps'
21936 d_gethbyaddr='$d_gethbyaddr'
21937 d_gethbyname='$d_gethbyname'
21938 d_gethent='$d_gethent'
21939 d_gethname='$d_gethname'
21940 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21941 d_gethostbyname_r='$d_gethostbyname_r'
21942 d_gethostent_r='$d_gethostent_r'
21943 d_gethostprotos='$d_gethostprotos'
21944 d_getitimer='$d_getitimer'
21945 d_getlogin='$d_getlogin'
21946 d_getlogin_r='$d_getlogin_r'
21947 d_getmnt='$d_getmnt'
21948 d_getmntent='$d_getmntent'
21949 d_getnbyaddr='$d_getnbyaddr'
21950 d_getnbyname='$d_getnbyname'
21951 d_getnent='$d_getnent'
21952 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21953 d_getnetbyname_r='$d_getnetbyname_r'
21954 d_getnetent_r='$d_getnetent_r'
21955 d_getnetprotos='$d_getnetprotos'
21956 d_getpagsz='$d_getpagsz'
21957 d_getpbyname='$d_getpbyname'
21958 d_getpbynumber='$d_getpbynumber'
21959 d_getpent='$d_getpent'
21960 d_getpgid='$d_getpgid'
21961 d_getpgrp2='$d_getpgrp2'
21962 d_getpgrp='$d_getpgrp'
21963 d_getppid='$d_getppid'
21964 d_getprior='$d_getprior'
21965 d_getprotobyname_r='$d_getprotobyname_r'
21966 d_getprotobynumber_r='$d_getprotobynumber_r'
21967 d_getprotoent_r='$d_getprotoent_r'
21968 d_getprotoprotos='$d_getprotoprotos'
21969 d_getprpwnam='$d_getprpwnam'
21970 d_getpwent='$d_getpwent'
21971 d_getpwent_r='$d_getpwent_r'
21972 d_getpwnam_r='$d_getpwnam_r'
21973 d_getpwuid_r='$d_getpwuid_r'
21974 d_getsbyname='$d_getsbyname'
21975 d_getsbyport='$d_getsbyport'
21976 d_getsent='$d_getsent'
21977 d_getservbyname_r='$d_getservbyname_r'
21978 d_getservbyport_r='$d_getservbyport_r'
21979 d_getservent_r='$d_getservent_r'
21980 d_getservprotos='$d_getservprotos'
21981 d_getspnam='$d_getspnam'
21982 d_getspnam_r='$d_getspnam_r'
21983 d_gettimeod='$d_gettimeod'
21984 d_gmtime_r='$d_gmtime_r'
21985 d_gnulibc='$d_gnulibc'
21986 d_grpasswd='$d_grpasswd'
21987 d_hasmntopt='$d_hasmntopt'
21988 d_htonl='$d_htonl'
21989 d_ilogbl='$d_ilogbl'
21990 d_inc_version_list='$d_inc_version_list'
21991 d_index='$d_index'
21992 d_inetaton='$d_inetaton'
21993 d_int64_t='$d_int64_t'
21994 d_isascii='$d_isascii'
21995 d_isfinite='$d_isfinite'
21996 d_isinf='$d_isinf'
21997 d_isnan='$d_isnan'
21998 d_isnanl='$d_isnanl'
21999 d_killpg='$d_killpg'
22000 d_lchown='$d_lchown'
22001 d_ldbl_dig='$d_ldbl_dig'
22002 d_libm_lib_version='$d_libm_lib_version'
22003 d_link='$d_link'
22004 d_localtime_r='$d_localtime_r'
22005 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22006 d_locconv='$d_locconv'
22007 d_lockf='$d_lockf'
22008 d_longdbl='$d_longdbl'
22009 d_longlong='$d_longlong'
22010 d_lseekproto='$d_lseekproto'
22011 d_lstat='$d_lstat'
22012 d_madvise='$d_madvise'
22013 d_malloc_good_size='$d_malloc_good_size'
22014 d_malloc_size='$d_malloc_size'
22015 d_mblen='$d_mblen'
22016 d_mbstowcs='$d_mbstowcs'
22017 d_mbtowc='$d_mbtowc'
22018 d_memchr='$d_memchr'
22019 d_memcmp='$d_memcmp'
22020 d_memcpy='$d_memcpy'
22021 d_memmove='$d_memmove'
22022 d_memset='$d_memset'
22023 d_mkdir='$d_mkdir'
22024 d_mkdtemp='$d_mkdtemp'
22025 d_mkfifo='$d_mkfifo'
22026 d_mkstemp='$d_mkstemp'
22027 d_mkstemps='$d_mkstemps'
22028 d_mktime='$d_mktime'
22029 d_mmap='$d_mmap'
22030 d_modfl='$d_modfl'
22031 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22032 d_modflproto='$d_modflproto'
22033 d_mprotect='$d_mprotect'
22034 d_msg='$d_msg'
22035 d_msg_ctrunc='$d_msg_ctrunc'
22036 d_msg_dontroute='$d_msg_dontroute'
22037 d_msg_oob='$d_msg_oob'
22038 d_msg_peek='$d_msg_peek'
22039 d_msg_proxy='$d_msg_proxy'
22040 d_msgctl='$d_msgctl'
22041 d_msgget='$d_msgget'
22042 d_msghdr_s='$d_msghdr_s'
22043 d_msgrcv='$d_msgrcv'
22044 d_msgsnd='$d_msgsnd'
22045 d_msync='$d_msync'
22046 d_munmap='$d_munmap'
22047 d_mymalloc='$d_mymalloc'
22048 d_nice='$d_nice'
22049 d_nl_langinfo='$d_nl_langinfo'
22050 d_nv_preserves_uv='$d_nv_preserves_uv'
22051 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22052 d_off64_t='$d_off64_t'
22053 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22054 d_oldpthreads='$d_oldpthreads'
22055 d_oldsock='$d_oldsock'
22056 d_open3='$d_open3'
22057 d_pathconf='$d_pathconf'
22058 d_pause='$d_pause'
22059 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22060 d_phostname='$d_phostname'
22061 d_pipe='$d_pipe'
22062 d_poll='$d_poll'
22063 d_portable='$d_portable'
22064 d_printf_format_null='$d_printf_format_null'
22065 d_procselfexe='$d_procselfexe'
22066 d_pseudofork='$d_pseudofork'
22067 d_pthread_atfork='$d_pthread_atfork'
22068 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22069 d_pthread_yield='$d_pthread_yield'
22070 d_pwage='$d_pwage'
22071 d_pwchange='$d_pwchange'
22072 d_pwclass='$d_pwclass'
22073 d_pwcomment='$d_pwcomment'
22074 d_pwexpire='$d_pwexpire'
22075 d_pwgecos='$d_pwgecos'
22076 d_pwpasswd='$d_pwpasswd'
22077 d_pwquota='$d_pwquota'
22078 d_qgcvt='$d_qgcvt'
22079 d_quad='$d_quad'
22080 d_random_r='$d_random_r'
22081 d_readdir64_r='$d_readdir64_r'
22082 d_readdir='$d_readdir'
22083 d_readdir_r='$d_readdir_r'
22084 d_readlink='$d_readlink'
22085 d_readv='$d_readv'
22086 d_recvmsg='$d_recvmsg'
22087 d_rename='$d_rename'
22088 d_rewinddir='$d_rewinddir'
22089 d_rmdir='$d_rmdir'
22090 d_safebcpy='$d_safebcpy'
22091 d_safemcpy='$d_safemcpy'
22092 d_sanemcmp='$d_sanemcmp'
22093 d_sbrkproto='$d_sbrkproto'
22094 d_scalbnl='$d_scalbnl'
22095 d_sched_yield='$d_sched_yield'
22096 d_scm_rights='$d_scm_rights'
22097 d_seekdir='$d_seekdir'
22098 d_select='$d_select'
22099 d_sem='$d_sem'
22100 d_semctl='$d_semctl'
22101 d_semctl_semid_ds='$d_semctl_semid_ds'
22102 d_semctl_semun='$d_semctl_semun'
22103 d_semget='$d_semget'
22104 d_semop='$d_semop'
22105 d_sendmsg='$d_sendmsg'
22106 d_setegid='$d_setegid'
22107 d_seteuid='$d_seteuid'
22108 d_setgrent='$d_setgrent'
22109 d_setgrent_r='$d_setgrent_r'
22110 d_setgrps='$d_setgrps'
22111 d_sethent='$d_sethent'
22112 d_sethostent_r='$d_sethostent_r'
22113 d_setitimer='$d_setitimer'
22114 d_setlinebuf='$d_setlinebuf'
22115 d_setlocale='$d_setlocale'
22116 d_setlocale_r='$d_setlocale_r'
22117 d_setnent='$d_setnent'
22118 d_setnetent_r='$d_setnetent_r'
22119 d_setpent='$d_setpent'
22120 d_setpgid='$d_setpgid'
22121 d_setpgrp2='$d_setpgrp2'
22122 d_setpgrp='$d_setpgrp'
22123 d_setprior='$d_setprior'
22124 d_setproctitle='$d_setproctitle'
22125 d_setprotoent_r='$d_setprotoent_r'
22126 d_setpwent='$d_setpwent'
22127 d_setpwent_r='$d_setpwent_r'
22128 d_setregid='$d_setregid'
22129 d_setresgid='$d_setresgid'
22130 d_setresuid='$d_setresuid'
22131 d_setreuid='$d_setreuid'
22132 d_setrgid='$d_setrgid'
22133 d_setruid='$d_setruid'
22134 d_setsent='$d_setsent'
22135 d_setservent_r='$d_setservent_r'
22136 d_setsid='$d_setsid'
22137 d_setvbuf='$d_setvbuf'
22138 d_sfio='$d_sfio'
22139 d_shm='$d_shm'
22140 d_shmat='$d_shmat'
22141 d_shmatprototype='$d_shmatprototype'
22142 d_shmctl='$d_shmctl'
22143 d_shmdt='$d_shmdt'
22144 d_shmget='$d_shmget'
22145 d_sigaction='$d_sigaction'
22146 d_signbit='$d_signbit'
22147 d_sigprocmask='$d_sigprocmask'
22148 d_sigsetjmp='$d_sigsetjmp'
22149 d_sitearch='$d_sitearch'
22150 d_snprintf='$d_snprintf'
22151 d_sockatmark='$d_sockatmark'
22152 d_sockatmarkproto='$d_sockatmarkproto'
22153 d_socket='$d_socket'
22154 d_socklen_t='$d_socklen_t'
22155 d_sockpair='$d_sockpair'
22156 d_socks5_init='$d_socks5_init'
22157 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22158 d_sqrtl='$d_sqrtl'
22159 d_srand48_r='$d_srand48_r'
22160 d_srandom_r='$d_srandom_r'
22161 d_sresgproto='$d_sresgproto'
22162 d_sresuproto='$d_sresuproto'
22163 d_statblks='$d_statblks'
22164 d_statfs_f_flags='$d_statfs_f_flags'
22165 d_statfs_s='$d_statfs_s'
22166 d_statvfs='$d_statvfs'
22167 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22168 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22169 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22170 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22171 d_stdio_stream_array='$d_stdio_stream_array'
22172 d_stdiobase='$d_stdiobase'
22173 d_stdstdio='$d_stdstdio'
22174 d_strchr='$d_strchr'
22175 d_strcoll='$d_strcoll'
22176 d_strctcpy='$d_strctcpy'
22177 d_strerrm='$d_strerrm'
22178 d_strerror='$d_strerror'
22179 d_strerror_r='$d_strerror_r'
22180 d_strftime='$d_strftime'
22181 d_strlcat='$d_strlcat'
22182 d_strlcpy='$d_strlcpy'
22183 d_strtod='$d_strtod'
22184 d_strtol='$d_strtol'
22185 d_strtold='$d_strtold'
22186 d_strtoll='$d_strtoll'
22187 d_strtoq='$d_strtoq'
22188 d_strtoul='$d_strtoul'
22189 d_strtoull='$d_strtoull'
22190 d_strtouq='$d_strtouq'
22191 d_strxfrm='$d_strxfrm'
22192 d_suidsafe='$d_suidsafe'
22193 d_symlink='$d_symlink'
22194 d_syscall='$d_syscall'
22195 d_syscallproto='$d_syscallproto'
22196 d_sysconf='$d_sysconf'
22197 d_sysernlst='$d_sysernlst'
22198 d_syserrlst='$d_syserrlst'
22199 d_system='$d_system'
22200 d_tcgetpgrp='$d_tcgetpgrp'
22201 d_tcsetpgrp='$d_tcsetpgrp'
22202 d_telldir='$d_telldir'
22203 d_telldirproto='$d_telldirproto'
22204 d_time='$d_time'
22205 d_times='$d_times'
22206 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22207 d_tm_tm_zone='$d_tm_tm_zone'
22208 d_tmpnam_r='$d_tmpnam_r'
22209 d_truncate='$d_truncate'
22210 d_ttyname_r='$d_ttyname_r'
22211 d_tzname='$d_tzname'
22212 d_u32align='$d_u32align'
22213 d_ualarm='$d_ualarm'
22214 d_umask='$d_umask'
22215 d_uname='$d_uname'
22216 d_union_semun='$d_union_semun'
22217 d_unordered='$d_unordered'
22218 d_unsetenv='$d_unsetenv'
22219 d_usleep='$d_usleep'
22220 d_usleepproto='$d_usleepproto'
22221 d_ustat='$d_ustat'
22222 d_vendorarch='$d_vendorarch'
22223 d_vendorbin='$d_vendorbin'
22224 d_vendorlib='$d_vendorlib'
22225 d_vendorscript='$d_vendorscript'
22226 d_vfork='$d_vfork'
22227 d_void_closedir='$d_void_closedir'
22228 d_voidsig='$d_voidsig'
22229 d_voidtty='$d_voidtty'
22230 d_volatile='$d_volatile'
22231 d_vprintf='$d_vprintf'
22232 d_vsnprintf='$d_vsnprintf'
22233 d_wait4='$d_wait4'
22234 d_waitpid='$d_waitpid'
22235 d_wcstombs='$d_wcstombs'
22236 d_wctomb='$d_wctomb'
22237 d_writev='$d_writev'
22238 d_xenix='$d_xenix'
22239 date='$date'
22240 db_hashtype='$db_hashtype'
22241 db_prefixtype='$db_prefixtype'
22242 db_version_major='$db_version_major'
22243 db_version_minor='$db_version_minor'
22244 db_version_patch='$db_version_patch'
22245 defvoidused='$defvoidused'
22246 direntrytype='$direntrytype'
22247 dlext='$dlext'
22248 dlsrc='$dlsrc'
22249 doublesize='$doublesize'
22250 drand01='$drand01'
22251 drand48_r_proto='$drand48_r_proto'
22252 dtrace='$dtrace'
22253 dynamic_ext='$dynamic_ext'
22254 eagain='$eagain'
22255 ebcdic='$ebcdic'
22256 echo='$echo'
22257 egrep='$egrep'
22258 emacs='$emacs'
22259 endgrent_r_proto='$endgrent_r_proto'
22260 endhostent_r_proto='$endhostent_r_proto'
22261 endnetent_r_proto='$endnetent_r_proto'
22262 endprotoent_r_proto='$endprotoent_r_proto'
22263 endpwent_r_proto='$endpwent_r_proto'
22264 endservent_r_proto='$endservent_r_proto'
22265 eunicefix='$eunicefix'
22266 exe_ext='$exe_ext'
22267 expr='$expr'
22268 extensions='$extensions'
22269 extras='$extras'
22270 fflushNULL='$fflushNULL'
22271 fflushall='$fflushall'
22272 find='$find'
22273 firstmakefile='$firstmakefile'
22274 flex='$flex'
22275 fpossize='$fpossize'
22276 fpostype='$fpostype'
22277 freetype='$freetype'
22278 from='$from'
22279 full_ar='$full_ar'
22280 full_csh='$full_csh'
22281 full_sed='$full_sed'
22282 gccansipedantic='$gccansipedantic'
22283 gccosandvers='$gccosandvers'
22284 gccversion='$gccversion'
22285 getgrent_r_proto='$getgrent_r_proto'
22286 getgrgid_r_proto='$getgrgid_r_proto'
22287 getgrnam_r_proto='$getgrnam_r_proto'
22288 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22289 gethostbyname_r_proto='$gethostbyname_r_proto'
22290 gethostent_r_proto='$gethostent_r_proto'
22291 getlogin_r_proto='$getlogin_r_proto'
22292 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22293 getnetbyname_r_proto='$getnetbyname_r_proto'
22294 getnetent_r_proto='$getnetent_r_proto'
22295 getprotobyname_r_proto='$getprotobyname_r_proto'
22296 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22297 getprotoent_r_proto='$getprotoent_r_proto'
22298 getpwent_r_proto='$getpwent_r_proto'
22299 getpwnam_r_proto='$getpwnam_r_proto'
22300 getpwuid_r_proto='$getpwuid_r_proto'
22301 getservbyname_r_proto='$getservbyname_r_proto'
22302 getservbyport_r_proto='$getservbyport_r_proto'
22303 getservent_r_proto='$getservent_r_proto'
22304 getspnam_r_proto='$getspnam_r_proto'
22305 gidformat='$gidformat'
22306 gidsign='$gidsign'
22307 gidsize='$gidsize'
22308 gidtype='$gidtype'
22309 glibpth='$glibpth'
22310 gmake='$gmake'
22311 gmtime_r_proto='$gmtime_r_proto'
22312 gnulibc_version='$gnulibc_version'
22313 grep='$grep'
22314 groupcat='$groupcat'
22315 groupstype='$groupstype'
22316 gzip='$gzip'
22317 h_fcntl='$h_fcntl'
22318 h_sysfile='$h_sysfile'
22319 hint='$hint'
22320 hostcat='$hostcat'
22321 html1dir='$html1dir'
22322 html1direxp='$html1direxp'
22323 html3dir='$html3dir'
22324 html3direxp='$html3direxp'
22325 i16size='$i16size'
22326 i16type='$i16type'
22327 i32size='$i32size'
22328 i32type='$i32type'
22329 i64size='$i64size'
22330 i64type='$i64type'
22331 i8size='$i8size'
22332 i8type='$i8type'
22333 i_arpainet='$i_arpainet'
22334 i_assert='$i_assert'
22335 i_bsdioctl='$i_bsdioctl'
22336 i_crypt='$i_crypt'
22337 i_db='$i_db'
22338 i_dbm='$i_dbm'
22339 i_dirent='$i_dirent'
22340 i_dld='$i_dld'
22341 i_dlfcn='$i_dlfcn'
22342 i_fcntl='$i_fcntl'
22343 i_float='$i_float'
22344 i_fp='$i_fp'
22345 i_fp_class='$i_fp_class'
22346 i_gdbm='$i_gdbm'
22347 i_grp='$i_grp'
22348 i_ieeefp='$i_ieeefp'
22349 i_inttypes='$i_inttypes'
22350 i_langinfo='$i_langinfo'
22351 i_libutil='$i_libutil'
22352 i_limits='$i_limits'
22353 i_locale='$i_locale'
22354 i_machcthr='$i_machcthr'
22355 i_malloc='$i_malloc'
22356 i_math='$i_math'
22357 i_memory='$i_memory'
22358 i_mntent='$i_mntent'
22359 i_ndbm='$i_ndbm'
22360 i_netdb='$i_netdb'
22361 i_neterrno='$i_neterrno'
22362 i_netinettcp='$i_netinettcp'
22363 i_niin='$i_niin'
22364 i_poll='$i_poll'
22365 i_prot='$i_prot'
22366 i_pthread='$i_pthread'
22367 i_pwd='$i_pwd'
22368 i_rpcsvcdbm='$i_rpcsvcdbm'
22369 i_sfio='$i_sfio'
22370 i_sgtty='$i_sgtty'
22371 i_shadow='$i_shadow'
22372 i_socks='$i_socks'
22373 i_stdarg='$i_stdarg'
22374 i_stddef='$i_stddef'
22375 i_stdlib='$i_stdlib'
22376 i_string='$i_string'
22377 i_sunmath='$i_sunmath'
22378 i_sysaccess='$i_sysaccess'
22379 i_sysdir='$i_sysdir'
22380 i_sysfile='$i_sysfile'
22381 i_sysfilio='$i_sysfilio'
22382 i_sysin='$i_sysin'
22383 i_sysioctl='$i_sysioctl'
22384 i_syslog='$i_syslog'
22385 i_sysmman='$i_sysmman'
22386 i_sysmode='$i_sysmode'
22387 i_sysmount='$i_sysmount'
22388 i_sysndir='$i_sysndir'
22389 i_sysparam='$i_sysparam'
22390 i_syspoll='$i_syspoll'
22391 i_sysresrc='$i_sysresrc'
22392 i_syssecrt='$i_syssecrt'
22393 i_sysselct='$i_sysselct'
22394 i_syssockio='$i_syssockio'
22395 i_sysstat='$i_sysstat'
22396 i_sysstatfs='$i_sysstatfs'
22397 i_sysstatvfs='$i_sysstatvfs'
22398 i_systime='$i_systime'
22399 i_systimek='$i_systimek'
22400 i_systimes='$i_systimes'
22401 i_systypes='$i_systypes'
22402 i_sysuio='$i_sysuio'
22403 i_sysun='$i_sysun'
22404 i_sysutsname='$i_sysutsname'
22405 i_sysvfs='$i_sysvfs'
22406 i_syswait='$i_syswait'
22407 i_termio='$i_termio'
22408 i_termios='$i_termios'
22409 i_time='$i_time'
22410 i_unistd='$i_unistd'
22411 i_ustat='$i_ustat'
22412 i_utime='$i_utime'
22413 i_values='$i_values'
22414 i_varargs='$i_varargs'
22415 i_varhdr='$i_varhdr'
22416 i_vfork='$i_vfork'
22417 ignore_versioned_solibs='$ignore_versioned_solibs'
22418 inc_version_list='$inc_version_list'
22419 inc_version_list_init='$inc_version_list_init'
22420 incpath='$incpath'
22421 inews='$inews'
22422 initialinstalllocation='$initialinstalllocation'
22423 installarchlib='$installarchlib'
22424 installbin='$installbin'
22425 installhtml1dir='$installhtml1dir'
22426 installhtml3dir='$installhtml3dir'
22427 installman1dir='$installman1dir'
22428 installman3dir='$installman3dir'
22429 installprefix='$installprefix'
22430 installprefixexp='$installprefixexp'
22431 installprivlib='$installprivlib'
22432 installscript='$installscript'
22433 installsitearch='$installsitearch'
22434 installsitebin='$installsitebin'
22435 installsitehtml1dir='$installsitehtml1dir'
22436 installsitehtml3dir='$installsitehtml3dir'
22437 installsitelib='$installsitelib'
22438 installsiteman1dir='$installsiteman1dir'
22439 installsiteman3dir='$installsiteman3dir'
22440 installsitescript='$installsitescript'
22441 installstyle='$installstyle'
22442 installusrbinperl='$installusrbinperl'
22443 installvendorarch='$installvendorarch'
22444 installvendorbin='$installvendorbin'
22445 installvendorhtml1dir='$installvendorhtml1dir'
22446 installvendorhtml3dir='$installvendorhtml3dir'
22447 installvendorlib='$installvendorlib'
22448 installvendorman1dir='$installvendorman1dir'
22449 installvendorman3dir='$installvendorman3dir'
22450 installvendorscript='$installvendorscript'
22451 intsize='$intsize'
22452 issymlink='$issymlink'
22453 ivdformat='$ivdformat'
22454 ivsize='$ivsize'
22455 ivtype='$ivtype'
22456 known_extensions='$known_extensions'
22457 ksh='$ksh'
22458 ld='$ld'
22459 lddlflags='$lddlflags'
22460 ldflags='$ldflags'
22461 ldflags_uselargefiles='$ldflags_uselargefiles'
22462 ldlibpthname='$ldlibpthname'
22463 less='$less'
22464 lib_ext='$lib_ext'
22465 libc='$libc'
22466 libperl='$libperl'
22467 libpth='$libpth'
22468 libs='$libs'
22469 libsdirs='$libsdirs'
22470 libsfiles='$libsfiles'
22471 libsfound='$libsfound'
22472 libspath='$libspath'
22473 libswanted='$libswanted'
22474 libswanted_uselargefiles='$libswanted_uselargefiles'
22475 line='$line'
22476 lint='$lint'
22477 lkflags='$lkflags'
22478 ln='$ln'
22479 lns='$lns'
22480 localtime_r_proto='$localtime_r_proto'
22481 locincpth='$locincpth'
22482 loclibpth='$loclibpth'
22483 longdblsize='$longdblsize'
22484 longlongsize='$longlongsize'
22485 longsize='$longsize'
22486 lp='$lp'
22487 lpr='$lpr'
22488 ls='$ls'
22489 lseeksize='$lseeksize'
22490 lseektype='$lseektype'
22491 mad='$mad'
22492 madlyh='$madlyh'
22493 madlyobj='$madlyobj'
22494 madlysrc='$madlysrc'
22495 mail='$mail'
22496 mailx='$mailx'
22497 make='$make'
22498 make_set_make='$make_set_make'
22499 mallocobj='$mallocobj'
22500 mallocsrc='$mallocsrc'
22501 malloctype='$malloctype'
22502 man1dir='$man1dir'
22503 man1direxp='$man1direxp'
22504 man1ext='$man1ext'
22505 man3dir='$man3dir'
22506 man3direxp='$man3direxp'
22507 man3ext='$man3ext'
22508 mips_type='$mips_type'
22509 mistrustnm='$mistrustnm'
22510 mkdir='$mkdir'
22511 mmaptype='$mmaptype'
22512 modetype='$modetype'
22513 more='$more'
22514 multiarch='$multiarch'
22515 mv='$mv'
22516 myarchname='$myarchname'
22517 mydomain='$mydomain'
22518 myhostname='$myhostname'
22519 myuname='$myuname'
22520 n='$n'
22521 need_va_copy='$need_va_copy'
22522 netdb_hlen_type='$netdb_hlen_type'
22523 netdb_host_type='$netdb_host_type'
22524 netdb_name_type='$netdb_name_type'
22525 netdb_net_type='$netdb_net_type'
22526 nm='$nm'
22527 nm_opt='$nm_opt'
22528 nm_so_opt='$nm_so_opt'
22529 nonxs_ext='$nonxs_ext'
22530 nroff='$nroff'
22531 nvEUformat='$nvEUformat'
22532 nvFUformat='$nvFUformat'
22533 nvGUformat='$nvGUformat'
22534 nv_overflows_integers_at='$nv_overflows_integers_at'
22535 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22536 nveformat='$nveformat'
22537 nvfformat='$nvfformat'
22538 nvgformat='$nvgformat'
22539 nvsize='$nvsize'
22540 nvtype='$nvtype'
22541 o_nonblock='$o_nonblock'
22542 obj_ext='$obj_ext'
22543 old_pthread_create_joinable='$old_pthread_create_joinable'
22544 optimize='$optimize'
22545 orderlib='$orderlib'
22546 osname='$osname'
22547 osvers='$osvers'
22548 otherlibdirs='$otherlibdirs'
22549 package='$package'
22550 pager='$pager'
22551 passcat='$passcat'
22552 patchlevel='$patchlevel'
22553 path_sep='$path_sep'
22554 perl5='$perl5'
22555 perl='$perl'
22556 perl_patchlevel='$perl_patchlevel'
22557 perladmin='$perladmin'
22558 perllibs='$perllibs'
22559 perlpath='$perlpath'
22560 pg='$pg'
22561 phostname='$phostname'
22562 pidtype='$pidtype'
22563 plibpth='$plibpth'
22564 pmake='$pmake'
22565 pr='$pr'
22566 prefix='$prefix'
22567 prefixexp='$prefixexp'
22568 privlib='$privlib'
22569 privlibexp='$privlibexp'
22570 procselfexe='$procselfexe'
22571 prototype='$prototype'
22572 ptrsize='$ptrsize'
22573 quadkind='$quadkind'
22574 quadtype='$quadtype'
22575 randbits='$randbits'
22576 randfunc='$randfunc'
22577 random_r_proto='$random_r_proto'
22578 randseedtype='$randseedtype'
22579 ranlib='$ranlib'
22580 rd_nodata='$rd_nodata'
22581 readdir64_r_proto='$readdir64_r_proto'
22582 readdir_r_proto='$readdir_r_proto'
22583 revision='$revision'
22584 rm='$rm'
22585 rm_try='$rm_try'
22586 rmail='$rmail'
22587 run='$run'
22588 runnm='$runnm'
22589 sPRIEUldbl='$sPRIEUldbl'
22590 sPRIFUldbl='$sPRIFUldbl'
22591 sPRIGUldbl='$sPRIGUldbl'
22592 sPRIXU64='$sPRIXU64'
22593 sPRId64='$sPRId64'
22594 sPRIeldbl='$sPRIeldbl'
22595 sPRIfldbl='$sPRIfldbl'
22596 sPRIgldbl='$sPRIgldbl'
22597 sPRIi64='$sPRIi64'
22598 sPRIo64='$sPRIo64'
22599 sPRIu64='$sPRIu64'
22600 sPRIx64='$sPRIx64'
22601 sSCNfldbl='$sSCNfldbl'
22602 sched_yield='$sched_yield'
22603 scriptdir='$scriptdir'
22604 scriptdirexp='$scriptdirexp'
22605 sed='$sed'
22606 seedfunc='$seedfunc'
22607 selectminbits='$selectminbits'
22608 selecttype='$selecttype'
22609 sendmail='$sendmail'
22610 setgrent_r_proto='$setgrent_r_proto'
22611 sethostent_r_proto='$sethostent_r_proto'
22612 setlocale_r_proto='$setlocale_r_proto'
22613 setnetent_r_proto='$setnetent_r_proto'
22614 setprotoent_r_proto='$setprotoent_r_proto'
22615 setpwent_r_proto='$setpwent_r_proto'
22616 setservent_r_proto='$setservent_r_proto'
22617 sh='$sh'
22618 shar='$shar'
22619 sharpbang='$sharpbang'
22620 shmattype='$shmattype'
22621 shortsize='$shortsize'
22622 shrpenv='$shrpenv'
22623 shsharp='$shsharp'
22624 sig_count='$sig_count'
22625 sig_name='$sig_name'
22626 sig_name_init='$sig_name_init'
22627 sig_num='$sig_num'
22628 sig_num_init='$sig_num_init'
22629 sig_size='$sig_size'
22630 signal_t='$signal_t'
22631 sitearch='$sitearch'
22632 sitearchexp='$sitearchexp'
22633 sitebin='$sitebin'
22634 sitebinexp='$sitebinexp'
22635 sitehtml1dir='$sitehtml1dir'
22636 sitehtml1direxp='$sitehtml1direxp'
22637 sitehtml3dir='$sitehtml3dir'
22638 sitehtml3direxp='$sitehtml3direxp'
22639 sitelib='$sitelib'
22640 sitelib_stem='$sitelib_stem'
22641 sitelibexp='$sitelibexp'
22642 siteman1dir='$siteman1dir'
22643 siteman1direxp='$siteman1direxp'
22644 siteman3dir='$siteman3dir'
22645 siteman3direxp='$siteman3direxp'
22646 siteprefix='$siteprefix'
22647 siteprefixexp='$siteprefixexp'
22648 sitescript='$sitescript'
22649 sitescriptexp='$sitescriptexp'
22650 sizesize='$sizesize'
22651 sizetype='$sizetype'
22652 sleep='$sleep'
22653 smail='$smail'
22654 so='$so'
22655 sockethdr='$sockethdr'
22656 socketlib='$socketlib'
22657 socksizetype='$socksizetype'
22658 sort='$sort'
22659 spackage='$spackage'
22660 spitshell='$spitshell'
22661 srand48_r_proto='$srand48_r_proto'
22662 srandom_r_proto='$srandom_r_proto'
22663 src='$src'
22664 ssizetype='$ssizetype'
22665 startperl='$startperl'
22666 startsh='$startsh'
22667 static_ext='$static_ext'
22668 stdchar='$stdchar'
22669 stdio_base='$stdio_base'
22670 stdio_bufsiz='$stdio_bufsiz'
22671 stdio_cnt='$stdio_cnt'
22672 stdio_filbuf='$stdio_filbuf'
22673 stdio_ptr='$stdio_ptr'
22674 stdio_stream_array='$stdio_stream_array'
22675 strerror_r_proto='$strerror_r_proto'
22676 strings='$strings'
22677 submit='$submit'
22678 subversion='$subversion'
22679 sysman='$sysman'
22680 tail='$tail'
22681 tar='$tar'
22682 targetarch='$targetarch'
22683 tbl='$tbl'
22684 tee='$tee'
22685 test='$test'
22686 timeincl='$timeincl'
22687 timetype='$timetype'
22688 tmpnam_r_proto='$tmpnam_r_proto'
22689 to='$to'
22690 touch='$touch'
22691 tr='$tr'
22692 trnl='$trnl'
22693 troff='$troff'
22694 ttyname_r_proto='$ttyname_r_proto'
22695 u16size='$u16size'
22696 u16type='$u16type'
22697 u32size='$u32size'
22698 u32type='$u32type'
22699 u64size='$u64size'
22700 u64type='$u64type'
22701 u8size='$u8size'
22702 u8type='$u8type'
22703 uidformat='$uidformat'
22704 uidsign='$uidsign'
22705 uidsize='$uidsize'
22706 uidtype='$uidtype'
22707 uname='$uname'
22708 uniq='$uniq'
22709 uquadtype='$uquadtype'
22710 use5005threads='$use5005threads'
22711 use64bitall='$use64bitall'
22712 use64bitint='$use64bitint'
22713 usecrosscompile='$usecrosscompile'
22714 usedl='$usedl'
22715 usedtrace='$usedtrace'
22716 usefaststdio='$usefaststdio'
22717 useithreads='$useithreads'
22718 uselargefiles='$uselargefiles'
22719 uselongdouble='$uselongdouble'
22720 usemallocwrap='$usemallocwrap'
22721 usemorebits='$usemorebits'
22722 usemultiplicity='$usemultiplicity'
22723 usemymalloc='$usemymalloc'
22724 usenm='$usenm'
22725 useopcode='$useopcode'
22726 useperlio='$useperlio'
22727 useposix='$useposix'
22728 usereentrant='$usereentrant'
22729 userelocatableinc='$userelocatableinc'
22730 usesfio='$usesfio'
22731 useshrplib='$useshrplib'
22732 usesitecustomize='$usesitecustomize'
22733 usesocks='$usesocks'
22734 usethreads='$usethreads'
22735 usevendorprefix='$usevendorprefix'
22736 usevfork='$usevfork'
22737 usrinc='$usrinc'
22738 uuname='$uuname'
22739 uvXUformat='$uvXUformat'
22740 uvoformat='$uvoformat'
22741 uvsize='$uvsize'
22742 uvtype='$uvtype'
22743 uvuformat='$uvuformat'
22744 uvxformat='$uvxformat'
22745 vendorarch='$vendorarch'
22746 vendorarchexp='$vendorarchexp'
22747 vendorbin='$vendorbin'
22748 vendorbinexp='$vendorbinexp'
22749 vendorhtml1dir='$vendorhtml1dir'
22750 vendorhtml1direxp='$vendorhtml1direxp'
22751 vendorhtml3dir='$vendorhtml3dir'
22752 vendorhtml3direxp='$vendorhtml3direxp'
22753 vendorlib='$vendorlib'
22754 vendorlib_stem='$vendorlib_stem'
22755 vendorlibexp='$vendorlibexp'
22756 vendorman1dir='$vendorman1dir'
22757 vendorman1direxp='$vendorman1direxp'
22758 vendorman3dir='$vendorman3dir'
22759 vendorman3direxp='$vendorman3direxp'
22760 vendorprefix='$vendorprefix'
22761 vendorprefixexp='$vendorprefixexp'
22762 vendorscript='$vendorscript'
22763 vendorscriptexp='$vendorscriptexp'
22764 version='$version'
22765 version_patchlevel_string='$version_patchlevel_string'
22766 versiononly='$versiononly'
22767 vi='$vi'
22768 voidflags='$voidflags'
22769 xlibpth='$xlibpth'
22770 yacc='$yacc'
22771 yaccflags='$yaccflags'
22772 zcat='$zcat'
22773 zip='$zip'
22774 EOT
22775
22776 : Add in command line options if available
22777 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22778
22779 : add special variables
22780 $test -f $src/patchlevel.h && \
22781 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22782 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22783 echo "PERL_CONFIG_SH=true" >>config.sh
22784
22785 : propagate old symbols
22786 if $test -f UU/config.sh; then
22787         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22788         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22789                 config.sh config.sh UU/oldconfig.sh |\
22790                 $sort | $uniq -u >UU/oldsyms
22791         set X `cat UU/oldsyms`
22792         shift
22793         case $# in
22794         0) ;;
22795         *)
22796                 cat <<EOM
22797 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22798 EOM
22799                 echo ": Variables propagated from previous config.sh file." >>config.sh
22800                 for sym in `cat UU/oldsyms`; do
22801                         echo "    Propagating $hint variable "'$'"$sym..."
22802                         eval 'tmp="$'"${sym}"'"'
22803                         echo "$tmp" | \
22804                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22805                 done
22806                 ;;
22807         esac
22808 fi
22809
22810 : Finish up by extracting the .SH files
22811 case "$alldone" in
22812 exit)
22813         $rm -rf UU
22814         echo "Extraction done."
22815         exit 0
22816         ;;
22817 cont)
22818         ;;
22819 '')
22820         dflt=''
22821         nostick=true
22822         $cat <<EOM
22823
22824 If you'd like to make any changes to the config.sh file before I begin
22825 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22826
22827 EOM
22828         rp="Press return or use a shell escape to edit config.sh:"
22829         . UU/myread
22830         nostick=''
22831         case "$ans" in
22832         '') ;;
22833         *) : in case they cannot read
22834                 sh 1>&4 -c "$ans";;
22835         esac
22836         ;;
22837 esac
22838
22839 : if this fails, just run all the .SH files by hand
22840 . ./config.sh
22841
22842 echo " "
22843 exec 1>&4
22844 pwd=`pwd`
22845 . ./UU/extract
22846 cd "$pwd"
22847
22848 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22849         dflt=y
22850         case "$silent" in
22851         true) ;;
22852         *)
22853                 $cat <<EOM
22854
22855 Now you need to generate make dependencies by running "$make depend".
22856 You might prefer to run it in background: "$make depend > makedepend.out &"
22857 It can take a while, so you might not want to run it right now.
22858
22859 EOM
22860                 ;;
22861         esac
22862         rp="Run $make depend now?"
22863         . UU/myread
22864         case "$ans" in
22865         y*)
22866                 $make depend && echo "Now you must run '$make'."
22867                 ;;
22868         *)
22869                 echo "You must run '$make depend' then '$make'."
22870                 ;;
22871         esac
22872 elif test -f [Mm]akefile; then
22873         echo " "
22874         echo "Now you must run a $make."
22875 else
22876         echo "Configure done."
22877 fi
22878
22879 if $test -f Policy.sh; then
22880     $cat <<EOM
22881
22882 If you compile $package on a different machine or from a different object
22883 directory, copy the Policy.sh file from this object directory to the
22884 new one before you run Configure -- this will help you with most of
22885 the policy defaults.
22886
22887 EOM
22888 fi
22889 if $test -f config.msg; then
22890     echo "Hmm.  I also noted the following information while running:"
22891     echo " "
22892     $cat config.msg >&4
22893     $rm -f config.msg
22894 fi
22895 $rm -f kit*isdone ark*isdone
22896 $rm -rf UU
22897
22898 : End of Configure
22899