This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Warnings within the conditional of until() and for() are not reported
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist 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 Wed Apr  2 20:45:31 CEST 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_mallocmalloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_syspoll=''
917 i_sysresrc=''
918 i_syssecrt=''
919 i_sysselct=''
920 i_sysstat=''
921 i_sysstatfs=''
922 i_sysstatvfs=''
923 i_systimes=''
924 i_systypes=''
925 i_sysuio=''
926 i_sysun=''
927 i_sysutsname=''
928 i_sysvfs=''
929 i_syswait=''
930 i_sgtty=''
931 i_termio=''
932 i_termios=''
933 d_tm_tm_gmtoff=''
934 d_tm_tm_zone=''
935 i_systime=''
936 i_systimek=''
937 i_time=''
938 timeincl=''
939 i_unistd=''
940 i_ustat=''
941 i_utime=''
942 i_values=''
943 i_stdarg=''
944 i_varargs=''
945 i_varhdr=''
946 i_vfork=''
947 d_inc_version_list=''
948 inc_version_list=''
949 inc_version_list_init=''
950 installprefix=''
951 installprefixexp=''
952 installstyle=''
953 installusrbinperl=''
954 intsize=''
955 longsize=''
956 shortsize=''
957 issymlink=''
958 libc=''
959 ldlibpthname=''
960 libperl=''
961 shrpenv=''
962 useshrplib=''
963 glibpth=''
964 libpth=''
965 loclibpth=''
966 plibpth=''
967 xlibpth=''
968 ignore_versioned_solibs=''
969 libs=''
970 libsdirs=''
971 libsfiles=''
972 libsfound=''
973 libspath=''
974 lns=''
975 d_PRIEUldbl=''
976 d_PRIFUldbl=''
977 d_PRIGUldbl=''
978 d_PRIeldbl=''
979 d_PRIfldbl=''
980 d_PRIgldbl=''
981 d_SCNfldbl=''
982 sPRIEUldbl=''
983 sPRIFUldbl=''
984 sPRIGUldbl=''
985 sPRIeldbl=''
986 sPRIfldbl=''
987 sPRIgldbl=''
988 sSCNfldbl=''
989 lseeksize=''
990 lseektype=''
991 mad=''
992 madlyh=''
993 madlyobj=''
994 madlysrc=''
995 make_set_make=''
996 d_mymalloc=''
997 freetype=''
998 mallocobj=''
999 mallocsrc=''
1000 malloctype=''
1001 usemallocwrap=''
1002 usemymalloc=''
1003 installman1dir=''
1004 man1dir=''
1005 man1direxp=''
1006 man1ext=''
1007 installman3dir=''
1008 man3dir=''
1009 man3direxp=''
1010 man3ext=''
1011 modetype=''
1012 multiarch=''
1013 mydomain=''
1014 myhostname=''
1015 phostname=''
1016 c=''
1017 n=''
1018 d_eofnblk=''
1019 eagain=''
1020 o_nonblock=''
1021 rd_nodata=''
1022 need_va_copy=''
1023 netdb_hlen_type=''
1024 netdb_host_type=''
1025 netdb_name_type=''
1026 netdb_net_type=''
1027 groupcat=''
1028 hostcat=''
1029 passcat=''
1030 orderlib=''
1031 ranlib=''
1032 d_perl_otherlibdirs=''
1033 otherlibdirs=''
1034 package=''
1035 spackage=''
1036 pager=''
1037 api_revision=''
1038 api_subversion=''
1039 api_version=''
1040 api_versionstring=''
1041 patchlevel=''
1042 perl_patchlevel=''
1043 revision=''
1044 subversion=''
1045 version=''
1046 version_patchlevel_string=''
1047 perl5=''
1048 perladmin=''
1049 perlpath=''
1050 d_nv_preserves_uv=''
1051 d_nv_zero_is_allbits_zero=''
1052 i16size=''
1053 i16type=''
1054 i32size=''
1055 i32type=''
1056 i64size=''
1057 i64type=''
1058 i8size=''
1059 i8type=''
1060 ivsize=''
1061 ivtype=''
1062 nv_overflows_integers_at=''
1063 nv_preserves_uv_bits=''
1064 nvsize=''
1065 nvtype=''
1066 u16size=''
1067 u16type=''
1068 u32size=''
1069 u32type=''
1070 u64size=''
1071 u64type=''
1072 u8size=''
1073 u8type=''
1074 uvsize=''
1075 uvtype=''
1076 ivdformat=''
1077 nvEUformat=''
1078 nvFUformat=''
1079 nvGUformat=''
1080 nveformat=''
1081 nvfformat=''
1082 nvgformat=''
1083 uvXUformat=''
1084 uvoformat=''
1085 uvuformat=''
1086 uvxformat=''
1087 pidtype=''
1088 prefix=''
1089 prefixexp=''
1090 installprivlib=''
1091 privlib=''
1092 privlibexp=''
1093 prototype=''
1094 ptrsize=''
1095 d_PRIXU64=''
1096 d_PRId64=''
1097 d_PRIi64=''
1098 d_PRIo64=''
1099 d_PRIu64=''
1100 d_PRIx64=''
1101 sPRIXU64=''
1102 sPRId64=''
1103 sPRIi64=''
1104 sPRIo64=''
1105 sPRIu64=''
1106 sPRIx64=''
1107 d_quad=''
1108 quadkind=''
1109 quadtype=''
1110 uquadtype=''
1111 drand01=''
1112 randbits=''
1113 randfunc=''
1114 randseedtype=''
1115 seedfunc=''
1116 installscript=''
1117 scriptdir=''
1118 scriptdirexp=''
1119 selectminbits=''
1120 selecttype=''
1121 sh=''
1122 sig_count=''
1123 sig_name=''
1124 sig_name_init=''
1125 sig_num=''
1126 sig_num_init=''
1127 sig_size=''
1128 d_sitearch=''
1129 installsitearch=''
1130 sitearch=''
1131 sitearchexp=''
1132 installsitebin=''
1133 sitebin=''
1134 sitebinexp=''
1135 installsitehtml1dir=''
1136 sitehtml1dir=''
1137 sitehtml1direxp=''
1138 installsitehtml3dir=''
1139 sitehtml3dir=''
1140 sitehtml3direxp=''
1141 installsitelib=''
1142 sitelib=''
1143 sitelib_stem=''
1144 sitelibexp=''
1145 installsiteman1dir=''
1146 siteman1dir=''
1147 siteman1direxp=''
1148 installsiteman3dir=''
1149 siteman3dir=''
1150 siteman3direxp=''
1151 siteprefix=''
1152 siteprefixexp=''
1153 installsitescript=''
1154 sitescript=''
1155 sitescriptexp=''
1156 sizesize=''
1157 sizetype=''
1158 so=''
1159 socksizetype=''
1160 sharpbang=''
1161 shsharp=''
1162 spitshell=''
1163 src=''
1164 ssizetype=''
1165 startperl=''
1166 startsh=''
1167 stdchar=''
1168 d_stdio_stream_array=''
1169 stdio_stream_array=''
1170 sysman=''
1171 trnl=''
1172 uidformat=''
1173 uidsign=''
1174 uidsize=''
1175 uidtype=''
1176 archname64=''
1177 use64bitall=''
1178 use64bitint=''
1179 dtrace=''
1180 usedtrace=''
1181 usefaststdio=''
1182 ccflags_uselargefiles=''
1183 ldflags_uselargefiles=''
1184 libswanted_uselargefiles=''
1185 uselargefiles=''
1186 uselongdouble=''
1187 usemorebits=''
1188 usemultiplicity=''
1189 nm_opt=''
1190 nm_so_opt=''
1191 runnm=''
1192 usenm=''
1193 useperlio=''
1194 usesocks=''
1195 d_oldpthreads=''
1196 use5005threads=''
1197 useithreads=''
1198 usereentrant=''
1199 usethreads=''
1200 incpath=''
1201 mips_type=''
1202 usrinc=''
1203 d_vendorarch=''
1204 installvendorarch=''
1205 vendorarch=''
1206 vendorarchexp=''
1207 d_vendorbin=''
1208 installvendorbin=''
1209 vendorbin=''
1210 vendorbinexp=''
1211 installvendorhtml1dir=''
1212 vendorhtml1dir=''
1213 vendorhtml1direxp=''
1214 installvendorhtml3dir=''
1215 vendorhtml3dir=''
1216 vendorhtml3direxp=''
1217 d_vendorlib=''
1218 installvendorlib=''
1219 vendorlib=''
1220 vendorlib_stem=''
1221 vendorlibexp=''
1222 installvendorman1dir=''
1223 vendorman1dir=''
1224 vendorman1direxp=''
1225 installvendorman3dir=''
1226 vendorman3dir=''
1227 vendorman3direxp=''
1228 usevendorprefix=''
1229 vendorprefix=''
1230 vendorprefixexp=''
1231 d_vendorscript=''
1232 installvendorscript=''
1233 vendorscript=''
1234 vendorscriptexp=''
1235 versiononly=''
1236 defvoidused=''
1237 voidflags=''
1238 yacc=''
1239 yaccflags=''
1240 CONFIG=''
1241
1242 : Detect odd OSs
1243 define='define'
1244 undef='undef'
1245 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1246 rmlist=''
1247
1248 : We must find out about Eunice early
1249 eunicefix=':'
1250 if test -f /etc/unixtovms; then
1251         eunicefix=/etc/unixtovms
1252 fi
1253 if test -f /etc/unixtovms.exe; then
1254         eunicefix=/etc/unixtovms.exe
1255 fi
1256
1257 : Set executable suffix now -- needed before hints available
1258 if test -f "/libs/version.library"; then
1259 : Amiga OS
1260     _exe=""
1261 elif test -f "/system/gnu_library/bin/ar.pm"; then
1262 : Stratus VOS
1263     _exe=".pm"
1264 elif test -n "$DJGPP"; then
1265 : DOS DJGPP
1266     _exe=".exe"
1267 elif test -d c:/. -o -n "$is_os2" ; then
1268 : OS/2 or cygwin
1269     _exe=".exe"
1270 fi
1271
1272 i_whoami=''
1273 : Trailing extension.  Override this in a hint file, if needed.
1274 : Extra object files, if any, needed on this platform.
1275 archobjs=''
1276 archname=''
1277 groupstype=''
1278 libnames=''
1279 : change the next line if compiling for Xenix/286 on Xenix/386
1280 xlibpth='/usr/lib/386 /lib/386'
1281 : Possible local library directories to search.
1282 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1283 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1284
1285 : general looking path for locating libraries
1286 glibpth="/lib /usr/lib $xlibpth"
1287 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1288 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1289 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1290 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1291
1292 : Private path used by Configure to find libraries.  Its value
1293 : is prepended to libpth. This variable takes care of special
1294 : machines, like the mips.  Usually, it should be empty.
1295 plibpth=''
1296
1297 : default library list
1298 libswanted=''
1299 : some systems want to use only the non-versioned libso:s
1300 ignore_versioned_solibs=''
1301 : set usethreads on the Configure command line to enable threads.
1302 usereentrant='undef'
1303 : full support for void wanted by default
1304 defvoidused=15
1305
1306 : Possible local include directories to search.
1307 : Set locincpth to "" in a hint file to defeat local include searches.
1308 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1309 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1310 :
1311 : no include file wanted by default
1312 inclwanted=''
1313
1314 : Enable -DEBUGGING and -DDEBUGGING from the command line
1315 EBUGGING=''
1316 DEBUGGING=old
1317
1318 ccname=''
1319 ccversion=''
1320 perllibs=''
1321 : set useposix=false in your hint file to disable the POSIX extension.
1322 useposix=true
1323 : set useopcode=false in your hint file to disable the Opcode extension.
1324 useopcode=true
1325 archname64=''
1326 ccflags_uselargefiles=''
1327 ldflags_uselargefiles=''
1328 libswanted_uselargefiles=''
1329 : set usemultiplicity on the Configure command line to enable multiplicity.
1330 : set usesocks on the Configure command line to enable socks.
1331 : List of libraries we want.
1332 : If anyone needs extra -lxxx, put those in a hint file.
1333 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1334 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1335 : We probably want to search /usr/shlib before most other libraries.
1336 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1337 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1338 glibpth="/usr/shlib $glibpth"
1339 : Do not use vfork unless overridden by a hint file.
1340 usevfork=false
1341
1342 : Find the basic shell for Bourne shell scripts
1343 case "$sh" in
1344 '')
1345         case "$SYSTYPE" in
1346         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1347         *) xxx='/bin/sh';;
1348         esac
1349         if test -f "$xxx"; then
1350                 sh="$xxx"
1351         else
1352                 : Build up a list and do a single loop so we can 'break' out.
1353                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1354                 for xxx in sh bash ksh pdksh ash; do
1355                         for p in $pth; do
1356                                 try="$try ${p}/${xxx}"
1357                         done
1358                 done
1359                 for xxx in $try; do
1360                         if test -f "$xxx"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         elif test -f "$xxx.exe"; then
1367                                 sh="$xxx";
1368                                 break
1369                         fi
1370                 done
1371         fi
1372         ;;
1373 esac
1374
1375 case "$sh" in
1376 '')     cat >&2 <<EOM
1377 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1378
1379 Usually it's in /bin/sh.  How did you even get this far?
1380 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1381 we'll try to straighten this all out.
1382 EOM
1383         exit 1
1384         ;;
1385 esac
1386
1387 : see if sh knows # comments
1388 if `$sh -c '#' >/dev/null 2>&1`; then
1389         shsharp=true
1390         spitshell=cat
1391         xcat=/bin/cat
1392         test -f $xcat$_exe || xcat=/usr/bin/cat
1393         if test ! -f $xcat$_exe; then
1394                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1395                         if test -f $p/cat$_exe; then
1396                                 xcat=$p/cat
1397                                 break
1398                         fi
1399                 done
1400                 if test ! -f $xcat$_exe; then
1401                         echo "Can't find cat anywhere!"
1402                         exit 1
1403                 fi
1404         fi
1405         echo "#!$xcat" >sharp
1406         $eunicefix sharp
1407         chmod +x sharp
1408         ./sharp > today
1409         if test -s today; then
1410                 sharpbang='#!'
1411         else
1412                 echo "#! $xcat" > sharp
1413                 $eunicefix sharp
1414                 chmod +x sharp
1415                 ./sharp > today
1416                 if test -s today; then
1417                         sharpbang='#! '
1418                 else
1419                         sharpbang=': use '
1420                 fi
1421         fi
1422 else
1423         echo " "
1424         echo "Your $sh doesn't grok # comments--I will strip them later on."
1425         shsharp=false
1426         cd ..
1427         echo "exec grep -v '^[  ]*#'" >spitshell
1428         chmod +x spitshell
1429         $eunicefix spitshell
1430         spitshell=`pwd`/spitshell
1431         cd UU
1432         echo "I presume that if # doesn't work, #! won't work either!"
1433         sharpbang=': use '
1434 fi
1435 rm -f sharp today
1436
1437 : figure out how to guarantee sh startup
1438 case "$startsh" in
1439 '') startsh=${sharpbang}${sh} ;;
1440 *)
1441 esac
1442 cat >sharp <<EOSS
1443 $startsh
1444 set abc
1445 test "$?abc" != 1
1446 EOSS
1447
1448 chmod +x sharp
1449 $eunicefix sharp
1450 if ./sharp; then
1451         : echo "Yup, it does."
1452 else
1453         echo "Hmm... '$startsh' does not guarantee sh startup..."
1454         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1455 fi
1456 rm -f sharp
1457
1458 : Save command line options in file UU/cmdline.opt for later use in
1459 : generating config.sh.
1460 cat > cmdline.opt <<EOSH
1461 : Configure command line arguments.
1462 config_arg0='$0'
1463 config_args='$*'
1464 config_argc=$#
1465 EOSH
1466 argn=1
1467 args_exp=''
1468 args_sep=''
1469 for arg in "$@"; do
1470         cat >>cmdline.opt <<EOSH
1471 config_arg$argn='$arg'
1472 EOSH
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 rm -f cmdl.opt
1482
1483 : produce awk script to parse command line options
1484 cat >options.awk <<'EOF'
1485 BEGIN {
1486         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1487
1488         len = length(optstr);
1489         for (i = 1; i <= len; i++) {
1490                 c = substr(optstr, i, 1);
1491                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492                 if (a == ":") {
1493                         arg[c] = 1;
1494                         i++;
1495                 }
1496                 opt[c] = 1;
1497         }
1498 }
1499 {
1500         expect = 0;
1501         str = $0;
1502         if (substr(str, 1, 1) != "-") {
1503                 printf("'%s'\n", str);
1504                 next;
1505         }
1506         len = length($0);
1507         for (i = 2; i <= len; i++) {
1508                 c = substr(str, i, 1);
1509                 if (!opt[c]) {
1510                         printf("-%s\n", substr(str, i));
1511                         next;
1512                 }
1513                 printf("-%s\n", c);
1514                 if (arg[c]) {
1515                         if (i < len)
1516                                 printf("'%s'\n", substr(str, i + 1));
1517                         else
1518                                 expect = 1;
1519                         next;
1520                 }
1521         }
1522 }
1523 END {
1524         if (expect)
1525                 print "?";
1526 }
1527 EOF
1528
1529 : process the command line options
1530 set X `for arg in "$@"; do echo "X$arg"; done |
1531         sed -e s/X// | awk -f options.awk`
1532 eval "set $*"
1533 shift
1534 rm -f options.awk
1535
1536 : set up default values
1537 fastread=''
1538 reuseval=false
1539 config_sh=''
1540 alldone=''
1541 error=''
1542 silent=''
1543 extractsh=''
1544 override=''
1545 knowitall=''
1546 rm -f optdef.sh posthint.sh
1547 cat >optdef.sh <<EOS
1548 $startsh
1549 EOS
1550
1551
1552 : option parsing
1553 while test $# -gt 0; do
1554         case "$1" in
1555         -d) shift; fastread=yes;;
1556         -e) shift; alldone=cont;;
1557         -f)
1558                 shift
1559                 cd ..
1560                 if test -r "$1"; then
1561                         config_sh="$1"
1562                 else
1563                         echo "$me: cannot read config file $1." >&2
1564                         error=true
1565                 fi
1566                 cd UU
1567                 shift;;
1568         --help|\
1569         -h) shift; error=true;;
1570         -r) shift; reuseval=true;;
1571         -s) shift; silent=true; realsilent=true;;
1572         -E) shift; alldone=exit;;
1573         -K) shift; knowitall=true;;
1574         -O) shift; override=true;;
1575         -S) shift; silent=true; extractsh=true;;
1576         -D)
1577                 shift
1578                 case "$1" in
1579                 *=)
1580                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1581                         echo "$me: ignoring -D $1" >&2
1582                         ;;
1583                 *=*) echo "$1" | \
1584                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1585                 *) echo "$1='define'" >> optdef.sh;;
1586                 esac
1587                 shift
1588                 ;;
1589         -U)
1590                 shift
1591                 case "$1" in
1592                 *=) echo "$1" >> optdef.sh;;
1593                 *=*)
1594                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1595                         echo "$me: ignoring -U $1" >&2
1596                         ;;
1597                 *) echo "$1='undef'" >> optdef.sh;;
1598                 esac
1599                 shift
1600                 ;;
1601         -A)
1602             shift
1603             xxx=''
1604             yyy="$1"
1605             zzz=''
1606             uuu=undef
1607             case "$yyy" in
1608             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1609                  case "$zzz" in
1610                  *:*) zzz='' ;;
1611                  *)   xxx=append
1612                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1613                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1614                  esac
1615                  ;;
1616             esac
1617             case "$xxx" in
1618             '')  case "$yyy" in
1619                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1621                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1622                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1623                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1624                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1625                  esac
1626                  ;;
1627             esac
1628             case "$xxx" in
1629             append)
1630                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1631             clear)
1632                 echo "$yyy=''"                  >> posthint.sh ;;
1633             define)
1634                 case "$zzz" in
1635                 '') zzz=define ;;
1636                 esac
1637                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1638             eval)
1639                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1640             prepend)
1641                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1642             undef)
1643                 case "$zzz" in
1644                 '') zzz="$uuu" ;;
1645                 esac
1646                 echo "$yyy=$zzz"                >> posthint.sh ;;
1647             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1648             esac
1649             shift
1650             ;;
1651         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1652             exit 0;;
1653         --) break;;
1654         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1655         *) break;;
1656         esac
1657 done
1658
1659 case "$error" in
1660 true)
1661         cat >&2 <<EOM
1662 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1663                  [-U symbol] [-U symbol=] [-A command:symbol...]
1664   -d : use defaults for all answers.
1665   -e : go on without questioning past the production of config.sh.
1666   -f : specify an alternate default configuration file.
1667   -h : print this help message and exit (with an error status).
1668   -r : reuse C symbols value if possible (skips costly nm extraction).
1669   -s : silent mode, only echoes questions and essential information.
1670   -D : define symbol to have some value:
1671          -D symbol         symbol gets the value 'define'
1672          -D symbol=value   symbol gets the value 'value'
1673        common used examples (see INSTALL for more info):
1674          -Duse64bitint            use 64bit integers
1675          -Duse64bitall            use 64bit integers and pointers
1676          -Dusethreads             use thread support
1677          -Dinc_version_list=none  do not include older perl trees in @INC
1678          -DEBUGGING=none          DEBUGGING options
1679          -Dcc=gcc                 choose your compiler
1680          -Dprefix=/opt/perl5      choose your destination
1681   -E : stop at the end of questions, after having produced config.sh.
1682   -K : do not use unless you know what you are doing.
1683   -O : let -D and -U override definitions from loaded configuration file.
1684   -S : perform variable substitutions on all .SH files (can mix with -f)
1685   -U : undefine symbol:
1686          -U symbol    symbol gets the value 'undef'
1687          -U symbol=   symbol gets completely empty
1688        e.g.:  -Uversiononly
1689   -A : manipulate symbol after the platform specific hints have been applied:
1690          -A append:symbol=value   append value to symbol
1691          -A symbol=value          like append:, but with a separating space
1692          -A define:symbol=value   define symbol to have value
1693          -A clear:symbol          define symbol to be ''
1694          -A define:symbol         define symbol to be 'define'
1695          -A eval:symbol=value     define symbol to be eval of value
1696          -A prepend:symbol=value  prepend value to symbol
1697          -A undef:symbol          define symbol to be 'undef'
1698          -A undef:symbol=         define symbol to be ''
1699        e.g.:  -A prepend:libswanted='cl pthread '
1700               -A ccflags=-DSOME_MACRO
1701   -V : print version number and exit (with a zero status).
1702 EOM
1703         exit 1
1704         ;;
1705 esac
1706
1707 : Sanity checks
1708 case "$fastread$alldone" in
1709 yescont|yesexit) ;;
1710 *)
1711         case "$extractsh" in
1712         true) ;;
1713         *)
1714                 if test ! -t 0; then
1715                         echo "Say 'sh Configure', not 'sh <Configure'"
1716                         exit 1
1717                 fi
1718                 ;;
1719         esac
1720         ;;
1721 esac
1722
1723 exec 4>&1
1724 case "$silent" in
1725 true) exec 1>/dev/null;;
1726 esac
1727
1728 : run the defines and the undefines, if any, but leave the file out there...
1729 touch optdef.sh
1730 . ./optdef.sh
1731 : create the posthint manipulation script and leave the file out there...
1732 touch posthint.sh
1733
1734 : set package name
1735 package='perl5'
1736 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1737 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1738 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1739 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1740 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1741 esac
1742
1743 : Some greps do not return status, grrr.
1744 echo "grimblepritz" >grimble
1745 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1746         contains=contains
1747 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1748         contains=grep
1749 else
1750         contains=contains
1751 fi
1752 rm -f grimble
1753 : the following should work in any shell
1754 case "$contains" in
1755 contains*)
1756         echo " "
1757         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1758         cat >contains <<'EOSS'
1759 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1760 EOSS
1761 chmod +x contains
1762 esac
1763
1764 : Find the path to the source tree
1765 case "$src" in
1766 '') case "$0" in
1767     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1768          case "$src" in
1769          /*)    ;;
1770          .)     ;;
1771          *)     src=`cd ../$src && pwd` ;;
1772          esac
1773          ;;
1774     *)   src='.';;
1775     esac;;
1776 esac
1777 case "$src" in
1778 '')     src=/
1779         rsrc=/
1780         ;;
1781 /*)     rsrc="$src";;
1782 *)      rsrc="../$src";;
1783 esac
1784 if test -f $rsrc/Configure && \
1785         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1786 then
1787    : found it, so we are ok.
1788 else
1789         rsrc=''
1790         for src in . .. ../.. ../../.. ../../../..; do
1791                 if test -f ../$src/Configure && \
1792                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1793                 then
1794                         rsrc=../$src
1795                         break
1796                 fi
1797         done
1798 fi
1799 case "$rsrc" in
1800 '')
1801         cat <<EOM >&4
1802
1803 Sorry, I can't seem to locate the source dir for $package.  Please start
1804 Configure with an explicit path -- i.e. /some/path/Configure.
1805
1806 EOM
1807         exit 1
1808         ;;
1809 ../.)   rsrc='..';;
1810 *)
1811         echo " "
1812         echo "Sources for $package found in \"$src\"." >&4
1813         ;;
1814 esac
1815
1816 : script used to extract .SH files with variable substitutions
1817 cat >extract <<'EOS'
1818 PERL_CONFIG_SH=true
1819 echo "Doing variable substitutions on .SH files..."
1820 if test -f MANIFEST; then
1821         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1822 else
1823         echo "(Looking for .SH files under the source directory.)"
1824         set x `(cd "$src"; find . -name "*.SH" -print)`
1825 fi
1826 shift
1827 case $# in
1828 0) set x `(cd "$src"; echo *.SH)`; shift;;
1829 esac
1830 if test ! -f "$src/$1"; then
1831         shift
1832 fi
1833 mkdir_p='
1834 name=$1;
1835 create="";
1836 while test $name; do
1837         if test ! -d "$name"; then
1838                 create="$name $create";
1839                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1840                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1841         else
1842                 name="";
1843         fi;
1844 done;
1845 for file in $create; do
1846         mkdir $file;
1847 done
1848 '
1849 for file in $*; do
1850         case "$src" in
1851         ".")
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (cd "$dir" && . ./$file)
1857                         ;;
1858                 *)
1859                         . ./$file
1860                         ;;
1861                 esac
1862                 ;;
1863         *)
1864                 case "$file" in
1865                 */*)
1866                         dir=`expr X$file : 'X\(.*\)/'`
1867                         file=`expr X$file : 'X.*/\(.*\)'`
1868                         (set x $dir; shift; eval $mkdir_p)
1869                         sh <"$src/$dir/$file"
1870                         ;;
1871                 *)
1872                         sh <"$src/$file"
1873                         ;;
1874                 esac
1875                 ;;
1876         esac
1877 done
1878 if test -f "$src/config_h.SH"; then
1879         if test ! -f config.h; then
1880         : oops, they left it out of MANIFEST, probably, so do it anyway.
1881         . "$src/config_h.SH"
1882         fi
1883 fi
1884 EOS
1885
1886 : extract files and exit if asked to do so
1887 case "$extractsh" in
1888 true)
1889         case "$realsilent" in
1890         true) ;;
1891         *) exec 1>&4;;
1892         esac
1893         case "$config_sh" in
1894         '') config_sh='config.sh';;
1895         esac
1896         echo " "
1897         echo "Fetching answers from $config_sh..."
1898         cd ..
1899         . $config_sh
1900         test "$override" && . ./optdef.sh
1901         echo " "
1902         . UU/extract
1903         rm -rf UU
1904         echo "Extraction done."
1905         exit 0
1906         ;;
1907 esac
1908
1909 : Eunice requires " " instead of "", can you believe it
1910 echo " "
1911 : Here we go...
1912 echo "Beginning of configuration questions for $package."
1913
1914 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1915
1916 : first determine how to suppress newline on echo command
1917 echo " "
1918 echo "Checking echo to see how to suppress newlines..."
1919 (echo "hi there\c" ; echo " ") >.echotmp
1920 if $contains c .echotmp >/dev/null 2>&1 ; then
1921         echo "...using -n."
1922         n='-n'
1923         c=''
1924 else
1925         cat <<'EOM'
1926 ...using \c
1927 EOM
1928         n=''
1929         c='\c'
1930 fi
1931 echo $n "The star should be here-->$c"
1932 echo '*'
1933 rm -f .echotmp
1934
1935 : Now test for existence of everything in MANIFEST
1936 echo " "
1937 if test -f "$rsrc/MANIFEST"; then
1938         echo "First let's make sure your kit is complete.  Checking..." >&4
1939         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1940                 (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1945                         >/dev/null 2>>"$tmppwd/missing")
1946         done
1947         if test -s missing; then
1948                 cat missing >&4
1949                 cat >&4 <<'EOM'
1950
1951 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1952
1953 You have the option of continuing the configuration process, despite the
1954 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1955 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1956 and contact the author (perlbug@perl.org).
1957
1958 EOM
1959                 echo $n "Continue? [n] $c" >&4
1960                 read ans
1961                 case "$ans" in
1962                 y*)
1963                         echo "Continuing..." >&4
1964                         rm -f missing
1965                         ;;
1966                 *)
1967                         echo "ABORTING..." >&4
1968                         kill $$
1969                         ;;
1970                 esac
1971         else
1972                 echo "Looks good..."
1973         fi
1974 else
1975         echo "There is no MANIFEST file.  I hope your kit is complete !"
1976 fi
1977 rm -f missing x??
1978
1979 : Find the appropriate value for a newline for tr
1980 echo " "
1981 if test -n "$DJGPP"; then
1982        trnl='\012'
1983 fi
1984 if test X"$trnl" = X; then
1985         case "`echo foo|tr '\n' x 2>/dev/null`" in
1986         foox) trnl='\n' ;;
1987         esac
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\012' x 2>/dev/null`" in
1991         foox) trnl='\012' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1996        fooxy) trnl='\n\r' ;;
1997        esac
1998 fi
1999 if test X"$trnl" = X; then
2000         cat <<EOM >&2
2001
2002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2003
2004 EOM
2005         exit 1
2006 fi
2007
2008 : compute the number of columns on the terminal for proper question formatting
2009 case "$COLUMNS" in
2010 '') COLUMNS='80';;
2011 esac
2012
2013 : set up the echo used in my read
2014 myecho="case \"\$xxxm\" in
2015 '') echo $n \"\$rp $c\" >&4;;
2016 *) case \"\$rp\" in
2017         '') echo $n \"[\$xxxm] $c\";;
2018         *)
2019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2020                         echo \"\$rp\" >&4
2021                         echo $n \"[\$xxxm] $c\" >&4
2022                 else
2023                         echo $n \"\$rp [\$xxxm] $c\" >&4
2024                 fi
2025                 ;;
2026         esac;;
2027 esac"
2028
2029 : now set up to do reads with possible shell escape and default assignment
2030 cat <<EOSC >myread
2031 $startsh
2032 xxxm=\$dflt
2033 $myecho
2034 ans='!'
2035 case "\$fastread" in
2036 yes) case "\$dflt" in
2037         '') ;;
2038         *) ans='';
2039                 case "\$silent-\$rp" in
2040                 true-) ;;
2041                 *) echo " " >&4;;
2042                 esac;;
2043         esac;;
2044 *) case "\$silent" in
2045         true) case "\$rp" in
2046                 '') ans='';;
2047                 esac;;
2048         esac;;
2049 esac
2050 while expr "X\$ans" : "X!" >/dev/null; do
2051         read answ
2052         set x \$xxxm
2053         shift
2054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2055         case  "\$answ" in
2056         "!")
2057                 sh 1>&4
2058                 echo " "
2059                 $myecho
2060                 ;;
2061         !*)
2062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2063                 shift
2064                 sh 1>&4 -c "\$*"
2065                 echo " "
2066                 $myecho
2067                 ;;
2068         "\$ans")
2069                 case "\$ans" in
2070                 \\&*)
2071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2072                         shift
2073                         case "\$1" in
2074                         -d)
2075                                 fastread=yes
2076                                 echo "(OK, I'll run with -d after this question.)" >&4
2077                                 ;;
2078                         -*)
2079                                 echo "*** Sorry, \$1 not supported yet." >&4
2080                                 ;;
2081                         esac
2082                         $myecho
2083                         ans=!
2084                         ;;
2085                 esac;;
2086         *)
2087                 case "\$aok" in
2088                 y)
2089                         echo "*** Substitution done -- please confirm."
2090                         xxxm="\$ans"
2091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2092                         xxxm="\$ans"
2093                         ans=!
2094                         ;;
2095                 *)
2096                         echo "*** Error -- try again."
2097                         ans=!
2098                         ;;
2099                 esac
2100                 $myecho
2101                 ;;
2102         esac
2103         case "\$ans\$xxxm\$nostick" in
2104         '')
2105                 ans=!
2106                 $myecho
2107                 ;;
2108         esac
2109 done
2110 case "\$ans" in
2111 '') ans="\$xxxm";;
2112 esac
2113 EOSC
2114
2115 : create .config dir to save info across Configure sessions
2116 test -d ../.config || mkdir ../.config
2117 cat >../.config/README <<EOF
2118 This directory created by Configure to save information that should
2119 persist across sessions for $package.
2120
2121 You may safely delete it if you wish.
2122 EOF
2123
2124 : See if we are using a devel version and want that
2125 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2126 case "$usedevel" in
2127 $define|true|[yY]*) ;;
2128 *) case "$xversion" in
2129    *[13579])
2130         cat >&4 <<EOH
2131 *** WHOA THERE!!! ***
2132
2133     This is an UNSTABLE DEVELOPMENT release.
2134     The version of this $package distribution is $xversion, that is, odd,
2135     (as opposed to even) and that signifies a development release.
2136     If you want a maintenance release, you want an even-numbered version.
2137
2138     Do ***NOT*** install this into production use.
2139     Data corruption and crashes are possible.
2140
2141     It is most seriously suggested that you do not continue any further
2142     unless you want to help in developing and debugging Perl.
2143
2144     If you *still* want to build perl, you can answer 'y' now,
2145     or pass -Dusedevel to Configure.
2146
2147 EOH
2148         rp='Do you really want to continue?'
2149         dflt='n'
2150         . ./myread
2151         case "$ans" in
2152         [yY]) echo >&4 "Okay, continuing."
2153               usedevel="$define" ;;
2154         *) echo >&4 "Okay, bye."
2155            exit 1
2156            ;;
2157         esac
2158         ;;
2159     esac
2160     ;;
2161 esac
2162 case "$usedevel" in
2163 $define|true|[yY]*)
2164         case "$versiononly" in
2165         '') versiononly="$define" ;;
2166         esac
2167         case "$installusrbinperl" in
2168         '') installusrbinperl="$undef" ;;
2169         esac
2170         ;;
2171 esac
2172
2173 : general instructions
2174 needman=true
2175 firsttime=true
2176 user=`(logname) 2>/dev/null`
2177 case "$user" in
2178 '') user=`whoami 2>&1`;;
2179 esac
2180 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2181         firsttime=false
2182         echo " "
2183         rp='Would you like to see the instructions?'
2184         dflt=n
2185         . ./myread
2186         case "$ans" in
2187         [yY]*) ;;
2188         *) needman=false;;
2189         esac
2190 fi
2191 if $needman; then
2192         cat <<EOH
2193
2194 This installation shell script will examine your system and ask you questions
2195 to determine how the perl5 package should be installed. If you get
2196 stuck on a question, you may use a ! shell escape to start a subshell or
2197 execute a command.  Many of the questions will have default answers in square
2198 brackets; typing carriage return will give you the default.
2199
2200 On some of the questions which ask for file or directory names you are allowed
2201 to use the ~name construct to specify the login directory belonging to "name",
2202 even if you don't have a shell which knows about that.  Questions where this is
2203 allowed will be marked "(~name ok)".
2204
2205 EOH
2206         rp=''
2207         dflt='Type carriage return to continue'
2208         . ./myread
2209         cat <<'EOH'
2210
2211 The prompter used in this script allows you to use shell variables and
2212 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2213 in the default answer, as if the default line was a set of arguments given to a
2214 script shell.  This means you may also use $* to repeat the whole default line,
2215 so you do not have to re-type everything to add something to the default.
2216
2217 Everytime there is a substitution, you will have to confirm.  If there is an
2218 error (e.g. an unmatched backtick), the default answer will remain unchanged
2219 and you will be prompted again.
2220
2221 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2222 the questions and use the computed defaults (or the previous answers if there
2223 was already a config.sh file). Type 'Configure -h' for a list of options.
2224 You may also start interactively and then answer '& -d' at any prompt to turn
2225 on the non-interactive behaviour for the remainder of the execution.
2226
2227 EOH
2228         . ./myread
2229         cat <<EOH
2230
2231 Much effort has been expended to ensure that this shell script will run on any
2232 Unix system.  If despite that it blows up on yours, your best bet is to edit
2233 Configure and run it again.  If you can't run Configure for some reason,
2234 you'll have to generate a config.sh file by hand.  Whatever problems you
2235 have, let me (perlbug@perl.org) know how I blew it.
2236
2237 This installation script affects things in two ways:
2238
2239 1) it may do direct variable substitutions on some of the files included
2240    in this kit.
2241 2) it builds a config.h file for inclusion in C programs.  You may edit
2242    any of these files as the need arises after running this script.
2243
2244 If you make a mistake on a question, there is no easy way to back up to it
2245 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2246 files.  Configure will offer to let you do this before it runs the SH files.
2247
2248 EOH
2249         dflt='Type carriage return to continue'
2250         . ./myread
2251         case "$firsttime" in
2252         true) echo $user >>../.config/instruct;;
2253         esac
2254 fi
2255
2256 : find out where common programs are
2257 echo " "
2258 echo "Locating common programs..." >&4
2259 cat <<EOSC >loc
2260 $startsh
2261 case \$# in
2262 0) exit 1;;
2263 esac
2264 thing=\$1
2265 shift
2266 dflt=\$1
2267 shift
2268 for dir in \$*; do
2269         case "\$thing" in
2270         .)
2271         if test -d \$dir/\$thing; then
2272                 echo \$dir
2273                 exit 0
2274         fi
2275         ;;
2276         *)
2277         for thisthing in \$dir/\$thing; do
2278                 : just loop through to pick last item
2279         done
2280         if test -f \$thisthing; then
2281                 echo \$thisthing
2282                 exit 0
2283         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2284                 echo \$thisthing
2285                 exit 0
2286         elif test -f \$dir/\$thing.exe; then
2287                 if test -n "$DJGPP"; then
2288                         echo \$dir/\$thing.exe
2289                 elif test "$eunicefix" != ":"; then
2290                         : on Eunice apparently
2291                         echo \$dir/\$thing
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 # This question was auctioned at YAPC::Europe-2007 in Vienna
2487 # I never promised you could answer it. I only auctioned the question.
2488 cat <<FOO
2489 The following message is sponsored by
2490
2491   Dresden.pm<--The stars should be here.
2492
2493 Dear Perl user, system administrator or package
2494 maintainer, the Perl community sends greetings to
2495 you. Do you (emblematical) greet back [Y/n]? n
2496
2497 FOO
2498
2499 : Check what type of C compiler we use
2500 cat <<EOS >trygcc
2501 $startsh
2502 EOS
2503 cat <<'EOSC' >>trygcc
2504 case "$cc" in
2505 '') ;;
2506 *)  $rm -f try try.*
2507     $cat >try.c <<EOM
2508 int main(int argc, char *argv[]) {
2509   return 0;
2510 }
2511 EOM
2512     if $cc -o try $ccflags $ldflags try.c; then
2513        :
2514     else
2515         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         despair=yes
2517         trygcc=yes
2518         case "$cc" in
2519         *gcc*) trygcc=no ;;
2520         esac
2521         # Skip this test because it gives a false match on output like:
2522         #    ./trygcc: line 23: cc: command not found
2523         # case "`$cc -v -c try.c 2>&1`" in
2524         # *gcc*) trygcc=no ;;
2525         # esac
2526         if $test X"$trygcc" = Xyes; then
2527             if gcc -o try -c try.c; then
2528                 echo " "
2529                 echo "You seem to have a working gcc, though." >&4
2530                 # Switching compilers may undo the work of hints files.
2531                 # The most common problem is -D_REENTRANT for threads.
2532                 # This heuristic catches that case, but gets false positives
2533                 # if -Dusethreads was not actually specified.  Better to
2534                 # bail out here with a useful message than fail 
2535                 # mysteriously later. Should we perhaps just try to
2536                 # re-invoke Configure -Dcc=gcc config_args ?
2537                 if $test -f usethreads.cbu; then
2538                         $cat >&4 <<EOM 
2539
2540 *** However, any setting of the C compiler flags (e.g. for thread support)
2541 *** will be lost.  It may be necessary for you to restart Configure and
2542 *** add -Dcc=gcc to your Configure command line.
2543
2544 EOM
2545                         rp="Would you like to go ahead and try gcc anyway?"
2546                         dflt=n
2547                 else
2548                         rp="Would you like to use it?"
2549                         dflt=y
2550                 fi
2551                 if $test -f myread; then
2552                     . ./myread
2553                 else
2554                     if $test -f UU/myread; then
2555                         . ./UU/myread
2556                     else
2557                         echo "Cannot find myread, sorry.  Aborting." >&2
2558                         exit 1
2559                     fi
2560                 fi  
2561                 case "$ans" in
2562                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2563                 esac
2564             fi
2565         fi
2566     fi
2567     $rm -f try try.*
2568     ;;
2569 esac
2570 EOSC
2571
2572 cat <<EOS >checkcc
2573 $startsh
2574 EOS
2575 cat <<'EOSC' >>checkcc
2576 case "$cc" in        
2577 '') ;;
2578 *)  $rm -f try try.*              
2579     $cat >try.c <<EOM
2580 int main(int argc, char *argv[]) {
2581   return 0;
2582 }
2583 EOM
2584     if $cc -o try $ccflags $ldflags try.c; then
2585        :
2586     else
2587         if $test X"$despair" = Xyes; then
2588            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2589         fi
2590         $cat >&4 <<EOM         
2591 You need to find a working C compiler.
2592 Either (purchase and) install the C compiler supplied by your OS vendor,
2593 or for a free C compiler try http://gcc.gnu.org/
2594 I cannot continue any further, aborting.
2595 EOM
2596         exit 1
2597     fi
2598     $rm -f try try.*
2599     ;;
2600 esac
2601 EOSC
2602
2603 : determine whether symbolic links are supported
2604 echo " "
2605 $touch blurfl
2606 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2607         echo "Symbolic links are supported." >&4
2608         lns="$ln -s"
2609 else
2610         echo "Symbolic links are NOT supported." >&4
2611         lns="$ln"
2612 fi
2613 $rm -f blurfl sym
2614
2615 : determine whether symbolic links are supported
2616 echo " "
2617 case "$lns" in
2618 *"ln"*" -s")
2619         echo "Checking how to test for symbolic links..." >&4
2620         $lns blurfl sym
2621         if $test "X$issymlink" = X; then
2622                 case "$newsh" in
2623                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 esac
2626                 if test $? = 0; then
2627                         issymlink="test -h"
2628                 else
2629                         echo "Your builtin 'test -h' may be broken." >&4
2630                         case "$test" in
2631                         /*)     ;;
2632                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2633                                 for p in $pth
2634                                 do
2635                                         if test -f "$p/$test"; then
2636                                                 test="$p/$test"
2637                                                 break
2638                                         fi
2639                                 done
2640                                 ;;
2641                         esac
2642                         case "$test" in
2643                         /*)
2644                                 echo "Trying external '$test -h'." >&4
2645                                 issymlink="$test -h"
2646                                 if $test ! -h sym >/dev/null 2>&1; then
2647                                         echo "External '$test -h' is broken, too." >&4
2648                                         issymlink=''
2649                                 fi
2650                                 ;;
2651                         *)      issymlink='' ;;
2652                         esac
2653                 fi              
2654         fi
2655         if $test "X$issymlink" = X; then
2656                 if $test -L sym 2>/dev/null; then
2657                         issymlink="$test -L"
2658                         echo "The builtin '$test -L' worked." >&4
2659                 fi
2660         fi
2661         if $test "X$issymlink" != X; then
2662                 echo "You can test for symbolic links with '$issymlink'." >&4
2663         else
2664                 echo "I do not know how you can test for symbolic links." >&4
2665         fi
2666         $rm -f blurfl sym
2667         ;;
2668 *)      echo "No symbolic links, so not testing for their testing..." >&4
2669         ;;
2670 esac
2671 echo " "
2672
2673 : Make symlinks util
2674 case "$mksymlinks" in
2675 $define|true|[yY]*)
2676         case "$src" in
2677         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2678                 exit 1
2679                 ;;
2680         *)      case "$lns:$issymlink" in
2681                 *"ln"*" -s:"*"test -"?)
2682                         echo "Creating the symbolic links..." >&4
2683                         echo "(First creating the subdirectories...)" >&4
2684                         cd ..
2685                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2686                                 read directory
2687                                 test -z "$directory" && break
2688                                 mkdir -p $directory
2689                         done
2690                         # Sanity check 1.
2691                         if test ! -d t/base; then
2692                                 echo "Failed to create the subdirectories.  Aborting." >&4
2693                                 exit 1
2694                         fi
2695                         echo "(Then creating the symlinks...)" >&4
2696                         awk '{print $1}' $src/MANIFEST | while true; do
2697                                 read filename
2698                                 test -z "$filename" && break
2699                                 if test -f $filename; then
2700                                         if $issymlink $filename; then
2701                                                 rm -f $filename
2702                                         fi
2703                                 fi
2704                                 if test -f $filename; then
2705                                         echo "$filename already exists, not symlinking."
2706                                 else
2707                                         ln -s $src/$filename $filename
2708                                 fi
2709                         done
2710                         # Sanity check 2.
2711                         if test ! -f t/base/lex.t; then
2712                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2713                                 exit 1
2714                         fi
2715                         cd UU
2716                         ;;
2717                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2718                         ;;
2719                 esac
2720                 ;;
2721         esac
2722         ;;
2723 esac
2724
2725 : Check for Cross-Compilation
2726 case "$usecrosscompile" in
2727 $define|true|[yY]*)
2728         $echo "Cross-compiling..."
2729         croak=''
2730         case "$cc" in
2731         *-*-gcc) # A cross-compiling gcc, probably.
2732             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2733             ar=$targetarch-ar
2734             # leave out ld, choosing it is more complex
2735             nm=$targetarch-nm
2736             ranlib=$targetarch-ranlib
2737             $echo 'extern int foo;' > try.c
2738             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2739             shift
2740             if $test $# -gt 0; then
2741                 incpth="$incpth $*"
2742                 incpth="`$echo $incpth|$sed 's/^ //'`"
2743                 echo "Guessing incpth '$incpth'." >&4
2744                 for i in $*; do
2745                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2746                     if $test -d $j; then
2747                         libpth="$libpth $j"
2748                     fi
2749                 done   
2750                 libpth="`$echo $libpth|$sed 's/^ //'`"
2751                 echo "Guessing libpth '$libpth'." >&4
2752             fi
2753             $rm -f try.c
2754             ;;
2755         esac
2756         case "$targetarch" in
2757         '') echo "Targetarch not defined." >&4; croak=y ;;
2758         *)  echo "Using targetarch $targetarch." >&4 ;;
2759         esac
2760         case "$incpth" in
2761         '') echo "Incpth not defined." >&4; croak=y ;;
2762         *)  echo "Using incpth '$incpth'." >&4 ;;
2763         esac
2764         case "$libpth" in
2765         '') echo "Libpth not defined." >&4; croak=y ;;
2766         *)  echo "Using libpth '$libpth'." >&4 ;;
2767         esac
2768         case "$usrinc" in
2769         '') for i in $incpth; do
2770                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2771                     usrinc=$i
2772                     echo "Guessing usrinc $usrinc." >&4
2773                     break
2774                 fi
2775             done
2776             case "$usrinc" in
2777             '') echo "Usrinc not defined." >&4; croak=y ;;
2778             esac
2779             ;;
2780         *)  echo "Using usrinc $usrinc." >&4 ;;
2781         esac
2782         case "$targethost" in
2783         '') echo "Targethost not defined." >&4; croak=y ;;
2784         *)  echo "Using targethost $targethost." >&4
2785         esac
2786         locincpth=' '
2787         loclibpth=' '
2788         case "$croak" in
2789         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2790         esac
2791         case "$src" in
2792         /*) run=$src/Cross/run
2793             targetmkdir=$src/Cross/mkdir
2794             to=$src/Cross/to
2795             from=$src/Cross/from
2796             ;;
2797         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2798             run=$pwd/Cross/run
2799             targetmkdir=$pwd/Cross/mkdir
2800             to=$pwd/Cross/to
2801             from=$pwd/Cross/from
2802             ;;
2803         esac
2804         case "$targetrun" in
2805         '') targetrun=ssh ;;
2806         esac
2807         case "$targetto" in
2808         '') targetto=scp ;;
2809         esac
2810         case "$targetfrom" in
2811         '') targetfrom=scp ;;
2812         esac
2813         run=$run-$targetrun
2814         to=$to-$targetto
2815         from=$from-$targetfrom
2816         case "$targetdir" in
2817         '')  targetdir=/tmp
2818              echo "Guessing targetdir $targetdir." >&4
2819              ;;
2820         esac
2821         case "$targetuser" in
2822         '')  targetuser=root
2823              echo "Guessing targetuser $targetuser." >&4
2824              ;;
2825         esac
2826         case "$targetfrom" in
2827         scp)    q=-q ;;
2828         *)      q='' ;;
2829         esac
2830         case "$targetrun" in
2831         ssh|rsh)
2832             cat >$run <<EOF
2833 #!/bin/sh
2834 case "\$1" in
2835 -cwd)
2836   shift
2837   cwd=\$1
2838   shift
2839   ;;
2840 esac
2841 case "\$cwd" in
2842 '') cwd=$targetdir ;;
2843 esac
2844 exe=\$1
2845 shift
2846 if $test ! -f \$exe.xok; then
2847   $to \$exe
2848   $touch \$exe.xok
2849 fi
2850 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2851 EOF
2852             ;;
2853         *)  echo "Unknown targetrun '$targetrun'" >&4
2854             exit 1
2855             ;;
2856         esac
2857         case "$targetmkdir" in
2858         */Cross/mkdir)
2859             cat >$targetmkdir <<EOF
2860 #!/bin/sh
2861 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2862 EOF
2863             $chmod a+rx $targetmkdir
2864             ;;
2865         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetto" in
2870         scp|rcp)
2871             cat >$to <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   case "\$f" in
2876   /*)
2877     $targetmkdir \`dirname \$f\`
2878     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2879     ;;
2880   *)
2881     $targetmkdir $targetdir/\`dirname \$f\`
2882     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2883     ;;
2884   esac
2885 done
2886 exit 0
2887 EOF
2888             ;;
2889         cp) cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $mkdir -p $targetdir/\`dirname \$f\`
2896     $cp \$f $targetdir/\$f || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $cp \$f $targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetto '$targetto'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetfrom" in
2912         scp|rcp)
2913           cat >$from <<EOF
2914 #!/bin/sh
2915 for f in \$@
2916 do
2917   $rm -f \$f
2918   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$from <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   $rm -f \$f
2928   cp $targetdir/\$f . || exit 1
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         if $test ! -f $run; then
2938             echo "Target 'run' script '$run' not found." >&4
2939         else
2940             $chmod a+rx $run
2941         fi
2942         if $test ! -f $to; then
2943             echo "Target 'to' script '$to' not found." >&4
2944         else
2945             $chmod a+rx $to
2946         fi
2947         if $test ! -f $from; then
2948             echo "Target 'from' script '$from' not found." >&4
2949         else
2950             $chmod a+rx $from
2951         fi
2952         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2953             exit 1
2954         fi
2955         cat >&4 <<EOF
2956 Using '$run' for remote execution,
2957 and '$from' and '$to'
2958 for remote file transfer.
2959 EOF
2960         ;;
2961 *)      run=''
2962         to=:
2963         from=:
2964         usecrosscompile='undef'
2965         targetarch=''
2966         ;;
2967 esac
2968
2969 : see whether [:lower:] and [:upper:] are supported character classes
2970 echo " "
2971 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2972 ABYZ)
2973         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2974         up='[:upper:]'
2975         low='[:lower:]'
2976         ;;
2977 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2978         # (0xd9 and 0xe2), therefore that is a nice testing point.
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2981             rs) up='[A-Z]'
2982                 low='[a-z]'
2983                 ;;
2984             esac
2985         fi
2986         if test "X$up" = X -o "X$low" = X; then
2987             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2988             rs) up='A-Z'
2989                 low='a-z'
2990                 ;;
2991             esac
2992         fi
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | od -x 2>/dev/null`" in
2995             *D9E2*|*d9e2*)
2996                 echo "Hey, this might be EBCDIC." >&4
2997                 if test "X$up" = X -o "X$low" = X; then
2998                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2999                     rs) up='[A-IJ-RS-Z]'
3000                         low='[a-ij-rs-z]'
3001                         ;;
3002                     esac
3003                 fi
3004                 if test "X$up" = X -o "X$low" = X; then
3005                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3006                     rs) up='A-IJ-RS-Z'
3007                         low='a-ij-rs-z'
3008                         ;;
3009                     esac
3010                 fi
3011                 ;;
3012             esac
3013         fi
3014 esac
3015 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3016 rs)
3017     echo "Using $up and $low to convert case." >&4
3018     ;;
3019 *)
3020     echo "I don't know how to translate letters from upper to lower case." >&4
3021     echo "Your tr is not acting any way I know of." >&4
3022     exit 1
3023     ;;
3024 esac
3025 : set up the translation script tr, must be called with ./tr of course
3026 cat >tr <<EOSC
3027 $startsh
3028 case "\$1\$2" in
3029 '[A-Z][a-z]') exec $tr '$up' '$low';;
3030 '[a-z][A-Z]') exec $tr '$low' '$up';;
3031 esac
3032 exec $tr "\$@"
3033 EOSC
3034 chmod +x tr
3035 $eunicefix tr
3036
3037 : Try to determine whether config.sh was made on this system
3038 case "$config_sh" in
3039 '')
3040 myuname=`$uname -a 2>/dev/null`
3041 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3042 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3043 # because the A-Z/a-z are not consecutive.
3044 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3045         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3046 newmyuname="$myuname"
3047 dflt=n
3048 case "$knowitall" in
3049 '')
3050         if test -f ../config.sh; then
3051                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3052                         eval "`grep myuname= ../config.sh`"
3053                 fi
3054                 if test "X$myuname" = "X$newmyuname"; then
3055                         dflt=y
3056                 fi
3057         fi
3058         ;;
3059 *) dflt=y;;
3060 esac
3061
3062 : Get old answers from old config file if Configure was run on the
3063 : same system, otherwise use the hints.
3064 hint=default
3065 cd ..
3066 if test -f config.sh; then
3067         echo " "
3068         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3069         . UU/myread
3070         case "$ans" in
3071         n*|N*) echo "OK, I'll ignore it."
3072                 mv config.sh config.sh.old
3073                 myuname="$newmyuname"
3074                 ;;
3075         *)  echo "Fetching default answers from your old config.sh file..." >&4
3076                 tmp_n="$n"
3077                 tmp_c="$c"
3078                 tmp_sh="$sh"
3079                 . ./config.sh
3080                 cp config.sh UU
3081                 n="$tmp_n"
3082                 c="$tmp_c"
3083                 : Older versions did not always set $sh.  Catch re-use of such
3084                 : an old config.sh.
3085                 case "$sh" in
3086                 '') sh="$tmp_sh" ;;
3087                 esac
3088                 hint=previous
3089                 ;;
3090         esac
3091 fi
3092 . ./UU/checkcc
3093 if test ! -f config.sh; then
3094         $cat <<EOM
3095
3096 First time through, eh?  I have some defaults handy for some systems
3097 that need some extra help getting the Configure answers right:
3098
3099 EOM
3100         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3101         dflt=''
3102         : Half the following guesses are probably wrong... If you have better
3103         : tests or hints, please send them to perlbug@perl.org
3104         : The metaconfig authors would also appreciate a copy...
3105         $test -f /irix && osname=irix
3106         $test -f /xenix && osname=sco_xenix
3107         $test -f /dynix && osname=dynix
3108         $test -f /dnix && osname=dnix
3109         $test -f /lynx.os && osname=lynxos
3110         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3111         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /bin/mips && /bin/mips && osname=mips
3114         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3115                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3116         $test -d /usr/apollo/bin && osname=apollo
3117         $test -f /etc/saf/_sactab && osname=svr4
3118         $test -d /usr/include/minix && osname=minix
3119         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3120         if $test -d /MachTen -o -d /MachTen_Folder; then
3121                 osname=machten
3122                 if $test -x /sbin/version; then
3123                         osvers=`/sbin/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 elif $test -x /usr/etc/version; then
3126                         osvers=`/usr/etc/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 else
3129                         osvers="$2.$3"
3130                 fi
3131         fi
3132
3133         $test -f /sys/posix.dll &&
3134                 $test -f /usr/bin/what &&
3135                 set X `/usr/bin/what /sys/posix.dll` &&
3136                 $test "$3" = UWIN &&
3137                 osname=uwin &&
3138                 osvers="$5"
3139
3140         if $test -f $uname; then
3141                 set X $myuname
3142                 shift
3143
3144                 case "$5" in
3145                 fps*) osname=fps ;;
3146                 mips*)
3147                         case "$4" in
3148                         umips) osname=umips ;;
3149                         *) osname=mips ;;
3150                         esac;;
3151                 [23]100) osname=mips ;;
3152                 next*) osname=next ;;
3153                 i386*)
3154                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3155                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3156                                 osname='sco'
3157                                 osvers=$tmp
3158                         elif $test -f /etc/kconfig; then
3159                                 osname=isc
3160                                 if test "$lns" = "$ln -s"; then
3161                                         osvers=4
3162                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=3
3164                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3165                                         osvers=2
3166                                 fi
3167                         fi
3168                         tmp=''
3169                         ;;
3170                 pc*)
3171                         if test -n "$DJGPP"; then
3172                                 osname=dos
3173                                 osvers=djgpp
3174                         fi
3175                         ;;
3176                 esac
3177
3178                 case "$1" in
3179                 aix) osname=aix
3180                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3181                         case "$tmp" in
3182                         # oslevel can fail with:
3183                         # oslevel: Unable to acquire lock.
3184                         *not\ found) osvers="$4"."$3" ;;
3185                         '<3240'|'<>3240') osvers=3.2.0 ;;
3186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3187                         '=3250'|'>3250') osvers=3.2.5 ;;
3188                         *) osvers=$tmp;;
3189                         esac
3190                         ;;
3191                 bsd386) osname=bsd386
3192                         osvers=`$uname -r`
3193                         ;;
3194                 cygwin*) osname=cygwin
3195                         osvers="$3"
3196                         ;;
3197                 *dc.osx) osname=dcosx
3198                         osvers="$3"
3199                         ;;
3200                 dnix) osname=dnix
3201                         osvers="$3"
3202                         ;;
3203                 domainos) osname=apollo
3204                         osvers="$3"
3205                         ;;
3206                 dgux)   osname=dgux
3207                         osvers="$3"
3208                         ;;
3209                 dragonfly) osname=dragonfly
3210                         osvers="$3"
3211                         ;;
3212                 dynixptx*) osname=dynixptx
3213                         osvers=`echo "$4"|sed 's/^v//'`
3214                         ;;
3215                 freebsd) osname=freebsd
3216                         osvers="$3" ;;
3217                 genix)  osname=genix ;;
3218                 gnu)    osname=gnu
3219                         osvers="$3" ;;
3220                 hp*)    osname=hpux
3221                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3222                         ;;
3223                 irix*)  osname=irix
3224                         case "$3" in
3225                         4*) osvers=4 ;;
3226                         5*) osvers=5 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 linux)  osname=linux
3231                         case "$3" in
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 MiNT)   osname=mint
3236                         ;;
3237                 netbsd*) osname=netbsd
3238                         osvers="$3"
3239                         ;;
3240                 news-os) osvers="$3"
3241                         case "$3" in
3242                         4*) osname=newsos4 ;;
3243                         *) osname=newsos ;;
3244                         esac
3245                         ;;
3246                 next*) osname=next ;;
3247                 nonstop-ux) osname=nonstopux ;;
3248                 openbsd) osname=openbsd
3249                         osvers="$3"
3250                         ;;
3251                 os2)    osname=os2
3252                         osvers="$4"
3253                         ;;
3254                 POSIX-BC | posix-bc ) osname=posix-bc
3255                         osvers="$3"
3256                         ;;
3257                 powerux | power_ux | powermax_os | powermaxos | \
3258                 powerunix | power_unix) osname=powerux
3259                         osvers="$3"
3260                         ;;
3261                 qnx) osname=qnx
3262                         osvers="$4"
3263                         ;;
3264                 solaris) osname=solaris
3265                         case "$3" in
3266                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 sunos) osname=sunos
3271                         case "$3" in
3272                         5*) osname=solaris
3273                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3274                         *)      osvers="$3" ;;
3275                         esac
3276                         ;;
3277                 titanos) osname=titanos
3278                         case "$3" in
3279                         1*) osvers=1 ;;
3280                         2*) osvers=2 ;;
3281                         3*) osvers=3 ;;
3282                         4*) osvers=4 ;;
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 ultrix) osname=ultrix
3287                         osvers="$3"
3288                         ;;
3289                 osf1|mls+)      case "$5" in
3290                                 alpha)
3291                                         osname=dec_osf
3292                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3293                                         case "$osvers" in
3294                                         [1-9].[0-9]*) ;;
3295                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3296                                         esac
3297                                         ;;
3298                         hp*)    osname=hp_osf1  ;;
3299                         mips)   osname=mips_osf1 ;;
3300                         esac
3301                         ;;
3302                 # UnixWare 7.1.2 is known as Open UNIX 8
3303                 openunix|unixware) osname=svr5
3304                         osvers="$4"
3305                         ;;
3306                 uts)    osname=uts
3307                         osvers="$3"
3308                         ;;
3309                 vos) osvers="$3"
3310                         ;;
3311                 $2) case "$osname" in
3312                         *isc*) ;;
3313                         *freebsd*) ;;
3314                         svr*)
3315                                 : svr4.x or possibly later
3316                                 case "svr$3" in
3317                                 ${osname}*)
3318                                         osname=svr$3
3319                                         osvers=$4
3320                                         ;;
3321                                 esac
3322                                 case "$osname" in
3323                                 svr4.0)
3324                                         : Check for ESIX
3325                                         if test -f /stand/boot ; then
3326                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3327                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3328                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3329                                                         if test -n "$isesix"; then
3330                                                                 osname=esix4
3331                                                         fi
3332                                                 fi
3333                                         fi
3334                                         ;;
3335                                 esac
3336                                 ;;
3337                         *)      if test -f /etc/systemid; then
3338                                         osname=sco
3339                                         set `echo $3 | $sed 's/\./ /g'` $4
3340                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3341                                                 osvers=$1.$2.$3
3342                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3343                                                 osvers=$1.$2
3344                                         elif $test -f $src/hints/sco_$1.sh; then
3345                                                 osvers=$1
3346                                         fi
3347                                 else
3348                                         case "$osname" in
3349                                         '') : Still unknown.  Probably a generic Sys V.
3350                                                 osname="sysv"
3351                                                 osvers="$3"
3352                                                 ;;
3353                                         esac
3354                                 fi
3355                                 ;;
3356                         esac
3357                         ;;
3358                 *)      case "$osname" in
3359                         '') : Still unknown.  Probably a generic BSD.
3360                                 osname="$1"
3361                                 osvers="$3"
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366         else
3367                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3368                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3369                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3370                                 osname=news_os
3371                         fi
3372                         $rm -f UU/kernel.what
3373                 elif test -d c:/. -o -n "$is_os2" ; then
3374                         set X $myuname
3375                         osname=os2
3376                         osvers="$5"
3377                 fi
3378         fi
3379
3380         case "$targetarch" in
3381         '') ;;
3382         *)  hostarch=$osname
3383             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3384             osvers=''
3385             ;;
3386         esac
3387
3388         : Now look for a hint file osname_osvers, unless one has been
3389         : specified already.
3390         case "$hintfile" in
3391         ''|' ')
3392                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3393                 : Also try without trailing minor version numbers.
3394                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3395                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3398                 case "$file" in
3399                 '') dflt=none ;;
3400                 *)  case "$osvers" in
3401                         '') dflt=$file
3402                                 ;;
3403                         *)  if $test -f $src/hints/$file.sh ; then
3404                                         dflt=$file
3405                                 elif $test -f $src/hints/$xfile.sh ; then
3406                                         dflt=$xfile
3407                                 elif $test -f $src/hints/$xxfile.sh ; then
3408                                         dflt=$xxfile
3409                                 elif $test -f $src/hints/$xxxfile.sh ; then
3410                                         dflt=$xxxfile
3411                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3412                                         dflt=$xxxxfile
3413                                 elif $test -f "$src/hints/${osname}.sh" ; then
3414                                         dflt="${osname}"
3415                                 else
3416                                         dflt=none
3417                                 fi
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 if $test -f Policy.sh ; then
3423                         case "$dflt" in
3424                         *Policy*) ;;
3425                         none) dflt="Policy" ;;
3426                         *) dflt="Policy $dflt" ;;
3427                         esac
3428                 fi
3429                 ;;
3430         *)
3431                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3432                 ;;
3433         esac
3434
3435         if $test -f Policy.sh ; then
3436                 $cat <<EOM
3437
3438 There's also a Policy hint file available, which should make the
3439 site-specific (policy) questions easier to answer.
3440 EOM
3441
3442         fi
3443
3444         $cat <<EOM
3445
3446 You may give one or more space-separated answers, or "none" if appropriate.
3447 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3448 previous run of Configure, you may specify it as well as or instead of
3449 OS-specific hints.  If hints are provided for your OS, you should use them:
3450 although Perl can probably be built without hints on many platforms, using
3451 hints often improve performance and may enable features that Configure can't
3452 set up on its own. If there are no hints that match your OS, specify "none";
3453 DO NOT give a wrong version or a wrong OS.
3454
3455 EOM
3456
3457         rp="Which of these apply, if any?"
3458         . UU/myread
3459         tans=$ans
3460         for file in $tans; do
3461                 if $test X$file = XPolicy -a -f Policy.sh; then
3462                         . Policy.sh
3463                         $cat Policy.sh >> UU/config.sh
3464                 elif $test -f $src/hints/$file.sh; then
3465                         . $src/hints/$file.sh
3466                         $cat $src/hints/$file.sh >> UU/config.sh
3467                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3468                         : nothing
3469                 else
3470                         : Give one chance to correct a possible typo.
3471                         echo "$file.sh does not exist"
3472                         dflt=$file
3473                         rp="hint to use instead?"
3474                         . UU/myread
3475                         for file in $ans; do
3476                                 if $test -f "$src/hints/$file.sh"; then
3477                                         . $src/hints/$file.sh
3478                                         $cat $src/hints/$file.sh >> UU/config.sh
3479                                 elif $test X$ans = X -o X$ans = Xnone ; then
3480                                         : nothing
3481                                 else
3482                                         echo "$file.sh does not exist -- ignored."
3483                                 fi
3484                         done
3485                 fi
3486         done
3487
3488         hint=recommended
3489         : Remember our hint file for later.
3490         if $test -f "$src/hints/$file.sh" ; then
3491                 hintfile="$file"
3492         else
3493                 hintfile=''
3494         fi
3495 fi
3496 cd UU
3497 ;;
3498 *)
3499         echo " "
3500         echo "Fetching default answers from $config_sh..." >&4
3501         tmp_n="$n"
3502         tmp_c="$c"
3503         cd ..
3504         cp $config_sh config.sh 2>/dev/null
3505         chmod +w config.sh
3506         . ./config.sh
3507         cd UU
3508         cp ../config.sh .
3509         n="$tmp_n"
3510         c="$tmp_c"
3511         hint=previous
3512         ;;
3513 esac
3514 test "$override" && . ./optdef.sh
3515
3516 : Restore computed paths
3517 for file in $loclist $trylist; do
3518         eval $file="\$_$file"
3519 done
3520
3521 cat << EOM
3522
3523 Configure uses the operating system name and version to set some defaults.
3524 The default value is probably right if the name rings a bell. Otherwise,
3525 since spelling matters for me, either accept the default or answer "none"
3526 to leave it blank.
3527
3528 EOM
3529 case "$osname" in
3530         ''|' ')
3531                 case "$hintfile" in
3532                 ''|' '|none) dflt=none ;;
3533                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3534                 esac
3535                 ;;
3536         *) dflt="$osname" ;;
3537 esac
3538 rp="Operating system name?"
3539 . ./myread
3540 case "$ans" in
3541 none)  osname='' ;;
3542 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3543 esac
3544 echo " "
3545 case "$osvers" in
3546         ''|' ')
3547                 case "$hintfile" in
3548                 ''|' '|none) dflt=none ;;
3549                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3550                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3551                         case "$dflt" in
3552                         ''|' ') dflt=none ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osvers" ;;
3558 esac
3559 rp="Operating system version?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osvers='' ;;
3563 *) osvers="$ans" ;;
3564 esac
3565
3566
3567 . ./posthint.sh
3568
3569 : who configured the system
3570 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3571 case "$cf_by" in
3572 "")
3573         cf_by=`(logname) 2>/dev/null`
3574         case "$cf_by" in
3575         "")
3576                 cf_by=`(whoami) 2>/dev/null`
3577                 case "$cf_by" in
3578                 "") cf_by=unknown ;;
3579                 esac ;;
3580         esac ;;
3581 esac
3582
3583 : decide how portable to be.  Allow command line overrides.
3584 case "$d_portable" in
3585 "$undef") ;;
3586 *)      d_portable="$define" ;;
3587 esac
3588
3589 : set up shell script to do ~ expansion
3590 cat >filexp <<EOSS
3591 $startsh
3592 : expand filename
3593 case "\$1" in
3594  \~/*|\~)
3595         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3596         ;;
3597  \~*)
3598         if $test -f /bin/csh; then
3599                 /bin/csh -f -c "glob \$1"
3600                 failed=\$?
3601                 echo ""
3602                 exit \$failed
3603         else
3604                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3605                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3606                 if $test ! -d "\$dir"; then
3607                         me=\`basename \$0\`
3608                         echo "\$me: can't locate home directory for: \$name" >&2
3609                         exit 1
3610                 fi
3611                 case "\$1" in
3612                 */*)
3613                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3614                         ;;
3615                 *)
3616                         echo \$dir
3617                         ;;
3618                 esac
3619         fi
3620         ;;
3621 *)
3622         echo \$1
3623         ;;
3624 esac
3625 EOSS
3626 chmod +x filexp
3627 $eunicefix filexp
3628
3629 : now set up to get a file name
3630 cat <<EOS >getfile
3631 $startsh
3632 EOS
3633 cat <<'EOSC' >>getfile
3634 tilde=''
3635 fullpath=''
3636 already=''
3637 skip=''
3638 none_ok=''
3639 exp_file=''
3640 nopath_ok=''
3641 orig_rp="$rp"
3642 orig_dflt="$dflt"
3643 case "$gfpth" in
3644 '') gfpth='.' ;;
3645 esac
3646
3647 case "$fn" in
3648 *\(*)
3649         : getfile will accept an answer from the comma-separated list
3650         : enclosed in parentheses even if it does not meet other criteria.
3651         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3652         fn=`echo $fn | sed 's/(.*)//'`
3653         ;;
3654 esac
3655
3656 case "$fn" in
3657 *:*)
3658         loc_file=`expr $fn : '.*:\(.*\)'`
3659         fn=`expr $fn : '\(.*\):.*'`
3660         ;;
3661 esac
3662
3663 case "$fn" in
3664 *~*) tilde=true;;
3665 esac
3666 case "$fn" in
3667 */*) fullpath=true;;
3668 esac
3669 case "$fn" in
3670 *+*) skip=true;;
3671 esac
3672 case "$fn" in
3673 *n*) none_ok=true;;
3674 esac
3675 case "$fn" in
3676 *e*) exp_file=true;;
3677 esac
3678 case "$fn" in
3679 *p*) nopath_ok=true;;
3680 esac
3681
3682 case "$fn" in
3683 *f*) type='File';;
3684 *d*) type='Directory';;
3685 *l*) type='Locate';;
3686 esac
3687
3688 what="$type"
3689 case "$what" in
3690 Locate) what='File';;
3691 esac
3692
3693 case "$exp_file" in
3694 '')
3695         case "$d_portable" in
3696         "$define") ;;
3697         *) exp_file=true;;
3698         esac
3699         ;;
3700 esac
3701
3702 cd ..
3703 while test "$type"; do
3704         redo=''
3705         rp="$orig_rp"
3706         dflt="$orig_dflt"
3707         case "$tilde" in
3708         true) rp="$rp (~name ok)";;
3709         esac
3710         . UU/myread
3711         if test -f UU/getfile.ok && \
3712                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3713         then
3714                 value="$ans"
3715                 ansexp="$ans"
3716                 break
3717         fi
3718         case "$ans" in
3719         none)
3720                 value=''
3721                 ansexp=''
3722                 case "$none_ok" in
3723                 true) type='';;
3724                 esac
3725                 ;;
3726         *)
3727                 case "$tilde" in
3728                 '') value="$ans"
3729                         ansexp="$ans";;
3730                 *)
3731                         value=`UU/filexp $ans`
3732                         case $? in
3733                         0)
3734                                 if test "$ans" != "$value"; then
3735                                         echo "(That expands to $value on this system.)"
3736                                 fi
3737                                 ;;
3738                         *) value="$ans";;
3739                         esac
3740                         ansexp="$value"
3741                         case "$exp_file" in
3742                         '') value="$ans";;
3743                         esac
3744                         ;;
3745                 esac
3746                 case "$fullpath" in
3747                 true)
3748                         case "$ansexp" in
3749                         /*) value="$ansexp" ;;
3750                         [a-zA-Z]:/*) value="$ansexp" ;;
3751                         *)
3752                                 redo=true
3753                                 case "$already" in
3754                                 true)
3755                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3756                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3757                                         ;;
3758                                 *)
3759                                 echo "Please give a full path name, starting with slash." >&4
3760                                         case "$tilde" in
3761                                         true)
3762                                 echo "Note that using ~name is ok provided it expands well." >&4
3763                                                 already=true
3764                                                 ;;
3765                                         esac
3766                                 esac
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 case "$redo" in
3772                 '')
3773                         case "$type" in
3774                         File)
3775                                 for fp in $gfpth; do
3776                                         if test "X$fp" = X.; then
3777                                             pf="$ansexp"
3778                                         else    
3779                                             pf="$fp/$ansexp"
3780                                         fi
3781                                         if test -f "$pf"; then
3782                                                 type=''
3783                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3784                                         then
3785                                                 echo "($value is not a plain file, but that's ok.)"
3786                                                 type=''
3787                                         fi
3788                                         if test X"$type" = X; then
3789                                             value="$pf"
3790                                             break
3791                                         fi
3792                                 done
3793                                 ;;
3794                         Directory)
3795                                 for fp in $gfpth; do
3796                                         if test "X$fp" = X.; then
3797                                             dir="$ans"
3798                                             direxp="$ansexp"
3799                                         else    
3800                                             dir="$fp/$ansexp"
3801                                             direxp="$fp/$ansexp"
3802                                         fi
3803                                         if test -d "$direxp"; then
3804                                                 type=''
3805                                                 value="$dir"
3806                                                 break
3807                                         fi
3808                                 done
3809                                 ;;
3810                         Locate)
3811                                 if test -d "$ansexp"; then
3812                                         echo "(Looking for $loc_file in directory $value.)"
3813                                         value="$value/$loc_file"
3814                                         ansexp="$ansexp/$loc_file"
3815                                 fi
3816                                 if test -f "$ansexp"; then
3817                                         type=''
3818                                 fi
3819                                 case "$nopath_ok" in
3820                                 true)   case "$value" in
3821                                         */*) ;;
3822                                         *)      echo "Assuming $value will be in people's path."
3823                                                 type=''
3824                                                 ;;
3825                                         esac
3826                                         ;;
3827                                 esac
3828                                 ;;
3829                         esac
3830
3831                         case "$skip" in
3832                         true) type='';
3833                         esac
3834
3835                         case "$type" in
3836                         '') ;;
3837                         *)
3838                                 if test "$fastread" = yes; then
3839                                         dflt=y
3840                                 else
3841                                         dflt=n
3842                                 fi
3843                                 rp="$what $value doesn't exist.  Use that name anyway?"
3844                                 . UU/myread
3845                                 dflt=''
3846                                 case "$ans" in
3847                                 y*) type='';;
3848                                 *) echo " ";;
3849                                 esac
3850                                 ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         esac
3856 done
3857 cd UU
3858 ans="$value"
3859 rp="$orig_rp"
3860 dflt="$orig_dflt"
3861 rm -f getfile.ok
3862 test "X$gfpthkeep" != Xy && gfpth=""
3863 EOSC
3864
3865 : determine root of directory hierarchy where package will be installed.
3866 case "$prefix" in
3867 '')
3868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3869         ;;
3870 *?/)
3871         dflt=`echo "$prefix" | sed 's/.$//'`
3872         ;;
3873 *)
3874         dflt="$prefix"
3875         ;;
3876 esac
3877 $cat <<EOM
3878
3879 By default, $package will be installed in $dflt/bin, manual pages
3880 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3881 installation directories. Typically this is something like /usr/local.
3882 If you wish to have binaries under /usr/bin but other parts of the
3883 installation under /usr/local, that's ok: you will be prompted
3884 separately for each of the installation directories, the prefix being
3885 only used to set the defaults.
3886
3887 EOM
3888 fn=d~
3889 rp='Installation prefix to use?'
3890 . ./getfile
3891 oldprefix=''
3892 case "$prefix" in
3893 '') ;;
3894 *)
3895         case "$ans" in
3896         "$prefix") ;;
3897         *) oldprefix="$prefix";;
3898         esac
3899         ;;
3900 esac
3901 prefix="$ans"
3902 prefixexp="$ansexp"
3903
3904 : allow them to override the AFS root
3905 case "$afsroot" in
3906 '')     afsroot=/afs ;;
3907 *)      afsroot=$afsroot ;;
3908 esac
3909
3910 : is AFS running?
3911 echo " "
3912 case "$afs" in
3913 $define|true)   afs=true ;;
3914 $undef|false)   afs=false ;;
3915 *)      if $test -d $afsroot; then
3916                 afs=true
3917         else
3918                 afs=false
3919         fi
3920         ;;
3921 esac
3922 if $afs; then
3923         echo "AFS may be running... I'll be extra cautious then..." >&4
3924 else
3925         echo "AFS does not seem to be running..." >&4
3926 fi
3927
3928 : determine installation prefix for where package is to be installed.
3929 if $afs; then 
3930 $cat <<EOM
3931
3932 Since you are running AFS, I need to distinguish the directory in which
3933 files will reside from the directory in which they are installed (and from
3934 which they are presumably copied to the former directory by occult means).
3935
3936 EOM
3937         case "$installprefix" in
3938         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3939         *) dflt="$installprefix";;
3940         esac
3941 else
3942 $cat <<EOM
3943
3944 In some special cases, particularly when building $package for distribution,
3945 it is convenient to distinguish the directory in which files should be
3946 installed from the directory ($prefix) in which they will
3947 eventually reside.  For most users, these two directories are the same.
3948
3949 EOM
3950         case "$installprefix" in
3951         '') dflt=$prefix ;;
3952         *) dflt=$installprefix;;
3953         esac
3954 fi
3955 fn=d~
3956 rp='What installation prefix should I use for installing files?'
3957 . ./getfile
3958 installprefix="$ans"
3959 installprefixexp="$ansexp"
3960
3961 : Perform the prefixexp/installprefixexp correction if necessary
3962 cat <<EOS >installprefix
3963 $startsh
3964 EOS
3965 cat <<'EOSC' >>installprefix
3966 : Change installation prefix, if necessary.
3967 if $test X"$prefix" != X"$installprefix"; then
3968     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3969 else
3970     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3971 fi
3972 EOSC
3973 chmod +x installprefix
3974 $eunicefix installprefix
3975
3976 : Set variables such as privlib and privlibexp from the output of ./getfile
3977 : performing the prefixexp/installprefixexp correction if necessary.
3978 cat <<EOS >setprefixvar
3979 $startsh
3980 EOS
3981 cat <<'EOSC' >>setprefixvar
3982 eval "${prefixvar}=\"\$ans\""
3983 eval "${prefixvar}exp=\"\$ansexp\""
3984 . ./installprefix
3985 EOSC
3986 chmod +x setprefixvar
3987 $eunicefix setprefixvar
3988
3989 : set up the script used to warn in case of inconsistency
3990 cat <<EOS >whoa
3991 $startsh
3992 EOS
3993 cat <<'EOSC' >>whoa
3994 dflt=y
3995 case "$hint" in
3996     recommended)
3997         case "$hintfile" in
3998         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3999                 ;;
4000         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4001                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4002                 ;;
4003         esac
4004         ;;
4005     *)  echo " "
4006         echo "*** WHOA THERE!!! ***" >&4
4007         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4008         ;;
4009 esac
4010 rp="    Keep the $hint value?"
4011 . ./myread
4012 case "$ans" in
4013 y) td=$was; tu=$was;;
4014 esac
4015 EOSC
4016
4017 : function used to set '$1' to '$val'
4018 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4019 case "$val$was" in
4020 $define$undef) . ./whoa; eval "$var=\$td";;
4021 $undef$define) . ./whoa; eval "$var=\$tu";;
4022 *) eval "$var=$val";;
4023 esac'
4024
4025 : Check is we will use socks
4026 case "$usesocks" in
4027 $define|true|[yY]*)     dflt='y';;
4028 *) dflt='n';;
4029 esac
4030 cat <<EOM
4031
4032 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4033 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4034 to use the PerlIO abstraction layer, this will be implicitly selected.
4035
4036 If this doesn't make any sense to you, just accept the default '$dflt'.
4037 EOM
4038 rp='Build Perl for SOCKS?'
4039 . ./myread
4040 case "$ans" in
4041 y|Y)    val="$define" ;;
4042 *)      val="$undef" ;;
4043 esac
4044 set usesocks
4045 eval $setvar
4046
4047 case "$usesocks" in
4048 $define|true|[yY]*) useperlio="$define";;
4049 esac
4050
4051 : Check if we want perlio
4052 case "$useperlio" in
4053 $define|true|[yY]*|'')  dflt='y';;
4054 *) dflt='n';;
4055 esac
4056 cat <<EOM
4057
4058 Previous version of $package used the standard IO mechanisms as
4059 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4060 alternate IO mechanisms via the PerlIO abstraction layer, but the
4061 stdio mechanism is still available if needed.  The abstraction layer
4062 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4063 Using PerlIO with sfio may cause problems with some extension modules.
4064
4065 If this doesn't make any sense to you, just accept the default '$dflt'.
4066 EOM
4067 rp='Use the PerlIO abstraction layer?'
4068 . ./myread
4069 case "$ans" in
4070 y|Y)
4071         val="$define"
4072         ;;
4073 *)
4074         echo "Ok, doing things the stdio way."
4075         val="$undef"
4076         ;;
4077 esac
4078 set useperlio
4079 eval $setvar
4080
4081 case "$usesocks" in
4082 $define|true|[yY]*)
4083         case "$useperlio" in
4084         $define|true|[yY]*) ;;
4085         *)      cat >&4 <<EOM
4086
4087 You are using the SOCKS proxy protocol library which means that you
4088 should also use the PerlIO layer.  You may be headed for trouble.
4089
4090 EOM
4091                 ;;
4092         esac
4093         ;;
4094 esac
4095
4096 : get the patchlevel
4097 echo " "
4098 echo "Getting the current patchlevel..." >&4
4099 if $test -r $rsrc/patchlevel.h;then
4100         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4104         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4105         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4106         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4107 else
4108         revision=0
4109         patchlevel=0
4110         subversion=0
4111         api_revision=0
4112         api_version=0
4113         api_subversion=0
4114         perl_patchlevel=0
4115         $echo "(You do not have patchlevel.h.  Eek.)"
4116 fi
4117 if $test -r $rsrc/.patch ; then
4118         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4119                 perl_patchlevel=`cat $rsrc/.patch`
4120         fi
4121 fi
4122 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4123 version_patchlevel_string="version $patchlevel subversion $subversion"
4124 case "$perl_patchlevel" in
4125 0|'') ;;
4126 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4127 esac
4128
4129 $echo "(You have $package $version_patchlevel_string.)"
4130
4131 case "$osname" in
4132 dos|vms)
4133         : XXX Should be a Configure test for double-dots in filenames.
4134         version=`echo $revision $patchlevel $subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4137                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4138         ;;
4139 *)
4140         version=`echo $revision $patchlevel $subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4143                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4144         ;;
4145 esac
4146 : Special case the 5.005_xx maintenance series, which used 5.005
4147 : without any subversion label as a subdirectory in $sitelib
4148 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4149         api_versionstring='5.005'
4150 fi
4151
4152 : Do we want threads support and if so, what type
4153 case "$usethreads" in
4154 $define|true|[yY]*)     dflt='y';;
4155 *)     # Catch case where user specified ithreads or 5005threads but
4156        # forgot -Dusethreads (A.D. 4/2002)
4157        case "$useithreads$use5005threads" in
4158        *$define*)
4159                 case "$useperlio" in
4160                 "$define")      dflt='y' ;;
4161                 *)              dflt='n' ;;
4162                 esac
4163                 ;;
4164        *)       dflt='n';;
4165        esac
4166        ;;
4167 esac
4168 cat <<EOM
4169
4170 Perl can be built to take advantage of threads on some systems.
4171 To do so, Configure can be run with -Dusethreads.
4172
4173 Note that Perl built with threading support runs slightly slower
4174 and uses more memory than plain Perl. The current implementation
4175 is believed to be stable, but it is fairly new, and so should be
4176 treated with caution.
4177
4178 If this doesn't make any sense to you, just accept the default '$dflt'.
4179 EOM
4180 rp='Build a threading Perl?'
4181 . ./myread
4182 case "$ans" in
4183 y|Y)    val="$define" ;;
4184 *)      val="$undef" ;;
4185 esac
4186 set usethreads
4187 eval $setvar
4188
4189 if $test $patchlevel -lt 9; then
4190     case "$usethreads" in
4191     $define)
4192         $cat <<EOM
4193
4194 Since release 5.6, Perl has had two different threading implementations,
4195 the newer interpreter-based version (ithreads) with one interpreter per
4196 thread, and the older 5.005 version (5005threads).
4197 The 5005threads version is effectively unmaintained and will probably be
4198 removed in Perl 5.10, so there should be no need to build a Perl using it
4199 unless needed for backwards compatibility with some existing 5.005threads
4200 code.
4201
4202 EOM
4203         : Default to ithreads unless overridden on command line or with
4204         : old config.sh
4205         dflt='y'
4206         case "$use5005threads" in
4207                 $define|true|[yY]*) dflt='n';;
4208         esac
4209         case "$useithreads" in
4210                 $undef|false|[nN]*) dflt='n';;
4211         esac
4212         rp='Use the newer interpreter-based ithreads?'
4213         . ./myread
4214         case "$ans" in
4215         y|Y)    val="$define" ;;
4216         *)      val="$undef" ;;
4217         esac
4218         set useithreads
4219         eval $setvar
4220         : Now set use5005threads to the opposite value.
4221         case "$useithreads" in
4222         $define) val="$undef" ;;
4223         *) val="$define" ;;
4224         esac
4225         set use5005threads
4226         eval $setvar
4227         ;;
4228     *)
4229         useithreads="$undef"
4230         use5005threads="$undef"
4231         ;;
4232     esac
4233
4234     case "$useithreads$use5005threads" in
4235     "$define$define")
4236         $cat >&4 <<EOM
4237
4238 You cannot have both the ithreads and the 5.005 threads enabled
4239 at the same time.  Disabling the 5.005 threads since they are
4240 much less stable than the ithreads.
4241
4242 EOM
4243         use5005threads="$undef"
4244         ;;
4245     esac
4246
4247 else
4248 : perl-5.9.x and later
4249
4250     if test X"$usethreads" = "X$define"; then
4251         case "$use5005threads" in
4252             $define|true|[yY]*)
4253                 $cat >&4 <<EOM
4254
4255 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4256
4257 EOM
4258             ;;
4259         esac
4260     fi
4261
4262     use5005threads="$undef"
4263     useithreads="$usethreads"
4264 fi
4265
4266 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4267         cat >&4 <<EOF
4268 ***
4269 *** To build with ithreads you must also use the PerlIO layer.
4270 *** Cannot continue, aborting.
4271 ***
4272 EOF
4273         exit 1
4274 fi
4275
4276 case "$d_oldpthreads" in
4277 '')     : Configure tests would be welcome here.  For now, assume undef.
4278         val="$undef" ;;
4279 *)      val="$d_oldpthreads" ;;
4280 esac
4281 set d_oldpthreads
4282 eval $setvar
4283
4284
4285 : Look for a hint-file generated 'call-back-unit'.  If the
4286 : user has specified that a threading perl is to be built,
4287 : we may need to set or change some other defaults.
4288 if $test -f usethreads.cbu; then
4289     echo "Your platform has some specific hints regarding threaded builds, using them..."
4290     . ./usethreads.cbu
4291 else
4292     case "$usethreads" in
4293         "$define"|true|[yY]*)
4294                 $cat <<EOM
4295 (Your platform does not have any specific hints for threaded builds.
4296  Assuming POSIX threads, then.)
4297 EOM
4298         ;;
4299     esac
4300 fi
4301
4302 : Check if multiplicity is required
4303 cat <<EOM
4304
4305 Perl can be built so that multiple Perl interpreters can coexist
4306 within the same Perl executable.
4307 EOM
4308
4309 case "$useithreads" in
4310 $define)
4311         cat <<EOM
4312 This multiple interpreter support is required for interpreter-based threads.
4313 EOM
4314         val="$define"
4315         ;;
4316 *)      case "$usemultiplicity" in
4317         $define|true|[yY]*)     dflt='y';;
4318         *) dflt='n';;
4319         esac
4320         echo " "
4321         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4322         rp='Build Perl for multiplicity?'
4323         . ./myread
4324         case "$ans" in
4325         y|Y)    val="$define" ;;
4326         *)      val="$undef" ;;
4327         esac
4328         ;;
4329 esac
4330 set usemultiplicity
4331 eval $setvar
4332
4333 : Check if morebits is requested
4334 case "$usemorebits" in
4335 "$define"|true|[yY]*)
4336         use64bitint="$define"
4337         uselongdouble="$define"
4338         usemorebits="$define"
4339         ;;
4340 *)      usemorebits="$undef"
4341         ;;
4342 esac
4343
4344 : Determine the C compiler to be used
4345 echo " "
4346 case "$cc" in
4347 '') dflt=cc;;
4348 *) dflt="$cc";;
4349 esac
4350 rp="Use which C compiler?"
4351 . ./myread
4352 cc="$ans"
4353
4354 : See whether they have no cc but they do have gcc
4355 . ./trygcc
4356 if $test -f cc.cbu; then
4357     . ./cc.cbu
4358 fi
4359 . ./checkcc
4360
4361 : make some quick guesses about what we are up against
4362 echo " "
4363 $echo $n "Hmm...  $c"
4364 echo exit 1 >bsd
4365 echo exit 1 >usg
4366 echo exit 1 >v7
4367 echo exit 1 >osf1
4368 echo exit 1 >eunice
4369 echo exit 1 >xenix
4370 echo exit 1 >venix
4371 echo exit 1 >os2
4372 d_bsd="$undef"
4373 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4374 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4375 then
4376         echo "Looks kind of like an OSF/1 system, but we'll see..."
4377         echo exit 0 >osf1
4378 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4379         xxx=`./loc addbib blurfl $pth`
4380         if $test -f $xxx; then
4381         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4382                 echo exit 0 >bsd
4383                 echo exit 0 >usg
4384         else
4385                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4386                         echo "Looks kind of like an extended USG system, but we'll see..."
4387                 else
4388                         echo "Looks kind of like a USG system, but we'll see..."
4389                 fi
4390                 echo exit 0 >usg
4391         fi
4392 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4393         echo "Looks kind of like a BSD system, but we'll see..."
4394         d_bsd="$define"
4395         echo exit 0 >bsd
4396 else
4397         echo "Looks kind of like a Version 7 system, but we'll see..."
4398         echo exit 0 >v7
4399 fi
4400 case "$eunicefix" in
4401 *unixtovms*)
4402         $cat <<'EOI'
4403 There is, however, a strange, musty smell in the air that reminds me of
4404 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4405 EOI
4406         echo exit 0 >eunice
4407         d_eunice="$define"
4408 : it so happens the Eunice I know will not run shell scripts in Unix format
4409         ;;
4410 *)
4411         echo " "
4412         echo "Congratulations.  You aren't running Eunice."
4413         d_eunice="$undef"
4414         ;;
4415 esac
4416 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4417 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4418 : semicolon as a patch separator
4419 case "$p_" in
4420 :) ;;
4421 *)
4422         $cat <<'EOI'
4423 I have the feeling something is not exactly right, however...don't tell me...
4424 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4425 (Or you may be running DOS with DJGPP.)
4426 EOI
4427         echo exit 0 >os2
4428         ;;
4429 esac
4430 if test -f /xenix; then
4431         echo "Actually, this looks more like a XENIX system..."
4432         echo exit 0 >xenix
4433         d_xenix="$define"
4434 else
4435         echo " "
4436         echo "It's not Xenix..."
4437         d_xenix="$undef"
4438 fi
4439 chmod +x xenix
4440 $eunicefix xenix
4441 if test -f /venix; then
4442         echo "Actually, this looks more like a VENIX system..."
4443         echo exit 0 >venix
4444 else
4445         echo " "
4446         if ./xenix; then
4447                 : null
4448         else
4449                 echo "Nor is it Venix..."
4450         fi
4451 fi
4452 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4453 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4454 $rm -f foo
4455
4456 : Check if we are using GNU gcc and what its version is
4457 echo " "
4458 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4459 $cat >try.c <<EOM
4460 #include <stdio.h>
4461 int main() {
4462 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4463 #ifdef __VERSION__
4464         printf("%s\n", __VERSION__);
4465 #else
4466         printf("%s\n", "1");
4467 #endif
4468 #endif
4469         return(0);
4470 }
4471 EOM
4472 if $cc -o try $ccflags $ldflags try.c; then
4473         gccversion=`$run ./try`
4474         case "$gccversion" in
4475         '') echo "You are not using GNU cc." ;;
4476         *)  echo "You are using GNU cc $gccversion."
4477             ccname=gcc
4478             ;;
4479         esac
4480 else
4481         echo " "
4482         echo "*** WHOA THERE!!! ***" >&4
4483         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4484         case "$knowitall" in
4485         '')
4486         echo "    You'd better start hunting for one and let me know about it." >&4
4487                 exit 1
4488                 ;;
4489         esac
4490 fi
4491 $rm -f try try.*
4492 case "$gccversion" in
4493 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4494 esac
4495 case "$gccversion" in
4496 '') gccosandvers='' ;;
4497 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4498    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4499    gccshortvers=''
4500    case "$gccosandvers" in
4501    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4502    $osname$osvers) ;; # looking good
4503    $osname*) cat <<EOM >&4
4504
4505 *** WHOA THERE!!! ***
4506
4507     Your gcc has not been compiled for the exact release of
4508     your operating system ($gccosandvers versus $osname$osvers).
4509
4510     In general it is a good idea to keep gcc synchronized with
4511     the operating system because otherwise serious problems
4512     may ensue when trying to compile software, like Perl.
4513
4514     I'm trying to be optimistic here, though, and will continue.
4515     If later during the configuration and build icky compilation
4516     problems appear (headerfile conflicts being the most common
4517     manifestation), I suggest reinstalling the gcc to match
4518     your operating system release.
4519
4520 EOM
4521       ;;
4522    *) gccosandvers='' ;; # failed to parse, better be silent
4523    esac
4524    ;;
4525 esac
4526 case "$ccname" in
4527 '') ccname="$cc" ;;
4528 esac
4529
4530 # gcc 3.* complain about adding -Idirectories that they already know about,
4531 # so we will take those off from locincpth.
4532 case "$gccversion" in
4533 3*)
4534     echo "main(){}">try.c
4535     for incdir in $locincpth; do
4536        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4537              grep '^c[cp]p*[01]: warning: changing search order '`
4538        if test "X$warn" != X; then
4539            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4540        fi
4541     done
4542     $rm -f try try.*
4543 esac
4544
4545 : What should the include directory be ?
4546 echo " "
4547 $echo $n "Hmm...  $c"
4548 dflt='/usr/include'
4549 incpath=''
4550 mips_type=''
4551 if $test -f /bin/mips && /bin/mips; then
4552         echo "Looks like a MIPS system..."
4553         $cat >usr.c <<'EOCP'
4554 #ifdef SYSTYPE_BSD43
4555 /bsd43
4556 #endif
4557 EOCP
4558         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4559                 dflt='/bsd43/usr/include'
4560                 incpath='/bsd43'
4561                 mips_type='BSD 4.3'
4562         else
4563                 mips_type='System V'
4564         fi
4565         $rm -f usr.c usr.out
4566         echo "and you're compiling with the $mips_type compiler and libraries."
4567         xxx_prompt=y
4568         echo "exit 0" >mips
4569 else
4570         echo "Doesn't look like a MIPS system."
4571         xxx_prompt=n
4572         echo "exit 1" >mips
4573 fi
4574 chmod +x mips
4575 $eunicefix mips
4576 case "$usrinc" in
4577 '') ;;
4578 *) dflt="$usrinc";;
4579 esac
4580 case "$xxx_prompt" in
4581 y)      fn=d/
4582         echo " "
4583         rp='Where are the include files you want to use?'
4584         . ./getfile
4585         usrinc="$ans"
4586         ;;
4587 *)      usrinc="$dflt"
4588         ;;
4589 esac
4590
4591 : see how we invoke the C preprocessor
4592 echo " "
4593 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4594 cat <<'EOT' >testcpp.c
4595 #define ABC abc
4596 #define XYZ xyz
4597 ABC.XYZ
4598 EOT
4599 cd ..
4600 if test ! -f cppstdin; then
4601         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4602                 # AIX cc -E doesn't show the absolute headerfile
4603                 # locations but we'll cheat by using the -M flag.
4604                 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
4605         else
4606                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4607         fi
4608 else
4609         echo "Keeping your $hint cppstdin wrapper."
4610 fi
4611 chmod 755 cppstdin
4612 wrapper=`pwd`/cppstdin
4613 ok='false'
4614 cd UU
4615
4616 if $test "X$cppstdin" != "X" && \
4617         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4619 then
4620         echo "You used to use $cppstdin $cppminus so we'll use that again."
4621         case "$cpprun" in
4622         '') echo "But let's see if we can live without a wrapper..." ;;
4623         *)
4624                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4625                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4626                 then
4627                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4628                         ok='true'
4629                 else
4630                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4631                 fi
4632                 ;;
4633         esac
4634 else
4635         case "$cppstdin" in
4636         '') ;;
4637         *)
4638                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4639                 ;;
4640         esac
4641 fi
4642
4643 if $ok; then
4644         : nothing
4645 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4646         $cc -E <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "Yup, it does."
4649         x_cpp="$cc -E"
4650         x_minus='';
4651 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4652         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         echo "Yup, it does."
4655         x_cpp="$cc -E"
4656         x_minus='-';
4657 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4658         $cc -P <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Yipee, that works!"
4661         x_cpp="$cc -P"
4662         x_minus='';
4663 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4664         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         echo "At long last!"
4667         x_cpp="$cc -P"
4668         x_minus='-';
4669 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4670         $cpp <testcpp.c >testcpp.out 2>&1; \
4671         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672         echo "It works!"
4673         x_cpp="$cpp"
4674         x_minus='';
4675 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4676         $cpp - <testcpp.c >testcpp.out 2>&1; \
4677         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678         echo "Hooray, it works!  I was beginning to wonder."
4679         x_cpp="$cpp"
4680         x_minus='-';
4681 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4682         $wrapper <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         x_cpp="$wrapper"
4685         x_minus=''
4686         echo "Eureka!"
4687 else
4688         dflt=''
4689         rp="No dice.  I can't find a C preprocessor.  Name one:"
4690         . ./myread
4691         x_cpp="$ans"
4692         x_minus=''
4693         $x_cpp <testcpp.c >testcpp.out 2>&1
4694         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4695                 echo "OK, that will do." >&4
4696         else
4697 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4698                 exit 1
4699         fi
4700 fi
4701
4702 case "$ok" in
4703 false)
4704         cppstdin="$x_cpp"
4705         cppminus="$x_minus"
4706         cpprun="$x_cpp"
4707         cpplast="$x_minus"
4708         set X $x_cpp
4709         shift
4710         case "$1" in
4711         "$cpp")
4712                 echo "Perhaps can we force $cc -E using a wrapper..."
4713                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4714                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4715                 then
4716                         echo "Yup, we can."
4717                         cppstdin="$wrapper"
4718                         cppminus='';
4719                 else
4720                         echo "Nope, we'll have to live without it..."
4721                 fi
4722                 ;;
4723         esac
4724         case "$cpprun" in
4725         "$wrapper")
4726                 cpprun=''
4727                 cpplast=''
4728                 ;;
4729         esac
4730         ;;
4731 esac
4732
4733 case "$cppstdin" in
4734 "$wrapper"|'cppstdin') ;;
4735 *) $rm -f $wrapper;;
4736 esac
4737 $rm -f testcpp.c testcpp.out
4738
4739 : Set private lib path
4740 case "$plibpth" in
4741 '') if ./mips; then
4742                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4743         fi;;
4744 esac
4745 case "$libpth" in
4746 ' ') dlist='';;
4747 '') dlist="$loclibpth $plibpth $glibpth";;
4748 *) dlist="$libpth";;
4749 esac
4750
4751 : Now check and see which directories actually exist, avoiding duplicates
4752 libpth=''
4753 for xxx in $dlist
4754 do
4755     if $test -d $xxx; then
4756                 case " $libpth " in
4757                 *" $xxx "*) ;;
4758                 *) libpth="$libpth $xxx";;
4759                 esac
4760     fi
4761 done
4762 $cat <<'EOM'
4763
4764 Some systems have incompatible or broken versions of libraries.  Among
4765 the directories listed in the question below, please remove any you
4766 know not to be holding relevant libraries, and add any that are needed.
4767 Say "none" for none.
4768
4769 EOM
4770 case "$libpth" in
4771 '') dflt='none';;
4772 *)
4773         set X $libpth
4774         shift
4775         dflt=${1+"$@"}
4776         ;;
4777 esac
4778 rp="Directories to use for library searches?"
4779 . ./myread
4780 case "$ans" in
4781 none) libpth=' ';;
4782 *) libpth="$ans";;
4783 esac
4784
4785 : compute shared library extension
4786 case "$so" in
4787 '')
4788         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4789                 dflt='sl'
4790         else
4791                 dflt='so'
4792         fi
4793         ;;
4794 *) dflt="$so";;
4795 esac
4796 $cat <<EOM
4797
4798 On some systems, shared libraries may be available.  Answer 'none' if
4799 you want to suppress searching of shared libraries for the remainder
4800 of this configuration.
4801
4802 EOM
4803 rp='What is the file extension used for shared libraries?'
4804 . ./myread
4805 so="$ans"
4806
4807 : Define several unixisms.
4808 : Hints files or command line option can be used to override them.
4809 : The convoluted testing is in case hints files set either the old
4810 : or the new name.
4811 case "$_exe" in
4812 '')     case "$exe_ext" in
4813         '')     ;;
4814         *)      _exe="$exe_ext" ;;
4815         esac
4816         ;;
4817 esac
4818 case "$_a" in
4819 '')     case "$lib_ext" in
4820     '') _a='.a';;
4821         *)      _a="$lib_ext" ;;
4822         esac
4823         ;;
4824 esac
4825 case "$_o" in
4826 '') case "$obj_ext" in
4827         '')     _o='.o';;
4828         *)      _o="$obj_ext";;
4829         esac
4830         ;;
4831 esac
4832 case "$p_" in
4833 '') case "$path_sep" in
4834         '')     p_=':';;
4835         *)      p_="$path_sep";;
4836         esac
4837         ;;
4838 esac
4839 exe_ext=$_exe
4840 lib_ext=$_a
4841 obj_ext=$_o
4842 path_sep=$p_
4843
4844 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4845
4846 : Which makefile gets called first.  This is used by make depend.
4847 case "$firstmakefile" in
4848 '') firstmakefile='makefile';;
4849 esac
4850
4851 : Check for uselongdouble support
4852 case "$ccflags" in
4853 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4854 esac
4855
4856 case "$uselongdouble" in
4857 $define|true|[yY]*)     dflt='y';;
4858 *) dflt='n';;
4859 esac
4860 cat <<EOM
4861
4862 Perl can be built to take advantage of long doubles which
4863 (if available) may give more accuracy and range for floating point numbers.
4864
4865 If this doesn't make any sense to you, just accept the default '$dflt'.
4866 EOM
4867 rp='Try to use long doubles if available?'
4868 . ./myread
4869 case "$ans" in
4870 y|Y)    val="$define"   ;;
4871 *)      val="$undef"    ;;
4872 esac
4873 set uselongdouble
4874 eval $setvar
4875
4876 case "$uselongdouble" in
4877 true|[yY]*) uselongdouble="$define" ;;
4878 esac
4879
4880 : Look for a hint-file generated 'call-back-unit'.  If the
4881 : user has specified that long doubles should be used,
4882 : we may need to set or change some other defaults.
4883 if $test -f uselongdouble.cbu; then
4884     echo "Your platform has some specific hints regarding long doubles, using them..."
4885     . ./uselongdouble.cbu
4886 else
4887     case "$uselongdouble" in
4888         $define)
4889                 $cat <<EOM
4890 (Your platform does not have any specific hints for long doubles.)
4891 EOM
4892         ;;
4893     esac
4894 fi
4895
4896 : Looking for optional libraries
4897 echo " "
4898 echo "Checking for optional libraries..." >&4
4899 case "$libs" in
4900 ' '|'') dflt='';;
4901 *) dflt="$libs";;
4902 esac
4903 case "$libswanted" in
4904 '') libswanted='c_s';;
4905 esac
4906 case "$usesocks" in
4907 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4908 esac
4909 libsfound=''
4910 libsfiles=''
4911 libsdirs=''
4912 libspath=''
4913 for thisdir in $libpth $xlibpth; do
4914   test -d $thisdir && libspath="$libspath $thisdir"
4915 done
4916 for thislib in $libswanted; do
4917         for thisdir in $libspath; do
4918             xxx=''
4919             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4920                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib.$so
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=shared
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/$thislib$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib${thislib}_s$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943                 $test -f "$xxx" && thislib=${thislib}_s
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/Slib$thislib$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949             fi
4950             if $test -f "$xxx"; then
4951                 case "$libstyle" in
4952                 shared) echo "Found -l$thislib (shared)." ;;
4953                 static) echo "Found -l$thislib." ;;
4954                 *)      echo "Found -l$thislib ($libstyle)." ;;
4955                 esac
4956                 case " $dflt " in
4957                 *"-l$thislib "*);;
4958                 *) dflt="$dflt -l$thislib"
4959                    libsfound="$libsfound $xxx"
4960                    yyy=`basename $xxx`
4961                    libsfiles="$libsfiles $yyy"
4962                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4963                    case " $libsdirs " in
4964                    *" $yyy "*) ;;
4965                    *) libsdirs="$libsdirs $yyy" ;;
4966                    esac
4967                    ;;
4968                 esac
4969                 break
4970             fi
4971         done
4972         if $test ! -f "$xxx"; then
4973             echo "No -l$thislib."
4974         fi
4975 done
4976 set X $dflt
4977 shift
4978 dflt="$*"
4979 case "$libs" in
4980 '') dflt="$dflt";;
4981 *) dflt="$libs";;
4982 esac
4983 case "$dflt" in
4984 ' '|'') dflt='none';;
4985 esac
4986
4987 $cat <<EOM
4988
4989 In order to compile $package on your machine, a number of libraries
4990 are usually needed.  Include any other special libraries here as well.
4991 Say "none" for none.  The default list is almost always right.
4992 EOM
4993
4994 echo " "
4995 rp="What libraries to use?"
4996 . ./myread
4997 case "$ans" in
4998 none) libs=' ';;
4999 *) libs="$ans";;
5000 esac
5001
5002 : determine optimization, if desired, or use for debug flag also
5003 case "$optimize" in
5004 ' '|$undef) dflt='none';;
5005 '') dflt='-O';;
5006 *) dflt="$optimize";;
5007 esac
5008 $cat <<EOH
5009
5010 By default, $package compiles with the -O flag to use the optimizer.
5011 Alternately, you might want to use the symbolic debugger, which uses
5012 the -g flag (on traditional Unix systems).  Either flag can be
5013 specified here.  To use neither flag, specify the word "none".
5014
5015 EOH
5016 rp="What optimizer/debugger flag should be used?"
5017 . ./myread
5018 optimize="$ans"
5019 case "$optimize" in
5020 'none') optimize=" ";;
5021 esac
5022
5023 : Check what DEBUGGING is required from the command line
5024 : -DEBUGGING      or -DDEBUGGING or
5025 : -DEBUGGING=both                       = -g + -DDEBUGGING
5026 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5027 : -DEBUGGING=none or -UDEBUGGING        =
5028 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5029 case "$EBUGGING" in
5030 '')     ;;
5031 *)      DEBUGGING=$EBUGGING ;;
5032 esac
5033
5034 case "$DEBUGGING" in
5035 -g|both|$define)
5036     case "$optimize" in
5037         *-g*) ;;
5038         *)    optimize="$optimize -g" ;;
5039     esac ;;
5040 none|$undef)
5041     case "$optimize" in
5042         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5043                 shift
5044                 optimize="$*"
5045                 ;;
5046     esac ;;
5047 esac
5048
5049 dflt=''
5050 case "$DEBUGGING" in
5051 both|$define) dflt='-DDEBUGGING'
5052 esac
5053
5054 : argument order is deliberate, as the flag will start with - which set could
5055 : think is an option
5056 checkccflag='check=$1; flag=$2; callback=$3;
5057 echo " ";
5058 echo "Checking if your compiler accepts $flag" 2>&1;
5059 echo "int main(void) { return 0; }" > gcctest.c;
5060 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5061     echo "Yes, it does." 2>&1;
5062     if $test -s gcctest.out ; then
5063         echo "But your platform does not like it:";
5064         cat gcctest.out;
5065     else
5066         case "$ccflags" in
5067         *$check*)
5068             echo "Leaving current flags $ccflags alone." 2>&1
5069             ;;
5070         *) dflt="$dflt $flag";
5071             eval $callback
5072             ;;
5073         esac
5074     fi
5075 else
5076     echo "Nope, it does not, but that is ok." 2>&1;
5077 fi
5078 '
5079
5080 : We will not override a previous value, but we might want to
5081 : augment a hint file
5082 case "$hint" in
5083 default|recommended)
5084         case "$gccversion" in
5085         1*) dflt="$dflt -fpcc-struct-return" ;;
5086         esac
5087         case "$optimize:$DEBUGGING" in
5088         *-g*:old) dflt="$dflt -DDEBUGGING";;
5089         esac
5090         case "$gccversion" in
5091         2*) if $test -d /etc/conf/kconfig.d &&
5092                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5093                 then
5094                         # Interactive Systems (ISC) POSIX mode.
5095                         dflt="$dflt -posix"
5096                 fi
5097                 ;;
5098         esac
5099         case "$gccversion" in
5100         1*) ;;
5101         2.[0-8]*) ;;
5102         ?*)     set strict-aliasing -fno-strict-aliasing
5103                 eval $checkccflag
5104                 ;;
5105         esac
5106         # For gcc, adding -pipe speeds up compilations for some, but apparently
5107         # some assemblers can't read from stdin.  (It also slows down compilations
5108         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5109         case "$gccversion" in
5110         ?*)     set pipe -pipe
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114
5115         # on x86_64 (at least) we require an extra library (libssp) in the
5116         # link command line. This library is not named, so I infer that it is
5117         # an implementation detail that may change. Hence the safest approach
5118         # is to add the flag to the flags passed to the compiler at link time,
5119         # as that way the compiler can do the right implementation dependant
5120         # thing. (NWC)
5121         case "$gccversion" in
5122         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5123                 eval $checkccflag
5124                 ;;
5125         esac
5126         ;;
5127 esac
5128
5129 case "$mips_type" in
5130 *BSD*|'') inclwanted="$locincpth $usrinc";;
5131 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5132 esac
5133 for thisincl in $inclwanted; do
5134         if $test -d $thisincl; then
5135                 if $test x$thisincl != x$usrinc; then
5136                         case "$dflt" in
5137                         *" -I$thisincl "*);;
5138                         *) dflt="$dflt -I$thisincl ";;
5139                         esac
5140                 fi
5141         fi
5142 done
5143
5144 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5145         xxx=true;
5146 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5147         xxx=true;
5148 else
5149         xxx=false;
5150 fi;
5151 if $xxx; then
5152         case "$dflt" in
5153         *$2*);;
5154         *) dflt="$dflt -D$2";;
5155         esac;
5156 fi'
5157
5158 set signal.h LANGUAGE_C; eval $inctest
5159
5160 case "$usesocks" in
5161 $define)
5162         ccflags="$ccflags -DSOCKS"
5163         ;;
5164 esac
5165
5166 case "$hint" in
5167 default|recommended) dflt="$ccflags $dflt" ;;
5168 *) dflt="$ccflags";;
5169 esac
5170
5171 case "$dflt" in
5172 ''|' ') dflt=none;;
5173 esac
5174
5175 $cat <<EOH
5176
5177 Your C compiler may want other flags.  For this question you should include
5178 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5179 but you should NOT include libraries or ld flags like -lwhatever.  If you
5180 want $package to honor its debug switch, you should include -DDEBUGGING here.
5181 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5182
5183 To use no flags, specify the word "none".
5184
5185 EOH
5186 set X $dflt
5187 shift
5188 dflt=${1+"$@"}
5189 rp="Any additional cc flags?"
5190 . ./myread
5191 case "$ans" in
5192 none) ccflags='';;
5193 *) ccflags="$ans";;
5194 esac
5195
5196 : the following weeds options from ccflags that are of no interest to cpp
5197 case "$cppflags" in
5198 '') cppflags="$ccflags" ;;
5199 *)  cppflags="$cppflags $ccflags" ;;
5200 esac
5201 case "$gccversion" in
5202 1*) cppflags="$cppflags -D__GNUC__"
5203 esac
5204 case "$mips_type" in
5205 '');;
5206 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5207 esac
5208 case "$cppflags" in
5209 '');;
5210 *)
5211         echo " "
5212         echo "Let me guess what the preprocessor flags are..." >&4
5213         set X $cppflags
5214         shift
5215         cppflags=''
5216         $cat >cpp.c <<'EOM'
5217 #define BLURFL foo
5218
5219 BLURFL xx LFRULB
5220 EOM
5221         previous=''
5222         for flag in $*
5223         do
5224                 case "$flag" in
5225                 -*) ftry="$flag";;
5226                 *) ftry="$previous $flag";;
5227                 esac
5228                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5229                         >cpp1.out 2>/dev/null && \
5230                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5231                         >cpp2.out 2>/dev/null && \
5232                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5233                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5234                 then
5235                         cppflags="$cppflags $ftry"
5236                         previous=''
5237                 else
5238                         previous="$flag"
5239                 fi
5240         done
5241         set X $cppflags
5242         shift
5243         cppflags=${1+"$@"}
5244         case "$cppflags" in
5245         *-*)  echo "They appear to be: $cppflags";;
5246         esac
5247         $rm -f cpp.c cpp?.out
5248         ;;
5249 esac
5250
5251 : flags used in final linking phase
5252 case "$ldflags" in
5253 '') if ./venix; then
5254                 dflt='-i -z'
5255         else
5256                 dflt=''
5257         fi
5258         case "$ccflags" in
5259         *-posix*) dflt="$dflt -posix" ;;
5260         esac
5261         ;;
5262 *) dflt="$ldflags";;
5263 esac
5264
5265 : Try to guess additional flags to pick up local libraries.
5266 for thislibdir in $libpth; do
5267         case " $loclibpth " in
5268         *" $thislibdir "*)
5269                 case "$dflt " in
5270                 *"-L$thislibdir "*) ;;
5271                 *)  dflt="$dflt -L$thislibdir" ;;
5272                 esac
5273                 ;;
5274         esac
5275 done
5276
5277 case "$dflt" in
5278 '') dflt='none' ;;
5279 esac
5280
5281 $cat <<EOH
5282
5283 Your C linker may need flags.  For this question you should
5284 include -L/whatever and any other flags used by the C linker, but you
5285 should NOT include libraries like -lwhatever.
5286
5287 Make sure you include the appropriate -L/path flags if your C linker
5288 does not normally search all of the directories you specified above,
5289 namely
5290         $libpth
5291 To use no flags, specify the word "none".
5292
5293 EOH
5294
5295 rp="Any additional ld flags (NOT including libraries)?"
5296 . ./myread
5297 case "$ans" in
5298 none) ldflags='';;
5299 *) ldflags="$ans";;
5300 esac
5301 rmlist="$rmlist pdp11"
5302
5303 : coherency check
5304 echo " "
5305 echo "Checking your choice of C compiler and flags for coherency..." >&4
5306 $cat > try.c <<'EOF'
5307 #include <stdio.h>
5308 int main() { printf("Ok\n"); return(0); }
5309 EOF
5310 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5311 shift
5312 $cat >try.msg <<'EOM'
5313 I've tried to compile and run the following simple program:
5314
5315 EOM
5316 $cat try.c >> try.msg
5317
5318 $cat >> try.msg <<EOM
5319
5320 I used the command:
5321
5322         $*
5323         $run ./try
5324
5325 and I got the following output:
5326
5327 EOM
5328 dflt=y
5329 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5330         if $sh -c "$run ./try " >>try.msg 2>&1; then
5331                 xxx=`$run ./try`
5332                 case "$xxx" in
5333                 "Ok") dflt=n ;;
5334                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5335                         case " $libs " in
5336                         *" -lsfio "*)
5337                                 cat >> try.msg <<'EOQS'
5338 If $libs contains -lsfio, and sfio is mis-configured, then it
5339 sometimes (apparently) runs and exits with a 0 status, but with no
5340 output!  It may have to do with sfio's use of _exit vs. exit.
5341
5342 EOQS
5343                                 rp="You have a big problem.  Shall I abort Configure"
5344                                 dflt=y
5345                                 ;;
5346                         esac
5347                         ;;
5348                 esac
5349         else
5350                 echo "The program compiled OK, but exited with status $?." >>try.msg
5351                 rp="You have a problem.  Shall I abort Configure"
5352                 dflt=y
5353         fi
5354 else
5355         echo "I can't compile the test program." >>try.msg
5356         rp="You have a BIG problem.  Shall I abort Configure"
5357         dflt=y
5358 fi
5359 case "$dflt" in
5360 y)
5361         $cat try.msg >&4
5362         case "$knowitall" in
5363         '')
5364                 echo "(The supplied flags or libraries might be incorrect.)"
5365                 ;;
5366         *) dflt=n;;
5367         esac
5368         echo " "
5369         . ./myread
5370         case "$ans" in
5371         n*|N*) ;;
5372         *)      echo "Ok.  Stopping Configure." >&4
5373                 exit 1
5374                 ;;
5375         esac
5376         ;;
5377 n) echo "OK, that should do.";;
5378 esac
5379 $rm_try gcctest gcctest.out
5380
5381 : define a shorthand compile call
5382 compile='
5383 mc_file=$1;
5384 shift;
5385 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5386 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5387 exit 1;
5388 fi;
5389 esac;
5390 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5391 : define a shorthand compile call for compilations that should be ok.
5392 compile_ok='
5393 mc_file=$1;
5394 shift;
5395 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5396
5397 : determine filename position in cpp output
5398 echo " "
5399 echo "Computing filename position in cpp output for #include directives..." >&4
5400 case "$osname" in
5401 vos) testaccess=-e ;;
5402 *)   testaccess=-r ;;
5403 esac
5404 echo '#include <stdio.h>' > foo.c
5405 $cat >fieldn <<EOF
5406 $startsh
5407 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5408 $grep '^[       ]*#.*stdio\.h' | \
5409 while read cline; do
5410         pos=1
5411         set \$cline
5412         while $test \$# -gt 0; do
5413                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5414                         echo "\$pos"
5415                         exit 0
5416                 fi
5417                 shift
5418                 pos=\`expr \$pos + 1\`
5419         done
5420 done
5421 EOF
5422 chmod +x fieldn
5423 fieldn=`./fieldn`
5424 $rm -f foo.c fieldn
5425 case $fieldn in
5426 '') pos='???';;
5427 1) pos=first;;
5428 2) pos=second;;
5429 3) pos=third;;
5430 *) pos="${fieldn}th";;
5431 esac
5432 echo "Your cpp writes the filename in the $pos field of the line."
5433
5434 case "$osname" in
5435 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5436 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5437 *)   cppfilter='' ;;
5438 esac
5439 : locate header file
5440 $cat >findhdr <<EOF
5441 $startsh
5442 wanted=\$1
5443 name=''
5444 for usrincdir in $usrinc
5445 do
5446         if test -f \$usrincdir/\$wanted; then
5447                 echo "\$usrincdir/\$wanted"
5448                 exit 0
5449         fi
5450 done
5451 awkprg='{ print \$$fieldn }'
5452 echo "#include <\$wanted>" > foo\$\$.c
5453 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5454 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5455 while read cline; do
5456         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5457         case "\$name" in
5458         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5459         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5460         *) exit 2;;
5461         esac;
5462 done;
5463 #
5464 # status = 0: grep returned 0 lines, case statement not executed
5465 # status = 1: headerfile found
5466 # status = 2: while loop executed, no headerfile found
5467 #
5468 status=\$?
5469 $rm -f foo\$\$.c;
5470 if test \$status -eq 1; then
5471         exit 0;
5472 fi
5473 exit 1
5474 EOF
5475 chmod +x findhdr
5476
5477 : define an alternate in-header-list? function
5478 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5479 cont=true; xxf="echo \"<\$1> found.\" >&4";
5480 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5481 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5482 esac;
5483 case $# in 4) instead=instead;; *) instead="at last";; esac;
5484 while $test "$cont"; do
5485         xxx=`./findhdr $1`
5486         var=$2; eval "was=\$$2";
5487         if $test "$xxx" && $test -r "$xxx";
5488         then eval $xxf;
5489         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5490                 cont="";
5491         else eval $xxnf;
5492         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5493         set $yyy; shift; shift; yyy=$@;
5494         case $# in 0) cont="";;
5495         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5496                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5497         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5498                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5499         esac;
5500 done;
5501 while $test "$yyy";
5502 do set $yyy; var=$2; eval "was=\$$2";
5503         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5504         set $yyy; shift; shift; yyy=$@;
5505 done'
5506
5507 : see if stdlib is available
5508 set stdlib.h i_stdlib
5509 eval $inhdr
5510
5511 : check for lengths of integral types
5512 echo " "
5513 case "$intsize" in
5514 '')
5515         echo "Checking to see how big your integers are..." >&4
5516         $cat >try.c <<EOCP
5517 #include <stdio.h>
5518 #$i_stdlib I_STDLIB
5519 #ifdef I_STDLIB
5520 #include <stdlib.h>
5521 #endif
5522 int main()
5523 {
5524         printf("intsize=%d;\n", (int)sizeof(int));
5525         printf("longsize=%d;\n", (int)sizeof(long));
5526         printf("shortsize=%d;\n", (int)sizeof(short));
5527         exit(0);
5528 }
5529 EOCP
5530         set try
5531         if eval $compile_ok && $run ./try > /dev/null; then
5532                 eval `$run ./try`
5533                 echo "Your integers are $intsize bytes long."
5534                 echo "Your long integers are $longsize bytes long."
5535                 echo "Your short integers are $shortsize bytes long."
5536         else
5537                 $cat >&4 <<EOM
5538 !
5539 Help! I can't compile and run the intsize test program: please enlighten me!
5540 (This is probably a misconfiguration in your system or libraries, and
5541 you really ought to fix it.  Still, I'll try anyway.)
5542 !
5543 EOM
5544                 dflt=4
5545                 rp="What is the size of an integer (in bytes)?"
5546                 . ./myread
5547                 intsize="$ans"
5548                 dflt=$intsize
5549                 rp="What is the size of a long integer (in bytes)?"
5550                 . ./myread
5551                 longsize="$ans"
5552                 dflt=2
5553                 rp="What is the size of a short integer (in bytes)?"
5554                 . ./myread
5555                 shortsize="$ans"
5556         fi
5557         ;;
5558 esac
5559 $rm_try
5560
5561 : check for long long
5562 echo " "
5563 echo "Checking to see if you have long long..." >&4
5564 echo 'int main() { long long x = 7; return 0; }' > try.c
5565 set try
5566 if eval $compile; then
5567         val="$define"
5568         echo "You have long long."
5569 else
5570         val="$undef"
5571         echo "You do not have long long."
5572 fi
5573 $rm_try
5574 set d_longlong
5575 eval $setvar
5576
5577 : check for length of long long
5578 case "${d_longlong}${longlongsize}" in
5579 $define)
5580         echo " "
5581         echo "Checking to see how big your long longs are..." >&4
5582         $cat >try.c <<'EOCP'
5583 #include <stdio.h>
5584 int main()
5585 {
5586     printf("%d\n", (int)sizeof(long long));
5587     return(0);
5588 }
5589 EOCP
5590         set try
5591         if eval $compile_ok; then
5592                 longlongsize=`$run ./try`
5593                 echo "Your long longs are $longlongsize bytes long."
5594         else
5595                 dflt='8'
5596                 echo " "
5597                 echo "(I can't seem to compile the test program.  Guessing...)"
5598                 rp="What is the size of a long long (in bytes)?"
5599                 . ./myread
5600                 longlongsize="$ans"
5601         fi
5602         if $test "X$longsize" = "X$longlongsize"; then
5603                 echo "(That isn't any different from an ordinary long.)"
5604         fi
5605         ;;
5606 esac
5607 $rm_try
5608
5609 : see if inttypes.h is available
5610 : we want a real compile instead of Inhdr because some systems
5611 : have an inttypes.h which includes non-existent headers
5612 echo " "
5613 $cat >try.c <<EOCP
5614 #include <inttypes.h>
5615 int main() {
5616         static int32_t foo32 = 0x12345678;
5617 }
5618 EOCP
5619 set try
5620 if eval $compile; then
5621         echo "<inttypes.h> found." >&4
5622         val="$define"
5623 else
5624         echo "<inttypes.h> NOT found." >&4
5625         val="$undef"
5626 fi
5627 $rm_try
5628 set i_inttypes
5629 eval $setvar
5630
5631 : check for int64_t
5632 echo " "
5633 echo "Checking to see if you have int64_t..." >&4
5634 $cat >try.c <<EOCP
5635 #include <sys/types.h>
5636 #$i_inttypes I_INTTYPES
5637 #ifdef I_INTTYPES
5638 #include <inttypes.h>
5639 #endif
5640 int main() { int64_t x = 7; }
5641 EOCP
5642 set try
5643 if eval $compile; then
5644         val="$define"
5645         echo "You have int64_t."
5646 else
5647         val="$undef"
5648         echo "You do not have int64_t."
5649 fi
5650 $rm_try
5651 set d_int64_t
5652 eval $setvar
5653
5654 : Check if 64bit ints have a quad type
5655 echo " "
5656 echo "Checking which 64-bit integer type we could use..." >&4
5657
5658 case "$intsize" in
5659 8) val=int
5660    set quadtype
5661    eval $setvar
5662    val='"unsigned int"'
5663    set uquadtype
5664    eval $setvar
5665    quadkind=1
5666    ;;
5667 *) case "$longsize" in
5668    8) val=long
5669       set quadtype
5670       eval $setvar
5671       val='"unsigned long"'
5672       set uquadtype
5673       eval $setvar
5674       quadkind=2
5675       ;;
5676    *) case "$d_longlong:$longlongsize" in
5677       define:8)
5678         val='"long long"'
5679         set quadtype
5680         eval $setvar
5681         val='"unsigned long long"'
5682         set uquadtype
5683         eval $setvar
5684         quadkind=3
5685         ;;
5686       *) case "$d_int64_t" in
5687          define)
5688            val=int64_t
5689            set quadtype
5690            eval $setvar
5691            val=uint64_t
5692            set uquadtype
5693            eval $setvar
5694            quadkind=4
5695            ;;
5696          esac
5697          ;;
5698       esac
5699       ;;
5700    esac
5701    ;;
5702 esac
5703
5704 case "$quadtype" in
5705 '')     echo "Alas, no 64-bit integer types in sight." >&4
5706         d_quad="$undef"
5707         ;;
5708 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5709         d_quad="$define"
5710         ;;
5711 esac
5712
5713 : Do we want 64bit support
5714 case "$uselonglong" in
5715 "$define"|true|[yY]*)
5716         cat <<EOM >&4
5717
5718 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5719 EOM
5720         use64bitint="$define"
5721         ;;
5722 esac
5723 case "$use64bits" in
5724 "$define"|true|[yY]*)
5725         cat <<EOM >&4
5726
5727 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5728 EOM
5729         use64bitint="$define"
5730         ;;
5731 esac
5732 case "$use64bitints" in
5733 "$define"|true|[yY]*)
5734         cat <<EOM >&4
5735
5736 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5737 EOM
5738         use64bitint="$define"
5739         ;;
5740 esac
5741 case "$use64bitsint" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$uselonglongs" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$use64bitsall" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5764 EOM
5765         use64bitall="$define"
5766         ;;
5767 esac
5768
5769 case "$ccflags" in
5770 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5771 esac
5772 case "$use64bitall" in
5773 "$define"|true|[yY]*) use64bitint="$define" ;;
5774 esac
5775
5776 case "$longsize" in
5777 8) cat <<EOM
5778
5779 You have natively 64-bit long integers.
5780 EOM
5781    val="$define"
5782    ;;
5783 *) case "$use64bitint" in
5784    "$define"|true|[yY]*) dflt='y';;
5785    *) dflt='n';;
5786    esac
5787    case "$d_quad" in
5788    "$define") ;;
5789    *) dflt='n' ;;
5790    esac
5791    cat <<EOM
5792
5793 Perl can be built to take advantage of 64-bit integer types
5794 on some systems.  To do so, Configure can be run with -Duse64bitint.
5795 Choosing this option will most probably introduce binary incompatibilities.
5796
5797 If this doesn't make any sense to you, just accept the default '$dflt'.
5798 (The default has been chosen based on your configuration.)
5799 EOM
5800    rp='Try to use 64-bit integers, if available?'
5801    . ./myread
5802    case "$ans" in
5803    [yY]*) val="$define" ;;
5804    *)     val="$undef"  ;;
5805    esac
5806    ;;
5807 esac
5808 set use64bitint
5809 eval $setvar
5810
5811 case "$use64bitall" in
5812 "$define"|true|[yY]*) dflt='y' ;;
5813 *) case "$longsize" in
5814    8) dflt='y' ;;
5815    *) dflt='n' ;;
5816    esac
5817    ;;
5818 esac
5819 cat <<EOM
5820
5821 You may also choose to try maximal 64-bitness.  It means using as much
5822 64-bitness as possible on the platform.  This in turn means even more
5823 binary incompatibilities.  On the other hand, your platform may not
5824 have any more 64-bitness available than what you already have chosen.
5825
5826 If this doesn't make any sense to you, just accept the default '$dflt'.
5827 (The default has been chosen based on your configuration.)
5828 EOM
5829 rp='Try to use maximal 64-bit support, if available?'
5830 . ./myread
5831 case "$ans" in
5832 [yY]*) val="$define" ;;
5833 *)     val="$undef"  ;;
5834 esac
5835 set use64bitall
5836 eval $setvar
5837 case "$use64bitall" in
5838 "$define")
5839         case "$use64bitint" in
5840         "$undef")
5841                 cat <<EOM
5842
5843 Since you have chosen a maximally 64-bit build, I'm also turning on
5844 the use of 64-bit integers.
5845 EOM
5846                 use64bitint="$define" ;;
5847         esac
5848         ;;
5849 esac
5850
5851 : Look for a hint-file generated 'call-back-unit'.  If the
5852 : user has specified that a 64-bit perl is to be built,
5853 : we may need to set or change some other defaults.
5854 if $test -f use64bitint.cbu; then
5855         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5856         . ./use64bitint.cbu
5857 fi
5858 case "$use64bitint" in
5859 "$define"|true|[yY]*)
5860         case "$longsize" in
5861         4) case "$archname64" in
5862            '') archname64=64int ;;
5863            esac
5864            ;;
5865         esac
5866         ;;
5867 esac
5868
5869 : Look for a hint-file generated 'call-back-unit'.  If the
5870 : user has specified that a maximally 64-bit perl is to be built,
5871 : we may need to set or change some other defaults.
5872 if $test -f use64bitall.cbu; then
5873         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5874         . ./use64bitall.cbu
5875 fi
5876 case "$use64bitall" in
5877 "$define"|true|[yY]*)
5878         case "$longsize" in
5879         4) case "$archname64" in
5880            ''|64int) archname64=64all ;;
5881            esac
5882            ;;
5883         esac
5884         ;;
5885 esac
5886
5887 case "$d_quad:$use64bitint" in
5888 $undef:$define)
5889         cat >&4 <<EOF
5890
5891 *** You have chosen to use 64-bit integers,
5892 *** but none can be found.
5893 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5894 *** Cannot continue, aborting.
5895
5896 EOF
5897         exit 1
5898         ;;
5899 esac
5900
5901 : check for length of double
5902 echo " "
5903 case "$doublesize" in
5904 '')
5905         echo "Checking to see how big your double precision numbers are..." >&4
5906         $cat >try.c <<EOCP
5907 #include <stdio.h>
5908 #$i_stdlib I_STDLIB
5909 #ifdef I_STDLIB
5910 #include <stdlib.h>
5911 #endif
5912 int main()
5913 {
5914     printf("%d\n", (int)sizeof(double));
5915     exit(0);
5916 }
5917 EOCP
5918         set try
5919         if eval $compile_ok; then
5920                 doublesize=`$run ./try`
5921                 echo "Your double is $doublesize bytes long."
5922         else
5923                 dflt='8'
5924                 echo "(I can't seem to compile the test program.  Guessing...)"
5925                 rp="What is the size of a double precision number (in bytes)?"
5926                 . ./myread
5927                 doublesize="$ans"
5928         fi
5929         ;;
5930 esac
5931 $rm_try
5932
5933 : check for long doubles
5934 echo " "
5935 echo "Checking to see if you have long double..." >&4
5936 echo 'int main() { long double x = 7.0; }' > try.c
5937 set try
5938 if eval $compile; then
5939         val="$define"
5940         echo "You have long double."
5941 else
5942         val="$undef"
5943         echo "You do not have long double."
5944 fi
5945 $rm_try
5946 set d_longdbl
5947 eval $setvar
5948
5949 : check for length of long double
5950 case "${d_longdbl}${longdblsize}" in
5951 $define)
5952         echo " "
5953         echo "Checking to see how big your long doubles are..." >&4
5954         $cat >try.c <<'EOCP'
5955 #include <stdio.h>
5956 int main()
5957 {
5958         printf("%d\n", sizeof(long double));
5959 }
5960 EOCP
5961         set try
5962         set try
5963         if eval $compile; then
5964                 longdblsize=`$run ./try`
5965                 echo "Your long doubles are $longdblsize bytes long."
5966         else
5967                 dflt='8'
5968                 echo " "
5969                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5970                 rp="What is the size of a long double (in bytes)?"
5971                 . ./myread
5972                 longdblsize="$ans"
5973         fi
5974         if $test "X$doublesize" = "X$longdblsize"; then
5975                 echo "That isn't any different from an ordinary double."
5976                 echo "I'll keep your setting anyway, but you may see some"
5977                 echo "harmless compilation warnings."
5978         fi
5979         ;;
5980 esac
5981 $rm_try
5982
5983 : determine the architecture name
5984 echo " "
5985 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5986         tarch=`arch`"-$osname"
5987 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5988         if uname -m > tmparch 2>&1 ; then
5989                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5990                         -e 's/$/'"-$osname/" tmparch`
5991         else
5992                 tarch="$osname"
5993         fi
5994         $rm -f tmparch
5995 else
5996         tarch="$osname"
5997 fi
5998 case "$myarchname" in
5999 ''|"$tarch") ;;
6000 *)
6001         echo "(Your architecture name used to be $myarchname.)"
6002         archname=''
6003         ;;
6004 esac
6005 case "$targetarch" in
6006 '') ;;
6007 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6008 esac
6009 myarchname="$tarch"
6010 case "$archname" in
6011 '') dflt="$tarch";;
6012 *) dflt="$archname";;
6013 esac
6014 rp='What is your architecture name'
6015 . ./myread
6016 archname="$ans"
6017 case "$usethreads" in
6018 $define)
6019         echo "Threads selected." >&4
6020         case "$archname" in
6021         *-thread*) echo "...and architecture name already has -thread." >&4
6022                 ;;
6023         *)      archname="$archname-thread"
6024                 echo "...setting architecture name to $archname." >&4
6025                 ;;
6026         esac
6027         ;;
6028 esac
6029 case "$usemultiplicity" in
6030 $define)
6031         echo "Multiplicity selected." >&4
6032         case "$archname" in
6033         *-multi*) echo "...and architecture name already has -multi." >&4
6034                 ;;
6035         *)      archname="$archname-multi"
6036                 echo "...setting architecture name to $archname." >&4
6037                 ;;
6038         esac
6039         ;;
6040 esac
6041 case "$use64bitint$use64bitall" in
6042 *"$define"*)
6043         case "$archname64" in
6044         '')
6045                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6046                 ;;
6047         *)
6048                 case "$use64bitint" in
6049                 "$define") echo "64 bit integers selected." >&4 ;;
6050                 esac
6051                 case "$use64bitall" in
6052                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6053                 esac
6054                 case "$archname" in
6055                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6056                         ;;
6057                 *)      archname="$archname-$archname64"
6058                         echo "...setting architecture name to $archname." >&4
6059                         ;;
6060                 esac
6061                 ;;
6062         esac
6063 esac
6064 case "$uselongdouble" in
6065 $define)
6066         echo "Long doubles selected." >&4
6067         case "$longdblsize" in
6068         $doublesize)
6069                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6070                 ;;
6071         *)
6072                 case "$archname" in
6073                 *-ld*) echo "...and architecture name already has -ld." >&4
6074                         ;;
6075                 *)      archname="$archname-ld"
6076                         echo "...setting architecture name to $archname." >&4
6077                         ;;
6078                 esac
6079                 ;;
6080         esac
6081         ;;
6082 esac
6083 case "$useperlio" in
6084 $define)
6085         echo "Perlio selected." >&4
6086         ;;
6087 *)
6088         echo "Perlio not selected, using stdio." >&4
6089         case "$archname" in
6090         *-stdio*) echo "...and architecture name already has -stdio." >&4
6091                 ;;
6092         *)      archname="$archname-stdio"
6093                 echo "...setting architecture name to $archname." >&4
6094                 ;;
6095         esac
6096         ;;
6097 esac
6098 if $test -f archname.cbu; then
6099         echo "Your platform has some specific hints for architecture name, using them..."
6100         . ./archname.cbu
6101 fi
6102
6103 : set the prefixit variable, to compute a suitable default value
6104 prefixit='case "$3" in
6105 ""|none)
6106         case "$oldprefix" in
6107         "") eval "$1=\"\$$2\"";;
6108         *)
6109                 case "$3" in
6110                 "") eval "$1=";;
6111                 none)
6112                         eval "tp=\"\$$2\"";
6113                         case "$tp" in
6114                         ""|" ") eval "$1=\"\$$2\"";;
6115                         *) eval "$1=";;
6116                         esac;;
6117                 esac;;
6118         esac;;
6119 *)
6120         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6121         case "$tp" in
6122         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6123         /*-$oldprefix/*|\~*-$oldprefix/*)
6124                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6125         *) eval "$1=\"\$$2\"";;
6126         esac;;
6127 esac'
6128
6129 : determine installation style
6130 : For now, try to deduce it from prefix unless it is already set.
6131 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6132 case "$installstyle" in
6133 '')     case "$prefix" in
6134                 *perl*) dflt='lib';;
6135                 *) dflt='lib/perl5' ;;
6136         esac
6137         ;;
6138 *)      dflt="$installstyle" ;;
6139 esac
6140 : Probably not worth prompting for this since we prompt for all
6141 : the directories individually, and the prompt would be too long and
6142 : confusing anyway.
6143 installstyle=$dflt
6144
6145 : determine where public executables go
6146 echo " "
6147 set dflt bin bin
6148 eval $prefixit
6149 fn=d~
6150 rp='Pathname where the public executables will reside?'
6151 . ./getfile
6152 if $test "X$ansexp" != "X$binexp"; then
6153         installbin=''
6154 fi
6155 prefixvar=bin
6156 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6157 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6158 :     this via initialinstalllocation
6159 . ./setprefixvar
6160
6161 case "$userelocatableinc" in
6162 $define|true|[yY]*)     dflt='y' ;;
6163 *)                      dflt='n' ;;
6164 esac
6165 cat <<EOM
6166
6167 Would you like to build Perl so that the installation is relocatable, so that
6168 library paths in @INC are determined relative to the path of the perl binary?
6169 This is not advised for system Perl installs, or if you need to run setid
6170 scripts or scripts under taint mode.
6171
6172 If this doesn't make any sense to you, just accept the default '$dflt'.
6173 EOM
6174 rp='Use relocatable @INC?'
6175 . ./myread
6176 case "$ans" in
6177 y|Y)    val="$define" ;;
6178 *)      val="$undef"  ;;
6179 esac
6180 set userelocatableinc
6181 eval $setvar
6182
6183 initialinstalllocation="$binexp"
6184 : Default prefix is now "up one level from where the binaries are"
6185 case "$userelocatableinc" in
6186 $define|true|[yY]*)
6187     bin=".../"
6188     binexp=".../"
6189     prefix=".../.."
6190     prefixexp=".../.."
6191     installprefixexp=".../.."
6192     ;;
6193 esac
6194
6195 : determine where private library files go
6196 : Usual default is /usr/local/lib/perl5/$version.
6197 : Also allow things like /opt/perl/lib/$version, since
6198 : /opt/perl/lib/perl5... would be redundant.
6199 : The default "style" setting is made in installstyle.U
6200 case "$installstyle" in
6201 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6202 *)       set dflt privlib lib/$version ;;
6203 esac
6204 eval $prefixit
6205 $cat <<EOM
6206
6207 There are some auxiliary files for $package that need to be put into a
6208 private library directory that is accessible by everyone.
6209
6210 EOM
6211 fn=$binexp
6212 fn=d~+
6213 rp='Pathname where the private library files will reside?'
6214 . ./getfile
6215 prefixvar=privlib
6216 . ./setprefixvar
6217
6218 : set the prefixup variable, to restore leading tilda escape
6219 prefixup='case "$prefixexp" in
6220 "$prefix") ;;
6221 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6222 esac'
6223
6224 : determine where public architecture dependent libraries go
6225 set archlib archlib
6226 eval $prefixit
6227 : privlib default is /usr/local/lib/$package/$version
6228 : archlib default is /usr/local/lib/$package/$version/$archname
6229 : privlib may have an optional trailing /share.
6230 tdflt=`echo $privlib | $sed 's,/share$,,'`
6231 tdflt=$tdflt/$archname
6232 case "$archlib" in
6233 '')     dflt=$tdflt
6234         ;;
6235 *)      dflt="$archlib"
6236     ;;
6237 esac
6238 $cat <<EOM
6239
6240 $spackage contains architecture-dependent library files.  If you are
6241 sharing libraries in a heterogeneous environment, you might store
6242 these files in a separate location.  Otherwise, you can just include
6243 them with the rest of the public library files.
6244
6245 EOM
6246 fn=$binexp
6247 fn=d+~
6248 rp='Where do you want to put the public architecture-dependent libraries?'
6249 . ./getfile
6250 prefixvar=archlib
6251 . ./setprefixvar
6252 if $test X"$archlib" = X"$privlib"; then
6253         d_archlib="$undef"
6254 else
6255         d_archlib="$define"
6256 fi
6257
6258 : see if setuid scripts can be secure
6259 $cat <<EOM
6260
6261 Some kernels have a bug that prevents setuid #! scripts from being
6262 secure.  Some sites have disabled setuid #! scripts because of this.
6263
6264 First let's decide if your kernel supports secure setuid #! scripts.
6265 (If setuid #! scripts would be secure but have been disabled anyway,
6266 don't say that they are secure if asked.)
6267
6268 EOM
6269
6270 val="$undef"
6271 if $test -d /dev/fd; then
6272         echo "#!$ls" >reflect
6273         chmod +x,u+s reflect
6274         ./reflect >flect 2>&1
6275         if $contains "/dev/fd" flect >/dev/null; then
6276                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6277                 val="$define"
6278         else
6279                 $cat <<EOM
6280 If you are not sure if they are secure, I can check but I'll need a
6281 username and password different from the one you are using right now.
6282 If you don't have such a username or don't want me to test, simply
6283 enter 'none'.
6284
6285 EOM
6286                 rp='Other username to test security of setuid scripts with?'
6287                 dflt='none'
6288                 . ./myread
6289                 case "$ans" in
6290                 n|none)
6291                         case "$d_suidsafe" in
6292                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6293                                 dflt=n;;
6294                         "$undef")
6295                                 echo "Well, the $hint value is *not* secure." >&4
6296                                 dflt=n;;
6297                         *)      echo "Well, the $hint value *is* secure." >&4
6298                                 dflt=y;;
6299                         esac
6300                         ;;
6301                 *)
6302                         $rm -f reflect flect
6303                         echo "#!$ls" >reflect
6304                         chmod +x,u+s reflect
6305                         echo >flect
6306                         chmod a+w flect
6307                         echo '"su" will (probably) prompt you for '"$ans's password."
6308                         su $ans -c './reflect >flect'
6309                         if $contains "/dev/fd" flect >/dev/null; then
6310                                 echo "Okay, it looks like setuid scripts are secure." >&4
6311                                 dflt=y
6312                         else
6313                                 echo "I don't think setuid scripts are secure." >&4
6314                                 dflt=n
6315                         fi
6316                         ;;
6317                 esac
6318                 rp='Does your kernel have *secure* setuid scripts?'
6319                 . ./myread
6320                 case "$ans" in
6321                 [yY]*)  val="$define";;
6322                 *)      val="$undef";;
6323                 esac
6324         fi
6325 else
6326         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6327         echo "(That's for file descriptors, not floppy disks.)"
6328         val="$undef"
6329 fi
6330 set d_suidsafe
6331 eval $setvar
6332
6333 $rm -f reflect flect
6334
6335 : now see if they want to do setuid emulation
6336 echo " "
6337 val="$undef"
6338 case "$d_suidsafe" in
6339 "$define")
6340         val="$undef"
6341         echo "No need to emulate SUID scripts since they are secure here." >&4
6342         ;;
6343 *)
6344         $cat <<EOM
6345 Some systems have disabled setuid scripts, especially systems where
6346 setuid scripts cannot be secure.  On systems where setuid scripts have
6347 been disabled, the setuid/setgid bits on scripts are currently
6348 useless.  It is possible for $package to detect those bits and emulate
6349 setuid/setgid in a secure fashion.  This emulation will only work if
6350 setuid scripts have been disabled in your kernel.
6351
6352 EOM
6353         case "$d_dosuid" in
6354         "$define") dflt=y ;;
6355         *) dflt=n ;;
6356         esac
6357         rp="Do you want to do setuid/setgid emulation?"
6358         . ./myread
6359         case "$ans" in
6360         [yY]*)  val="$define";;
6361         *)      val="$undef";;
6362         esac
6363         ;;
6364 esac
6365 set d_dosuid
6366 eval $setvar
6367
6368 : Find perl5.005 or later.
6369 echo "Looking for a previously installed perl5.005 or later... "
6370 case "$perl5" in
6371 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6372                 : Check if this perl is recent and can load a simple module
6373                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374                         perl5=$tdir/perl
6375                         break;
6376                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6377                         perl5=$tdir/perl5
6378                         break;
6379                 fi
6380         done
6381         ;;
6382 *)      perl5="$perl5"
6383         ;;
6384 esac
6385 case "$perl5" in
6386 '')     echo "None found.  That's ok.";;
6387 *)      echo "Using $perl5." ;;
6388 esac
6389
6390 : Set the siteprefix variables
6391 $cat <<EOM
6392
6393 After $package is installed, you may wish to install various
6394 add-on modules and utilities.  Typically, these add-ons will
6395 be installed under $prefix with the rest
6396 of this package.  However, you may wish to install such add-ons
6397 elsewhere under a different prefix.
6398
6399 If you do not wish to put everything under a single prefix, that's
6400 ok.  You will be prompted for the individual locations; this siteprefix
6401 is only used to suggest the defaults.
6402
6403 The default should be fine for most people.
6404
6405 EOM
6406 fn=d~+
6407 rp='Installation prefix to use for add-on modules and utilities?'
6408 : XXX Here might be another good place for an installstyle setting.
6409 case "$siteprefix" in
6410 '') dflt=$prefix ;;
6411 *)  dflt=$siteprefix ;;
6412 esac
6413 . ./getfile
6414 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6415 oldsiteprefix=''
6416 case "$siteprefix" in
6417 '') ;;
6418 *)      case "$ans" in
6419         "$prefix") ;;
6420         *) oldsiteprefix="$prefix";;
6421         esac
6422         ;;
6423 esac
6424 siteprefix="$ans"
6425 siteprefixexp="$ansexp"
6426
6427 : determine where site specific libraries go.
6428 : Usual default is /usr/local/lib/perl5/site_perl/$version
6429 : The default "style" setting is made in installstyle.U
6430 : XXX No longer works with Prefixit stuff.
6431 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6432 case "$sitelib" in
6433 '') case "$installstyle" in
6434         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6435         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6436         esac
6437         ;;
6438 *)      dflt="$sitelib"
6439         ;;
6440 esac
6441 $cat <<EOM
6442
6443 The installation process will create a directory for
6444 site-specific extensions and modules.  Most users find it convenient
6445 to place all site-specific files in this directory rather than in the
6446 main distribution directory.
6447
6448 EOM
6449 fn=d~+
6450 rp='Pathname for the site-specific library files?'
6451 . ./getfile
6452 prefixvar=sitelib
6453 . ./setprefixvar
6454 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6455
6456 : Determine list of previous versions to include in @INC
6457 $cat > getverlist <<EOPL
6458 #!$perl5 -w
6459 use File::Basename;
6460 \$api_versionstring = "$api_versionstring";
6461 \$version = "$version";
6462 \$stem = "$sitelib_stem";
6463 \$archname = "$archname";
6464 EOPL
6465         $cat >> getverlist <<'EOPL'
6466 # The list found is store twice for each entry: the original name, and
6467 # the binary broken down version as pack "sss", so sorting is easy and
6468 # unambiguous. This will work for all versions that have a maximum of
6469 # three digit groups, separate by '.'s or '_'s. Names are extended with
6470 # ".0.0" to ensure at least three elements for the pack.
6471 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6472
6473 # Can't have leading @ because metaconfig interprets it as a command!
6474 ;@inc_version_list=();
6475 # XXX Redo to do opendir/readdir?
6476 if (-d $stem) {
6477     chdir($stem);
6478     ;@candidates = map {
6479         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6480 }
6481 else {
6482     ;@candidates = ();
6483 }
6484
6485 ($pversion, $aversion, $vsn5005) = map {
6486     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6487 foreach $d (@candidates) {
6488     if ($d->[1] lt $pversion) {
6489         if ($d->[1] ge $aversion) {
6490             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6491         }
6492         elsif ($d->[1] ge $vsn5005) {
6493             unshift(@inc_version_list, grep { -d } $d->[0]);
6494         }
6495     }
6496     else {
6497         # Skip newer version.  I.e. don't look in
6498         # 5.7.0 if we're installing 5.6.1.
6499     }
6500 }
6501
6502 if (@inc_version_list) {
6503     print join(' ', @inc_version_list);
6504 }
6505 else {
6506     # Blank space to preserve value for next Configure run.
6507     print " ";
6508 }
6509 EOPL
6510 chmod +x getverlist
6511 case "$inc_version_list" in
6512 '')     if test -x "$perl5$exe_ext"; then
6513                 dflt=`$perl5 getverlist`
6514         else
6515                 dflt='none'
6516         fi
6517         ;;
6518 $undef) dflt='none' ;;
6519 *)  eval dflt=\"$inc_version_list\" ;;
6520 esac
6521 case "$dflt" in
6522 ''|' ') dflt=none ;;
6523 esac
6524 case "$dflt" in
6525 5.005) dflt=none ;;
6526 esac
6527 $cat <<EOM
6528
6529 In order to ease the process of upgrading, this version of perl
6530 can be configured to use modules built and installed with earlier
6531 versions of perl that were installed under $prefix.  Specify here
6532 the list of earlier versions that this version of perl should check.
6533 If Configure detected no earlier versions of perl installed under
6534 $prefix, then the list will be empty.  Answer 'none' to tell perl
6535 to not search earlier versions.
6536
6537 The default should almost always be sensible, so if you're not sure,
6538 just accept the default.
6539 EOM
6540
6541 rp='List of earlier versions to include in @INC?'
6542 . ./myread
6543 case "$ans" in
6544 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6545 *) inc_version_list="$ans" ;;
6546 esac
6547 case "$inc_version_list" in
6548 ''|' ')
6549         inc_version_list_init='0'
6550         d_inc_version_list="$undef"
6551         ;;
6552 *)      inc_version_list_init=`echo $inc_version_list |
6553                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6554         d_inc_version_list="$define"
6555         ;;
6556 esac
6557 $rm -f getverlist
6558
6559 : see if malloc/malloc.h has to be included
6560 set malloc/malloc.h i_mallocmalloc
6561 eval $inhdr
6562
6563 : see if this is a malloc.h system
6564 : we want a real compile instead of Inhdr because some systems have a
6565 : malloc.h that just gives a compile error saying to use stdlib.h instead
6566 echo " "
6567 $cat >try.c <<EOCP
6568 #include <stdlib.h>
6569 #include <malloc.h>
6570 #$i_mallocmalloc I_MALLOCMALLOC
6571 #ifdef I_MALLOCMALLOC
6572 # include <malloc/malloc.h>
6573 #endif
6574
6575 int main () { return 0; }
6576 EOCP
6577 set try
6578 if eval $compile; then
6579     echo "<malloc.h> found." >&4
6580     val="$define"
6581 else
6582     echo "<malloc.h> NOT found." >&4
6583     val="$undef"
6584 fi
6585 $rm_try
6586 set i_malloc
6587 eval $setvar
6588
6589 : check for void type
6590 echo " "
6591 echo "Checking to see how well your C compiler groks the void type..." >&4
6592 case "$voidflags" in
6593 '')
6594         $cat >try.c <<EOCP
6595 #$i_stdlib I_STDLIB
6596 #ifdef I_STDLIB
6597 #include <stdlib.h>
6598 #endif
6599 #if TRY & 1
6600 void sub() {
6601 #else
6602 sub() {
6603 #endif
6604         extern void moo();      /* function returning void */
6605         void (*goo)();          /* ptr to func returning void */
6606 #if TRY & 8
6607         void *hue;              /* generic ptr */
6608 #endif
6609 #if TRY & 2
6610         void (*foo[10])();
6611 #endif
6612
6613 #if TRY & 4
6614         if(goo == moo) {
6615                 exit(0);
6616         }
6617 #endif
6618         exit(0);
6619 }
6620 int main() { sub(); }
6621 EOCP
6622         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6623                 voidflags=$defvoidused
6624         echo "Good.  It appears to support void to the level $package wants.">&4
6625                 if $contains warning .out >/dev/null 2>&1; then
6626                         echo "However, you might get some warnings that look like this:"
6627                         $cat .out
6628                 fi
6629         else
6630 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6631                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6632                         echo "It supports 1..."
6633                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6634                                 echo "It also supports 2..."
6635                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6636                                         voidflags=7
6637                                         echo "And it supports 4 but not 8 definitely."
6638                                 else
6639                                         echo "It doesn't support 4..."
6640                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6641                                                 voidflags=11
6642                                                 echo "But it supports 8."
6643                                         else
6644                                                 voidflags=3
6645                                                 echo "Neither does it support 8."
6646                                         fi
6647                                 fi
6648                         else
6649                                 echo "It does not support 2..."
6650                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6651                                         voidflags=13
6652                                         echo "But it supports 4 and 8."
6653                                 else
6654                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6655                                                 voidflags=5
6656                                                 echo "And it supports 4 but has not heard about 8."
6657                                         else
6658                                                 echo "However it supports 8 but not 4."
6659                                         fi
6660                                 fi
6661                         fi
6662                 else
6663                         echo "There is no support at all for void."
6664                         voidflags=0
6665                 fi
6666         fi
6667 esac
6668 case "$voidflags" in
6669 "$defvoidused") ;;
6670 *)      $cat >&4 <<'EOM'
6671   Support flag bits are:
6672     1: basic void declarations.
6673     2: arrays of pointers to functions returning void.
6674     4: operations between pointers to and addresses of void functions.
6675     8: generic void pointers.
6676 EOM
6677         dflt="$voidflags";
6678         rp="Your void support flags add up to what?"
6679         . ./myread
6680         voidflags="$ans"
6681         ;;
6682 esac
6683 $rm_try
6684
6685 : check for length of pointer
6686 echo " "
6687 case "$ptrsize" in
6688 '')
6689         echo "Checking to see how big your pointers are..." >&4
6690         if test "$voidflags" -gt 7; then
6691                 echo '#define VOID_PTR char *' > try.c
6692         else
6693                 echo '#define VOID_PTR void *' > try.c
6694         fi
6695         $cat >>try.c <<EOCP
6696 #include <stdio.h>
6697 #$i_stdlib I_STDLIB
6698 #ifdef I_STDLIB
6699 #include <stdlib.h>
6700 #endif
6701 int main()
6702 {
6703     printf("%d\n", (int)sizeof(VOID_PTR));
6704     exit(0);
6705 }
6706 EOCP
6707         set try
6708         if eval $compile_ok; then
6709                 ptrsize=`$run ./try`
6710                 echo "Your pointers are $ptrsize bytes long."
6711         else
6712                 dflt='4'
6713                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6714                 rp="What is the size of a pointer (in bytes)?"
6715                 . ./myread
6716                 ptrsize="$ans"
6717         fi
6718         ;;
6719 esac
6720 $rm_try
6721 case "$use64bitall" in
6722 "$define"|true|[yY]*)
6723         case "$ptrsize" in
6724         4)      cat <<EOM >&4
6725
6726 *** You have chosen a maximally 64-bit build,
6727 *** but your pointers are only 4 bytes wide.
6728 *** Please rerun Configure without -Duse64bitall.
6729 EOM
6730                 case "$d_quad" in
6731                 define)
6732                         cat <<EOM >&4
6733 *** Since you have quads, you could possibly try with -Duse64bitint.
6734 EOM
6735                         ;;
6736                 esac
6737                 cat <<EOM >&4
6738 *** Cannot continue, aborting.
6739
6740 EOM
6741
6742                 exit 1
6743                 ;;
6744         esac
6745         ;;
6746 esac
6747
6748
6749 : determine whether to use malloc wrapping
6750 echo " "
6751 case "$usemallocwrap" in
6752 [yY]*|true|$define)     dflt='y' ;;
6753 [nN]*|false|$undef)     dflt='n' ;;
6754 *)      case "$usedevel" in
6755         [yY]*|true|$define)     dflt='y' ;;
6756         *) dflt='n' ;;
6757         esac
6758         ;;
6759 esac
6760 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6761 . ./myread
6762 usemallocwrap="$ans"
6763 case "$ans" in
6764 y*|true)
6765         usemallocwrap="$define" ;;
6766 *)
6767         usemallocwrap="$undef" ;;
6768 esac
6769
6770 : determine which malloc to compile in
6771 echo " "
6772 case "$usemymalloc" in
6773 [yY]*|true|$define)     dflt='y' ;;
6774 [nN]*|false|$undef)     dflt='n' ;;
6775 *)      case "$ptrsize" in
6776         4) dflt='y' ;;
6777         *) dflt='n' ;;
6778         esac
6779         ;;
6780 esac
6781 rp="Do you wish to attempt to use the malloc that comes with $package?"
6782 . ./myread
6783 usemymalloc="$ans"
6784 case "$ans" in
6785 y*|true)
6786         usemymalloc='y'
6787         mallocsrc='malloc.c'
6788         mallocobj="malloc$_o"
6789         d_mymalloc="$define"
6790         case "$libs" in
6791         *-lmalloc*)
6792                 : Remove malloc from list of libraries to use
6793                 echo "Removing unneeded -lmalloc from library list" >&4
6794                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6795                 shift
6796                 libs="$*"
6797                 echo "libs = $libs" >&4
6798                 ;;
6799         esac
6800         ;;
6801 *)
6802         usemymalloc='n'
6803         mallocsrc=''
6804         mallocobj=''
6805         d_mymalloc="$undef"
6806         ;;
6807 esac
6808
6809 : compute the return types of malloc and free
6810 echo " "
6811 $cat >malloc.c <<END
6812 #$i_malloc I_MALLOC
6813 #$i_stdlib I_STDLIB
6814 #include <stdio.h>
6815 #include <sys/types.h>
6816 #ifdef I_MALLOC
6817 #include <malloc.h>
6818 #endif
6819 #ifdef I_STDLIB
6820 #include <stdlib.h>
6821 #endif
6822 #ifdef TRY_MALLOC
6823 void *malloc();
6824 #endif
6825 #ifdef TRY_FREE
6826 void free();
6827 #endif
6828 END
6829 case "$malloctype" in
6830 '')
6831         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6832                 malloctype='void *'
6833         else
6834                 malloctype='char *'
6835         fi
6836         ;;
6837 esac
6838 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6839
6840 case "$freetype" in
6841 '')
6842         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6843                 freetype='void'
6844         else
6845                 freetype='int'
6846         fi
6847         ;;
6848 esac
6849 echo "Your system uses $freetype free(), it would seem." >&4
6850 $rm -f malloc.[co]
6851 : determine where site specific architecture-dependent libraries go.
6852 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6853 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6854 : sitelib may have an optional trailing /share.
6855 case "$sitearch" in
6856 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6857         dflt="$dflt/$archname"
6858         ;;
6859 *)      dflt="$sitearch"
6860         ;;
6861 esac
6862 set sitearch sitearch none
6863 eval $prefixit
6864 $cat <<EOM
6865
6866 The installation process will also create a directory for
6867 architecture-dependent site-specific extensions and modules.
6868
6869 EOM
6870 fn=d~+
6871 rp='Pathname for the site-specific architecture-dependent library files?'
6872 . ./getfile
6873 prefixvar=sitearch
6874 . ./setprefixvar
6875 if $test X"$sitearch" = X"$sitelib"; then
6876         d_sitearch="$undef"
6877 else
6878         d_sitearch="$define"
6879 fi
6880
6881 : Set the vendorprefix variables
6882 $cat <<EOM
6883
6884 The installation process will also create a directory for
6885 vendor-supplied add-ons.  Vendors who supply perl with their system
6886 may find it convenient to place all vendor-supplied files in this
6887 directory rather than in the main distribution directory.  This will
6888 ease upgrades between binary-compatible maintenance versions of perl.
6889
6890 Of course you may also use these directories in whatever way you see
6891 fit.  For example, you might use them to access modules shared over a
6892 company-wide network.
6893
6894 The default answer should be fine for most people.
6895 This causes further questions about vendor add-ons to be skipped
6896 and no vendor-specific directories will be configured for perl.
6897
6898 EOM
6899 rp='Do you want to configure vendor-specific add-on directories?'
6900 case "$usevendorprefix" in
6901 define|true|[yY]*) dflt=y ;;
6902 *)      : User may have set vendorprefix directly on Configure command line.
6903         case "$vendorprefix" in
6904         ''|' ') dflt=n ;;
6905         *)      dflt=y ;;
6906         esac
6907         ;;
6908 esac
6909 . ./myread
6910 case "$ans" in
6911 [yY]*)  fn=d~+
6912         rp='Installation prefix to use for vendor-supplied add-ons?'
6913         case "$vendorprefix" in
6914         '') dflt='' ;;
6915         *)  dflt=$vendorprefix ;;
6916         esac
6917         . ./getfile
6918         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6919         oldvendorprefix=''
6920         case "$vendorprefix" in
6921         '') ;;
6922         *)      case "$ans" in
6923                 "$prefix") ;;
6924                 *) oldvendorprefix="$prefix";;
6925                 esac
6926                 ;;
6927         esac
6928         usevendorprefix="$define"
6929         vendorprefix="$ans"
6930         vendorprefixexp="$ansexp"
6931         ;;
6932 *)      usevendorprefix="$undef"
6933         vendorprefix=''
6934         vendorprefixexp=''
6935         ;;
6936 esac
6937
6938 : Set the vendorlib variables
6939 case "$vendorprefix" in
6940 '')     d_vendorlib="$undef"
6941         vendorlib=''
6942         vendorlibexp=''
6943         ;;
6944 *)      d_vendorlib="$define"
6945         : determine where vendor-supplied modules go.
6946         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6947         case "$vendorlib" in
6948         '')
6949                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6950                 case "$installstyle" in
6951                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6952                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6953                 esac
6954                 ;;
6955         *)      dflt="$vendorlib"
6956                 ;;
6957         esac
6958         fn=d~+
6959         rp='Pathname for the vendor-supplied library files?'
6960         . ./getfile
6961         vendorlib="$ans"
6962         vendorlibexp="$ansexp"
6963         ;;
6964 esac
6965 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6966 prefixvar=vendorlib
6967 . ./installprefix
6968
6969 : Set the vendorarch variables
6970 case "$vendorprefix" in
6971 '')     d_vendorarch="$undef"
6972         vendorarch=''
6973         vendorarchexp=''
6974         ;;
6975 *)      d_vendorarch="$define"
6976         : determine where vendor-supplied architecture-dependent libraries go.
6977         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6978         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6979         : vendorlib may have an optional trailing /share.
6980         case "$vendorarch" in
6981         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6982                 dflt="$dflt/$archname"
6983                 ;;
6984         *)      dflt="$vendorarch" ;;
6985         esac
6986         fn=d~+
6987         rp='Pathname for vendor-supplied architecture-dependent files?'
6988         . ./getfile
6989         vendorarch="$ans"
6990         vendorarchexp="$ansexp"
6991         ;;
6992 esac
6993 prefixvar=vendorarch
6994 . ./installprefix
6995
6996 : Final catch-all directories to search
6997 $cat <<EOM
6998
6999 Lastly, you can have perl look in other directories for extensions and
7000 modules in addition to those already specified.
7001 These directories will be searched after 
7002         $sitearch 
7003         $sitelib 
7004 EOM
7005 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7006 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7007 echo ' '
7008 case "$otherlibdirs" in
7009 ''|' ') dflt='none' ;;
7010 *)      dflt="$otherlibdirs" ;;
7011 esac
7012 $cat <<EOM
7013 Enter a colon-separated set of extra paths to include in perl's @INC
7014 search path, or enter 'none' for no extra paths.
7015
7016 EOM
7017
7018 rp='Colon-separated list of additional directories for perl to search?'
7019 . ./myread
7020 case "$ans" in
7021 ' '|''|none)    otherlibdirs=' ' ;;     
7022 *)      otherlibdirs="$ans" ;;
7023 esac
7024 case "$otherlibdirs" in
7025 ' ') val=$undef ;;
7026 *)      val=$define ;;
7027 esac
7028 set d_perl_otherlibdirs
7029 eval $setvar
7030
7031 : Cruising for prototypes
7032 echo " "
7033 echo "Checking out function prototypes..." >&4
7034 $cat >prototype.c <<EOCP
7035 #$i_stdlib I_STDLIB
7036 #ifdef I_STDLIB
7037 #include <stdlib.h>
7038 #endif
7039 int main(int argc, char *argv[]) {
7040         exit(0);}
7041 EOCP
7042 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7043         echo "Your C compiler appears to support function prototypes."
7044         val="$define"
7045 else
7046         echo "Your C compiler doesn't seem to understand function prototypes."
7047         val="$undef"
7048 fi
7049 set prototype
7050 eval $setvar
7051 $rm -f prototype*
7052
7053 : Check if ansi2knr is required
7054 case "$prototype" in
7055 "$define") ;;
7056 *)      ansi2knr='ansi2knr'
7057         echo " "
7058         cat <<EOM >&4
7059
7060 $me:  FATAL ERROR:
7061 This version of $package can only be compiled by a compiler that 
7062 understands function prototypes.  Unfortunately, your C compiler 
7063         $cc $ccflags
7064 doesn't seem to understand them.  Sorry about that.
7065
7066 If GNU cc is available for your system, perhaps you could try that instead.  
7067
7068 Eventually, we hope to support building Perl with pre-ANSI compilers.
7069 If you would like to help in that effort, please contact <perlbug@perl.org>.
7070
7071 Aborting Configure now.
7072 EOM
7073         exit 2
7074         ;;
7075 esac
7076
7077 : DTrace support
7078 dflt_dtrace='/usr/sbin/dtrace'
7079 cat <<EOM
7080
7081 Perl can be built to support DTrace on platforms that support it.
7082 DTrace is a diagnosis and performance analysis tool from Sun.
7083
7084 If this doesn't make any sense to you, just accept the default '$dflt'.
7085 EOM
7086
7087 while $test 1 ; do
7088         case "$usedtrace" in
7089         $define|true|[yY]*)
7090                 dflt='y'
7091                 ;;
7092         ?*)
7093                 dflt='y'
7094                 dflt_dtrace=$usedtrace
7095                 ;;
7096         *)
7097                 dflt='n'
7098                 ;;
7099         esac
7100
7101         rp='Support DTrace if available?'
7102         . ./myread
7103         case "$ans" in
7104         y|Y)    val="$define" ;;
7105         *)      val="$undef" ;;
7106         esac
7107         set usedtrace
7108         eval $setvar
7109
7110         test "X$usedtrace" != "X$define" && break
7111
7112         echo " "
7113         rp='Where is the dtrace executable?'
7114         dflt=$dflt_dtrace
7115         . ./getfile
7116         val="$ans"
7117         set dtrace
7118         eval $setvar
7119
7120         if $test -f $dtrace
7121         then
7122                 if $dtrace -h -s ../perldtrace.d \
7123                         -o perldtrace.tmp >/dev/null 2>&1 \
7124                         && rm -f perldtrace.tmp
7125                 then
7126                         echo " "
7127                         echo "Good: your $dtrace knows about the -h flag."
7128                 else
7129                         cat >&2 <<EOM
7130
7131 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7132 ***
7133 *** Your installed dtrace doesn't support the -h switch to compile a D
7134 *** program into a C header. Can't continue.
7135
7136 EOM
7137                         exit 1
7138                 fi
7139                 break;
7140         fi
7141
7142         case "$fastread" in
7143         yes)
7144                 cat >&2 <<EOM
7145
7146 *** $me:  Fatal Error:  $dtrace not found.
7147 *** Can't continue.
7148
7149 EOM
7150                 exit 1
7151                 ;;
7152         *)
7153                 echo "*** $dtrace was not found."
7154                 echo " "
7155                 ;;
7156         esac
7157 done
7158
7159 : See if we want extra modules installed
7160 echo " "
7161 case "$extras" in
7162 '') dflt='n';;
7163 *) dflt='y';;
7164 esac
7165 cat <<EOM
7166 Perl can be built with extra modules or bundles of modules which
7167 will be fetched from the CPAN and installed alongside Perl.
7168
7169 Notice that you will need access to the CPAN; either via the Internet,
7170 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7171 be asked later to configure the CPAN.pm module which will in turn do
7172 the installation of the rest of the extra modules or bundles.)
7173
7174 Notice also that if the modules require any external software such as
7175 libraries and headers (the libz library and the zlib.h header for the
7176 Compress::Zlib module, for example) you MUST have any such software
7177 already installed, this configuration process will NOT install such
7178 things for you.
7179
7180 If this doesn't make any sense to you, just accept the default '$dflt'.
7181 EOM
7182 rp='Install any extra modules (y or n)?'
7183 . ./myread
7184 case "$ans" in
7185 y|Y)
7186         cat <<EOM
7187
7188 Please list any extra modules or bundles to be installed from CPAN,
7189 with spaces between the names.  The names can be in any format the
7190 'install' command of CPAN.pm will understand.  (Answer 'none',
7191 without the quotes, to install no extra modules or bundles.)
7192 EOM
7193         rp='Extras?'
7194         dflt="$extras"
7195         . ./myread
7196         extras="$ans"
7197 esac
7198 case "$extras" in
7199 ''|'none')
7200         val=''
7201         $rm -f ../extras.lst
7202         ;;
7203 *)      echo "(Saving the list of extras for later...)"
7204         echo "$extras" > ../extras.lst
7205         val="'$extras'"
7206         ;;
7207 esac
7208 set extras
7209 eval $setvar
7210 echo " "
7211
7212 : determine where html pages for programs go
7213 set html1dir html1dir none
7214 eval $prefixit
7215 $cat <<EOM
7216
7217 If you wish to install html files for programs in $spackage, indicate
7218 the appropriate directory here.  To skip installing html files,
7219 answer "none".
7220 EOM
7221 case "$html1dir" in
7222 ''|none|$undef|' ') dflt=none ;;
7223 *) dflt=$html1dir ;;
7224 esac
7225 fn=dn+~
7226 rp="Directory for the main $spackage html pages?"
7227 . ./getfile
7228 prefixvar=html1dir
7229 . ./setprefixvar
7230 : Use ' ' for none so value is preserved next time through Configure
7231 $test X"$html1dir" = "X" && html1dir=' '
7232
7233 : determine where html pages for libraries and modules go
7234 set html3dir html3dir none
7235 eval $prefixit
7236 $cat <<EOM
7237
7238 If you wish to install html files for modules associated with $spackage,
7239 indicate the appropriate directory here.  To skip installing html files,
7240 answer "none".
7241 EOM
7242 : There is no obvious default.  If they have specified html1dir, then
7243 : try to key off that, possibly changing .../html1 into .../html3.
7244 case "$html3dir" in
7245 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7246 *) dflt=$html3dir ;;
7247 esac
7248 fn=dn+~
7249 rp="Directory for the $spackage module html pages?"
7250 . ./getfile
7251 prefixvar=html3dir
7252 . ./setprefixvar
7253 : Use ' ' for none so value is preserved next time through Configure
7254 $test X"$html3dir" = "X" && html3dir=' '
7255
7256 : determine whether to install perl also as /usr/bin/perl
7257
7258 echo " "
7259 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7260         $cat <<EOM
7261 Many scripts expect perl to be installed as /usr/bin/perl.
7262
7263 If you want to, I can install the perl you are about to compile
7264 as /usr/bin/perl (in addition to $bin/perl).
7265 EOM
7266         if test -f /usr/bin/perl; then
7267             $cat <<EOM
7268
7269 However, please note that because you already have a /usr/bin/perl,
7270 overwriting that with a new Perl would very probably cause problems.
7271 Therefore I'm assuming you don't want to do that (unless you insist).
7272
7273 EOM
7274             case "$installusrbinperl" in
7275             "$define"|[yY]*)    dflt='y';;
7276             *)                  dflt='n';;
7277             esac
7278         else
7279             $cat <<EOM
7280
7281 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7282
7283 EOM
7284             case "$installusrbinperl" in
7285             "$undef"|[nN]*)     dflt='n';;
7286             *)                  dflt='y';;
7287             esac
7288         fi
7289         rp="Do you want to install perl as /usr/bin/perl?"
7290         . ./myread
7291         case "$ans" in
7292         [yY]*)  val="$define";;
7293         *)      val="$undef" ;;
7294         esac
7295 else
7296         val="$undef"
7297 fi
7298 set installusrbinperl
7299 eval $setvar
7300
7301 : Check if we are using the GNU C library
7302 echo " "
7303 echo "Checking for GNU C Library..." >&4
7304 cat >try.c <<'EOCP'
7305 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7306    alone are insufficient to distinguish different versions, such as
7307    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7308    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7309 */
7310 #include <stdio.h>
7311 int main(void)
7312 {
7313 #ifdef __GLIBC__
7314 #   ifdef __GLIBC_MINOR__
7315 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7316 #           include <gnu/libc-version.h>
7317             printf("%s\n",  gnu_get_libc_version());
7318 #       else
7319             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7320 #       endif
7321 #   else
7322         printf("%d\n",  __GLIBC__);
7323 #   endif
7324     return 0;
7325 #else
7326     return 1;
7327 #endif
7328 }
7329 EOCP
7330 set try
7331 if eval $compile_ok && $run ./try > glibc.ver; then
7332         val="$define"
7333         gnulibc_version=`$cat glibc.ver`
7334         echo "You are using the GNU C Library version $gnulibc_version"
7335 else
7336         val="$undef"
7337         gnulibc_version=''
7338         echo "You are not using the GNU C Library"
7339 fi
7340 $rm_try glibc.ver
7341 set d_gnulibc
7342 eval $setvar
7343
7344 : see if nm is to be used to determine whether a symbol is defined or not
7345 case "$usenm" in
7346 '')
7347         dflt=''
7348         case "$d_gnulibc" in
7349         "$define")
7350                 echo " "
7351                 echo "nm probably won't work on the GNU C Library." >&4
7352                 dflt=n
7353                 ;;
7354         esac
7355         case "$dflt" in
7356         '') 
7357                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7358                         echo " "
7359                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7360                         echo "'nm' won't be sufficient on this sytem." >&4
7361                         dflt=n
7362                 fi
7363                 ;;
7364         esac
7365         case "$dflt" in
7366         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7367                 if $test $dflt -gt 20; then
7368                         dflt=y
7369                 else
7370                         dflt=n
7371                 fi
7372                 ;;
7373         esac
7374         ;;
7375 *)
7376         case "$usenm" in
7377         true|$define) dflt=y;;
7378         *) dflt=n;;
7379         esac
7380         ;;
7381 esac
7382 $cat <<EOM
7383
7384 I can use $nm to extract the symbols from your C libraries. This
7385 is a time consuming task which may generate huge output on the disk (up
7386 to 3 megabytes) but that should make the symbols extraction faster. The
7387 alternative is to skip the 'nm' extraction part and to compile a small
7388 test program instead to determine whether each symbol is present. If
7389 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7390 this may be the best solution.
7391
7392 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7393
7394 EOM
7395 rp="Shall I use $nm to extract C symbols from the libraries?"
7396 . ./myread
7397 case "$ans" in
7398 [Nn]*) usenm=false;;
7399 *) usenm=true;;
7400 esac
7401
7402 runnm=$usenm
7403 case "$reuseval" in
7404 true) runnm=false;;
7405 esac
7406
7407 : nm options which may be necessary
7408 case "$nm_opt" in
7409 '') if $test -f /mach_boot; then
7410                 nm_opt=''       # Mach
7411         elif $test -d /usr/ccs/lib; then
7412                 nm_opt='-p'     # Solaris (and SunOS?)
7413         elif $test -f /dgux; then
7414                 nm_opt='-p'     # DG-UX
7415         elif $test -f /lib64/rld; then
7416                 nm_opt='-p'     # 64-bit Irix
7417         else
7418                 nm_opt=''
7419         fi;;
7420 esac
7421
7422 : nm options which may be necessary for shared libraries but illegal
7423 : for archive libraries.  Thank you, Linux.
7424 case "$nm_so_opt" in
7425 '')     case "$myuname" in
7426         *linux*|gnu*)
7427                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7428                         nm_so_opt='--dynamic'
7429                 fi
7430                 ;;
7431         esac
7432         ;;
7433 esac
7434
7435 : get list of predefined functions in a handy place
7436 case "$runnm" in
7437 true)
7438 echo " "
7439 case "$libc" in
7440 '') libc=unknown
7441         case "$libs" in
7442         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7443         esac
7444         ;;
7445 esac
7446 case "$libs" in
7447 '') ;;
7448 *)  for thislib in $libs; do
7449         case "$thislib" in
7450         -lc|-lc_s)
7451                 : Handle C library specially below.
7452                 ;;
7453         -l*)
7454                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7455                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7456                         :
7457                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7458                         :
7459                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7460                         :
7461                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7462                         :
7463                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7464                         :
7465                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7466                         :
7467                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7468                         :
7469                 else
7470                         try=''
7471                 fi
7472                 libnames="$libnames $try"
7473                 ;;
7474         *) libnames="$libnames $thislib" ;;
7475         esac
7476         done
7477         ;;
7478 esac
7479 xxx=normal
7480 case "$libc" in
7481 unknown)
7482         set /lib/libc.$so
7483         for xxx in $libpth; do
7484                 $test -r $1 || set $xxx/libc.$so
7485                 : The messy sed command sorts on library version numbers.
7486                 $test -r $1 || \
7487                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7488                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7489                                 h
7490                                 s/[0-9][0-9]*/0000&/g
7491                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7492                                 G
7493                                 s/\n/ /' | \
7494                          $sort | $sed -e 's/^.* //'`
7495                 eval set \$$#
7496         done
7497         $test -r $1 || set /usr/ccs/lib/libc.$so
7498         $test -r $1 || set /lib/libsys_s$_a
7499         ;;
7500 *)
7501         set blurfl
7502         ;;
7503 esac
7504 if $test -r "$1"; then
7505         echo "Your (shared) C library seems to be in $1."
7506         libc="$1"
7507 elif $test -r /lib/libc && $test -r /lib/clib; then
7508         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7509         xxx=apollo
7510         libc='/lib/clib /lib/libc'
7511         if $test -r /lib/syslib; then
7512                 echo "(Your math library is in /lib/syslib.)"
7513                 libc="$libc /lib/syslib"
7514         fi
7515 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7516         echo "Your C library seems to be in $libc, as you said before."
7517 elif $test -r $incpath/usr/lib/libc$_a; then
7518         libc=$incpath/usr/lib/libc$_a;
7519         echo "Your C library seems to be in $libc.  That's fine."
7520 elif $test -r /lib/libc$_a; then
7521         libc=/lib/libc$_a;
7522         echo "Your C library seems to be in $libc.  You're normal."
7523 else
7524         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7525                 :
7526         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7527                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7528         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7529                 :
7530         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7531                 :
7532         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7533                 :
7534         else
7535                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7536         fi
7537         if $test -r "$tans"; then
7538                 echo "Your C library seems to be in $tans, of all places."
7539                 libc=$tans
7540         else
7541                 libc='blurfl'
7542         fi
7543 fi
7544 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7545         dflt="$libc"
7546         cat <<EOM
7547
7548 If the guess above is wrong (which it might be if you're using a strange
7549 compiler, or your machine supports multiple models), you can override it here.
7550
7551 EOM
7552 else
7553         dflt=''
7554         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7555         cat >&4 <<EOM
7556 I can't seem to find your C library.  I've looked in the following places:
7557
7558 EOM
7559         $sed 's/^/      /' libpath
7560         cat <<EOM
7561
7562 None of these seems to contain your C library. I need to get its name...
7563
7564 EOM
7565 fi
7566 fn=f
7567 rp='Where is your C library?'
7568 . ./getfile
7569 libc="$ans"
7570
7571 echo " "
7572 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7573 set X `cat libnames`
7574 shift
7575 xxx=files
7576 case $# in 1) xxx=file; esac
7577 echo "Extracting names from the following $xxx for later perusal:" >&4
7578 echo " "
7579 $sed 's/^/      /' libnames >&4
7580 echo " "
7581 $echo $n "This may take a while...$c" >&4
7582
7583 for file in $*; do
7584         case $file in
7585         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7586         *) $nm $nm_opt $file 2>/dev/null;;
7587         esac
7588 done >libc.tmp
7589
7590 $echo $n ".$c"
7591 $grep fprintf libc.tmp > libc.ptf
7592 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7593 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7594 xxx='[ADTSIW]'
7595 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7596         eval $xscan;\
7597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7598                 eval $xrun
7599 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7620                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 else
7653         $nm -p $* 2>/dev/null >libc.tmp
7654         $grep fprintf libc.tmp > libc.ptf
7655         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7656                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7657         then
7658                 nm_opt='-p'
7659                 eval $xrun
7660         else
7661                 echo " "
7662                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7663                 com=''
7664                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7665                         for thisname in $libnames $libc; do
7666                                 $ar t $thisname >>libc.tmp
7667                         done
7668                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7669                         echo "Ok." >&4
7670                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7671                         # Repeat libc to extract forwarders to DLL entries too
7672                         for thisname in $libnames $libc; do
7673                                 $ar tv $thisname >>libc.tmp
7674                                 # Revision 50 of EMX has bug in $ar.
7675                                 # it will not extract forwarders to DLL entries
7676                                 # Use emximp which will extract exactly them.
7677                                 emximp -o tmp.imp $thisname \
7678                                     2>/dev/null && \
7679                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7680                                     < tmp.imp >>libc.tmp
7681                                 $rm tmp.imp
7682                         done
7683                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7684                         echo "Ok." >&4
7685                 else
7686                         echo "$ar didn't seem to work right." >&4
7687                         echo "Maybe this is a Cray...trying bld instead..." >&4
7688                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7689                         then
7690                                 for thisname in $libnames; do
7691                                         bld t $libnames | \
7692                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7693                                         $ar t $thisname >>libc.tmp
7694                                 done
7695                                 echo "Ok." >&4
7696                         else
7697                                 echo "That didn't work either.  Giving up." >&4
7698                                 exit 1
7699                         fi
7700                 fi
7701         fi
7702 fi
7703 nm_extract="$com"
7704 case "$PASE" in
7705 define)
7706     echo " "
7707     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7708     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7709     ;;
7710 *)  if $test -f /lib/syscalls.exp; then
7711         echo " "
7712         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7713         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7714     fi
7715     ;;
7716 esac
7717 ;;
7718 esac
7719 $rm -f libnames libpath
7720
7721 : see if dld is available
7722 set dld.h i_dld
7723 eval $inhdr
7724
7725 : Check if we are using C++
7726 echo " "
7727 echo "Checking for C++..." >&4
7728 $cat >try.c <<'EOCP'
7729 #include <stdio.h>
7730 int main(void)
7731 {
7732 #ifdef __cplusplus
7733     return 0;
7734 #else
7735     return 1;
7736 #endif
7737 }
7738 EOCP
7739 set try
7740 if eval $compile_ok && $run ./try; then
7741         val="$define"
7742         echo "You are using a C++ compiler."
7743 else
7744         val="$undef"
7745         echo "You are not using a C++ compiler."
7746 fi
7747 $rm_try cplusplus$$
7748 set d_cplusplus
7749 eval $setvar
7750
7751 : is a C symbol defined?
7752 csym='tlook=$1;
7753 case "$3" in
7754 -v) tf=libc.tmp; tdc="";;
7755 -a) tf=libc.tmp; tdc="[]";;
7756 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7757 esac;
7758 tx=yes;
7759 case "$reuseval-$4" in
7760 true-) ;;
7761 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7762 esac;
7763 case "$tx" in
7764 yes)
7765         tval=false;
7766         case "$d_cplusplus" in
7767                 $define) extern_C=\"C\";;
7768         esac;
7769         if $test "$runnm" = true; then
7770                 if $contains $tlook $tf >/dev/null 2>&1; then
7771                         tval=true;
7772                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7773                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7774                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7775                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7776                         $rm_try;
7777                 fi;
7778         else
7779                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7780                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7781                 $rm_try;
7782         fi;
7783         ;;
7784 *)
7785         case "$tval" in
7786         $define) tval=true;;
7787         *) tval=false;;
7788         esac;
7789         ;;
7790 esac;
7791 eval "$2=$tval"'
7792
7793 : define an is-in-libc? function
7794 inlibc='echo " "; td=$define; tu=$undef;
7795 sym=$1; var=$2; eval "was=\$$2";
7796 tx=yes;
7797 case "$reuseval$was" in
7798 true) ;;
7799 true*) tx=no;;
7800 esac;
7801 case "$tx" in
7802 yes)
7803         set $sym tres -f;
7804         eval $csym;
7805         case "$tres" in
7806         true)
7807                 echo "$sym() found." >&4;
7808                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7809         *)
7810                 echo "$sym() NOT found." >&4;
7811                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7812         esac;;
7813 *)
7814         case "$was" in
7815         $define) echo "$sym() found." >&4;;
7816         *) echo "$sym() NOT found." >&4;;
7817         esac;;
7818 esac'
7819
7820 : see if dlopen exists
7821 xxx_runnm="$runnm"
7822 xxx_ccflags="$ccflags"
7823 runnm=false
7824 : with g++ one needs -shared to get is-in-libc to work for dlopen
7825 case "$gccversion" in
7826 '')     ;;
7827 *)      case "$d_cplusplus" in
7828         "$define") ccflags="$ccflags -shared" ;;
7829         esac
7830         ;;
7831 esac
7832 set dlopen d_dlopen
7833 eval $inlibc
7834 runnm="$xxx_runnm"
7835 ccflags="$xxx_ccflags"
7836
7837 : see if this is a unistd.h system
7838 set unistd.h i_unistd
7839 eval $inhdr
7840
7841 : determine which dynamic loading, if any, to compile in
7842 echo " "
7843 dldir="ext/DynaLoader"
7844 case "$usedl" in
7845 $define|y|true)
7846         dflt='y'
7847         usedl="$define"
7848         ;;
7849 $undef|n|false)
7850         dflt='n'
7851         usedl="$undef"
7852         ;;
7853 *)
7854         dflt='n'
7855         case "$d_dlopen" in
7856             $define) dflt='y' ;;
7857         esac
7858         case "$i_dld" in
7859             $define) dflt='y' ;;
7860         esac
7861         : Does a dl_xxx.xs file exist for this operating system
7862         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7863         ;;
7864 esac
7865 rp="Do you wish to use dynamic loading?"
7866 . ./myread
7867 usedl="$ans"
7868 case "$ans" in
7869 y*) usedl="$define"
7870         case "$dlsrc" in
7871         '')
7872                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7873                         dflt="$dldir/dl_${osname}.xs"
7874                 elif $test "$d_dlopen" = "$define" ; then
7875                         dflt="$dldir/dl_dlopen.xs"
7876                 elif $test "$i_dld" = "$define" ; then
7877                         dflt="$dldir/dl_dld.xs"
7878                 else
7879                         dflt=''
7880                 fi
7881                 ;;
7882         *)      dflt="$dldir/$dlsrc"
7883                 ;;
7884         esac
7885     echo "The following dynamic loading files are available:"
7886         : Can not go over to $dldir because getfile has path hard-coded in.
7887         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7888         rp="Source file to use for dynamic loading"
7889         fn="fne"
7890         gfpth="$src"
7891         . ./getfile
7892         usedl="$define"
7893         : emulate basename
7894         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7895
7896         $cat << EOM
7897
7898 Some systems may require passing special flags to $cc -c to
7899 compile modules that will be used to create a shared library.
7900 To use no flags, say "none".
7901
7902 EOM
7903     case "$cccdlflags" in
7904     '') case "$gccversion" in
7905                 '') case "$osname" in
7906                         hpux)   dflt='+z' ;;
7907                         next)   dflt='none' ;;
7908                         irix*)  dflt='-KPIC' ;;
7909                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7910                         sunos)  dflt='-pic' ;;
7911                         *)      dflt='none' ;;
7912                     esac
7913                         ;;
7914                 *)  case "$osname" in
7915                         darwin) dflt='none' ;;
7916                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7917                         *)      dflt='-fpic' ;;
7918                     esac ;;
7919             esac ;;
7920         ' ') dflt='none' ;;
7921     *)  dflt="$cccdlflags" ;;
7922     esac
7923     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7924     . ./myread
7925     case "$ans" in
7926     none) cccdlflags=' ' ;;
7927     *) cccdlflags="$ans" ;;
7928     esac
7929
7930     cat << EOM
7931
7932 Some systems use ld to create libraries that can be dynamically loaded,
7933 while other systems (such as those using ELF) use $cc.
7934
7935 EOM
7936         case "$ld" in
7937         '')     $cat >try.c <<EOM
7938 /* Test for whether ELF binaries are produced */
7939 #include <fcntl.h>
7940 #$i_stdlib I_STDLIB
7941 #ifdef I_STDLIB
7942 #include <stdlib.h>
7943 #endif
7944 #$i_unistd I_UNISTD
7945 #ifdef I_UNISTD
7946 #include <unistd.h>
7947 #endif
7948 int main() {
7949         char b[4];
7950         int i = open("a.out",O_RDONLY);
7951         if(i == -1)
7952                 exit(1); /* fail */
7953         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7954                 exit(0); /* succeed (yes, it's ELF) */
7955         else
7956                 exit(1); /* fail */
7957 }
7958 EOM
7959                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7960                         cat <<EOM
7961 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7962 EOM
7963                         dflt="$cc"
7964                 else
7965                         echo "I'll use ld to build dynamic libraries."
7966                         dflt='ld'
7967                 fi
7968                 $rm_try
7969                 ;;
7970         *)      dflt="$ld"
7971                 ;;
7972         esac
7973
7974     rp="What command should be used to create dynamic libraries?"
7975     . ./myread
7976         ld="$ans"
7977
7978     cat << EOM
7979
7980 Some systems may require passing special flags to $ld to create a
7981 library that can be dynamically loaded.  If your ld flags include
7982 -L/other/path options to locate libraries outside your loader's normal
7983 search path, you may need to specify those -L options here as well.  To
7984 use no flags, say "none".
7985
7986 EOM
7987     case "$lddlflags" in
7988     '') case "$osname" in
7989                         beos) dflt='-nostart' ;;
7990                         hpux) dflt='-b';
7991                               case "$gccversion" in
7992                               '') dflt="$dflt +vnocompatwarnings" ;;
7993                               esac
7994                               ;;
7995                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7996                         next)  dflt='none' ;;
7997                         solaris) dflt='-G' ;;
7998                         sunos) dflt='-assert nodefinitions' ;;
7999                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8000                 *)     dflt='none' ;;
8001                         esac
8002                         ;;
8003     *) dflt="$lddlflags" ;;
8004     esac
8005
8006         : Try to guess additional flags to pick up local libraries.
8007         : Be careful not to append to a plain 'none'
8008         case "$dflt" in
8009         none) dflt='' ;;
8010         esac
8011         for thisflag in $ldflags; do
8012                 case "$thisflag" in
8013                 -L*|-R*|-Wl,-R*)
8014                         case " $dflt " in
8015                         *" $thisflag "*) ;;
8016                         *) dflt="$dflt $thisflag" ;;
8017                         esac
8018                         ;;
8019                 esac
8020         done
8021
8022         case "$dflt" in
8023         ''|' ') dflt='none' ;;
8024         esac
8025
8026     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8027     . ./myread
8028     case "$ans" in
8029     none) lddlflags=' ' ;;
8030     *) lddlflags="$ans" ;;
8031     esac
8032
8033         cat <<EOM
8034
8035 Some systems may require passing special flags to $cc to indicate that
8036 the resulting executable will use dynamic linking.  To use no flags,
8037 say "none".
8038
8039 EOM
8040     case "$ccdlflags" in
8041     '') case "$osname" in
8042             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8043             next|sunos) dflt='none' ;;
8044             *)          dflt='none' ;;
8045             esac ;;
8046     ' ')  dflt='none' ;;
8047     *)  dflt="$ccdlflags" ;;
8048     esac
8049     rp="Any special flags to pass to $cc to use dynamic linking?"
8050     . ./myread
8051     case "$ans" in
8052     none) ccdlflags=' ' ;;
8053     *) ccdlflags="$ans" ;;
8054     esac
8055     ;;
8056 *)  usedl="$undef"
8057         ld='ld'
8058     dlsrc='dl_none.xs'
8059     lddlflags=''
8060     ccdlflags=''
8061     ;;
8062 esac
8063
8064 : Do we want a shared libperl?
8065 also=''
8066 case "$usedl" in
8067 $undef)
8068         # No dynamic loading being used, so don't bother even to prompt.
8069         useshrplib='false'
8070         ;;
8071 *)      case "$useshrplib" in
8072         '')     case "$osname" in
8073                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8074                         dflt=y
8075                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8076                         ;;
8077                 next*)
8078                         case "$osvers" in
8079                         4*)     dflt=y
8080                                 also='Building a shared libperl is needed for MAB support.'
8081                                 ;;
8082                         *)      dflt=n
8083                                 ;;
8084                         esac
8085                         ;;
8086                 *)      dflt=n
8087                         ;;
8088                 esac
8089                 ;;
8090         $define|true|[Yy]*)
8091                 dflt=y
8092                 ;;
8093         *)      dflt=n
8094                 ;;
8095         esac
8096         $cat << EOM
8097
8098 The perl executable is normally obtained by linking perlmain.c with
8099 libperl${_a}, any static extensions (usually just DynaLoader), and
8100 any other libraries needed on this system (such as -lm, etc.).  Since
8101 your system supports dynamic loading, it is probably possible to build
8102 a shared libperl.$so.  If you will have more than one executable linked
8103 to libperl.$so, this will significantly reduce the size of each
8104 executable, but it may have a noticeable effect on performance.  The
8105 default is probably sensible for your system.
8106 $also
8107
8108 EOM
8109         rp="Build a shared libperl.$so (y/n)"
8110         . ./myread
8111         case "$ans" in
8112         true|$define|[Yy]*)
8113                 useshrplib='true'  ;;
8114         *)      useshrplib='false' ;;
8115         esac
8116         ;;
8117 esac
8118
8119 case "$useshrplib" in
8120 true)
8121         case "$libperl" in
8122         '')
8123                 # Figure out a good name for libperl.so.  Since it gets stored in
8124                 # a version-specific architecture-dependent library, the version
8125                 # number isn't really that important, except for making cc/ld happy.
8126                 #
8127                 # A name such as libperl.so.3.1
8128                 majmin="libperl.$so.$patchlevel.$subversion"
8129                 # A name such as libperl.so.301
8130                 majonly=`echo $patchlevel $subversion |
8131                         $awk '{printf "%d%02d", $1, $2}'`
8132                 majonly=libperl.$so.$majonly
8133                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8134                 # rely on figuring it out from the naming of libc.
8135                 case "${osname}${osvers}" in
8136                 next4*)
8137                         dflt=libperl.5.$so
8138                         # XXX How handle the --version stuff for MAB?
8139                         ;;
8140                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8141                         dflt=libperl.$so
8142                         ;;
8143                 cygwin*) # ld links against an importlib
8144                         dflt=libperl$lib_ext
8145                         ;;
8146                 *)      # Try to guess based on whether libc has major.minor.
8147                         case "$libc" in
8148                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8149                         *libc.$so.[0-9]*) dflt=$majonly ;;
8150                         *)      dflt=libperl.$so ;;
8151                         esac
8152                         ;;
8153                 esac
8154                 ;;
8155         *)      dflt=$libperl
8156                 ;;
8157         esac
8158         cat << EOM
8159
8160 I need to select a good name for the shared libperl.  If your system uses
8161 library names with major and minor numbers, then you might want something
8162 like $majmin.  Alternatively, if your system uses a single version
8163 number for shared libraries, then you might want to use $majonly.
8164 Or, your system might be quite happy with a simple libperl.$so.
8165
8166 Since the shared libperl will get installed into a version-specific
8167 architecture-dependent directory, the version number of the shared perl
8168 library probably isn't important, so the default should be o.k.
8169
8170 EOM
8171         rp='What name do you want to give to the shared libperl?'
8172         . ./myread
8173         libperl=$ans
8174         echo "Ok, I'll use $libperl"
8175         ;;
8176 *)
8177         libperl="libperl${_a}"
8178         ;;
8179 esac
8180
8181 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8182 case "$shrpdir" in
8183 '') ;;
8184 *)      $cat >&4 <<EOM
8185 WARNING:  Use of the shrpdir variable for the installation location of
8186 the shared $libperl is not supported.  It was never documented and
8187 will not work in this version.  Let me (perlbug@perl.org)
8188 know of any problems this may cause.
8189
8190 EOM
8191         case "$shrpdir" in
8192         "$archlibexp/CORE")
8193                 $cat >&4 <<EOM
8194 But your current setting of $shrpdir is
8195 the default anyway, so it's harmless.
8196 EOM
8197                 ;;
8198         *)
8199                 $cat >&4 <<EOM
8200 Further, your current attempted setting of $shrpdir
8201 conflicts with the value of $archlibexp/CORE
8202 that installperl will use.
8203 EOM
8204                 ;;
8205         esac
8206         ;;
8207 esac
8208
8209 # How will the perl executable find the installed shared $libperl?
8210 # Add $xxx to ccdlflags.
8211 # If we can't figure out a command-line option, use $shrpenv to
8212 # set env LD_RUN_PATH.  The main perl makefile uses this.
8213 shrpdir=$archlibexp/CORE
8214 xxx=''
8215 tmp_shrpenv=''
8216 if "$useshrplib"; then
8217     case "$osname" in
8218         aix)
8219                 # We'll set it in Makefile.SH...
8220                 ;;
8221         solaris)
8222                 xxx="-R $shrpdir"
8223                 ;;
8224         freebsd|netbsd|openbsd|interix|dragonfly)
8225                 xxx="-Wl,-R$shrpdir"
8226                 ;;
8227         bsdos|linux|irix*|dec_osf|gnu*)
8228                 xxx="-Wl,-rpath,$shrpdir"
8229                 ;;
8230         next)
8231                 # next doesn't like the default...
8232                 ;;
8233         beos)
8234                 # beos doesn't like the default, either.
8235                 ;;
8236         hpux*)
8237                 # hpux doesn't like the default, either.
8238                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8239                 ;;
8240         *)
8241                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8242                 ;;
8243         esac
8244         case "$xxx" in
8245         '') ;;
8246         *)
8247                 # Only add $xxx if it isn't already in ccdlflags.
8248                 case " $ccdlflags " in
8249                 *" $xxx "*)     ;;
8250                 *)      ccdlflags="$ccdlflags $xxx"
8251                         cat <<EOM >&4
8252
8253 Adding $xxx to the flags
8254 passed to $ld so that the perl executable will find the
8255 installed shared $libperl.
8256
8257 EOM
8258                         ;;
8259                 esac
8260                 ;;
8261         esac
8262 fi
8263 # Fix ccdlflags in AIX for building external extensions.
8264 # (For building Perl itself bare -bE:perl.exp is needed,
8265 #  Makefile.SH takes care of this.)
8266 case "$osname" in
8267 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8268 esac
8269 # Respect a hint or command-line value.
8270 case "$shrpenv" in
8271 '') shrpenv="$tmp_shrpenv" ;;
8272 esac
8273 case "$ldlibpthname" in
8274 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8275 none)   ldlibpthname='' ;;
8276 esac
8277
8278 : determine where manual pages are on this system
8279 echo " "
8280 case "$sysman" in
8281 '') 
8282         syspath='/usr/share/man/man1 /usr/man/man1'
8283         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8284         syspath="$syspath /usr/man/u_man/man1"
8285         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8286         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8287         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8288         sysman=`./loc . /usr/man/man1 $syspath`
8289         ;;
8290 esac
8291 if $test -d "$sysman"; then
8292         echo "System manual is in $sysman." >&4
8293 else
8294         echo "Could not find manual pages in source form." >&4
8295 fi
8296
8297 : determine where manual pages go
8298 set man1dir man1dir none
8299 eval $prefixit
8300 $cat <<EOM
8301
8302 $spackage has manual pages available in source form.
8303 EOM
8304 case "$nroff" in
8305 nroff)
8306         echo "However, you don't have nroff, so they're probably useless to you."
8307         case "$man1dir" in
8308         '') man1dir="none";;
8309         esac;;
8310 esac
8311 echo "If you don't want the manual sources installed, answer 'none'."
8312 case "$man1dir" in
8313 ' ') dflt=none
8314         ;;
8315 '')
8316         lookpath="$prefixexp/share/man/man1"
8317         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8318         lookpath="$lookpath $prefixexp/man/p_man/man1"
8319         lookpath="$lookpath $prefixexp/man/u_man/man1"
8320         lookpath="$lookpath $prefixexp/man/man.1"
8321         case "$sysman" in
8322         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8323         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8324         esac
8325         set dflt
8326         eval $prefixup
8327         ;;
8328 *)  dflt="$man1dir"
8329         ;;
8330 esac
8331 echo " "
8332 fn=dn+~
8333 rp="Where do the main $spackage manual pages (source) go?"
8334 . ./getfile
8335 if $test "X$man1direxp" != "X$ansexp"; then
8336         installman1dir=''
8337 fi
8338 prefixvar=man1dir
8339 . ./setprefixvar
8340
8341 case "$man1dir" in
8342 '')     man1dir=' '
8343         installman1dir='';;
8344 esac
8345
8346 : What suffix to use on installed man pages
8347
8348 case "$man1dir" in
8349 ' ')
8350         man1ext='0'
8351         ;;
8352 *)
8353         rp="What suffix should be used for the main $spackage man pages?"
8354         case "$man1ext" in
8355         '')     case "$man1dir" in
8356                 *1)  dflt=1 ;;
8357                 *1p) dflt=1p ;;
8358                 *1pm) dflt=1pm ;;
8359                 *l) dflt=l;;
8360                 *n) dflt=n;;
8361                 *o) dflt=o;;
8362                 *p) dflt=p;;
8363                 *C) dflt=C;;
8364                 *L) dflt=L;;
8365                 *L1) dflt=L1;;
8366                 *) dflt=1;;
8367                 esac
8368                 ;;
8369         *)      dflt="$man1ext";;
8370         esac
8371         . ./myread
8372         man1ext="$ans"
8373         ;;
8374 esac
8375
8376 : see if we can have long filenames
8377 echo " "
8378 first=123456789abcdef
8379 $rm -f $first
8380 if (echo hi >$first) 2>/dev/null; then
8381         if $test -f 123456789abcde; then
8382                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8383                 val="$undef"
8384         else
8385                 echo 'You can have filenames longer than 14 characters.'>&4
8386                 val="$define"
8387         fi
8388 else
8389         $cat <<'EOM'
8390 You can't have filenames longer than 14 chars.
8391 You can't even think about them!
8392 EOM
8393         val="$undef"
8394 fi
8395 set d_flexfnam
8396 eval $setvar
8397 $rm -rf 123456789abcde*
8398
8399 : determine where library module manual pages go
8400 set man3dir man3dir none
8401 eval $prefixit
8402 $cat <<EOM
8403
8404 $spackage has manual pages for many of the library modules.
8405 EOM
8406
8407 case "$nroff" in
8408 nroff)
8409         $cat <<'EOM'
8410 However, you don't have nroff, so they're probably useless to you.
8411 EOM
8412         case "$man3dir" in
8413         '') man3dir="none";;
8414         esac;;
8415 esac
8416
8417 case "$d_flexfnam" in
8418 undef)
8419         $cat <<'EOM'
8420 However, your system can't handle the long file names like File::Basename.3.
8421 EOM
8422         case "$man3dir" in
8423         '') man3dir="none";;
8424         esac;;
8425 esac
8426
8427 echo "If you don't want the manual sources installed, answer 'none'."
8428 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8429 case "$man3dir" in
8430 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8431         if $test -d "$privlib/man/man3"; then
8432                 cat <<EOM >&4
8433
8434 WARNING:  Previous versions of perl installed man3 pages into
8435 $privlib/man/man3.  This version will suggest a
8436 new default of $dflt.
8437 EOM
8438                 tdflt=$dflt
8439                 dflt='n'
8440                 rp='Do you wish to preserve the old behavior?(y/n)'
8441                 . ./myread
8442                 case "$ans" in
8443                 y*) dflt="$privlib/man/man3" ;;
8444                 *)  dflt=$tdflt ;;
8445                 esac
8446     fi
8447         ;;
8448 *)      dflt="$man3dir" ;;
8449 esac
8450 case "$dflt" in
8451 ' ') dflt=none ;;
8452 esac
8453 echo " "
8454 fn=dn+~
8455 rp="Where do the $package library man pages (source) go?"
8456 . ./getfile
8457 prefixvar=man3dir
8458 . ./setprefixvar
8459
8460 case "$man3dir" in
8461 '')     man3dir=' '
8462         installman3dir='';;
8463 esac
8464
8465 : What suffix to use on installed man pages
8466 case "$man3dir" in
8467 ' ')
8468         man3ext='0'
8469         ;;
8470 *)
8471         rp="What suffix should be used for the $package library man pages?"
8472         case "$man3ext" in
8473         '')     case "$man3dir" in
8474                 *3)  dflt=3 ;;
8475                 *3p) dflt=3p ;;
8476                 *3pm) dflt=3pm ;;
8477                 *l) dflt=l;;
8478                 *n) dflt=n;;
8479                 *o) dflt=o;;
8480                 *p) dflt=p;;
8481                 *C) dflt=C;;
8482                 *L) dflt=L;;
8483                 *L3) dflt=L3;;
8484                 *) dflt=3;;
8485                 esac
8486                 ;;
8487         *)      dflt="$man3ext";;
8488         esac
8489         . ./myread
8490         man3ext="$ans"
8491         ;;
8492 esac
8493
8494 : see if we have to deal with yellow pages, now NIS.
8495 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8496         if $test -f /usr/etc/nibindd; then
8497                 echo " "
8498                 echo "I'm fairly confident you're on a NeXT."
8499                 echo " "
8500                 rp='Do you get the hosts file via NetInfo?'
8501                 dflt=y
8502                 case "$hostcat" in
8503                 nidump*) ;;
8504                 '') ;;
8505                 *) dflt=n;;
8506                 esac
8507                 . ./myread
8508                 case "$ans" in
8509                 y*) hostcat='nidump hosts .';;
8510                 *)      case "$hostcat" in
8511                         nidump*) hostcat='';;
8512                         esac
8513                         ;;
8514                 esac
8515         fi
8516         case "$hostcat" in
8517         nidump*) ;;
8518         *)
8519                 case "$hostcat" in
8520                 *ypcat*) dflt=y;;
8521                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8522                                 dflt=y
8523                         else
8524                                 dflt=n
8525                         fi;;
8526                 *) dflt=n;;
8527                 esac
8528                 echo " "
8529                 rp='Are you getting the hosts file via yellow pages?'
8530                 . ./myread
8531                 case "$ans" in
8532                 y*) hostcat='ypcat hosts';;
8533                 *) hostcat='cat /etc/hosts';;
8534                 esac
8535                 ;;
8536         esac
8537 fi
8538 case "$hostcat" in
8539 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8540 esac
8541 case "$groupcat" in
8542 '') test -f /etc/group && groupcat='cat /etc/group';;
8543 esac
8544 case "$passcat" in
8545 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8546 esac
8547
8548 : now get the host name
8549 echo " "
8550 echo "Figuring out host name..." >&4
8551 case "$myhostname" in
8552 '') cont=true
8553         echo 'Maybe "hostname" will work...'
8554         if tans=`sh -c hostname 2>&1` ; then
8555                 myhostname=$tans
8556                 phostname=hostname
8557                 cont=''
8558         fi
8559         ;;
8560 *) cont='';;
8561 esac
8562 if $test "$cont"; then
8563         if ./xenix; then
8564                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8565                 if tans=`cat /etc/systemid 2>&1` ; then
8566                         myhostname=$tans
8567                         phostname='cat /etc/systemid'
8568                         echo "Whadyaknow.  Xenix always was a bit strange..."
8569                         cont=''
8570                 fi
8571         elif $test -r /etc/systemid; then
8572                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8573         fi
8574 fi
8575 if $test "$cont"; then
8576         echo 'No, maybe "uuname -l" will work...'
8577         if tans=`sh -c 'uuname -l' 2>&1` ; then
8578                 myhostname=$tans
8579                 phostname='uuname -l'
8580         else
8581                 echo 'Strange.  Maybe "uname -n" will work...'
8582                 if tans=`sh -c 'uname -n' 2>&1` ; then
8583                         myhostname=$tans
8584                         phostname='uname -n'
8585                 else
8586                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8587                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8588                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8589                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8590                         else
8591                                 case "$myhostname" in
8592                                 '') echo "Does this machine have an identity crisis or something?"
8593                                         phostname='';;
8594                                 *)
8595                                         echo "Well, you said $myhostname before..."
8596                                         phostname='echo $myhostname';;
8597                                 esac
8598                         fi
8599                 fi
8600         fi
8601 fi
8602 case "$myhostname" in
8603 '') myhostname=noname ;;
8604 esac
8605 : you do not want to know about this
8606 set $myhostname
8607 myhostname=$1
8608
8609 : verify guess
8610 if $test "$myhostname" ; then
8611         dflt=y
8612         rp='Your host name appears to be "'$myhostname'".'" Right?"
8613         . ./myread
8614         case "$ans" in
8615         y*) ;;
8616         *) myhostname='';;
8617         esac
8618 fi
8619
8620 : bad guess or no guess
8621 while $test "X$myhostname" = X ; do
8622         dflt=''
8623         rp="Please type the (one word) name of your host:"
8624         . ./myread
8625         myhostname="$ans"
8626 done
8627
8628 : translate upper to lower if necessary
8629 case "$myhostname" in
8630 *[A-Z]*)
8631         echo "(Normalizing case in your host name)"
8632         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8633         ;;
8634 esac
8635
8636 case "$myhostname" in
8637 *.*)
8638         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8639         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8640         echo "(Trimming domain name from host name--host name is now $myhostname)"
8641         ;;
8642 *) case "$mydomain" in
8643         '')
8644                 {
8645                         test "X$hostcat" = "Xypcat hosts" &&
8646                         ypmatch "$myhostname" hosts 2>/dev/null |\
8647                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8648                         $test -s hosts
8649                 } || {
8650                         test "X$hostcat" != "X" &&
8651                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8652                                         /[       ]$myhostname[  . ]/p" > hosts
8653                 }
8654                 tmp_re="[       . ]"
8655                 if $test -f hosts; then
8656                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8657                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8658                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8659                                 hosts | $sort | $uniq | \
8660                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8661                         case `$echo X$dflt` in
8662                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8663                                 dflt=.
8664                                 ;;
8665                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8666                                 ;;
8667                         esac
8668                 else
8669                         echo "(I cannot locate a hosts database anywhere)"
8670                         dflt=.
8671                 fi
8672                 case "$dflt" in
8673                 .)
8674                         tans=`./loc resolv.conf X /etc /usr/etc`
8675                         if $test -f "$tans"; then
8676                                 echo "(Attempting domain name extraction from $tans)"
8677                                 dflt=.`$sed -n -e 's/   / /g' \
8678                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8679                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8680                                 case "$dflt" in
8681                                 .) dflt=.`$sed -n -e 's/        / /g' \
8682                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8683                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8684                                         ;;
8685                                 esac
8686                         fi
8687                         ;;
8688                 esac
8689                 case "$dflt" in
8690                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8691                         dflt=.`sh -c domainname 2>/dev/null`
8692                         case "$dflt" in
8693                         '') dflt='.';;
8694                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8695                         esac
8696                         ;;
8697                 esac
8698                 case "$dflt$osname" in
8699                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8700                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8701                         ;;
8702                 esac
8703                 case "$dflt" in
8704                 .) echo "(Lost all hope -- silly guess then)"
8705                         dflt='.nonet'
8706                         ;;
8707                 esac
8708                 $rm -f hosts
8709                 ;;
8710         *) dflt="$mydomain";;
8711         esac;;
8712 esac
8713 echo " "
8714 rp="What is your domain name?"
8715 . ./myread
8716 tans="$ans"
8717 case "$ans" in
8718 '') ;;
8719 .*) ;;
8720 *) tans=".$tans";;
8721 esac
8722 mydomain="$tans"
8723
8724 : translate upper to lower if necessary
8725 case "$mydomain" in
8726 *[A-Z]*)
8727         echo "(Normalizing case in your domain name)"
8728         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8729         ;;
8730 esac
8731
8732 : a little sanity check here
8733 case "$phostname" in
8734 '') ;;
8735 *)
8736         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8737         $myhostname$mydomain|$myhostname) ;;
8738         *)
8739                 case "$phostname" in
8740                 sed*)
8741                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8742                         ;;
8743                 *)
8744                         echo "(That doesn't agree with your $phostname command, by the way.)"
8745                         ;;
8746                 esac
8747         ;;
8748         esac
8749         ;;
8750 esac
8751
8752 : determine the e-mail address of the user who is running us
8753 $cat <<EOM
8754
8755 I need to get your e-mail address in Internet format if possible, i.e.
8756 something like user@host.domain. Please answer accurately since I have
8757 no easy means to double check it. The default value provided below
8758 is most probably close to reality but may not be valid from outside
8759 your organization...
8760
8761 EOM
8762 cont=x
8763 while test "$cont"; do
8764         case "$cf_email" in
8765         '') dflt="$cf_by@$myhostname$mydomain";;
8766         *) dflt="$cf_email";;
8767         esac
8768         rp='What is your e-mail address?'
8769         . ./myread
8770         cf_email="$ans"
8771         case "$cf_email" in
8772         *@*.*) cont='' ;;
8773         *)
8774                 rp='Address does not look like an Internet one.  Use it anyway?'
8775                 case "$fastread" in
8776                 yes) dflt=y ;;
8777                 *) dflt=n ;;
8778                 esac
8779                 . ./myread
8780                 case "$ans" in
8781                 y*) cont='' ;;
8782                 *) echo " " ;;
8783                 esac
8784                 ;;
8785         esac
8786 done
8787
8788 : Ask e-mail of administrator
8789 $cat <<EOM
8790
8791 If you or somebody else will be maintaining perl at your site, please
8792 fill in the correct e-mail address here so that they may be contacted
8793 if necessary. Currently, the "perlbug" program included with perl
8794 will send mail to this address in addition to perlbug@perl.org. You may
8795 enter "none" for no administrator.
8796
8797 EOM
8798 case "$perladmin" in
8799 '') dflt="$cf_email";;
8800 *) dflt="$perladmin";;
8801 esac
8802 rp='Perl administrator e-mail address'
8803 . ./myread
8804 perladmin="$ans"
8805
8806 : determine whether to only install version-specific parts.
8807 echo " "
8808 $cat <<EOM
8809 Do you want to install only the version-specific parts of the perl
8810 distribution?  Usually you do *not* want to do this.
8811 EOM
8812 case "$versiononly" in
8813 "$define"|[Yy]*|true) dflt='y' ;;
8814 *) dflt='n';
8815 esac
8816 rp="Do you want to install only the version-specific parts of perl?"
8817 . ./myread
8818 case "$ans" in
8819 [yY]*)  val="$define";;
8820 *)      val="$undef" ;;
8821 esac
8822 set versiononly
8823 eval $setvar
8824
8825 case "$versiononly" in
8826 "$define") inc_version_list=''
8827            inc_version_list_init=0
8828            ;;
8829 esac
8830
8831 : figure out how to guarantee perl startup
8832 : XXX Note that this currently takes advantage of the bug that binexp ignores
8833 :     the Configure -Dinstallprefix setting, which in turn means that under
8834 :     relocatable @INC, initialinstalllocation is what binexp started as.
8835 case "$startperl" in
8836 '')
8837         case "$sharpbang" in
8838         *!)
8839                 $cat <<EOH
8840
8841 I can use the #! construct to start perl on your system. This will
8842 make startup of perl scripts faster, but may cause problems if you
8843 want to share those scripts and perl is not in a standard place
8844 ($initialinstalllocation/perl) on all your platforms. The alternative
8845 is to force a shell by starting the script with a single ':' character.
8846
8847 EOH
8848                 case "$versiononly" in
8849                 "$define")      dflt="$initialinstalllocation/perl$version";;
8850                 *)              dflt="$initialinstalllocation/perl";;
8851                 esac
8852                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8853                 . ./myread
8854                 case "$ans" in
8855                 none)   startperl=": # use perl";;
8856                 *)      startperl="#!$ans"
8857                         if $test 30 -lt `echo "$ans" | wc -c`; then
8858                                 $cat >&4 <<EOM
8859
8860 WARNING:  Some systems limit the #! command to 32 characters.
8861 If you experience difficulty running Perl scripts with #!, try
8862 installing Perl in a directory with a shorter pathname.
8863
8864 EOM
8865                         fi ;;
8866                 esac
8867                 ;;
8868         *) startperl=": # use perl"
8869                 ;;
8870         esac
8871         ;;
8872 esac
8873 echo "I'll use $startperl to start perl scripts."
8874
8875 : figure best path for perl in scripts
8876 case "$perlpath" in
8877 '')
8878         case "$versiononly" in
8879         "$define")      perlpath="$initialinstalllocation/perl$version";;
8880         *)              perlpath="$initialinstalllocation/perl";;
8881         esac
8882         case "$startperl" in
8883         *!*) ;;
8884         *)
8885                 $cat <<EOH
8886
8887 I will use the "eval 'exec'" idiom to start Perl on your system.
8888 I can use the full path of your Perl binary for this purpose, but
8889 doing so may cause problems if you want to share those scripts and
8890 Perl is not always in a standard place ($initialinstalllocation/perl).
8891
8892 EOH
8893                 dflt="$initialinstalllocation/perl"
8894                 rp="What path shall I use in \"eval 'exec'\"?"
8895                 . ./myread
8896                 perlpath="$ans"
8897                 ;;
8898         esac
8899         ;;
8900 esac
8901 case "$startperl" in
8902 *!*)    ;;
8903 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8904 esac
8905
8906 : determine where public executable scripts go
8907 set scriptdir scriptdir
8908 eval $prefixit
8909 case "$scriptdir" in
8910 '')
8911         dflt="$bin"
8912         : guess some guesses
8913         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8914         $test -d /usr/share/bin     && dflt=/usr/share/bin
8915         $test -d /usr/local/script  && dflt=/usr/local/script
8916         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8917         $test -d $prefixexp/script  && dflt=$prefixexp/script
8918         set dflt
8919         eval $prefixup
8920         ;;
8921 *)  dflt="$scriptdir"
8922         ;;
8923 esac
8924 $cat <<EOM
8925
8926 Some installations have a separate directory just for executable scripts so
8927 that they can mount it across multiple architectures but keep the scripts in
8928 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8929 Or you might just lump your scripts in with all your other executables.
8930
8931 EOM
8932 fn=d~
8933 rp='Where do you keep publicly executable scripts?'
8934 . ./getfile
8935 if $test "X$ansexp" != "X$scriptdirexp"; then
8936         installscript=''
8937 fi
8938 installscriptdir=''
8939 prefixvar=scriptdir
8940 . ./setprefixvar
8941 : A little fix up for an irregularly named variable.
8942 installscript="$installscriptdir"
8943
8944 : determine where add-on public executables go
8945 case "$sitebin" in
8946 '')     dflt=$siteprefix/bin ;;
8947 *)      dflt=$sitebin ;;
8948 esac
8949 fn=d~
8950 rp='Pathname where the add-on public executables should be installed?'
8951 . ./getfile
8952 prefixvar=sitebin
8953 . ./setprefixvar
8954
8955 : determine where add-on html pages go
8956 : There is no standard location, so try to copy the previously-selected
8957 : directory structure for the core html pages.
8958 case "$sitehtml1dir" in
8959 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8960 *)     dflt=$sitehtml1dir ;;
8961 esac
8962 case "$dflt" in
8963 ''|' ') dflt=none ;;
8964 esac
8965 fn=dn+~
8966 rp='Pathname where the site-specific html pages should be installed?'
8967 . ./getfile
8968 prefixvar=sitehtml1dir
8969 . ./setprefixvar
8970
8971 : determine where add-on library html pages go
8972 : There is no standard location, so try to copy the previously-selected
8973 : directory structure for the core html pages.
8974 case "$sitehtml3dir" in
8975 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8976 *)     dflt=$sitehtml3dir ;;
8977 esac
8978 case "$dflt" in
8979 ''|' ') dflt=none ;;
8980 esac
8981 fn=dn+~
8982 rp='Pathname where the site-specific library html pages should be installed?'
8983 . ./getfile
8984 prefixvar=sitehtml3dir
8985 . ./setprefixvar
8986
8987 : determine where add-on manual pages go
8988 case "$siteman1dir" in
8989 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8990 *)      dflt=$siteman1dir ;;
8991 esac
8992 case "$dflt" in
8993 ''|' ') dflt=none ;;
8994 esac
8995 fn=dn+~
8996 rp='Pathname where the site-specific manual pages should be installed?'
8997 . ./getfile
8998 prefixvar=siteman1dir
8999 . ./setprefixvar
9000
9001 : determine where add-on library man pages go
9002 case "$siteman3dir" in
9003 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9004 *)      dflt=$siteman3dir ;;
9005 esac
9006 case "$dflt" in
9007 ''|' ') dflt=none ;;
9008 esac
9009 fn=dn+~
9010 rp='Pathname where the site-specific library manual pages should be installed?'
9011 . ./getfile
9012 prefixvar=siteman3dir
9013 . ./setprefixvar
9014
9015 : determine where add-on public executable scripts go
9016 case "$sitescript" in
9017 '')     dflt=$siteprefix/script
9018         $test -d $dflt || dflt=$sitebin ;;
9019 *)  dflt="$sitescript" ;;
9020 esac
9021 fn=d~+
9022 rp='Pathname where add-on public executable scripts should be installed?'
9023 . ./getfile
9024 prefixvar=sitescript
9025 . ./setprefixvar
9026
9027 : Check if faststdio is requested and available
9028 case "$usefaststdio" in
9029 $define|true|[yY]*|'')
9030         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9031         case "$xversion" in
9032         [68])   dflt='y' ;;
9033         *)      dflt='n' ;;
9034         esac
9035         ;;
9036 *) dflt='n';;
9037 esac
9038 cat <<EOM
9039
9040 Perl can be built to use 'fast stdio', which means using the stdio
9041 library but also directly manipulating the stdio buffers to enable
9042 faster I/O.  Using stdio is better for backward compatibility (especially
9043 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9044 interface has been preferred instead of stdio.
9045
9046 If this doesn't make any sense to you, just accept the default '$dflt'.
9047 EOM
9048 rp='Use the "fast stdio" if available?'
9049 . ./myread
9050 case "$ans" in
9051 y|Y)    val="$define" ;;
9052 *)      val="$undef" ;;
9053 esac
9054 set usefaststdio
9055 eval $setvar
9056
9057
9058 : define an is-a-typedef? function
9059 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9060 case "$inclist" in
9061 "") inclist="sys/types.h";;
9062 esac;
9063 eval "varval=\$$var";
9064 case "$varval" in
9065 "")
9066         $rm -f temp.c;
9067         for inc in $inclist; do
9068                 echo "#include <$inc>" >>temp.c;
9069         done;
9070         echo "#ifdef $type" >> temp.c;
9071         echo "printf(\"We have $type\");" >> temp.c;
9072         echo "#endif" >> temp.c;
9073         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9074         if $contains $type temp.E >/dev/null 2>&1; then
9075                 eval "$var=\$type";
9076         else
9077                 eval "$var=\$def";
9078         fi;
9079         $rm -f temp.?;;
9080 *) eval "$var=\$varval";;
9081 esac'
9082
9083 : define an is-a-typedef? function that prompts if the type is not available.
9084 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9085 case "$inclist" in
9086 "") inclist="sys/types.h";;
9087 esac;
9088 eval "varval=\$$var";
9089 case "$varval" in
9090 "")
9091         $rm -f temp.c;
9092         for inc in $inclist; do
9093                 echo "#include <$inc>" >>temp.c;
9094         done;
9095         echo "#ifdef $type" >> temp.c;
9096         echo "printf(\"We have $type\");" >> temp.c;
9097         echo "#endif" >> temp.c;
9098         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9099         echo " " ;
9100         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9101         if $contains $type temp.E >/dev/null 2>&1; then
9102                 echo "$type found." >&4;
9103                 eval "$var=\$type";
9104         else
9105                 echo "$type NOT found." >&4;
9106                 dflt="$def";
9107                 . ./myread ;
9108                 eval "$var=\$ans";
9109         fi;
9110         $rm -f temp.?;;
9111 *) eval "$var=\$varval";;
9112 esac'
9113
9114 : see what type lseek is declared as in the kernel
9115 rp="What is the type used for lseek's offset on this system?"
9116 set off_t lseektype long stdio.h sys/types.h
9117 eval $typedef_ask
9118
9119 echo " "
9120 echo "Checking to see how big your file offsets are..." >&4
9121 $cat >try.c <<EOCP
9122 #include <sys/types.h>
9123 #include <stdio.h>
9124 int main()
9125 {
9126     printf("%d\n", (int)sizeof($lseektype));
9127     return(0);
9128 }
9129 EOCP
9130 set try
9131 if eval $compile_ok; then
9132         lseeksize=`$run ./try`
9133         echo "Your file offsets are $lseeksize bytes long."
9134 else
9135         dflt=$longsize
9136         echo " "
9137         echo "(I can't seem to compile the test program.  Guessing...)"
9138         rp="What is the size of your file offsets (in bytes)?"
9139         . ./myread
9140         lseeksize="$ans"
9141 fi
9142 $rm_try
9143
9144 : see what type file positions are declared as in the library
9145 rp="What is the type for file position used by fsetpos()?"
9146 set fpos_t fpostype long stdio.h sys/types.h
9147 eval $typedef_ask
9148
9149 : Check size for Fpos_t
9150 echo " "
9151 case "$fpostype" in
9152 *_t) zzz="$fpostype"    ;;
9153 *)   zzz="fpos_t"       ;;
9154 esac
9155 echo "Checking the size of $zzz..." >&4
9156 cat > try.c <<EOCP
9157 #include <sys/types.h>
9158 #include <stdio.h>
9159 #$i_stdlib I_STDLIB
9160 #ifdef I_STDLIB
9161 #include <stdlib.h>
9162 #endif
9163 int main() {
9164     printf("%d\n", (int)sizeof($fpostype));
9165     exit(0);
9166 }
9167 EOCP
9168 set try
9169 if eval $compile_ok; then
9170         yyy=`$run ./try`
9171         case "$yyy" in
9172         '')     fpossize=4
9173                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9174                 ;;
9175         *)      fpossize=$yyy
9176                 echo "Your $zzz is $fpossize bytes long."
9177                 ;;
9178         esac
9179 else
9180         dflt="$longsize"
9181         echo " " >&4
9182         echo "(I can't compile the test program.  Guessing...)" >&4
9183         rp="What is the size of your file positions (in bytes)?"
9184         . ./myread
9185         fpossize="$ans"
9186 fi
9187
9188 : Check for large file support
9189 # Backward compatibility (uselfs is deprecated).
9190 case "$uselfs" in
9191 "$define"|true|[yY]*)
9192         cat <<EOM >&4
9193
9194 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9195 EOM
9196         uselargefiles="$define"
9197         ;;
9198 esac
9199
9200 case "$lseeksize:$fpossize" in
9201 8:8) cat <<EOM
9202
9203 You can have files larger than 2 gigabytes.
9204 EOM
9205    val="$define" ;;
9206 *)    case "$uselargefiles" in
9207    "$undef"|false|[nN]*) dflt='n' ;;
9208    *)   dflt='y' ;;
9209    esac
9210    cat <<EOM
9211
9212 Perl can be built to understand large files (files larger than 2 gigabytes)
9213 on some systems.  To do so, Configure can be run with -Duselargefiles.
9214
9215 If this doesn't make any sense to you, just accept the default '$dflt'.
9216 EOM
9217    rp='Try to understand large files, if available?'
9218    . ./myread
9219    case "$ans" in
9220    y|Y)         val="$define" ;;
9221    *)           val="$undef"  ;;
9222    esac
9223    ;;
9224 esac
9225 set uselargefiles
9226 eval $setvar
9227 : Look for a hint-file generated 'call-back-unit'.  If the
9228 : user has specified that a large files perl is to be built,
9229 : we may need to set or change some other defaults.
9230 if $test -f uselargefiles.cbu; then
9231         echo "Your platform has some specific hints regarding large file builds, using them..."
9232         . ./uselargefiles.cbu
9233 fi
9234 case "$uselargefiles" in
9235 "$define")
9236         if $test -f uselargefiles.cbu; then
9237                 echo " "
9238                 echo "Rechecking to see how big your file offsets are..." >&4
9239                 $cat >try.c <<EOCP
9240 #include <sys/types.h>
9241 #include <stdio.h>
9242 int main()
9243 {
9244     printf("%d\n", (int)sizeof($lseektype));
9245     return(0);
9246 }
9247 EOCP
9248                 set try
9249                 if eval $compile_ok; then
9250                         lseeksize=`$run ./try`
9251                         $echo "Your file offsets are now $lseeksize bytes long."
9252                 else
9253                         dflt="$lseeksize"
9254                         echo " "
9255                         echo "(I can't seem to compile the test program.  Guessing...)"
9256                         rp="What is the size of your file offsets (in bytes)?"
9257                         . ./myread
9258                         lseeksize="$ans"
9259                 fi
9260                 case "$fpostype" in
9261                 *_t) zzz="$fpostype"    ;;
9262                 *)   zzz="fpos_t"       ;;
9263                 esac
9264                 $echo $n "Rechecking the size of $zzz...$c" >&4
9265                 $cat > try.c <<EOCP
9266 #include <sys/types.h>
9267 #include <stdio.h>
9268 #$i_stdlib I_STDLIB
9269 #ifdef I_STDLIB
9270 #include <stdlib.h>
9271 #endif
9272 int main() {
9273     printf("%d\n", (int)sizeof($fpostype));
9274     return(0);
9275 }
9276 EOCP
9277                 set try
9278                 if eval $compile_ok; then
9279                         yyy=`$run ./try`
9280                         dflt="$lseeksize"
9281                         case "$yyy" in
9282                         '')     echo " "
9283                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9284                                 ;;
9285                         *)      fpossize=$yyy
9286                                 echo " $fpossize bytes." >&4
9287                                 ;;
9288                         esac
9289                 else
9290                         dflt="$fpossize"
9291                         echo " "
9292                         echo "(I can't compile the test program.  Guessing...)" >&4
9293                         rp="What is the size of your file positions (in bytes)?"
9294                         . ./myread
9295                         fpossize="$ans"
9296                 fi
9297                 $rm_try
9298         fi
9299         ;;
9300 esac
9301
9302 : Set the vendorbin variables
9303 case "$vendorprefix" in
9304 '')     d_vendorbin="$undef"
9305         vendorbin=''
9306         vendorbinexp=''
9307         ;;
9308 *)      d_vendorbin="$define"
9309         : determine where vendor-supplied executables go.
9310         case "$vendorbin" in
9311         '') dflt=$vendorprefix/bin ;;
9312         *)      dflt="$vendorbin" ;;
9313         esac
9314         fn=d~+
9315         rp='Pathname for the vendor-supplied executables directory?'
9316         . ./getfile
9317         vendorbin="$ans"
9318         vendorbinexp="$ansexp"
9319         ;;
9320 esac
9321 prefixvar=vendorbin
9322 . ./installprefix
9323
9324 : Set the vendorhtml1dir variables
9325 case "$vendorprefix" in
9326 '')     vendorhtml1dir=''
9327         vendorhtml1direxp=''
9328         ;;
9329 *)      : determine where vendor-supplied html pages go.
9330         : There is no standard location, so try to copy the previously-selected
9331         : directory structure for the core html pages.
9332         : XXX Better default suggestions would be welcome.
9333         case "$vendorhtml1dir" in
9334         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9335         *)      dflt=$vendorhtml1dir ;;
9336         esac
9337         case "$dflt" in
9338         ''|' ') dflt=none ;;
9339         esac
9340         fn=dn+~
9341         rp='Pathname for the vendor-supplied html pages?'
9342         . ./getfile
9343         vendorhtml1dir="$ans"
9344         vendorhtml1direxp="$ansexp"
9345         ;;
9346 esac
9347 : Use ' ' for none so value is preserved next time through Configure
9348 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9349 prefixvar=vendorhtml1dir
9350 . ./installprefix
9351
9352 : Set the vendorhtml3dir variables
9353 case "$vendorprefix" in
9354 '')     vendorhtml3dir=''
9355         vendorhtml3direxp=''
9356         ;;
9357 *)      : determine where vendor-supplied module html pages go.
9358         : There is no standard location, so try to copy the previously-selected
9359         : directory structure for the core html pages.
9360         : XXX Better default suggestions would be welcome.
9361         case "$vendorhtml3dir" in
9362         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9363         *)      dflt=$vendorhtml3dir ;;
9364         esac
9365         case "$dflt" in
9366         ''|' ') dflt=none ;;
9367         esac
9368         fn=dn+~
9369         rp='Pathname for the vendor-supplied html pages?'
9370         . ./getfile
9371         vendorhtml3dir="$ans"
9372         vendorhtml3direxp="$ansexp"
9373         ;;
9374 esac
9375 : Use ' ' for none so value is preserved next time through Configure
9376 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9377 prefixvar=vendorhtml3dir
9378 . ./installprefix
9379
9380 : Set the vendorman1dir variables
9381 case "$vendorprefix" in
9382 '')     vendorman1dir=''
9383         vendorman1direxp=''
9384         ;;
9385 *)      : determine where vendor-supplied manual pages go.
9386         case "$vendorman1dir" in
9387         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9388         *)      dflt=$vendorman1dir ;;
9389         esac
9390         case "$dflt" in
9391         ''|' ') dflt=none ;;
9392         esac
9393         fn=nd~+
9394         rp='Pathname for the vendor-supplied manual section 1 pages?'
9395         . ./getfile
9396         vendorman1dir="$ans"
9397         vendorman1direxp="$ansexp"
9398         ;;
9399 esac
9400 : Use ' ' for none so value is preserved next time through Configure
9401 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9402 prefixvar=vendorman1dir
9403 . ./installprefix
9404
9405 : Set the vendorman3dir variables
9406 case "$vendorprefix" in
9407 '')     vendorman3dir=''
9408         vendorman3direxp=''
9409         ;;
9410 *)      : determine where vendor-supplied module manual pages go.
9411         case "$vendorman3dir" in
9412         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9413         *)      dflt=$vendorman3dir ;;
9414         esac
9415         case "$dflt" in
9416         ''|' ') dflt=none ;;
9417         esac
9418         fn=nd~+
9419         rp='Pathname for the vendor-supplied manual section 3 pages?'
9420         . ./getfile
9421         vendorman3dir="$ans"
9422         vendorman3direxp="$ansexp"
9423         ;;
9424 esac
9425 : Use ' ' for none so value is preserved next time through Configure
9426 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9427 prefixvar=vendorman3dir
9428 . ./installprefix
9429
9430 : Set the vendorscript variables
9431 case "$vendorprefix" in
9432 '')     d_vendorscript="$undef"
9433         vendorscript=''
9434         vendorscriptexp=''
9435         ;;
9436 *)      d_vendorscript="$define"
9437         : determine where vendor-supplied scripts go.
9438         case "$vendorscript" in
9439         '')     dflt=$vendorprefix/script
9440                 $test -d $dflt || dflt=$vendorbin ;;
9441         *)  dflt="$vendorscript" ;;
9442         esac
9443         $cat <<EOM
9444
9445 The installation process will create a directory for
9446 vendor-supplied scripts.
9447
9448 EOM
9449         fn=d~+
9450         rp='Pathname for the vendor-supplied scripts directory?'
9451         . ./getfile
9452         vendorscript="$ans"
9453         vendorscriptexp="$ansexp"
9454         ;;
9455 esac
9456 prefixvar=vendorscript
9457 . ./installprefix
9458
9459 : see if qgcvt exists
9460 set qgcvt d_qgcvt
9461 eval $inlibc
9462
9463 : Check print/scan long double stuff
9464 echo " "
9465
9466 if $test X"$d_longdbl" = X"$define"; then
9467
9468 echo "Checking how to print long doubles..." >&4
9469
9470 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9471         $cat >try.c <<'EOCP'
9472 #include <sys/types.h>
9473 #include <stdio.h>
9474 int main() {
9475   double d = 123.456;
9476   printf("%.3f\n", d);
9477 }
9478 EOCP
9479         set try
9480         if eval $compile; then
9481                 yyy=`$run ./try`
9482                 case "$yyy" in
9483                 123.456)
9484                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9485                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9486                         echo "We will use %f."
9487                         ;;
9488                 esac
9489         fi
9490 fi
9491
9492 if $test X"$sPRIfldbl" = X; then
9493         $cat >try.c <<'EOCP'
9494 #include <sys/types.h>
9495 #include <stdio.h>
9496 int main() {
9497   long double d = 123.456;
9498   printf("%.3Lf\n", d);
9499 }
9500 EOCP
9501         set try
9502         if eval $compile; then
9503                 yyy=`$run ./try`
9504                 case "$yyy" in
9505                 123.456)
9506                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9507                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9508                         echo "We will use %Lf."
9509                         ;;
9510                 esac
9511         fi
9512 fi
9513
9514 if $test X"$sPRIfldbl" = X; then
9515         $cat >try.c <<'EOCP'
9516 #include <sys/types.h>
9517 #include <stdio.h>
9518 int main() {
9519   long double d = 123.456;
9520   printf("%.3llf\n", d);
9521 }
9522 EOCP
9523         set try
9524         if eval $compile; then
9525                 yyy=`$run ./try`
9526                 case "$yyy" in
9527                 123.456)
9528                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9529                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9530                         echo "We will use %llf."
9531                         ;;
9532                 esac
9533         fi
9534 fi
9535
9536 if $test X"$sPRIfldbl" = X; then
9537         $cat >try.c <<'EOCP'
9538 #include <sys/types.h>
9539 #include <stdio.h>
9540 int main() {
9541   long double d = 123.456;
9542   printf("%.3lf\n", d);
9543 }
9544 EOCP
9545         set try
9546         if eval $compile; then
9547                 yyy=`$run ./try`
9548                 case "$yyy" in
9549                 123.456)
9550                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9551                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9552                         echo "We will use %lf."
9553                         ;;
9554                 esac
9555         fi
9556 fi
9557
9558 if $test X"$sPRIfldbl" = X; then
9559         echo "Cannot figure out how to print long doubles." >&4
9560 else
9561         sSCNfldbl=$sPRIfldbl    # expect consistency
9562 fi
9563
9564 $rm_try
9565
9566 fi # d_longdbl
9567
9568 case "$sPRIfldbl" in
9569 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9570         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9571         d_SCNfldbl="$undef";
9572         ;;
9573 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9574         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9575         d_SCNfldbl="$define";
9576         ;;
9577 esac
9578
9579 : Check how to convert floats to strings.
9580
9581 if test "X$d_Gconvert" = X; then
9582
9583 echo " "
9584 echo "Checking for an efficient way to convert floats to strings."
9585 echo " " > try.c
9586 case "$uselongdouble" in
9587 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9588 esac
9589 case "$d_longdbl" in
9590 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9591 esac
9592 case "$d_PRIgldbl" in
9593 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9594 esac
9595 $cat >>try.c <<EOP
9596 #ifdef TRY_gconvert
9597 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9598 char *myname = "gconvert";
9599 #endif
9600 #ifdef TRY_gcvt
9601 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9602 char *myname = "gcvt";
9603 #endif
9604 #ifdef TRY_qgcvt
9605 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9606 char *myname = "qgcvt";
9607 #define DOUBLETYPE long double
9608 #endif
9609 #ifdef TRY_sprintf
9610 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9611 #ifdef HAS_PRIgldbl
9612 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9613 #else
9614 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9615 #endif
9616 #else
9617 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9618 #endif
9619 char *myname = "sprintf";
9620 #endif
9621
9622 #ifndef DOUBLETYPE
9623 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9624 #define DOUBLETYPE long double
9625 #else
9626 #define DOUBLETYPE double
9627 #endif
9628 #endif
9629
9630 #include <stdio.h>
9631
9632 #define I_STDLIB $i_stdlib
9633 #ifdef I_STDLIB
9634 #include <stdlib.h>
9635 #endif
9636
9637 int
9638 checkit(expect, got)
9639 char *expect;
9640 char *got;
9641 {
9642     if (strcmp(expect, got)) {
9643                 printf("%s oddity:  Expected %s, got %s\n",
9644                         myname, expect, got);
9645                 exit(1);
9646         }
9647 }
9648
9649 int main()
9650 {
9651         char buf[64];
9652         buf[63] = '\0';
9653
9654         /* This must be 1st test on (which?) platform */
9655         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9656         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9657         checkit("0.1", buf);
9658
9659         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9660         checkit("0.01", buf);
9661
9662         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9663         checkit("0.001", buf);
9664
9665         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9666         checkit("0.0001", buf);
9667
9668         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9669         if (strlen(buf) > 5)
9670             checkit("9e-005", buf); /* for Microsoft ?? */
9671         else
9672             checkit("9e-05", buf);
9673
9674         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9675         checkit("1", buf);
9676
9677         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9678         checkit("1.1", buf);
9679
9680         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9681         checkit("1.01", buf);
9682
9683         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9684         checkit("1.001", buf);
9685
9686         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9687         checkit("1.0001", buf);
9688
9689         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9690         checkit("1.00001", buf);
9691
9692         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9693         checkit("1.000001", buf);
9694
9695         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9696         checkit("0", buf);
9697
9698         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9699         checkit("-1", buf);
9700
9701         /* Some Linux gcvt's give 1.e+5 here. */
9702         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9703         checkit("100000", buf);
9704
9705         /* Some Linux gcvt's give -1.e+5 here. */
9706         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9707         checkit("-100000", buf);
9708
9709         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9710         checkit("123.456", buf);
9711
9712         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9713         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9714         /* 34 should be enough to scare even long double
9715          * places into using the e notation. */
9716         if (strlen(buf) > 5)
9717             checkit("1e+034", buf); /* for Microsoft */
9718         else
9719             checkit("1e+34", buf);
9720
9721         /* For Perl, if you add additional tests here, also add them to
9722          * t/base/num.t for benefit of platforms not using Configure or
9723          * overriding d_Gconvert */
9724
9725         exit(0);
9726 }
9727 EOP
9728 : first add preferred functions to our list
9729 xxx_list=""
9730 for xxx_convert in $gconvert_preference; do
9731     case $xxx_convert in
9732     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9733     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9734     esac
9735 done
9736 : then add any others
9737 for xxx_convert in gconvert gcvt sprintf; do
9738     case "$xxx_list" in
9739     *$xxx_convert*) ;;
9740     *) xxx_list="$xxx_list $xxx_convert" ;;
9741     esac
9742 done
9743
9744 case "$d_longdbl$uselongdouble" in
9745 "$define$define")
9746     : again, add prefered functions to our list first
9747     xxx_ld_list=""
9748     for xxx_convert in $gconvert_ld_preference; do
9749         case $xxx_convert in
9750         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9751         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9752         esac
9753     done
9754     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9755     for xxx_convert in qgcvt sprintf $xxx_list; do
9756         case "$xxx_ld_list" in
9757         $xxx_convert*|*" $xxx_convert"*) ;;
9758         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9759         esac
9760     done
9761     : if sprintf cannot do long doubles, move it to the end
9762     if test "$d_PRIgldbl" != "$define"; then
9763         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9764     fi
9765     : if no qgcvt, remove it
9766     if test "$d_qgcvt" != "$define"; then
9767         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9768     fi
9769     : use the ld_list
9770     xxx_list="$xxx_ld_list"
9771     ;;
9772 esac
9773
9774 for xxx_convert in $xxx_list; do
9775         echo "Trying $xxx_convert..."
9776         $rm -f try try$_o core
9777         set try -DTRY_$xxx_convert
9778         if eval $compile; then
9779                 echo "$xxx_convert() found." >&4
9780                 if $run ./try; then
9781                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9782                         break;
9783                 else
9784                         echo "...But $xxx_convert didn't work as I expected."
9785                         xxx_convert=''
9786                 fi
9787         else
9788                 echo "$xxx_convert NOT found." >&4
9789         fi
9790 done
9791
9792 if test X$xxx_convert = X; then
9793     echo "*** WHOA THERE!!! ***" >&4
9794     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9795     xxx_convert=sprintf
9796 fi
9797
9798 case "$xxx_convert" in
9799 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9800 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9801 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9802 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9803    "$define$define$define")
9804       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9805    "$define$define$undef")
9806       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9807    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9808    esac
9809    ;;
9810 esac
9811
9812 fi
9813 $rm_try
9814
9815 : see if _fwalk exists
9816 set fwalk d__fwalk
9817 eval $inlibc
9818
9819 : Initialize h_fcntl
9820 h_fcntl=false
9821
9822 : Initialize h_sysfile
9823 h_sysfile=false
9824
9825 : access call always available on UNIX
9826 set access d_access
9827 eval $inlibc
9828
9829 : locate the flags for 'access()'
9830 case "$d_access" in
9831 "$define")
9832         echo " "
9833         $cat >access.c <<EOCP
9834 #include <sys/types.h>
9835 #ifdef I_FCNTL
9836 #include <fcntl.h>
9837 #endif
9838 #ifdef I_SYS_FILE
9839 #include <sys/file.h>
9840 #endif
9841 #ifdef I_UNISTD
9842 #include <unistd.h>
9843 #endif
9844 #$i_stdlib I_STDLIB
9845 #ifdef I_STDLIB
9846 #include <stdlib.h>
9847 #endif
9848 int main() {
9849         exit(R_OK);
9850 }
9851 EOCP
9852         : check sys/file.h first, no particular reason here
9853         if $test `./findhdr sys/file.h` && \
9854                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9855                 h_sysfile=true;
9856                 echo "<sys/file.h> defines the *_OK access constants." >&4
9857         elif $test `./findhdr fcntl.h` && \
9858                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9859                 h_fcntl=true;
9860                 echo "<fcntl.h> defines the *_OK access constants." >&4
9861         elif $test `./findhdr unistd.h` && \
9862                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9863                 echo "<unistd.h> defines the *_OK access constants." >&4
9864         else
9865                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9866         fi
9867         ;;
9868 esac
9869 $rm -f access*
9870
9871 : see if accessx exists
9872 set accessx d_accessx
9873 eval $inlibc
9874
9875 : see if aintl exists
9876 set aintl d_aintl
9877 eval $inlibc
9878
9879 : see if alarm exists
9880 set alarm d_alarm
9881 eval $inlibc
9882
9883 : see if POSIX threads are available
9884 set pthread.h i_pthread
9885 eval $inhdr
9886
9887 : define a fucntion to check prototypes
9888 $cat > protochk <<EOSH
9889 $startsh
9890 cc="$cc"
9891 optimize="$optimize"
9892 ccflags="$ccflags"
9893 prototype="$prototype"
9894 define="$define"
9895 rm_try="$rm_try"
9896 usethreads=$usethreads
9897 i_pthread=$i_pthread
9898 pthread_h_first=$pthread_h_first
9899 EOSH
9900
9901 $cat >> protochk <<'EOSH'
9902
9903 $rm_try
9904 foo="$1"
9905 shift
9906 while test $# -ge 2; do
9907         case "$1" in
9908                 $define) echo "#include <$2>" >> try.c ;;
9909                 literal) echo "$2" >> try.c ;;
9910         esac
9911     # Extra magic for the benefit of systems that need pthread.h
9912     # to be included early to correctly detect threadsafe functions.
9913     # Such functions must guarantee themselves, though, that the usethreads
9914     # and i_pthread have been defined, before calling protochk.
9915     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9916         echo "#include <pthread.h>" >> try.c
9917         pthread_h_done=yes
9918     fi
9919     shift 2
9920 done
9921 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9922 cat >> try.c <<'EOCP'
9923 #ifdef CAN_PROTOTYPE
9924 #define _(args) args
9925 #else
9926 #define _(args) ()
9927 #endif
9928 EOCP
9929 echo "$foo" >> try.c
9930 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9931 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9932 status=$?
9933 $rm_try
9934 exit $status
9935 EOSH
9936 chmod +x protochk
9937 $eunicefix protochk
9938
9939 : Define hasproto macro for Configure internal use
9940 hasproto='varname=$1; func=$2; shift; shift;
9941 while $test $# -ge 2; do
9942         case "$1" in
9943         $define) echo "#include <$2>";;
9944         esac ;
9945     shift 2;
9946 done > try.c;
9947 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9948 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9949         echo "$func() prototype found.";
9950         val="$define";
9951 else
9952         echo "$func() prototype NOT found.";
9953         val="$undef";
9954 fi;
9955 set $varname;
9956 eval $setvar;
9957 $rm_try tryout.c'
9958
9959 : see if sys/types.h has to be included
9960 set sys/types.h i_systypes
9961 eval $inhdr
9962
9963 : see if sys/select.h has to be included
9964 set sys/select.h i_sysselct
9965 eval $inhdr
9966
9967 : Define hasfield macro for Configure internal use
9968 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9969 while $test $# -ge 2; do
9970         case "$1" in
9971         $define) echo "#include <$2>";;
9972         esac ;
9973     shift 2;
9974 done > try.c;
9975 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9976 set try;
9977 if eval $compile; then
9978         val="$define";
9979 else
9980         val="$undef";
9981 fi;
9982 set $varname;
9983 eval $setvar;
9984 $rm_try'
9985
9986 : see if we should include time.h, sys/time.h, or both
9987 echo " "
9988 if test "X$timeincl" = X; then
9989         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9990         $echo $n "I'm now running the test program...$c"
9991         $cat >try.c <<EOCP
9992 #include <sys/types.h>
9993 #ifdef I_TIME
9994 #include <time.h>
9995 #endif
9996 #ifdef I_SYSTIME
9997 #ifdef SYSTIMEKERNEL
9998 #define KERNEL
9999 #endif
10000 #include <sys/time.h>
10001 #endif
10002 #ifdef I_SYSSELECT
10003 #include <sys/select.h>
10004 #endif
10005 #$i_stdlib I_STDLIB
10006 #ifdef I_STDLIB
10007 #include <stdlib.h>
10008 #endif
10009 int main()
10010 {
10011         struct tm foo;
10012 #ifdef S_TIMEVAL
10013         struct timeval bar;
10014 #endif
10015 #ifdef S_TIMEZONE
10016         struct timezone tzp;
10017 #endif
10018         if (foo.tm_sec == foo.tm_sec)
10019                 exit(0);
10020 #ifdef S_TIMEVAL
10021         if (bar.tv_sec == bar.tv_sec)
10022                 exit(0);
10023 #endif
10024         exit(1);
10025 }
10026 EOCP
10027         flags=''
10028         for s_timezone in '-DS_TIMEZONE' ''; do
10029         sysselect=''
10030         for s_timeval in '-DS_TIMEVAL' ''; do
10031         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10032         for i_time in '' '-DI_TIME'; do
10033         for i_systime in '-DI_SYSTIME' ''; do
10034                 case "$flags" in
10035                 '') $echo $n ".$c"
10036                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10037                         if eval $compile; then
10038                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10039                                 shift
10040                                 flags="$*"
10041                                 echo " "
10042                                 $echo $n "Succeeded with $flags$c"
10043                         fi
10044                         ;;
10045                 esac
10046         done
10047         done
10048         done
10049         done
10050         done
10051         timeincl=''
10052         echo " "
10053         case "$flags" in
10054         *SYSTIMEKERNEL*) i_systimek="$define"
10055                 timeincl=`./findhdr sys/time.h`
10056                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10057         *) i_systimek="$undef";;
10058         esac
10059         case "$flags" in
10060         *I_TIME*) i_time="$define"
10061                 timeincl=`./findhdr time.h`" $timeincl"
10062                 echo "We'll include <time.h>." >&4;;
10063         *) i_time="$undef";;
10064         esac
10065         case "$flags" in
10066         *I_SYSTIME*) i_systime="$define"
10067                 timeincl=`./findhdr sys/time.h`" $timeincl"
10068                 echo "We'll include <sys/time.h>." >&4;;
10069         *) i_systime="$undef";;
10070         esac
10071         $rm_try
10072 fi
10073 : see if struct tm knows about tm_zone
10074 case "$i_systime$i_time" in
10075 *$define*)
10076         echo " "
10077         echo "Checking to see if your struct tm has tm_zone field..." >&4
10078         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10079         eval $hasfield
10080         ;;
10081 *)      val="$undef"
10082         set d_tm_tm_zone
10083         eval $setvar
10084         ;;
10085 esac
10086 case "$d_tm_tm_zone" in
10087 "$define")      echo "Yes, it does."   ;;
10088 *)              echo "No, it doesn't." ;;
10089 esac
10090 : see if struct tm knows about tm_gmtoff
10091 case "$i_systime$i_time" in
10092 *$define*)
10093         echo " "
10094         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10095         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10096         eval $hasfield
10097         ;;
10098 *)      val="$undef"
10099         set d_tm_tm_gmtoff
10100         eval $setvar
10101         ;;
10102 esac
10103 case "$d_tm_tm_gmtoff" in
10104 "$define")      echo "Yes, it does."   ;;
10105 *)              echo "No, it doesn't." ;;
10106 esac
10107
10108 : see if asctime_r exists
10109 set asctime_r d_asctime_r
10110 eval $inlibc
10111 case "$d_asctime_r" in
10112 "$define")
10113         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10114         case "$d_asctime_r_proto:$usethreads" in
10115         ":define")      d_asctime_r_proto=define
10116                 set d_asctime_r_proto asctime_r $hdrs
10117                 eval $hasproto ;;
10118         *)      ;;
10119         esac
10120         case "$d_asctime_r_proto" in
10121         define)
10122         case "$asctime_r_proto" in
10123         ''|0) try='char* asctime_r(const struct tm*, char*);'
10124         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10125         esac
10126         case "$asctime_r_proto" in
10127         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10128         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10129         esac
10130         case "$asctime_r_proto" in
10131         ''|0) try='int asctime_r(const struct tm*, char*);'
10132         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10133         esac
10134         case "$asctime_r_proto" in
10135         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10136         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10137         esac
10138         case "$asctime_r_proto" in
10139         ''|0)   d_asctime_r=undef
10140                 asctime_r_proto=0
10141                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10142         * )     case "$asctime_r_proto" in
10143                 REENTRANT_PROTO*) ;;
10144                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10145                 esac
10146                 echo "Prototype: $try" ;;
10147         esac
10148         ;;
10149         *)      case "$usethreads" in
10150                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10151                 esac
10152                 d_asctime_r=undef
10153                 asctime_r_proto=0
10154                 ;;
10155         esac
10156         ;;
10157 *)      asctime_r_proto=0
10158         ;;
10159 esac
10160
10161 : see if atolf exists
10162 set atolf d_atolf
10163 eval $inlibc
10164
10165 : see if atoll exists
10166 set atoll d_atoll
10167 eval $inlibc
10168
10169 : Look for GCC-style attribute format
10170 case "$d_attribute_format" in
10171 '')
10172 echo " "
10173 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10174 $cat >attrib.c <<'EOCP'
10175 #include <stdio.h>
10176 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10177 EOCP
10178 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10179         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10180                 echo "Your C compiler doesn't support __attribute__((format))."
10181                 val="$undef"
10182         else
10183                 echo "Your C compiler supports __attribute__((format))."
10184                 val="$define"
10185         fi
10186 else
10187         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10188         val="$undef"
10189 fi
10190 ;;
10191 *) val="$d_attribute_format" ;;
10192 esac
10193 set d_attribute_format
10194 eval $setvar
10195 $rm -f attrib*
10196
10197 : Look for GCC-style attribute format with null format allowed
10198 case "$d_printf_format_null" in
10199 '') case "$d_attribute_format" in
10200     $define)
10201         echo " "
10202         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10203 $cat >attrib.c <<EOCP
10204 #include <stdio.h>
10205 #$i_stdlib I_STDLIB
10206 #ifdef I_STDLIB
10207 #include <stdlib.h>
10208 #endif
10209 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10210 int null_printf (char* pat,...) { return (int)pat; }
10211 int main () { exit(null_printf(NULL)); }
10212 EOCP
10213         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10214             : run the executable in case it produces a run-time warning
10215             if $run ./attrib >>attrib.out 2>&1; then
10216                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10217                     echo "Your C compiler doesn't allow __printf__ format to be null."
10218                     val="$undef"
10219                 else
10220                     echo "Your C compiler allows __printf__ format to be null."
10221                     val="$define"
10222                 fi
10223             else
10224             echo "Your C compiler executable failed with __printf__ format null."
10225             val="$undef"
10226         fi
10227     else
10228         echo "Your C compiler fails with __printf__ format null."
10229         val="$undef"
10230     fi
10231     ;;
10232     *)  val="$undef" ;;
10233     esac
10234 ;;
10235 *)  val="$d_printf_format_null" ;;
10236 esac
10237 set d_printf_format_null
10238 eval $setvar
10239 $rm -f attrib*
10240
10241 : Look for GCC-style attribute malloc
10242 case "$d_attribute_malloc" in
10243 '')
10244 echo " "
10245 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10246 $cat >attrib.c <<'EOCP'
10247 #include <stdio.h>
10248 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10249 EOCP
10250 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10251         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10252                 echo "Your C compiler doesn't support __attribute__((malloc))."
10253                 val="$undef"
10254         else
10255                 echo "Your C compiler supports __attribute__((malloc))."
10256                 val="$define"
10257         fi
10258 else
10259         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10260         val="$undef"
10261 fi
10262 ;;
10263 *) val="$d_attribute_malloc" ;;
10264 esac
10265 set d_attribute_malloc
10266 eval $setvar
10267 $rm -f attrib*
10268
10269 : Look for GCC-style attribute nonnull
10270 case "$d_attribute_nonnull" in
10271 '')
10272 echo " "
10273 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10274 $cat >attrib.c <<'EOCP'
10275 #include <stdio.h>
10276 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10277 EOCP
10278 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10279         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10280                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10281                 val="$undef"
10282         else
10283                 echo "Your C compiler supports __attribute__((nonnull))."
10284                 val="$define"
10285         fi
10286 else
10287         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10288         val="$undef"
10289 fi
10290 ;;
10291 *) val="$d_attribute_nonnull" ;;
10292 esac
10293 set d_attribute_nonnull
10294 eval $setvar
10295 $rm -f attrib*
10296
10297 : Look for GCC-style attribute noreturn
10298 case "$d_attribute_noreturn" in
10299 '')
10300 echo " "
10301 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10302 $cat >attrib.c <<'EOCP'
10303 #include <stdio.h>
10304 void fall_over_dead( void ) __attribute__((noreturn));
10305 EOCP
10306 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10307         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10308                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10309                 val="$undef"
10310         else
10311                 echo "Your C compiler supports __attribute__((noreturn))."
10312                 val="$define"
10313         fi
10314 else
10315         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10316         val="$undef"
10317 fi
10318 ;;
10319 *) val="$d_attribute_noreturn" ;;
10320 esac
10321 set d_attribute_noreturn
10322 eval $setvar
10323 $rm -f attrib*
10324
10325 : Look for GCC-style attribute pure
10326 case "$d_attribute_pure" in
10327 '')
10328 echo " "
10329 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10330 $cat >attrib.c <<'EOCP'
10331 #include <stdio.h>
10332 int square( int n ) __attribute__((pure));
10333 EOCP
10334 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10335         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10336                 echo "Your C compiler doesn't support __attribute__((pure))."
10337                 val="$undef"
10338         else
10339                 echo "Your C compiler supports __attribute__((pure))."
10340                 val="$define"
10341         fi
10342 else
10343         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10344         val="$undef"
10345 fi
10346 ;;
10347 *) val="$d_attribute_pure" ;;
10348 esac
10349 set d_attribute_pure
10350 eval $setvar
10351 $rm -f attrib*
10352
10353 : Look for GCC-style attribute unused
10354 case "$d_attribute_unused" in
10355 '')
10356 echo " "
10357 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10358 $cat >attrib.c <<'EOCP'
10359 #include <stdio.h>
10360 int do_something( int dummy __attribute__((unused)), int n );
10361 EOCP
10362 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10363         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10364                 echo "Your C compiler doesn't support __attribute__((unused))."
10365                 val="$undef"
10366         else
10367                 echo "Your C compiler supports __attribute__((unused))."
10368                 val="$define"
10369         fi
10370 else
10371         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10372         val="$undef"
10373 fi
10374 ;;
10375 *) val="$d_attribute_unused" ;;
10376 esac
10377 set d_attribute_unused
10378 eval $setvar
10379 $rm -f attrib*
10380
10381 : Look for GCC-style attribute warn_unused_result
10382 case "$d_attribute_warn_unused_result" in
10383 '')
10384 echo " "
10385 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10386 $cat >attrib.c <<'EOCP'
10387 #include <stdio.h>
10388 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10389 EOCP
10390 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10391         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10392                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10393                 val="$undef"
10394         else
10395                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10396                 val="$define"
10397         fi
10398 else
10399         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10400         val="$undef"
10401 fi
10402 ;;
10403 *) val="$d_attribute_warn_unused_result" ;;
10404 esac
10405 set d_attribute_warn_unused_result
10406 eval $setvar
10407 $rm -f attrib*
10408
10409 : see if bcmp exists
10410 set bcmp d_bcmp
10411 eval $inlibc
10412
10413 : see if bcopy exists
10414 set bcopy d_bcopy
10415 eval $inlibc
10416
10417 : see if getpgrp exists
10418 set getpgrp d_getpgrp
10419 eval $inlibc
10420
10421 case "$d_getpgrp" in
10422 "$define")
10423         echo " "
10424         echo "Checking to see which flavor of getpgrp is in use..."
10425         $cat >try.c <<EOP
10426 #$i_unistd I_UNISTD
10427 #include <sys/types.h>
10428 #ifdef I_UNISTD
10429 #  include <unistd.h>
10430 #endif
10431 #$i_stdlib I_STDLIB
10432 #ifdef I_STDLIB
10433 #include <stdlib.h>
10434 #endif
10435 int main()
10436 {
10437         if (getuid() == 0) {
10438                 printf("(I see you are running Configure as super-user...)\n");
10439                 setuid(1);
10440         }
10441 #ifdef TRY_BSD_PGRP
10442         if (getpgrp(1) == 0)
10443                 exit(0);
10444 #else
10445         if (getpgrp() > 0)
10446                 exit(0);
10447 #endif
10448         exit(1);
10449 }
10450 EOP
10451         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10452                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10453                 val="$define"
10454         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10455                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10456                 val="$undef"
10457         else
10458                 echo "I can't seem to compile and run the test program."
10459                 if ./usg; then
10460                         xxx="a USG one, i.e. you use getpgrp()."
10461                 else
10462                         # SVR4 systems can appear rather BSD-ish.
10463                         case "$i_unistd" in
10464                         $undef)
10465                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10466                                 val="$define"
10467                                 ;;
10468                         $define)
10469                                 xxx="probably a USG one, i.e. you use getpgrp()."
10470                                 val="$undef"
10471                                 ;;
10472                         esac
10473                 fi
10474                 echo "Assuming your getpgrp is $xxx" >&4
10475         fi
10476         ;;
10477 *) val="$undef";;
10478 esac
10479 set d_bsdgetpgrp
10480 eval $setvar
10481 $rm_try
10482
10483 : see if setpgrp exists
10484 set setpgrp d_setpgrp
10485 eval $inlibc
10486
10487 case "$d_setpgrp" in
10488 "$define")
10489         echo " "
10490         echo "Checking to see which flavor of setpgrp is in use..."
10491         $cat >try.c <<EOP
10492 #$i_unistd I_UNISTD
10493 #include <sys/types.h>
10494 #ifdef I_UNISTD
10495 #  include <unistd.h>
10496 #endif
10497 #$i_stdlib I_STDLIB
10498 #ifdef I_STDLIB
10499 #include <stdlib.h>
10500 #endif
10501 int main()
10502 {
10503         if (getuid() == 0) {
10504                 printf("(I see you are running Configure as super-user...)\n");
10505                 setuid(1);
10506         }
10507 #ifdef TRY_BSD_PGRP
10508         if (-1 == setpgrp(1, 1))
10509                 exit(0);
10510 #else
10511         if (setpgrp() != -1)
10512                 exit(0);
10513 #endif
10514         exit(1);
10515 }
10516 EOP
10517         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10518                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10519                 val="$define"
10520         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10521                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10522                 val="$undef"
10523         else
10524                 echo "(I can't seem to compile and run the test program.)"
10525                 if ./usg; then
10526                         xxx="a USG one, i.e. you use setpgrp()."
10527                 else
10528                         # SVR4 systems can appear rather BSD-ish.
10529                         case "$i_unistd" in
10530                         $undef)
10531                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10532                                 val="$define"
10533                                 ;;
10534                         $define)
10535                                 xxx="probably a USG one, i.e. you use setpgrp()."
10536                                 val="$undef"
10537                                 ;;
10538                         esac
10539                 fi
10540                 echo "Assuming your setpgrp is $xxx" >&4
10541         fi
10542         ;;
10543 *) val="$undef";;
10544 esac
10545 set d_bsdsetpgrp
10546 eval $setvar
10547 $rm_try
10548
10549 : Look for GCC-style __builtin_choose_expr
10550 case "$d_builtin_choose_expr" in
10551 '')
10552     echo " "
10553     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10554     $cat >try.c <<'EOCP'
10555 #include <assert.h>
10556 #include <stdlib.h>
10557 #include <stdio.h>
10558
10559 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10560
10561 int main(void) {
10562     assert( SYRINX(1) == 2112 );
10563     assert( SYRINX(1) != 5150 );
10564     assert( SYRINX(0) == 5150 );
10565     assert( SYRINX(0) != 2112 );
10566     puts( "All good!" );
10567     exit(0);
10568 }
10569
10570 EOCP
10571     set try
10572     if eval $compile && $run ./try; then
10573         echo "Your C compiler supports __builtin_choose_expr."
10574         val="$define"
10575     else
10576         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10577         val="$undef"
10578     fi
10579 ;;
10580 *) val="$d_builtin_choose_expr" ;;
10581 esac
10582
10583 set d_builtin_choose_expr
10584 eval $setvar
10585 $rm_try
10586
10587 : Look for GCC-style __builtin_expect
10588 case "$d_builtin_expect" in
10589 '')
10590     echo " "
10591     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10592     $cat >try.c <<'EOCP'
10593 int main(void) {
10594     int n = 50;
10595     if ( __builtin_expect(n, 0) ) n = 1;
10596     /* Remember shell exit code truth is 0, C truth is non-zero */
10597     return !(n == 1);
10598 }
10599 EOCP
10600     set try
10601     if eval $compile && $run ./try; then
10602         echo "Your C compiler supports __builtin_expect."
10603         val="$define"
10604     else
10605         echo "Your C compiler doesn't seem to understand __builtin_expect."
10606         val="$undef"
10607     fi
10608     ;;
10609 *) val="$d_builtin_expect" ;;
10610 esac
10611
10612 set d_builtin_expect
10613 eval $setvar
10614 $rm_try
10615
10616 : see if bzero exists
10617 set bzero d_bzero
10618 eval $inlibc
10619
10620 : see if stdarg is available
10621 echo " "
10622 if $test `./findhdr stdarg.h`; then
10623         echo "<stdarg.h> found." >&4
10624         valstd="$define"
10625 else
10626         echo "<stdarg.h> NOT found." >&4
10627         valstd="$undef"
10628 fi
10629
10630 : see if varags is available
10631 echo " "
10632 if $test `./findhdr varargs.h`; then
10633         echo "<varargs.h> found." >&4
10634 else
10635         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10636 fi
10637
10638 : set up the varargs testing programs
10639 $cat > varargs.c <<EOP
10640 #ifdef I_STDARG
10641 #include <stdarg.h>
10642 #endif
10643 #ifdef I_VARARGS
10644 #include <varargs.h>
10645 #endif
10646
10647 #ifdef I_STDARG
10648 int f(char *p, ...)
10649 #else
10650 int f(va_alist)
10651 va_dcl
10652 #endif
10653 {
10654         va_list ap;
10655 #ifndef I_STDARG
10656         char *p;
10657 #endif
10658 #ifdef I_STDARG
10659         va_start(ap,p);
10660 #else
10661         va_start(ap);
10662         p = va_arg(ap, char *);
10663 #endif
10664         va_end(ap);
10665         return 0;
10666 }
10667 EOP
10668 $cat > varargs <<EOP
10669 $startsh
10670 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10671         echo "true"
10672 else
10673         echo "false"
10674 fi
10675 $rm -f varargs$_o
10676 EOP
10677 chmod +x varargs
10678
10679 : now check which varargs header should be included
10680 echo " "
10681 i_varhdr=''
10682 case "$valstd" in
10683 "$define")
10684         if `./varargs I_STDARG`; then
10685                 val='stdarg.h'
10686         elif `./varargs I_VARARGS`; then
10687                 val='varargs.h'
10688         fi
10689         ;;
10690 *)
10691         if `./varargs I_VARARGS`; then
10692                 val='varargs.h'
10693         fi
10694         ;;
10695 esac
10696 case "$val" in
10697 '')
10698 echo "I could not find the definition for va_dcl... You have problems..." >&4
10699         val="$undef"; set i_stdarg; eval $setvar
10700         val="$undef"; set i_varargs; eval $setvar
10701         ;;
10702 *)
10703         set i_varhdr
10704         eval $setvar
10705         case "$i_varhdr" in
10706         stdarg.h)
10707                 val="$define"; set i_stdarg; eval $setvar
10708                 val="$undef"; set i_varargs; eval $setvar
10709                 ;;
10710         varargs.h)
10711                 val="$undef"; set i_stdarg; eval $setvar
10712                 val="$define"; set i_varargs; eval $setvar
10713                 ;;
10714         esac
10715         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10716 esac
10717 $rm -f varargs*
10718
10719 : see if the Compiler supports C99 variadic macros
10720 case "$i_stdarg$i_stdlib" in
10721     "$define$define")
10722     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10723     $cat >try.c <<EOCP
10724 #include <stdio.h>
10725 #include <stdarg.h>
10726
10727 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10728
10729 int main() {
10730   char buf[20];
10731   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10732   puts(buf);
10733   return 0;
10734 }
10735 EOCP
10736     set try
10737     if eval $compile && $run ./try 2>&1 >/dev/null; then
10738         case "`$run ./try`" in
10739             "123 456 789")
10740             echo "You have C99 variadic macros." >&4
10741             d_c99_variadic_macros="$define"
10742             ;;
10743             *)
10744             echo "You don't have functional C99 variadic macros." >&4
10745             d_c99_variadic_macros="$undef"
10746             ;;
10747         esac
10748     else
10749         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10750         d_c99_variadic_macros="$undef"
10751     fi
10752     $rm_try
10753     ;;
10754     *)
10755     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10756     d_c99_variadic_macros="$undef"
10757     ;;
10758 esac
10759
10760 : see if signal is declared as pointer to function returning int or void
10761 echo " "
10762 xxx=`./findhdr signal.h`
10763 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10764 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10765         echo "You have int (*signal())() instead of void." >&4
10766         val="$undef"
10767 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10768         echo "You have void (*signal())()." >&4
10769         val="$define"
10770 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10771         echo "You have int (*signal())() instead of void." >&4
10772         val="$undef"
10773 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10774         echo "You have void (*signal())()." >&4
10775         val="$define"
10776 else
10777         case "$d_voidsig" in
10778         '')
10779         echo "I can't determine whether signal handler returns void or int..." >&4
10780                 dflt=void
10781                 rp="What type does your signal handler return?"
10782                 . ./myread
10783                 case "$ans" in
10784                 v*) val="$define";;
10785                 *) val="$undef";;
10786                 esac;;
10787         "$define")
10788                 echo "As you already told me, signal handler returns void." >&4
10789                 val="$define"
10790                 ;;
10791         *)      echo "As you already told me, signal handler returns int." >&4
10792                 val="$undef"
10793                 ;;
10794         esac
10795 fi
10796 set d_voidsig
10797 eval $setvar
10798 case "$d_voidsig" in
10799 "$define") signal_t="void";;
10800 *) signal_t="int";;
10801 esac
10802 $rm -f $$.tmp
10803
10804 : check for ability to cast large floats to 32-bit ints.
10805 echo " "
10806 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10807 if $test "$intsize" -ge 4; then
10808         xxx=int
10809 else
10810         xxx=long
10811 fi
10812 $cat >try.c <<EOCP
10813 #include <stdio.h>
10814 #$i_stdlib I_STDLIB
10815 #ifdef I_STDLIB
10816 #include <stdlib.h>
10817 #endif
10818 #include <sys/types.h>
10819 #include <signal.h>
10820 $signal_t blech(int s) { exit(3); }
10821 int main()
10822 {
10823         $xxx i32;
10824         double f, g;
10825         int result = 0;
10826         char str[16];
10827         signal(SIGFPE, blech);
10828
10829         /* Don't let compiler optimize the test away.  Store the number
10830            in a writable string for gcc to pass to sscanf under HP/UX.
10831         */
10832         sprintf(str, "2147483647");
10833         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10834         g = 10 * f;
10835         i32  = ($xxx) g;
10836
10837         /* x86 processors will probably give 0x8000 0000, which is a
10838            sign change.  We don't want that.  We want to mimic SPARC
10839            behavior here, which is to preserve the sign and give
10840            back 0x7fff ffff.
10841         */
10842         if (i32 != ($xxx) f)
10843                 result |= 1;
10844         exit(result);
10845 }
10846 EOCP
10847 set try
10848 if eval $compile_ok; then
10849         $run ./try
10850         yyy=$?
10851 else
10852         echo "(I can't seem to compile the test program--assuming it can't)"
10853         yyy=1
10854 fi
10855 case "$yyy" in
10856 0)      val="$define"
10857         echo "Yup, it can."
10858         ;;
10859 *)      val="$undef"
10860         echo "Nope, it can't."
10861         ;;
10862 esac
10863 set d_casti32
10864 eval $setvar
10865 $rm_try
10866
10867 : check for ability to cast negative floats to unsigned
10868 echo " "
10869 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10870 $cat >try.c <<EOCP
10871 #include <stdio.h>
10872 #$i_stdlib I_STDLIB
10873 #ifdef I_STDLIB
10874 #include <stdlib.h>
10875 #endif
10876 #include <sys/types.h>
10877 #include <signal.h>
10878 $signal_t blech(int s) { exit(7); }
10879 $signal_t blech_in_list(int s) { exit(4); }
10880 unsigned long dummy_long(unsigned long p) { return p; }
10881 unsigned int dummy_int(unsigned int p) { return p; }
10882 unsigned short dummy_short(unsigned short p) { return p; }
10883 int main()
10884 {
10885         double f;
10886         unsigned long along;
10887         unsigned int aint;
10888         unsigned short ashort;
10889         int result = 0;
10890         char str[16];
10891
10892         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10893            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10894            optimized the whole file away
10895         */
10896         /* Store the number in a writable string for gcc to pass to
10897            sscanf under HP/UX.
10898         */
10899         sprintf(str, "-123");
10900         sscanf(str, "%lf", &f);  /* f = -123.; */
10901
10902         signal(SIGFPE, blech);
10903         along = (unsigned long)f;
10904         aint = (unsigned int)f;
10905         ashort = (unsigned short)f;
10906         if (along != (unsigned long)-123)
10907                 result |= 1;
10908         if (aint != (unsigned int)-123)
10909                 result |= 1;
10910         if (ashort != (unsigned short)-123)
10911                 result |= 1;
10912         sprintf(str, "1073741824.");
10913         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10914         f = f + f;
10915         along = 0;
10916         along = (unsigned long)f;
10917         if (along != 0x80000000)
10918                 result |= 2;
10919         f -= 1.;
10920         along = 0;
10921         along = (unsigned long)f;
10922         if (along != 0x7fffffff)
10923                 result |= 1;
10924         f += 2.;
10925         along = 0;
10926         along = (unsigned long)f;
10927         if (along != 0x80000001)
10928                 result |= 2;
10929         if (result)
10930                 exit(result);
10931         signal(SIGFPE, blech_in_list);
10932         sprintf(str, "123.");
10933         sscanf(str, "%lf", &f);  /* f = 123.; */
10934         along = dummy_long((unsigned long)f);
10935         aint = dummy_int((unsigned int)f);
10936         ashort = dummy_short((unsigned short)f);
10937         if (along != (unsigned long)123)
10938                 result |= 4;
10939         if (aint != (unsigned int)123)
10940                 result |= 4;
10941         if (ashort != (unsigned short)123)
10942                 result |= 4;
10943         exit(result);
10944
10945 }
10946 EOCP
10947 set try
10948 if eval $compile_ok; then
10949         $run ./try
10950         castflags=$?
10951 else
10952         echo "(I can't seem to compile the test program--assuming it can't)"
10953         castflags=7
10954 fi
10955 case "$castflags" in
10956 0)      val="$define"
10957         echo "Yup, it can."
10958         ;;
10959 *)      val="$undef"
10960         echo "Nope, it can't."
10961         ;;
10962 esac
10963 set d_castneg
10964 eval $setvar
10965 $rm_try
10966
10967 : see if vprintf exists
10968 echo " "
10969 if set vprintf val -f d_vprintf; eval $csym; $val; then
10970         echo 'vprintf() found.' >&4
10971         val="$define"
10972         $cat >try.c <<EOF
10973 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10974 #$i_varargs I_VARARGS
10975
10976 #$i_stdlib I_STDLIB
10977 #$i_unistd I_UNISTD
10978
10979 #ifdef I_STDARG
10980 #  include <stdarg.h>
10981 #else /* I_VARARGS */
10982 #  include <varargs.h>
10983 #endif
10984
10985 #ifdef I_UNISTD
10986 #  include <unistd.h>
10987 #endif
10988
10989 #ifdef I_STDLIB
10990 #  include <stdlib.h>
10991 #endif
10992
10993 #include <stdio.h> /* vsprintf prototype */
10994
10995 #ifdef I_STDARG
10996 void xxx(int n, ...)
10997 {
10998     va_list args;
10999     char buf[10];
11000     va_start(args, n);
11001     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11002 }
11003 int main() { xxx(1, "foo"); }
11004
11005 #else /* I_VARARGS */
11006
11007 xxx(va_alist)
11008 va_dcl
11009 {
11010     va_list args;
11011     char buf[10];
11012     va_start(args);
11013     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11014 }
11015 int main() { xxx("foo"); }
11016
11017 #endif
11018
11019 EOF
11020         set try
11021         if eval $compile_ok; then
11022                 if $run ./try; then
11023                         echo "Your vsprintf() returns (int)." >&4
11024                         val2="$undef"
11025                 else
11026                         echo "Your vsprintf() returns (char*)." >&4
11027                         val2="$define"
11028                 fi
11029         else
11030                 echo 'I am unable to compile the vsprintf() test program.' >&4
11031                 # We shouldn't get here.  If we do, assume the standard signature,
11032                 # not the old BSD one.
11033                 echo 'Guessing that vsprintf() returns (int).' >&4
11034                 val2="$undef"
11035         fi
11036 else
11037         echo 'vprintf() NOT found.' >&4
11038         val="$undef"
11039         val2="$undef"
11040 fi
11041 $rm_try
11042 set d_vprintf
11043 eval $setvar
11044 val=$val2
11045 set d_charvspr
11046 eval $setvar
11047
11048 : see if chown exists
11049 set chown d_chown
11050 eval $inlibc
11051
11052 : see if chroot exists
11053 set chroot d_chroot
11054 eval $inlibc
11055
11056 : see if chsize exists
11057 set chsize d_chsize
11058 eval $inlibc
11059
11060 : see if class exists
11061 set class d_class
11062 eval $inlibc
11063
11064 : see if clearenv exists
11065 set clearenv d_clearenv
11066 eval $inlibc
11067
11068 : Define hasstruct macro for Configure internal use
11069 hasstruct='varname=$1; struct=$2; shift; shift;
11070 while $test $# -ge 2; do
11071         case "$1" in
11072         $define) echo "#include <$2>";;
11073         esac ;
11074     shift 2;
11075 done > try.c;
11076 echo "int main () { struct $struct foo; }" >> try.c;
11077 set try;
11078 if eval $compile; then
11079         val="$define";
11080 else
11081         val="$undef";
11082 fi;
11083 set $varname;
11084 eval $setvar;
11085 $rm_try'
11086
11087 : see whether socket exists
11088 socketlib=''
11089 sockethdr=''
11090 echo " "
11091 $echo $n "Hmm... $c" >&4
11092 if set socket val -f d_socket; eval $csym; $val; then
11093         echo "Looks like you have Berkeley networking support." >&4
11094         d_socket="$define"
11095         if set setsockopt val -f; eval $csym; $val; then
11096                 d_oldsock="$undef"
11097         else
11098                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11099                 d_oldsock="$define"
11100         fi
11101 else
11102         if $contains socklib libc.list >/dev/null 2>&1; then
11103                 echo "Looks like you have Berkeley networking support." >&4
11104                 d_socket="$define"
11105                 : we will have to assume that it supports the 4.2 BSD interface
11106                 d_oldsock="$undef"
11107         else
11108                 echo "You don't have Berkeley networking in libc$_a..." >&4
11109                 if test "X$d_socket" = "X$define"; then
11110                    echo "...but you seem to believe that you have sockets." >&4
11111                 else
11112                         for net in net socket
11113                         do
11114                                 if test -f /usr/lib/lib$net$_a; then
11115                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11116                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11117                                         if $contains socket libc.list >/dev/null 2>&1; then
11118                                                 d_socket="$define"
11119                                                 socketlib="-l$net"
11120                                                 case "$net" in
11121                                                 net)
11122                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11123                                                         sockethdr="-I/usr/netinclude"
11124                                                         ;;
11125                                                 esac
11126                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11127                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11128                                                         d_oldsock="$undef"
11129                                                 else
11130                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11131                                                         d_oldsock="$define"
11132                                                 fi
11133                                                 break
11134                                         fi
11135                                 fi
11136                         done
11137                         if test "X$d_socket" != "X$define"; then
11138                            echo "or anywhere else I see." >&4
11139                            d_socket="$undef"
11140                            d_oldsock="$undef"
11141                         fi
11142                 fi
11143         fi
11144 fi
11145
11146 : see if socketpair exists
11147 set socketpair d_sockpair
11148 eval $inlibc
11149
11150
11151 echo " "
11152 echo "Checking the availability of certain socket constants..." >&4
11153 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11154         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11155         $cat >try.c <<EOF
11156 #include <sys/types.h>
11157 #include <sys/socket.h>
11158 int main() {
11159     int i = $ENUM;
11160 }
11161 EOF
11162         val="$undef"
11163         set try; if eval $compile; then
11164                 val="$define"
11165         fi
11166         set d_${enum}; eval $setvar
11167         $rm_try
11168 done
11169
11170 : see if this is a sys/uio.h system
11171 set sys/uio.h i_sysuio
11172 eval $inhdr
11173
11174 : Check for cmsghdr support
11175 echo " "
11176 echo "Checking to see if your system supports struct cmsghdr..." >&4
11177 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11178 eval $hasstruct
11179 case "$d_cmsghdr_s" in
11180 "$define")      echo "Yes, it does."   ;;
11181 *)              echo "No, it doesn't." ;;
11182 esac
11183
11184
11185 : check for const keyword
11186 echo " "
11187 echo 'Checking to see if your C compiler knows about "const"...' >&4
11188 $cat >const.c <<'EOCP'
11189 typedef struct spug { int drokk; } spug;
11190 int main()
11191 {
11192         const char *foo;
11193         const spug y = { 0 };
11194 }
11195 EOCP
11196 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11197         val="$define"
11198         echo "Yup, it does."
11199 else
11200         val="$undef"
11201         echo "Nope, it doesn't."
11202 fi
11203 set d_const
11204 eval $setvar
11205
11206 : see if copysignl exists
11207 set copysignl d_copysignl
11208 eval $inlibc
11209
11210 : see if crypt exists
11211 echo " "
11212 set crypt d_crypt
11213 eval $inlibc
11214 case "$d_crypt" in
11215 $define) cryptlib='' ;;
11216 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11217                 echo 'crypt() found.' >&4
11218                 val="$define"
11219                 cryptlib=''
11220         else
11221                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11222                 if $test -z "$cryptlib"; then
11223                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11224                 else
11225                         cryptlib=-lcrypt
11226                 fi
11227                 if $test -z "$cryptlib"; then
11228                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11229                 else
11230                         cryptlib=-lcrypt
11231                 fi
11232                 if $test -z "$cryptlib"; then
11233                         cryptlib=`./loc libcrypt$_a "" $libpth`
11234                 else
11235                         cryptlib=-lcrypt
11236                 fi
11237                 if $test -z "$cryptlib"; then
11238                         echo 'crypt() NOT found.' >&4
11239                         val="$undef"
11240                 else
11241                         val="$define"
11242                 fi
11243         fi
11244         set d_crypt
11245         eval $setvar
11246         ;;
11247 esac
11248
11249 : see if this is a crypt.h system
11250 set crypt.h i_crypt
11251 eval $inhdr
11252
11253 : see if crypt_r exists
11254 set crypt_r d_crypt_r
11255 eval $inlibc
11256 case "$d_crypt_r" in
11257 "$define")
11258         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11259         case "$d_crypt_r_proto:$usethreads" in
11260         ":define")      d_crypt_r_proto=define
11261                 set d_crypt_r_proto crypt_r $hdrs
11262                 eval $hasproto ;;
11263         *)      ;;
11264         esac
11265         case "$d_crypt_r_proto" in
11266         define)
11267         case "$crypt_r_proto" in
11268         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11269         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11270         esac
11271         case "$crypt_r_proto" in
11272         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11273         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11274         esac
11275         case "$crypt_r_proto" in
11276         ''|0)   d_crypt_r=undef
11277                 crypt_r_proto=0
11278                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11279         * )     case "$crypt_r_proto" in
11280                 REENTRANT_PROTO*) ;;
11281                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11282                 esac
11283                 echo "Prototype: $try" ;;
11284         esac
11285         ;;
11286         *)      case "$usethreads" in
11287                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11288                 esac
11289                 d_crypt_r=undef
11290                 crypt_r_proto=0
11291                 ;;
11292         esac
11293         ;;
11294 *)      crypt_r_proto=0
11295         ;;
11296 esac
11297
11298 : get csh whereabouts
11299 case "$csh" in
11300 'csh') val="$undef" ;;
11301 *) val="$define" ;;
11302 esac
11303 set d_csh
11304 eval $setvar
11305 : Respect a hint or command line value for full_csh.
11306 case "$full_csh" in
11307 '') full_csh=$csh ;;
11308 esac
11309
11310 : see if ctermid exists
11311 set ctermid d_ctermid
11312 eval $inlibc
11313
11314 : see if ctermid_r exists
11315 set ctermid_r d_ctermid_r
11316 eval $inlibc
11317 case "$d_ctermid_r" in
11318 "$define")
11319         hdrs="$i_systypes sys/types.h define stdio.h "
11320         case "$d_ctermid_r_proto:$usethreads" in
11321         ":define")      d_ctermid_r_proto=define
11322                 set d_ctermid_r_proto ctermid_r $hdrs
11323                 eval $hasproto ;;
11324         *)      ;;
11325         esac
11326         case "$d_ctermid_r_proto" in
11327         define)
11328         case "$ctermid_r_proto" in
11329         ''|0) try='char* ctermid_r(char*);'
11330         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11331         esac
11332         case "$ctermid_r_proto" in
11333         ''|0)   d_ctermid_r=undef
11334                 ctermid_r_proto=0
11335                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11336         * )     case "$ctermid_r_proto" in
11337                 REENTRANT_PROTO*) ;;
11338                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11339                 esac
11340                 echo "Prototype: $try" ;;
11341         esac
11342         ;;
11343         *)      case "$usethreads" in
11344                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11345                 esac
11346                 d_ctermid_r=undef
11347                 ctermid_r_proto=0
11348                 ;;
11349         esac
11350         ;;
11351 *)      ctermid_r_proto=0
11352         ;;
11353 esac
11354
11355 : see if ctime_r exists
11356 set ctime_r d_ctime_r
11357 eval $inlibc
11358 case "$d_ctime_r" in
11359 "$define")
11360         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11361         case "$d_ctime_r_proto:$usethreads" in
11362         ":define")      d_ctime_r_proto=define
11363                 set d_ctime_r_proto ctime_r $hdrs
11364                 eval $hasproto ;;
11365         *)      ;;
11366         esac
11367         case "$d_ctime_r_proto" in
11368         define)
11369         case "$ctime_r_proto" in
11370         ''|0) try='char* ctime_r(const time_t*, char*);'
11371         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11372         esac
11373         case "$ctime_r_proto" in
11374         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11375         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11376         esac
11377         case "$ctime_r_proto" in
11378         ''|0) try='int ctime_r(const time_t*, char*);'
11379         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11380         esac
11381         case "$ctime_r_proto" in
11382         ''|0) try='int ctime_r(const time_t*, char*, int);'
11383         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11384         esac
11385         case "$ctime_r_proto" in
11386         ''|0)   d_ctime_r=undef
11387                 ctime_r_proto=0
11388                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11389         * )     case "$ctime_r_proto" in
11390                 REENTRANT_PROTO*) ;;
11391                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11392                 esac
11393                 echo "Prototype: $try" ;;
11394         esac
11395         ;;
11396         *)      case "$usethreads" in
11397                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11398                 esac
11399                 d_ctime_r=undef
11400                 ctime_r_proto=0
11401                 ;;
11402         esac
11403         ;;
11404 *)      ctime_r_proto=0
11405         ;;
11406 esac
11407
11408 : see if cuserid exists
11409 set cuserid d_cuserid
11410 eval $inlibc
11411
11412 : see if this is a limits.h system
11413 set limits.h i_limits
11414 eval $inhdr
11415
11416 : see if this is a float.h system
11417 set float.h i_float
11418 eval $inhdr
11419
11420 : See if number of significant digits in a double precision number is known
11421 echo " "
11422 $cat >dbl_dig.c <<EOM
11423 #$i_limits I_LIMITS
11424 #$i_float I_FLOAT
11425 #ifdef I_LIMITS
11426 #include <limits.h>
11427 #endif
11428 #ifdef I_FLOAT
11429 #include <float.h>
11430 #endif
11431 #ifdef DBL_DIG
11432 printf("Contains DBL_DIG");
11433 #endif
11434 EOM
11435 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11436 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11437         echo "DBL_DIG found." >&4
11438         val="$define"
11439 else
11440         echo "DBL_DIG NOT found." >&4
11441         val="$undef"
11442 fi
11443 $rm -f dbl_dig.?
11444 set d_dbl_dig
11445 eval $setvar
11446
11447 : see if dbm.h is available
11448 : see if dbmclose exists
11449 set dbmclose d_dbmclose
11450 eval $inlibc
11451
11452 case "$d_dbmclose" in
11453 $define)
11454         set dbm.h i_dbm
11455         eval $inhdr
11456         case "$i_dbm" in
11457         $define)
11458                 val="$undef"
11459                 set i_rpcsvcdbm
11460                 eval $setvar
11461                 ;;
11462         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11463                 eval $inhdr
11464                 ;;
11465         esac
11466         ;;
11467 *)      echo "We won't be including <dbm.h>"
11468         val="$undef"
11469         set i_dbm
11470         eval $setvar
11471         val="$undef"
11472         set i_rpcsvcdbm
11473         eval $setvar
11474         ;;
11475 esac
11476
11477 : see if prototype for dbminit is available
11478 echo " "
11479 set d_dbminitproto dbminit $i_dbm dbm.h
11480 eval $hasproto
11481
11482 : see if difftime exists
11483 set difftime d_difftime
11484 eval $inlibc
11485
11486 : see if this is a dirent system
11487 echo " "
11488 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11489         val="$define"
11490         echo "<dirent.h> found." >&4
11491 else
11492         val="$undef"
11493         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11494                 echo "<sys/dir.h> found." >&4
11495                 echo " "
11496         else
11497                 xinc=`./findhdr sys/ndir.h`
11498         fi
11499         echo "<dirent.h> NOT found." >&4
11500 fi
11501 set i_dirent
11502 eval $setvar
11503
11504 : Look for type of directory structure.
11505 echo " "
11506 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11507
11508 case "$direntrytype" in
11509 ''|' ')
11510         case "$i_dirent" in
11511         $define) guess1='struct dirent' ;;
11512         *) guess1='struct direct'  ;;
11513         esac
11514         ;;
11515 *)      guess1="$direntrytype"
11516         ;;
11517 esac
11518
11519 case "$guess1" in
11520 'struct dirent') guess2='struct direct' ;;
11521 *) guess2='struct dirent' ;;
11522 esac
11523
11524 if $contains "$guess1" try.c >/dev/null 2>&1; then
11525         direntrytype="$guess1"
11526         echo "Your directory entries are $direntrytype." >&4
11527 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11528         direntrytype="$guess2"
11529         echo "Your directory entries seem to be $direntrytype." >&4
11530 else
11531         echo "I don't recognize your system's directory entries." >&4
11532         rp="What type is used for directory entries on this system?"
11533         dflt="$guess1"
11534         . ./myread
11535         direntrytype="$ans"
11536 fi
11537 $rm_try
11538
11539 : see if the directory entry stores field length
11540 echo " "
11541 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11542 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11543         echo "Good, your directory entry keeps length information in d_namlen." >&4
11544         val="$define"
11545 else
11546         echo "Your directory entry does not know about the d_namlen field." >&4
11547         val="$undef"
11548 fi
11549 set d_dirnamlen
11550 eval $setvar
11551 $rm_try
11552
11553 : Look for DIR.dd_fd
11554 case "$i_dirent" in
11555 "$define")
11556     echo "Checking to see if DIR has a dd_fd member variable" >&4
11557     $cat >try.c <<EOCP
11558 #$i_stdlib I_STDLIB
11559 #ifdef I_STDLIB
11560 #include <stdlib.h>
11561 #endif
11562 #include <dirent.h>
11563
11564 int main() {
11565     DIR dir;
11566     dir.dd_fd = 1;
11567     return 0;
11568 }
11569 EOCP
11570     val=$undef
11571     set try
11572     if eval $compile; then
11573         echo "Yes, it does."
11574         val="$define"
11575     else
11576         echo "No, it does not."
11577         val="$undef"
11578     fi
11579     ;;
11580 *)
11581     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11582     val="$undef"
11583     ;;
11584 esac
11585 set d_dir_dd_fd
11586 eval $setvar
11587 $rm_try
11588
11589 : see if this is an sysdir system
11590 set sys/dir.h i_sysdir
11591 eval $inhdr
11592
11593 : see if this is an sysndir system
11594 set sys/ndir.h i_sysndir
11595 eval $inhdr
11596
11597 : Look for dirfd
11598 echo " "
11599 $cat >dirfd.c <<EOM
11600 #include <stdio.h>
11601 #$i_stdlib I_STDLIB
11602 #ifdef I_STDLIB
11603 #include <stdlib.h>
11604 #endif
11605 #$i_dirent I_DIRENT             /**/
11606 #$i_sysdir I_SYS_DIR            /**/
11607 #$i_sysndir I_SYS_NDIR          /**/
11608 #$i_systypes I_SYS_TYPES        /**/
11609 #if defined(I_SYS_TYPES)
11610 #include <sys/types.h>
11611 #endif
11612 #if defined(I_DIRENT)
11613 #include <dirent.h>
11614 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11615 #include <sys/dir.h>
11616 #endif
11617 #else
11618 #ifdef I_SYS_NDIR
11619 #include <sys/ndir.h>
11620 #else
11621 #ifdef I_SYS_DIR
11622 #ifdef hp9000s500
11623 #include <ndir.h>       /* may be wrong in the future */
11624 #else
11625 #include <sys/dir.h>
11626 #endif
11627 #endif
11628 #endif
11629 #endif 
11630 int main() {
11631         DIR *dirp = opendir(".");
11632         if (dirfd(dirp) >= 0)
11633                 exit(0);
11634         else
11635                 exit(1);
11636 }
11637 EOM
11638 val=$undef
11639 set dirfd
11640 if eval $compile; then
11641         val="$define"
11642 fi
11643 case "$val" in
11644 $define)        echo "dirfd() found." >&4       ;;
11645 *)              echo "dirfd() NOT found." >&4   ;;
11646 esac
11647 set d_dirfd
11648 eval $setvar
11649 $rm -f dirfd*
11650
11651 : see if dlerror exists
11652 xxx_runnm="$runnm"
11653 runnm=false
11654 set dlerror d_dlerror
11655 eval $inlibc
11656 runnm="$xxx_runnm"
11657
11658 : see if dlfcn is available
11659 set dlfcn.h i_dlfcn
11660 eval $inhdr
11661
11662 : Check what extension to use for shared libs
11663 case "$usedl" in
11664 $define|y|true)
11665         $cat << EOM
11666
11667 On a few systems, the dynamically loaded modules that perl generates and uses
11668 will need a different extension than shared libs. The default will probably
11669 be appropriate.
11670
11671 EOM
11672         case "$dlext" in
11673         '')     dflt="$so" ;;
11674         *)      dflt="$dlext" ;;
11675         esac
11676         rp='What is the extension of dynamically loaded modules'
11677         . ./myread
11678         dlext="$ans"
11679         ;;
11680 *)
11681         dlext="none"
11682         ;;
11683 esac
11684
11685 : Check if dlsym need a leading underscore
11686 echo " "
11687 val="$undef"
11688
11689 case "$dlsrc" in
11690 dl_dlopen.xs)
11691         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11692         $cat >dyna.c <<'EOM'
11693 fred () { }
11694 EOM
11695
11696 $cat >fred.c<<EOM
11697
11698 #include <stdio.h>
11699 #$i_stdlib I_STDLIB
11700 #ifdef I_STDLIB
11701 #include <stdlib.h>
11702 #endif
11703 #$i_dlfcn I_DLFCN
11704 #ifdef I_DLFCN
11705 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11706 #else
11707 #include <sys/types.h>
11708 #include <nlist.h>
11709 #include <link.h>
11710 #endif
11711
11712 extern int fred() ;
11713
11714 int main()
11715 {
11716     void * handle ;
11717     void * symbol ;
11718 #ifndef RTLD_LAZY
11719     int mode = 1 ;
11720 #else
11721     int mode = RTLD_LAZY ;
11722 #endif
11723     handle = dlopen("./dyna.$dlext", mode) ;
11724     if (handle == NULL) {
11725         printf ("1\n") ;
11726         fflush (stdout) ;
11727         exit(0);
11728     }
11729     symbol = dlsym(handle, "fred") ;
11730     if (symbol == NULL) {
11731         /* try putting a leading underscore */
11732         symbol = dlsym(handle, "_fred") ;
11733         if (symbol == NULL) {
11734             printf ("2\n") ;
11735             fflush (stdout) ;
11736             exit(0);
11737         }
11738         printf ("3\n") ;
11739     }
11740     else
11741         printf ("4\n") ;
11742     fflush (stdout) ;
11743     exit(0);
11744 }
11745 EOM
11746         : Call the object file tmp-dyna.o in case dlext=o.
11747         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11748                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11749                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11750                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11751                 xxx=`$run ./fred`
11752                 case $xxx in
11753                 1)      echo "Test program failed using dlopen." >&4
11754                         echo "Perhaps you should not use dynamic loading." >&4;;
11755                 2)      echo "Test program failed using dlsym." >&4
11756                         echo "Perhaps you should not use dynamic loading." >&4;;
11757                 3)      echo "dlsym needs a leading underscore" >&4
11758                         val="$define" ;;
11759                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11760                 esac
11761         else
11762                 echo "I can't compile and run the test program." >&4
11763                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11764         fi
11765         ;;
11766 esac
11767
11768 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11769
11770 set d_dlsymun
11771 eval $setvar
11772
11773 : see if drand48_r exists
11774 set drand48_r d_drand48_r
11775 eval $inlibc
11776 case "$d_drand48_r" in
11777 "$define")
11778         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11779         case "$d_drand48_r_proto:$usethreads" in
11780         ":define")      d_drand48_r_proto=define
11781                 set d_drand48_r_proto drand48_r $hdrs
11782                 eval $hasproto ;;
11783         *)      ;;
11784         esac
11785         case "$d_drand48_r_proto" in
11786         define)
11787         case "$drand48_r_proto" in
11788         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11789         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11790         esac
11791         case "$drand48_r_proto" in
11792         ''|0)   d_drand48_r=undef
11793                 drand48_r_proto=0
11794                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11795         * )     case "$drand48_r_proto" in
11796                 REENTRANT_PROTO*) ;;
11797                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11798                 esac
11799                 echo "Prototype: $try" ;;
11800         esac
11801         ;;
11802         *)      case "$usethreads" in
11803                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11804                 esac
11805                 d_drand48_r=undef
11806                 drand48_r_proto=0
11807                 ;;
11808         esac
11809         ;;
11810 *)      drand48_r_proto=0
11811         ;;
11812 esac
11813
11814 : see if prototype for drand48 is available
11815 echo " "
11816 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11817 eval $hasproto
11818
11819 : see if dup2 exists
11820 set dup2 d_dup2
11821 eval $inlibc
11822
11823 : see if eaccess exists
11824 set eaccess d_eaccess
11825 eval $inlibc
11826
11827 : see if endgrent exists
11828 set endgrent d_endgrent
11829 eval $inlibc
11830
11831 : see if this is an grp system
11832 set grp.h i_grp
11833 eval $inhdr
11834
11835 case "$i_grp" in
11836 $define)
11837         xxx=`./findhdr grp.h`
11838         $cppstdin $cppflags $cppminus < $xxx >$$.h
11839
11840         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11841                 val="$define"
11842         else
11843                 val="$undef"
11844         fi
11845         set d_grpasswd
11846         eval $setvar
11847
11848         $rm -f $$.h
11849         ;;
11850 *)
11851         val="$undef";
11852         set d_grpasswd; eval $setvar
11853         ;;
11854 esac
11855
11856 : see if endgrent_r exists
11857 set endgrent_r d_endgrent_r
11858 eval $inlibc
11859 case "$d_endgrent_r" in
11860 "$define")
11861         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11862         case "$d_endgrent_r_proto:$usethreads" in
11863         ":define")      d_endgrent_r_proto=define
11864                 set d_endgrent_r_proto endgrent_r $hdrs
11865                 eval $hasproto ;;
11866         *)      ;;
11867         esac
11868         case "$d_endgrent_r_proto" in
11869         define)
11870         case "$endgrent_r_proto" in
11871         ''|0) try='int endgrent_r(FILE**);'
11872         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11873         esac
11874         case "$endgrent_r_proto" in
11875         ''|0) try='void endgrent_r(FILE**);'
11876         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11877         esac
11878         case "$endgrent_r_proto" in
11879         ''|0)   d_endgrent_r=undef
11880                 endgrent_r_proto=0
11881                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11882         * )     case "$endgrent_r_proto" in
11883                 REENTRANT_PROTO*) ;;
11884                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11885                 esac
11886                 echo "Prototype: $try" ;;
11887         esac
11888         ;;
11889         *)      case "$usethreads" in
11890                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11891                 esac
11892                 d_endgrent_r=undef
11893                 endgrent_r_proto=0
11894                 ;;
11895         esac
11896         ;;
11897 *)      endgrent_r_proto=0
11898         ;;
11899 esac
11900
11901 : see if endhostent exists
11902 set endhostent d_endhent
11903 eval $inlibc
11904
11905 : see if this is a netdb.h system
11906 set netdb.h i_netdb
11907 eval $inhdr
11908
11909 : see if endhostent_r exists
11910 set endhostent_r d_endhostent_r
11911 eval $inlibc
11912 case "$d_endhostent_r" in
11913 "$define")
11914         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11915         case "$d_endhostent_r_proto:$usethreads" in
11916         ":define")      d_endhostent_r_proto=define
11917                 set d_endhostent_r_proto endhostent_r $hdrs
11918                 eval $hasproto ;;
11919         *)      ;;
11920         esac
11921         case "$d_endhostent_r_proto" in
11922         define)
11923         case "$endhostent_r_proto" in
11924         ''|0) try='int endhostent_r(struct hostent_data*);'
11925         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11926         esac
11927         case "$endhostent_r_proto" in
11928         ''|0) try='void endhostent_r(struct hostent_data*);'
11929         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11930         esac
11931         case "$endhostent_r_proto" in
11932         ''|0)   d_endhostent_r=undef
11933                 endhostent_r_proto=0
11934                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11935         * )     case "$endhostent_r_proto" in
11936                 REENTRANT_PROTO*) ;;
11937                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11938                 esac
11939                 echo "Prototype: $try" ;;
11940         esac
11941         ;;
11942         *)      case "$usethreads" in
11943                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11944                 esac
11945                 d_endhostent_r=undef
11946                 endhostent_r_proto=0
11947                 ;;
11948         esac
11949         ;;
11950 *)      endhostent_r_proto=0
11951         ;;
11952 esac
11953
11954 : see if endnetent exists
11955 set endnetent d_endnent
11956 eval $inlibc
11957
11958 : see if endnetent_r exists
11959 set endnetent_r d_endnetent_r
11960 eval $inlibc
11961 case "$d_endnetent_r" in
11962 "$define")
11963         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11964         case "$d_endnetent_r_proto:$usethreads" in
11965         ":define")      d_endnetent_r_proto=define
11966                 set d_endnetent_r_proto endnetent_r $hdrs
11967                 eval $hasproto ;;
11968         *)      ;;
11969         esac
11970         case "$d_endnetent_r_proto" in
11971         define)
11972         case "$endnetent_r_proto" in
11973         ''|0) try='int endnetent_r(struct netent_data*);'
11974         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11975         esac
11976         case "$endnetent_r_proto" in
11977         ''|0) try='void endnetent_r(struct netent_data*);'
11978         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11979         esac
11980         case "$endnetent_r_proto" in
11981         ''|0)   d_endnetent_r=undef
11982                 endnetent_r_proto=0
11983                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11984         * )     case "$endnetent_r_proto" in
11985                 REENTRANT_PROTO*) ;;
11986                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11987                 esac
11988                 echo "Prototype: $try" ;;
11989         esac
11990         ;;
11991         *)      case "$usethreads" in
11992                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11993                 esac
11994                 d_endnetent_r=undef
11995                 endnetent_r_proto=0
11996                 ;;
11997         esac
11998         ;;
11999 *)      endnetent_r_proto=0
12000         ;;
12001 esac
12002
12003 : see if endprotoent exists
12004 set endprotoent d_endpent
12005 eval $inlibc
12006
12007 : see if endprotoent_r exists
12008 set endprotoent_r d_endprotoent_r
12009 eval $inlibc
12010 case "$d_endprotoent_r" in
12011 "$define")
12012         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12013         case "$d_endprotoent_r_proto:$usethreads" in
12014         ":define")      d_endprotoent_r_proto=define
12015                 set d_endprotoent_r_proto endprotoent_r $hdrs
12016                 eval $hasproto ;;
12017         *)      ;;
12018         esac
12019         case "$d_endprotoent_r_proto" in
12020         define)
12021         case "$endprotoent_r_proto" in
12022         ''|0) try='int endprotoent_r(struct protoent_data*);'
12023         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12024         esac
12025         case "$endprotoent_r_proto" in
12026         ''|0) try='void endprotoent_r(struct protoent_data*);'
12027         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12028         esac
12029         case "$endprotoent_r_proto" in
12030         ''|0)   d_endprotoent_r=undef
12031                 endprotoent_r_proto=0
12032                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12033         * )     case "$endprotoent_r_proto" in
12034                 REENTRANT_PROTO*) ;;
12035                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12036                 esac
12037                 echo "Prototype: $try" ;;
12038         esac
12039         ;;
12040         *)      case "$usethreads" in
12041                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12042                 esac
12043                 d_endprotoent_r=undef
12044                 endprotoent_r_proto=0
12045                 ;;
12046         esac
12047         ;;
12048 *)      endprotoent_r_proto=0
12049         ;;
12050 esac
12051
12052 : see if endpwent exists
12053 set endpwent d_endpwent
12054 eval $inlibc
12055
12056 : see if this is a pwd.h system
12057 set pwd.h i_pwd
12058 eval $inhdr
12059
12060 case "$i_pwd" in
12061 $define)
12062         xxx=`./findhdr pwd.h`
12063         $cppstdin $cppflags $cppminus < $xxx >$$.h
12064
12065         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12066                 val="$define"
12067         else
12068                 val="$undef"
12069         fi
12070         set d_pwquota
12071         eval $setvar
12072
12073         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12074                 val="$define"
12075         else
12076                 val="$undef"
12077         fi
12078         set d_pwage
12079         eval $setvar
12080
12081         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12082                 val="$define"
12083         else
12084                 val="$undef"
12085         fi
12086         set d_pwchange
12087         eval $setvar
12088
12089         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12090                 val="$define"
12091         else
12092                 val="$undef"
12093         fi
12094         set d_pwclass
12095         eval $setvar
12096
12097         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12098                 val="$define"
12099         else
12100                 val="$undef"
12101         fi
12102         set d_pwexpire
12103         eval $setvar
12104
12105         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12106                 val="$define"
12107         else
12108                 val="$undef"
12109         fi
12110         set d_pwcomment
12111         eval $setvar
12112
12113         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12114                 val="$define"
12115         else
12116                 val="$undef"
12117         fi
12118         set d_pwgecos
12119         eval $setvar
12120
12121         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12122                 val="$define"
12123         else
12124                 val="$undef"
12125         fi
12126         set d_pwpasswd
12127         eval $setvar
12128
12129         $rm -f $$.h
12130         ;;
12131 *)
12132         val="$undef"; 
12133         set d_pwquota; eval $setvar
12134         set d_pwage; eval $setvar
12135         set d_pwchange; eval $setvar
12136         set d_pwclass; eval $setvar
12137         set d_pwexpire; eval $setvar
12138         set d_pwcomment; eval $setvar
12139         set d_pwgecos; eval $setvar
12140         set d_pwpasswd; eval $setvar
12141         ;;
12142 esac
12143
12144 : see if endpwent_r exists
12145 set endpwent_r d_endpwent_r
12146 eval $inlibc
12147 case "$d_endpwent_r" in
12148 "$define")
12149         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12150         case "$d_endpwent_r_proto:$usethreads" in
12151         ":define")      d_endpwent_r_proto=define
12152                 set d_endpwent_r_proto endpwent_r $hdrs
12153                 eval $hasproto ;;
12154         *)      ;;
12155         esac
12156         case "$d_endpwent_r_proto" in
12157         define)
12158         case "$endpwent_r_proto" in
12159         ''|0) try='int endpwent_r(FILE**);'
12160         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12161         esac
12162         case "$endpwent_r_proto" in
12163         ''|0) try='void endpwent_r(FILE**);'
12164         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12165         esac
12166         case "$endpwent_r_proto" in
12167         ''|0)   d_endpwent_r=undef
12168                 endpwent_r_proto=0
12169                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12170         * )     case "$endpwent_r_proto" in
12171                 REENTRANT_PROTO*) ;;
12172                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12173                 esac
12174                 echo "Prototype: $try" ;;
12175         esac
12176         ;;
12177         *)      case "$usethreads" in
12178                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12179                 esac
12180                 d_endpwent_r=undef
12181                 endpwent_r_proto=0
12182                 ;;
12183         esac
12184         ;;
12185 *)      endpwent_r_proto=0
12186         ;;
12187 esac
12188
12189 : see if endservent exists
12190 set endservent d_endsent
12191 eval $inlibc
12192
12193 : see if endservent_r exists
12194 set endservent_r d_endservent_r
12195 eval $inlibc
12196 case "$d_endservent_r" in
12197 "$define")
12198         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12199         case "$d_endservent_r_proto:$usethreads" in
12200         ":define")      d_endservent_r_proto=define
12201                 set d_endservent_r_proto endservent_r $hdrs
12202                 eval $hasproto ;;
12203         *)      ;;
12204         esac
12205         case "$d_endservent_r_proto" in
12206         define)
12207         case "$endservent_r_proto" in
12208         ''|0) try='int endservent_r(struct servent_data*);'
12209         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12210         esac
12211         case "$endservent_r_proto" in
12212         ''|0) try='void endservent_r(struct servent_data*);'
12213         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12214         esac
12215         case "$endservent_r_proto" in
12216         ''|0)   d_endservent_r=undef
12217                 endservent_r_proto=0
12218                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12219         * )     case "$endservent_r_proto" in
12220                 REENTRANT_PROTO*) ;;
12221                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12222                 esac
12223                 echo "Prototype: $try" ;;
12224         esac
12225         ;;
12226         *)      case "$usethreads" in
12227                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12228                 esac
12229                 d_endservent_r=undef
12230                 endservent_r_proto=0
12231                 ;;
12232         esac
12233         ;;
12234 *)      endservent_r_proto=0
12235         ;;
12236 esac
12237
12238 : Locate the flags for 'open()'
12239 echo " "
12240 $cat >try.c <<EOCP
12241 #include <sys/types.h>
12242 #ifdef I_FCNTL
12243 #include <fcntl.h>
12244 #endif
12245 #ifdef I_SYS_FILE
12246 #include <sys/file.h>
12247 #endif
12248 #$i_stdlib I_STDLIB
12249 #ifdef I_STDLIB
12250 #include <stdlib.h>
12251 #endif
12252 int main() {
12253         if(O_RDONLY);
12254 #ifdef O_TRUNC
12255         exit(0);
12256 #else
12257         exit(1);
12258 #endif
12259 }
12260 EOCP
12261 : check sys/file.h first to get FREAD on Sun
12262 if $test `./findhdr sys/file.h` && \
12263                 set try -DI_SYS_FILE && eval $compile; then
12264         h_sysfile=true;
12265         echo "<sys/file.h> defines the O_* constants..." >&4
12266         if $run ./try; then
12267                 echo "and you have the 3 argument form of open()." >&4
12268                 val="$define"
12269         else
12270                 echo "but not the 3 argument form of open().  Oh, well." >&4
12271                 val="$undef"
12272         fi
12273 elif $test `./findhdr fcntl.h` && \
12274                 set try -DI_FCNTL && eval $compile; then
12275         h_fcntl=true;
12276         echo "<fcntl.h> defines the O_* constants..." >&4
12277         if $run ./try; then
12278                 echo "and you have the 3 argument form of open()." >&4
12279                 val="$define"
12280         else
12281                 echo "but not the 3 argument form of open().  Oh, well." >&4
12282                 val="$undef"
12283         fi
12284 else
12285         val="$undef"
12286         echo "I can't find the O_* constant definitions!  You got problems." >&4
12287 fi
12288 set d_open3
12289 eval $setvar
12290 $rm_try
12291
12292 : script used to emit important warnings
12293 cat >warn <<EOS
12294 $startsh
12295 if test \$# -gt 0; then
12296         echo "\$@" >msg
12297 else
12298         cat >msg
12299 fi
12300 echo "*** WARNING:" >&4
12301 sed -e 's/^/*** /' <msg >&4
12302 echo "*** " >&4
12303 cat msg >>config.msg
12304 echo " " >>config.msg
12305 rm -f msg
12306 EOS
12307 chmod +x warn
12308 $eunicefix warn
12309
12310 : see which of string.h or strings.h is needed
12311 echo " "
12312 strings=`./findhdr string.h`
12313 if $test "$strings" && $test -r "$strings"; then
12314         echo "Using <string.h> instead of <strings.h>." >&4
12315         val="$define"
12316 else
12317         val="$undef"
12318         strings=`./findhdr strings.h`
12319         if $test "$strings" && $test -r "$strings"; then
12320                 echo "Using <strings.h> instead of <string.h>." >&4
12321         else
12322                 ./warn "No string header found -- You'll surely have problems."
12323         fi
12324 fi
12325 set i_string
12326 eval $setvar
12327 case "$i_string" in
12328 "$undef") strings=`./findhdr strings.h`;;
12329 *)        strings=`./findhdr string.h`;;
12330 esac
12331
12332 : see if this is a sys/file.h system
12333 val=''
12334 set sys/file.h val
12335 eval $inhdr
12336
12337 : do we need to include sys/file.h ?
12338 case "$val" in
12339 "$define")
12340         echo " "
12341         if $h_sysfile; then
12342                 val="$define"
12343                 echo "We'll be including <sys/file.h>." >&4
12344         else
12345                 val="$undef"
12346                 echo "We won't be including <sys/file.h>." >&4
12347         fi
12348         ;;
12349 *)
12350         h_sysfile=false
12351         ;;
12352 esac
12353 set i_sysfile
12354 eval $setvar
12355
12356 : see if fcntl.h is there
12357 val=''
12358 set fcntl.h val
12359 eval $inhdr
12360
12361 : see if we can include fcntl.h
12362 case "$val" in
12363 "$define")
12364         echo " "
12365         if $h_fcntl; then
12366                 val="$define"
12367                 echo "We'll be including <fcntl.h>." >&4
12368         else
12369                 val="$undef"
12370                 if $h_sysfile; then
12371         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12372                 else
12373                         echo "We won't be including <fcntl.h>." >&4
12374                 fi
12375         fi
12376         ;;
12377 *)
12378         h_fcntl=false
12379         val="$undef"
12380         ;;
12381 esac
12382 set i_fcntl
12383 eval $setvar
12384
12385 : see if fork exists
12386 set fork d_fork
12387 eval $inlibc
12388
12389 : see if pipe exists
12390 set pipe d_pipe
12391 eval $inlibc
12392
12393 : check for non-blocking I/O stuff
12394 case "$h_sysfile" in
12395 true) echo "#include <sys/file.h>" > head.c;;
12396 *)
12397        case "$h_fcntl" in
12398        true) echo "#include <fcntl.h>" > head.c;;
12399        *) echo "#include <sys/fcntl.h>" > head.c;;
12400        esac
12401        ;;
12402 esac
12403 echo " "
12404 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12405 case "$o_nonblock" in
12406 '')
12407         $cat head.c > try.c
12408         $cat >>try.c <<EOCP
12409 #include <stdio.h>
12410 #$i_stdlib I_STDLIB
12411 #ifdef I_STDLIB
12412 #include <stdlib.h>
12413 #endif
12414 #$i_fcntl I_FCNTL
12415 #ifdef I_FCNTL
12416 #include <fcntl.h>
12417 #endif
12418 int main() {
12419 #ifdef O_NONBLOCK
12420         printf("O_NONBLOCK\n");
12421         exit(0);
12422 #endif
12423 #ifdef O_NDELAY
12424         printf("O_NDELAY\n");
12425         exit(0);
12426 #endif
12427 #ifdef FNDELAY
12428         printf("FNDELAY\n");
12429         exit(0);
12430 #endif
12431         exit(0);
12432 }
12433 EOCP
12434         set try
12435         if eval $compile_ok; then
12436                 o_nonblock=`$run ./try`
12437                 case "$o_nonblock" in
12438                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12439                 *) echo "Seems like we can use $o_nonblock.";;
12440                 esac
12441         else
12442                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12443         fi
12444         ;;
12445 *) echo "Using $hint value $o_nonblock.";;
12446 esac
12447 $rm_try
12448
12449 echo " "
12450 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12451 case "$eagain" in
12452 '')
12453         case "$d_fork:$d_pipe" in
12454         define:define)
12455         $cat head.c > try.c
12456         $cat >>try.c <<EOCP
12457 #include <errno.h>
12458 #include <sys/types.h>
12459 #include <signal.h>
12460 #include <stdio.h>
12461 #$i_stdlib I_STDLIB
12462 #ifdef I_STDLIB
12463 #include <stdlib.h>
12464 #endif
12465 #$i_fcntl I_FCNTL
12466 #ifdef I_FCNTL
12467 #include <fcntl.h>
12468 #endif
12469 #define MY_O_NONBLOCK $o_nonblock
12470 #ifndef errno  /* XXX need better Configure test */
12471 extern int errno;
12472 #endif
12473 #$i_unistd I_UNISTD
12474 #ifdef I_UNISTD
12475 #include <unistd.h>
12476 #endif
12477 #$i_string I_STRING
12478 #ifdef I_STRING
12479 #include <string.h>
12480 #else
12481 #include <strings.h>
12482 #endif
12483 $signal_t blech(int x) { exit(3); }
12484 EOCP
12485         $cat >> try.c <<'EOCP'
12486 int main()
12487 {
12488         int pd[2];
12489         int pu[2];
12490         char buf[1];
12491         char string[100];
12492
12493         pipe(pd);       /* Down: child -> parent */
12494         pipe(pu);       /* Up: parent -> child */
12495         if (0 != fork()) {
12496                 int ret;
12497                 close(pd[1]);   /* Parent reads from pd[0] */
12498                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12499 #ifdef F_SETFL
12500                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12501                         exit(1);
12502 #else
12503                 exit(4);
12504 #endif
12505                 signal(SIGALRM, blech);
12506                 alarm(5);
12507                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12508                         exit(2);
12509                 sprintf(string, "%d\n", ret);
12510                 write(2, string, strlen(string));
12511                 alarm(0);
12512 #ifdef EAGAIN
12513                 if (errno == EAGAIN) {
12514                         printf("EAGAIN\n");
12515                         goto ok;
12516                 }
12517 #endif
12518 #ifdef EWOULDBLOCK
12519                 if (errno == EWOULDBLOCK)
12520                         printf("EWOULDBLOCK\n");
12521 #endif
12522         ok:
12523                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12524                 sleep(2);                               /* Give it time to close our pipe */
12525                 alarm(5);
12526                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12527                 alarm(0);
12528                 sprintf(string, "%d\n", ret);
12529                 write(4, string, strlen(string));
12530                 exit(0);
12531         }
12532
12533         close(pd[0]);                   /* We write to pd[1] */
12534         close(pu[1]);                   /* We read from pu[0] */
12535         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12536         close(pd[1]);                   /* Pipe pd is now fully closed! */
12537         exit(0);                                /* Bye bye, thank you for playing! */
12538 }
12539 EOCP
12540         set try
12541         if eval $compile_ok; then
12542                 echo "$startsh" >mtry
12543                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12544                 chmod +x mtry
12545                 ./mtry >/dev/null 2>&1
12546                 case $? in
12547                 0) eagain=`$cat try.out`;;
12548                 1) echo "Could not perform non-blocking setting!";;
12549                 2) echo "I did a successful read() for something that was not there!";;
12550                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12551                 4) echo "Could not find F_SETFL!";;
12552                 *) echo "Something terribly wrong happened during testing.";;
12553                 esac
12554                 rd_nodata=`$cat try.ret`
12555                 echo "A read() system call with no data present returns $rd_nodata."
12556                 case "$rd_nodata" in
12557                 0|-1) ;;
12558                 *)
12559                         echo "(That's peculiar, fixing that to be -1.)"
12560                         rd_nodata=-1
12561                         ;;
12562                 esac
12563                 case "$eagain" in
12564                 '')
12565                         echo "Forcing errno EAGAIN on read() with no data available."
12566                         eagain=EAGAIN
12567                         ;;
12568                 *)
12569                         echo "Your read() sets errno to $eagain when no data is available."
12570                         ;;
12571                 esac
12572                 status=`$cat try.err`
12573                 case "$status" in
12574                 0) echo "And it correctly returns 0 to signal EOF.";;
12575                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12576                 *) echo "However, your read() returns '$status' on EOF??";;
12577                 esac
12578                 val="$define"
12579                 if test "$status" = "$rd_nodata"; then
12580                         echo "WARNING: you can't distinguish between EOF and no data!"
12581                         val="$undef"
12582                 fi
12583         else
12584                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12585                 eagain=EAGAIN
12586         fi
12587         ;;
12588         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12589                 eagain=EAGAIN
12590                 val="$define"
12591                 ;;
12592         esac
12593         set d_eofnblk
12594         eval $setvar
12595         ;;
12596 *)
12597         echo "Using $hint value $eagain."
12598         echo "Your read() returns $rd_nodata when no data is present."
12599         case "$d_eofnblk" in
12600         "$define") echo "And you can see EOF because read() returns 0.";;
12601         "$undef") echo "But you can't see EOF status from read() returned value.";;
12602         *)
12603                 echo "(Assuming you can't see EOF status from read anyway.)"
12604                 d_eofnblk=$undef
12605                 ;;
12606         esac
12607         ;;
12608 esac
12609 $rm_try head.c mtry
12610
12611 : see if _ptr and _cnt from stdio act std
12612 echo " "
12613
12614 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12615         echo "(Looks like you have stdio.h from BSD.)"
12616         case "$stdio_ptr" in
12617         '') stdio_ptr='((fp)->_p)'
12618                 ptr_lval=$define
12619                 ;;
12620         *)      ptr_lval=$d_stdio_ptr_lval;;
12621         esac
12622         case "$stdio_cnt" in
12623         '') stdio_cnt='((fp)->_r)'
12624                 cnt_lval=$define
12625                 ;;
12626         *)      cnt_lval=$d_stdio_cnt_lval;;
12627         esac
12628         case "$stdio_base" in
12629         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12630         esac
12631         case "$stdio_bufsiz" in
12632         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12633         esac
12634 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12635         echo "(Looks like you have stdio.h from Linux.)"
12636         case "$stdio_ptr" in
12637         '') stdio_ptr='((fp)->_IO_read_ptr)'
12638                 ptr_lval=$define
12639                 ;;
12640         *)      ptr_lval=$d_stdio_ptr_lval;;
12641         esac
12642         case "$stdio_cnt" in
12643         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12644                 cnt_lval=$undef
12645                 ;;
12646         *)      cnt_lval=$d_stdio_cnt_lval;;
12647         esac
12648         case "$stdio_base" in
12649         '') stdio_base='((fp)->_IO_read_base)';;
12650         esac
12651         case "$stdio_bufsiz" in
12652         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12653         esac
12654 else
12655         case "$stdio_ptr" in
12656         '') stdio_ptr='((fp)->_ptr)'
12657                 ptr_lval=$define
12658                 ;;
12659         *)      ptr_lval=$d_stdio_ptr_lval;;
12660         esac
12661         case "$stdio_cnt" in
12662         '') stdio_cnt='((fp)->_cnt)'
12663                 cnt_lval=$define
12664                 ;;
12665         *)      cnt_lval=$d_stdio_cnt_lval;;
12666         esac
12667         case "$stdio_base" in
12668         '') stdio_base='((fp)->_base)';;
12669         esac
12670         case "$stdio_bufsiz" in
12671         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12672         esac
12673 fi
12674
12675 : test whether _ptr and _cnt really work
12676 echo "Checking how std your stdio is..." >&4
12677 $cat >try.c <<EOP
12678 #include <stdio.h>
12679 #$i_stdlib I_STDLIB
12680 #ifdef I_STDLIB
12681 #include <stdlib.h>
12682 #endif
12683 #define FILE_ptr(fp)    $stdio_ptr
12684 #define FILE_cnt(fp)    $stdio_cnt
12685 int main() {
12686         FILE *fp = fopen("try.c", "r");
12687         char c = getc(fp);
12688         if (
12689                 18 <= FILE_cnt(fp) &&
12690                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12691         )
12692                 exit(0);
12693         exit(1);
12694 }
12695 EOP
12696 val="$undef"
12697 set try
12698 if eval $compile && $to try.c; then
12699         if $run ./try; then
12700                 echo "Your stdio acts pretty std."
12701                 val="$define"
12702         else
12703                 echo "Your stdio isn't very std."
12704         fi
12705 else
12706         echo "Your stdio doesn't appear very std."
12707 fi
12708 $rm_try
12709
12710 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12711 # direct buffer manipulation no longer works.  The Configure tests
12712 # should be changed to correctly detect this, but until then,
12713 # the following check should at least let perl compile and run.
12714 # (This quick fix should be updated before 5.8.1.)
12715 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12716 # A. Dougherty, June 3, 2002.
12717 case "$d_gnulibc" in
12718 $define)
12719         case "$gnulibc_version" in
12720         2.[01]*)  ;;
12721         2.2) ;;
12722         2.2.[0-9]) ;;
12723         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12724                 val="$undef"
12725                 ;;
12726         esac
12727         ;;
12728 esac
12729 set d_stdstdio
12730 eval $setvar
12731
12732 : Can _ptr be used as an lvalue?
12733 case "$d_stdstdio$ptr_lval" in
12734 $define$define) val=$define ;;
12735 *) val=$undef ;;
12736 esac
12737 set d_stdio_ptr_lval
12738 eval $setvar
12739
12740 : Can _cnt be used as an lvalue?
12741 case "$d_stdstdio$cnt_lval" in
12742 $define$define) val=$define ;;
12743 *) val=$undef ;;
12744 esac
12745 set d_stdio_cnt_lval
12746 eval $setvar
12747
12748
12749 : test whether setting _ptr sets _cnt as a side effect
12750 d_stdio_ptr_lval_sets_cnt="$undef"
12751 d_stdio_ptr_lval_nochange_cnt="$undef"
12752 case "$d_stdio_ptr_lval$d_stdstdio" in
12753 $define$define)
12754         echo "Checking to see what happens if we set the stdio ptr..." >&4
12755 $cat >try.c <<EOP
12756 #include <stdio.h>
12757 /* Can we scream? */
12758 /* Eat dust sed :-) */
12759 /* In the buffer space, no one can hear you scream. */
12760 #$i_stdlib I_STDLIB
12761 #ifdef I_STDLIB
12762 #include <stdlib.h>
12763 #endif
12764 #define FILE_ptr(fp)    $stdio_ptr
12765 #define FILE_cnt(fp)    $stdio_cnt
12766 #include <sys/types.h>
12767 int main() {
12768         FILE *fp = fopen("try.c", "r");
12769         int c;
12770         char *ptr;
12771         size_t cnt;
12772         if (!fp) {
12773             puts("Fail even to read");
12774             exit(1);
12775         }
12776         c = getc(fp); /* Read away the first # */
12777         if (c == EOF) {
12778             puts("Fail even to read");
12779             exit(1);
12780         }
12781         if (!(
12782                 18 <= FILE_cnt(fp) &&
12783                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12784         )) {
12785                 puts("Fail even to read");
12786                 exit (1);
12787         }
12788         ptr = (char*) FILE_ptr(fp);
12789         cnt = (size_t)FILE_cnt(fp);
12790
12791         FILE_ptr(fp) += 42;
12792
12793         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12794                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12795                 exit (1);
12796         }
12797         if (FILE_cnt(fp) <= 20) {
12798                 printf ("Fail (<20 chars to test)");
12799                 exit (1);
12800         }
12801         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12802                 puts("Fail compare");
12803                 exit (1);
12804         }
12805         if (cnt == FILE_cnt(fp)) {
12806                 puts("Pass_unchanged");
12807                 exit (0);
12808         }
12809         if (FILE_cnt(fp) == (cnt - 42)) {
12810                 puts("Pass_changed");
12811                 exit (0);
12812         }
12813         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12814         return 1;
12815
12816 }
12817 EOP
12818         set try
12819         if eval $compile && $to try.c; then
12820                 case `$run ./try` in
12821                 Pass_changed)
12822                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12823                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12824                 Pass_unchanged)
12825                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12826                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12827                 Fail*)
12828                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12829                 *)
12830                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12831         esac
12832         else
12833                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12834         fi
12835         $rm_try
12836         ;;
12837 esac
12838
12839 : see if _base is also standard
12840 val="$undef"
12841 case "$d_stdstdio" in
12842 $define)
12843         $cat >try.c <<EOP
12844 #include <stdio.h>
12845 #$i_stdlib I_STDLIB
12846 #ifdef I_STDLIB
12847 #include <stdlib.h>
12848 #endif
12849 #define FILE_base(fp)   $stdio_base
12850 #define FILE_bufsiz(fp) $stdio_bufsiz
12851 int main() {
12852         FILE *fp = fopen("try.c", "r");
12853         char c = getc(fp);
12854         if (
12855                 19 <= FILE_bufsiz(fp) &&
12856                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12857         )
12858                 exit(0);
12859         exit(1);
12860 }
12861 EOP
12862         set try
12863         if eval $compile && $to try.c; then
12864                 if $run ./try; then
12865                         echo "And its _base field acts std."
12866                         val="$define"
12867                 else
12868                         echo "But its _base field isn't std."
12869                 fi
12870         else
12871                 echo "However, it seems to be lacking the _base field."
12872         fi
12873         $rm_try
12874         ;;
12875 esac
12876 set d_stdiobase
12877 eval $setvar
12878
12879 : see if fast_stdio exists
12880 val="$undef"
12881 case "$d_stdstdio:$d_stdio_ptr_lval" in
12882 "$define:$define")
12883         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12884         *$define*)
12885                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12886                 val="$define"
12887                 ;;
12888         esac
12889         ;;
12890 esac
12891 set d_faststdio
12892 eval $setvar
12893
12894
12895
12896 : see if fchdir exists
12897 set fchdir d_fchdir
12898 eval $inlibc
12899
12900 : see if fchmod exists
12901 set fchmod d_fchmod
12902 eval $inlibc
12903
12904 : see if fchown exists
12905 set fchown d_fchown
12906 eval $inlibc
12907
12908 : see if this is an fcntl system
12909 set fcntl d_fcntl
12910 eval $inlibc
12911
12912 : See if fcntl-based locking works.
12913 echo " "
12914 $cat >try.c <<EOCP
12915 #$i_stdlib I_STDLIB
12916 #ifdef I_STDLIB
12917 #include <stdlib.h>
12918 #endif
12919 #include <unistd.h>
12920 #include <fcntl.h>
12921 #include <signal.h>
12922 $signal_t blech(int x) { exit(3); }
12923 int main() {
12924 #if defined(F_SETLK) && defined(F_SETLKW)
12925      struct flock flock;
12926      int retval, fd;
12927      fd = open("try.c", O_RDONLY);
12928      flock.l_type = F_RDLCK;
12929      flock.l_whence = SEEK_SET;
12930      flock.l_start = flock.l_len = 0;
12931      signal(SIGALRM, blech);
12932      alarm(10);
12933      retval = fcntl(fd, F_SETLK, &flock);
12934      close(fd);
12935      (retval < 0 ? exit(2) : exit(0));
12936 #else
12937      exit(2);
12938 #endif
12939 }
12940 EOCP
12941 echo "Checking if fcntl-based file locking works... "
12942 case "$d_fcntl" in
12943 "$define")
12944         set try
12945         if eval $compile_ok; then
12946                 if $run ./try; then
12947                         echo "Yes, it seems to work."
12948                         val="$define"
12949                 else
12950                         echo "Nope, it didn't work."
12951                         val="$undef"
12952                         case "$?" in
12953                         3) $cat >&4 <<EOM
12954 ***
12955 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12956 *** This is (almost) impossible.
12957 *** If your NFS lock daemons are not feeling well, something like
12958 *** this may happen, please investigate.  Cannot continue, aborting.
12959 ***
12960 EOM
12961                                 exit 1
12962                                 ;;
12963                         esac
12964                 fi
12965         else
12966                 echo "I'm unable to compile the test program, so I'll assume not."
12967                 val="$undef"
12968         fi
12969         ;;
12970 *) val="$undef";
12971         echo "Nope, since you don't even have fcntl()."
12972         ;;
12973 esac
12974 set d_fcntl_can_lock
12975 eval $setvar
12976 $rm_try
12977
12978 : check for fd_set items
12979 $cat <<EOM
12980
12981 Checking to see how well your C compiler handles fd_set and friends ...
12982 EOM
12983 $cat >try.c <<EOCP
12984 #$i_stdlib I_STDLIB
12985 #ifdef I_STDLIB
12986 #include <stdlib.h>
12987 #endif
12988 #$i_systime I_SYS_TIME
12989 #$i_sysselct I_SYS_SELECT
12990 #$d_socket HAS_SOCKET
12991 #include <sys/types.h>
12992 #ifdef HAS_SOCKET
12993 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12994 #endif
12995 #ifdef I_SYS_TIME
12996 #include <sys/time.h>
12997 #endif
12998 #ifdef I_SYS_SELECT
12999 #include <sys/select.h>
13000 #endif
13001 int main() {
13002         fd_set fds;
13003
13004 #ifdef TRYBITS
13005         if(fds.fds_bits);
13006 #endif
13007
13008 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13009         exit(0);
13010 #else
13011         exit(1);
13012 #endif
13013 }
13014 EOCP
13015 set try -DTRYBITS
13016 if eval $compile; then
13017         d_fds_bits="$define"
13018         d_fd_set="$define"
13019         echo "Well, your system knows about the normal fd_set typedef..." >&4
13020         if $run ./try; then
13021                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13022                 d_fd_macros="$define"
13023         else
13024                 $cat >&4 <<'EOM'
13025 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13026 EOM
13027                 d_fd_macros="$undef"
13028         fi
13029 else
13030         $cat <<'EOM'
13031 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13032 EOM
13033         set try
13034         if eval $compile; then
13035                 d_fds_bits="$undef"
13036                 d_fd_set="$define"
13037                 echo "Well, your system has some sort of fd_set available..." >&4
13038                 if $run ./try; then
13039                         echo "and you have the normal fd_set macros." >&4
13040                         d_fd_macros="$define"
13041                 else
13042                         $cat <<'EOM'
13043 but not the normal fd_set macros!  Gross!  More work for me...
13044 EOM
13045                         d_fd_macros="$undef"
13046                 fi
13047         else
13048         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13049                 d_fd_set="$undef"
13050                 d_fds_bits="$undef"
13051                 d_fd_macros="$undef"
13052         fi
13053 fi
13054 $rm_try
13055
13056 : see if fgetpos exists
13057 set fgetpos d_fgetpos
13058 eval $inlibc
13059
13060 : see if finite exists
13061 set finite d_finite
13062 eval $inlibc
13063
13064 : see if finitel exists
13065 set finitel d_finitel
13066 eval $inlibc
13067
13068 : see if flock exists
13069 set flock d_flock
13070 eval $inlibc
13071
13072 : see if prototype for flock is available
13073 echo " "
13074 set d_flockproto flock $i_sysfile sys/file.h
13075 eval $hasproto
13076
13077 : see if fp_class exists
13078 set fp_class d_fp_class
13079 eval $inlibc
13080
13081 : see if pathconf exists
13082 set pathconf d_pathconf
13083 eval $inlibc
13084
13085 : see if fpathconf exists
13086 set fpathconf d_fpathconf
13087 eval $inlibc
13088
13089 : see if fpclass exists
13090 set fpclass d_fpclass
13091 eval $inlibc
13092
13093 : see if fpclassify exists
13094 set fpclassify d_fpclassify
13095 eval $inlibc
13096
13097 : see if fpclassl exists
13098 set fpclassl d_fpclassl
13099 eval $inlibc
13100
13101 : check for fpos64_t
13102 echo " "
13103 echo "Checking to see if you have fpos64_t..." >&4
13104 $cat >try.c <<EOCP
13105 #include <stdio.h>
13106 int main() { fpos64_t x = 7; }
13107 EOCP
13108 set try
13109 if eval $compile; then
13110         val="$define"
13111         echo "You have fpos64_t."
13112 else
13113         val="$undef"
13114         echo "You do not have fpos64_t."
13115         case "$fpossize" in
13116         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13117         esac
13118 fi
13119 $rm_try
13120 set d_fpos64_t
13121 eval $setvar
13122
13123 : see if frexpl exists
13124 set frexpl d_frexpl
13125 eval $inlibc
13126
13127 : see if this is a sys/param system
13128 set sys/param.h i_sysparam
13129 eval $inhdr
13130
13131 : see if this is a sys/mount.h system
13132 set sys/mount.h i_sysmount
13133 eval $inhdr
13134
13135 : Check for fs_data_s
13136 echo " "
13137 echo "Checking to see if your system supports struct fs_data..." >&4
13138 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13139 eval $hasstruct
13140 case "$d_fs_data_s" in
13141 "$define")      echo "Yes, it does."   ;;
13142 *)              echo "No, it doesn't." ;;
13143 esac
13144
13145 : see if fseeko exists
13146 set fseeko d_fseeko
13147 eval $inlibc
13148 case "$longsize" in
13149 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13150 esac
13151
13152 : see if fsetpos exists
13153 set fsetpos d_fsetpos
13154 eval $inlibc
13155
13156 : see if fstatfs exists
13157 set fstatfs d_fstatfs
13158 eval $inlibc
13159
13160 : see if statvfs exists
13161 set statvfs d_statvfs
13162 eval $inlibc
13163
13164 : see if fstatvfs exists
13165 set fstatvfs d_fstatvfs
13166 eval $inlibc
13167
13168
13169 : see if fsync exists
13170 set fsync d_fsync
13171 eval $inlibc
13172
13173 : see if ftello exists
13174 set ftello d_ftello
13175 eval $inlibc
13176 case "$longsize" in
13177 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13178 esac
13179
13180 : check for a working futimes
13181 d_futimes="$undef"
13182 echo " "
13183 echo "Checking if you have a working futimes()" >&4
13184 $cat >try.c <<EOCP
13185 #include <stdio.h>
13186 #include <sys/time.h>
13187 #include <errno.h>
13188 #include <fcntl.h>
13189
13190 int main ()
13191 {
13192     int fd, rv;
13193     fd = open ("try.c", O_RDWR);
13194     if (-1 == fd) exit (1);
13195     rv = futimes (fd, NULL);
13196     exit (rv == -1 ? errno : 0);
13197 }
13198 EOCP
13199 set try
13200 if eval $compile; then
13201     `$run ./try`
13202     rc=$?
13203     case "$rc" in
13204         0)  echo "Yes, you have" >&4
13205             d_futimes="$define"
13206             ;;
13207         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13208             ;;
13209     esac
13210 else
13211     echo "No, it does not (probably harmless)" >&4
13212 fi
13213 $rm_try
13214
13215 : see if getcwd exists
13216 set getcwd d_getcwd
13217 eval $inlibc
13218
13219 : see if getespwnam exists
13220 set getespwnam d_getespwnam
13221 eval $inlibc
13222
13223 : see if getfsstat exists
13224 set getfsstat d_getfsstat
13225 eval $inlibc
13226
13227 : see if getgrent exists
13228 set getgrent d_getgrent
13229 eval $inlibc
13230
13231 : see if getgrent_r exists
13232 set getgrent_r d_getgrent_r
13233 eval $inlibc
13234 case "$d_getgrent_r" in
13235 "$define")
13236         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13237         case "$d_getgrent_r_proto:$usethreads" in
13238         ":define")      d_getgrent_r_proto=define
13239                 set d_getgrent_r_proto getgrent_r $hdrs
13240                 eval $hasproto ;;
13241         *)      ;;
13242         esac
13243         case "$d_getgrent_r_proto" in
13244         define)
13245         case "$getgrent_r_proto" in
13246         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13247         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13248         esac
13249         case "$getgrent_r_proto" in
13250         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13251         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13252         esac
13253         case "$getgrent_r_proto" in
13254         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13255         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13256         esac
13257         case "$getgrent_r_proto" in
13258         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13259         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13260         esac
13261         case "$getgrent_r_proto" in
13262         ''|0) try='int getgrent_r(struct group*, char*, int);'
13263         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13264         esac
13265         case "$getgrent_r_proto" in
13266         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13267         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13268         esac
13269         case "$getgrent_r_proto" in
13270         ''|0)   d_getgrent_r=undef
13271                 getgrent_r_proto=0
13272                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13273         * )     case "$getgrent_r_proto" in
13274                 REENTRANT_PROTO*) ;;
13275                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13276                 esac
13277                 echo "Prototype: $try" ;;
13278         esac
13279         ;;
13280         *)      case "$usethreads" in
13281                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13282                 esac
13283                 d_getgrent_r=undef
13284                 getgrent_r_proto=0
13285                 ;;
13286         esac
13287         ;;
13288 *)      getgrent_r_proto=0
13289         ;;
13290 esac
13291
13292 : see if getgrgid_r exists
13293 set getgrgid_r d_getgrgid_r
13294 eval $inlibc
13295 case "$d_getgrgid_r" in
13296 "$define")
13297         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13298         case "$d_getgrgid_r_proto:$usethreads" in
13299         ":define")      d_getgrgid_r_proto=define
13300                 set d_getgrgid_r_proto getgrgid_r $hdrs
13301                 eval $hasproto ;;
13302         *)      ;;
13303         esac
13304         case "$d_getgrgid_r_proto" in
13305         define)
13306         case "$getgrgid_r_proto" in
13307         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13308         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13309         esac
13310         case "$getgrgid_r_proto" in
13311         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13312         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13313         esac
13314         case "$getgrgid_r_proto" in
13315         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13316         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13317         esac
13318         case "$getgrgid_r_proto" in
13319         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13320         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13321         esac
13322         case "$getgrgid_r_proto" in
13323         ''|0)   d_getgrgid_r=undef
13324                 getgrgid_r_proto=0
13325                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13326         * )     case "$getgrgid_r_proto" in
13327                 REENTRANT_PROTO*) ;;
13328                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13329                 esac
13330                 echo "Prototype: $try" ;;
13331         esac
13332         ;;
13333         *)      case "$usethreads" in
13334                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13335                 esac
13336                 d_getgrgid_r=undef
13337                 getgrgid_r_proto=0
13338                 ;;
13339         esac
13340         ;;
13341 *)      getgrgid_r_proto=0
13342         ;;
13343 esac
13344
13345 : see if getgrnam_r exists
13346 set getgrnam_r d_getgrnam_r
13347 eval $inlibc
13348 case "$d_getgrnam_r" in
13349 "$define")
13350         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13351         case "$d_getgrnam_r_proto:$usethreads" in
13352         ":define")      d_getgrnam_r_proto=define
13353                 set d_getgrnam_r_proto getgrnam_r $hdrs
13354                 eval $hasproto ;;
13355         *)      ;;
13356         esac
13357         case "$d_getgrnam_r_proto" in
13358         define)
13359         case "$getgrnam_r_proto" in
13360         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13361         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13362         esac
13363         case "$getgrnam_r_proto" in
13364         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13365         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13366         esac
13367         case "$getgrnam_r_proto" in
13368         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13369         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13370         esac
13371         case "$getgrnam_r_proto" in
13372         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13373         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13374         esac
13375         case "$getgrnam_r_proto" in
13376         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13377         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13378         esac
13379         case "$getgrnam_r_proto" in
13380         ''|0)   d_getgrnam_r=undef
13381                 getgrnam_r_proto=0
13382                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13383         * )     case "$getgrnam_r_proto" in
13384                 REENTRANT_PROTO*) ;;
13385                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13386                 esac
13387                 echo "Prototype: $try" ;;
13388         esac
13389         ;;
13390         *)      case "$usethreads" in
13391                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13392                 esac
13393                 d_getgrnam_r=undef
13394                 getgrnam_r_proto=0
13395                 ;;
13396         esac
13397         ;;
13398 *)      getgrnam_r_proto=0
13399         ;;
13400 esac
13401
13402 : see if gethostbyaddr exists
13403 set gethostbyaddr d_gethbyaddr
13404 eval $inlibc
13405
13406 : see if gethostbyname exists
13407 set gethostbyname d_gethbyname
13408 eval $inlibc
13409
13410 : see if gethostent exists
13411 set gethostent d_gethent
13412 eval $inlibc
13413
13414 : see how we will look up host name
13415 echo " "
13416 call=''
13417 if set gethostname val -f d_gethname; eval $csym; $val; then
13418         echo 'gethostname() found.' >&4
13419         d_gethname="$define"
13420         call=gethostname
13421 fi
13422 if set uname val -f d_uname; eval $csym; $val; then
13423         if ./xenix; then
13424                 $cat <<'EOM'
13425 uname() was found, but you're running xenix, and older versions of xenix
13426 have a broken uname(). If you don't really know whether your xenix is old
13427 enough to have a broken system call, use the default answer.
13428
13429 EOM
13430                 dflt=y
13431                 case "$d_uname" in
13432                 "$define") dflt=n;;
13433                 esac
13434                 rp='Is your uname() broken?'
13435                 . ./myread
13436                 case "$ans" in
13437                 n*) d_uname="$define"; call=uname;;
13438                 esac
13439         else
13440                 echo 'uname() found.' >&4
13441                 d_uname="$define"
13442                 case "$call" in
13443                 '') call=uname ;;
13444                 esac
13445         fi
13446 fi
13447 case "$d_gethname" in
13448 '') d_gethname="$undef";;
13449 esac
13450 case "$d_uname" in
13451 '') d_uname="$undef";;
13452 esac
13453 case "$d_uname$d_gethname" in
13454 *define*)
13455         dflt=n
13456         cat <<EOM
13457
13458 Every now and then someone has a $call() that lies about the hostname
13459 but can't be fixed for political or economic reasons.  If you wish, I can
13460 pretend $call() isn't there and maybe compute hostname at run-time
13461 thanks to the '$phostname' command.
13462
13463 EOM
13464         rp="Shall I ignore $call() from now on?"
13465         . ./myread
13466         case "$ans" in
13467         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13468         esac;;
13469 esac
13470 case "$phostname" in
13471 '') aphostname='';;
13472 *) case "$aphostname" in
13473         /*) ;;
13474         *) set X $phostname
13475                 shift
13476                 file=$1
13477                 shift
13478                 file=`./loc $file $file $pth`
13479                 aphostname=`echo $file $*`
13480                 ;;
13481         esac
13482         ;;
13483 esac
13484 case "$d_uname$d_gethname" in
13485 *define*) ;;
13486 *)
13487         case "$phostname" in
13488         '')
13489                 echo "There will be no way for $package to get your hostname." >&4;;
13490         *)
13491         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13492                 ;;
13493         esac;;
13494 esac
13495 case "$d_phostname" in
13496 '') d_phostname="$undef";;
13497 esac
13498
13499 : see if gethostbyaddr_r exists
13500 set gethostbyaddr_r d_gethostbyaddr_r
13501 eval $inlibc
13502 case "$d_gethostbyaddr_r" in
13503 "$define")
13504         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13505         case "$d_gethostbyaddr_r_proto:$usethreads" in
13506         ":define")      d_gethostbyaddr_r_proto=define
13507                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13508                 eval $hasproto ;;
13509         *)      ;;
13510         esac
13511         case "$d_gethostbyaddr_r_proto" in
13512         define)
13513         case "$gethostbyaddr_r_proto" in
13514         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13515         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13516         esac
13517         case "$gethostbyaddr_r_proto" in
13518         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13519         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13520         esac
13521         case "$gethostbyaddr_r_proto" in
13522         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13523         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13524         esac
13525         case "$gethostbyaddr_r_proto" in
13526         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13527         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13528         esac
13529         case "$gethostbyaddr_r_proto" in
13530         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13531         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13532         esac
13533         case "$gethostbyaddr_r_proto" in
13534         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13535         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13536         esac
13537         case "$gethostbyaddr_r_proto" in
13538         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13539         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13540         esac
13541         case "$gethostbyaddr_r_proto" in
13542         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13543         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13544         esac
13545         case "$gethostbyaddr_r_proto" in
13546         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13547         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13548         esac
13549         case "$gethostbyaddr_r_proto" in
13550         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13551         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13552         esac
13553         case "$gethostbyaddr_r_proto" in
13554         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13555         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13556         esac
13557         case "$gethostbyaddr_r_proto" in
13558         ''|0)   d_gethostbyaddr_r=undef
13559                 gethostbyaddr_r_proto=0
13560                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13561         * )     case "$gethostbyaddr_r_proto" in
13562                 REENTRANT_PROTO*) ;;
13563                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13564                 esac
13565                 echo "Prototype: $try" ;;
13566         esac
13567         ;;
13568         *)      case "$usethreads" in
13569                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13570                 esac
13571                 d_gethostbyaddr_r=undef
13572                 gethostbyaddr_r_proto=0
13573                 ;;
13574         esac
13575         ;;
13576 *)      gethostbyaddr_r_proto=0
13577         ;;
13578 esac
13579
13580 : see if gethostbyname_r exists
13581 set gethostbyname_r d_gethostbyname_r
13582 eval $inlibc
13583 case "$d_gethostbyname_r" in
13584 "$define")
13585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13586         case "$d_gethostbyname_r_proto:$usethreads" in
13587         ":define")      d_gethostbyname_r_proto=define
13588                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13589                 eval $hasproto ;;
13590         *)      ;;
13591         esac
13592         case "$d_gethostbyname_r_proto" in
13593         define)
13594         case "$gethostbyname_r_proto" in
13595         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13596         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13597         esac
13598         case "$gethostbyname_r_proto" in
13599         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13600         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13601         esac
13602         case "$gethostbyname_r_proto" in
13603         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13604         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13605         esac
13606         case "$gethostbyname_r_proto" in
13607         ''|0)   d_gethostbyname_r=undef
13608                 gethostbyname_r_proto=0
13609                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13610         * )     case "$gethostbyname_r_proto" in
13611                 REENTRANT_PROTO*) ;;
13612                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13613                 esac
13614                 echo "Prototype: $try" ;;
13615         esac
13616         ;;
13617         *)      case "$usethreads" in
13618                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13619                 esac
13620                 d_gethostbyname_r=undef
13621                 gethostbyname_r_proto=0
13622                 ;;
13623         esac
13624         ;;
13625 *)      gethostbyname_r_proto=0
13626         ;;
13627 esac
13628
13629 : see if gethostent_r exists
13630 set gethostent_r d_gethostent_r
13631 eval $inlibc
13632 case "$d_gethostent_r" in
13633 "$define")
13634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13635         case "$d_gethostent_r_proto:$usethreads" in
13636         ":define")      d_gethostent_r_proto=define
13637                 set d_gethostent_r_proto gethostent_r $hdrs
13638                 eval $hasproto ;;
13639         *)      ;;
13640         esac
13641         case "$d_gethostent_r_proto" in
13642         define)
13643         case "$gethostent_r_proto" in
13644         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13645         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13646         esac
13647         case "$gethostent_r_proto" in
13648         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13649         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13650         esac
13651         case "$gethostent_r_proto" in
13652         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13653         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13654         esac
13655         case "$gethostent_r_proto" in
13656         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13657         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13658         esac
13659         case "$gethostent_r_proto" in
13660         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13661         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13662         esac
13663         case "$gethostent_r_proto" in
13664         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13665         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13666         esac
13667         case "$gethostent_r_proto" in
13668         ''|0)   d_gethostent_r=undef
13669                 gethostent_r_proto=0
13670                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13671         * )     case "$gethostent_r_proto" in
13672                 REENTRANT_PROTO*) ;;
13673                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13674                 esac
13675                 echo "Prototype: $try" ;;
13676         esac
13677         ;;
13678         *)      case "$usethreads" in
13679                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13680                 esac
13681                 d_gethostent_r=undef
13682                 gethostent_r_proto=0
13683                 ;;
13684         esac
13685         ;;
13686 *)      gethostent_r_proto=0
13687         ;;
13688 esac
13689
13690 : see if prototypes for various gethostxxx netdb.h functions are available
13691 echo " "
13692 set d_gethostprotos gethostent $i_netdb netdb.h
13693 eval $hasproto
13694
13695 : see if getitimer exists
13696 set getitimer d_getitimer
13697 eval $inlibc
13698
13699 : see if getlogin exists
13700 set getlogin d_getlogin
13701 eval $inlibc
13702
13703 : see if getlogin_r exists
13704 set getlogin_r d_getlogin_r
13705 eval $inlibc
13706 case "$d_getlogin_r" in
13707 "$define")
13708         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13709         case "$d_getlogin_r_proto:$usethreads" in
13710         ":define")      d_getlogin_r_proto=define
13711                 set d_getlogin_r_proto getlogin_r $hdrs
13712                 eval $hasproto ;;
13713         *)      ;;
13714         esac
13715         case "$d_getlogin_r_proto" in
13716         define)
13717         case "$getlogin_r_proto" in
13718         ''|0) try='int getlogin_r(char*, size_t);'
13719         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13720         esac
13721         case "$getlogin_r_proto" in
13722         ''|0) try='int getlogin_r(char*, int);'
13723         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13724         esac
13725         case "$getlogin_r_proto" in
13726         ''|0) try='char* getlogin_r(char*, size_t);'
13727         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13728         esac
13729         case "$getlogin_r_proto" in
13730         ''|0) try='char* getlogin_r(char*, int);'
13731         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13732         esac
13733         case "$getlogin_r_proto" in
13734         ''|0)   d_getlogin_r=undef
13735                 getlogin_r_proto=0
13736                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13737         * )     case "$getlogin_r_proto" in
13738                 REENTRANT_PROTO*) ;;
13739                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13740                 esac
13741                 echo "Prototype: $try" ;;
13742         esac
13743         ;;
13744         *)      case "$usethreads" in
13745                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13746                 esac
13747                 d_getlogin_r=undef
13748                 getlogin_r_proto=0
13749                 ;;
13750         esac
13751         ;;
13752 *)      getlogin_r_proto=0
13753         ;;
13754 esac
13755
13756 : see if getmnt exists
13757 set getmnt d_getmnt
13758 eval $inlibc
13759
13760 : see if getmntent exists
13761 set getmntent d_getmntent
13762 eval $inlibc
13763
13764 : see if getnetbyaddr exists
13765 set getnetbyaddr d_getnbyaddr
13766 eval $inlibc
13767
13768 : see if getnetbyname exists
13769 set getnetbyname d_getnbyname
13770 eval $inlibc
13771
13772 : see if getnetent exists
13773 set getnetent d_getnent
13774 eval $inlibc
13775
13776 : see if getnetbyaddr_r exists
13777 set getnetbyaddr_r d_getnetbyaddr_r
13778 eval $inlibc
13779 case "$d_getnetbyaddr_r" in
13780 "$define")
13781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13782         case "$d_getnetbyaddr_r_proto:$usethreads" in
13783         ":define")      d_getnetbyaddr_r_proto=define
13784                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13785                 eval $hasproto ;;
13786         *)      ;;
13787         esac
13788         case "$d_getnetbyaddr_r_proto" in
13789         define)
13790         case "$getnetbyaddr_r_proto" in
13791         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13792         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13793         esac
13794         case "$getnetbyaddr_r_proto" in
13795         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13796         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13797         esac
13798         case "$getnetbyaddr_r_proto" in
13799         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13800         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13801         esac
13802         case "$getnetbyaddr_r_proto" in
13803         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13804         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13805         esac
13806         case "$getnetbyaddr_r_proto" in
13807         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13808         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13809         esac
13810         case "$getnetbyaddr_r_proto" in
13811         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13812         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13813         esac
13814         case "$getnetbyaddr_r_proto" in
13815         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13816         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13817         esac
13818         case "$getnetbyaddr_r_proto" in
13819         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13820         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13821         esac
13822         case "$getnetbyaddr_r_proto" in
13823         ''|0)   d_getnetbyaddr_r=undef
13824                 getnetbyaddr_r_proto=0
13825                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13826         * )     case "$getnetbyaddr_r_proto" in
13827                 REENTRANT_PROTO*) ;;
13828                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13829                 esac
13830                 echo "Prototype: $try" ;;
13831         esac
13832         ;;
13833         *)      case "$usethreads" in
13834                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13835                 esac
13836                 d_getnetbyaddr_r=undef
13837                 getnetbyaddr_r_proto=0
13838                 ;;
13839         esac
13840         ;;
13841 *)      getnetbyaddr_r_proto=0
13842         ;;
13843 esac
13844
13845 : see if getnetbyname_r exists
13846 set getnetbyname_r d_getnetbyname_r
13847 eval $inlibc
13848 case "$d_getnetbyname_r" in
13849 "$define")
13850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13851         case "$d_getnetbyname_r_proto:$usethreads" in
13852         ":define")      d_getnetbyname_r_proto=define
13853                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13854                 eval $hasproto ;;
13855         *)      ;;
13856         esac
13857         case "$d_getnetbyname_r_proto" in
13858         define)
13859         case "$getnetbyname_r_proto" in
13860         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13861         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13862         esac
13863         case "$getnetbyname_r_proto" in
13864         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13865         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13866         esac
13867         case "$getnetbyname_r_proto" in
13868         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13869         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13870         esac
13871         case "$getnetbyname_r_proto" in
13872         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13873         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13874         esac
13875         case "$getnetbyname_r_proto" in
13876         ''|0)   d_getnetbyname_r=undef
13877                 getnetbyname_r_proto=0
13878                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13879         * )     case "$getnetbyname_r_proto" in
13880                 REENTRANT_PROTO*) ;;
13881                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13882                 esac
13883                 echo "Prototype: $try" ;;
13884         esac
13885         ;;
13886         *)      case "$usethreads" in
13887                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13888                 esac
13889                 d_getnetbyname_r=undef
13890                 getnetbyname_r_proto=0
13891                 ;;
13892         esac
13893         ;;
13894 *)      getnetbyname_r_proto=0
13895         ;;
13896 esac
13897
13898 : see if getnetent_r exists
13899 set getnetent_r d_getnetent_r
13900 eval $inlibc
13901 case "$d_getnetent_r" in
13902 "$define")
13903         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13904         case "$d_getnetent_r_proto:$usethreads" in
13905         ":define")      d_getnetent_r_proto=define
13906                 set d_getnetent_r_proto getnetent_r $hdrs
13907                 eval $hasproto ;;
13908         *)      ;;
13909         esac
13910         case "$d_getnetent_r_proto" in
13911         define)
13912         case "$getnetent_r_proto" in
13913         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13914         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13915         esac
13916         case "$getnetent_r_proto" in
13917         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13918         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13919         esac
13920         case "$getnetent_r_proto" in
13921         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13922         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13923         esac
13924         case "$getnetent_r_proto" in
13925         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13926         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13927         esac
13928         case "$getnetent_r_proto" in
13929         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13930         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13931         esac
13932         case "$getnetent_r_proto" in
13933         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13934         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13935         esac
13936         case "$getnetent_r_proto" in
13937         ''|0)   d_getnetent_r=undef
13938                 getnetent_r_proto=0
13939                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13940         * )     case "$getnetent_r_proto" in
13941                 REENTRANT_PROTO*) ;;
13942                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13943                 esac
13944                 echo "Prototype: $try" ;;
13945         esac
13946         ;;
13947         *)      case "$usethreads" in
13948                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13949                 esac
13950                 d_getnetent_r=undef
13951                 getnetent_r_proto=0
13952                 ;;
13953         esac
13954         ;;
13955 *)      getnetent_r_proto=0
13956         ;;
13957 esac
13958
13959 : see if prototypes for various getnetxxx netdb.h functions are available
13960 echo " "
13961 set d_getnetprotos getnetent $i_netdb netdb.h
13962 eval $hasproto
13963
13964 : see if getpagesize exists
13965 set getpagesize d_getpagsz
13966 eval $inlibc
13967
13968 : Optional checks for getprotobyname and getprotobynumber
13969
13970 : see if getprotobyname exists
13971 set getprotobyname d_getpbyname
13972 eval $inlibc
13973
13974 : see if getprotobynumber exists
13975 set getprotobynumber d_getpbynumber
13976 eval $inlibc
13977
13978 : see if getprotoent exists
13979 set getprotoent d_getpent
13980 eval $inlibc
13981
13982 : see if getpgid exists
13983 set getpgid d_getpgid
13984 eval $inlibc
13985
13986 : see if getpgrp2 exists
13987 set getpgrp2 d_getpgrp2
13988 eval $inlibc
13989
13990 : see if getppid exists
13991 set getppid d_getppid
13992 eval $inlibc
13993
13994 : see if getpriority exists
13995 set getpriority d_getprior
13996 eval $inlibc
13997
13998 : see if getprotobyname_r exists
13999 set getprotobyname_r d_getprotobyname_r
14000 eval $inlibc
14001 case "$d_getprotobyname_r" in
14002 "$define")
14003         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14004         case "$d_getprotobyname_r_proto:$usethreads" in
14005         ":define")      d_getprotobyname_r_proto=define
14006                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14007                 eval $hasproto ;;
14008         *)      ;;
14009         esac
14010         case "$d_getprotobyname_r_proto" in
14011         define)
14012         case "$getprotobyname_r_proto" in
14013         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14014         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14015         esac
14016         case "$getprotobyname_r_proto" in
14017         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14018         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14019         esac
14020         case "$getprotobyname_r_proto" in
14021         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14022         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14023         esac
14024         case "$getprotobyname_r_proto" in
14025         ''|0)   d_getprotobyname_r=undef
14026                 getprotobyname_r_proto=0
14027                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14028         * )     case "$getprotobyname_r_proto" in
14029                 REENTRANT_PROTO*) ;;
14030                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14031                 esac
14032                 echo "Prototype: $try" ;;
14033         esac
14034         ;;
14035         *)      case "$usethreads" in
14036                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14037                 esac
14038                 d_getprotobyname_r=undef
14039                 getprotobyname_r_proto=0
14040                 ;;
14041         esac
14042         ;;
14043 *)      getprotobyname_r_proto=0
14044         ;;
14045 esac
14046
14047 : see if getprotobynumber_r exists
14048 set getprotobynumber_r d_getprotobynumber_r
14049 eval $inlibc
14050 case "$d_getprotobynumber_r" in
14051 "$define")
14052         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14053         case "$d_getprotobynumber_r_proto:$usethreads" in
14054         ":define")      d_getprotobynumber_r_proto=define
14055                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14056                 eval $hasproto ;;
14057         *)      ;;
14058         esac
14059         case "$d_getprotobynumber_r_proto" in
14060         define)
14061         case "$getprotobynumber_r_proto" in
14062         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14063         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14064         esac
14065         case "$getprotobynumber_r_proto" in
14066         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14067         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14068         esac
14069         case "$getprotobynumber_r_proto" in
14070         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14071         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14072         esac
14073         case "$getprotobynumber_r_proto" in
14074         ''|0)   d_getprotobynumber_r=undef
14075                 getprotobynumber_r_proto=0
14076                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14077         * )     case "$getprotobynumber_r_proto" in
14078                 REENTRANT_PROTO*) ;;
14079                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14080                 esac
14081                 echo "Prototype: $try" ;;
14082         esac
14083         ;;
14084         *)      case "$usethreads" in
14085                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14086                 esac
14087                 d_getprotobynumber_r=undef
14088                 getprotobynumber_r_proto=0
14089                 ;;
14090         esac
14091         ;;
14092 *)      getprotobynumber_r_proto=0
14093         ;;
14094 esac
14095
14096 : see if getprotoent_r exists
14097 set getprotoent_r d_getprotoent_r
14098 eval $inlibc
14099 case "$d_getprotoent_r" in
14100 "$define")
14101         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14102         case "$d_getprotoent_r_proto:$usethreads" in
14103         ":define")      d_getprotoent_r_proto=define
14104                 set d_getprotoent_r_proto getprotoent_r $hdrs
14105                 eval $hasproto ;;
14106         *)      ;;
14107         esac
14108         case "$d_getprotoent_r_proto" in
14109         define)
14110         case "$getprotoent_r_proto" in
14111         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14112         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14113         esac
14114         case "$getprotoent_r_proto" in
14115         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14116         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14117         esac
14118         case "$getprotoent_r_proto" in
14119         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14120         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14121         esac
14122         case "$getprotoent_r_proto" in
14123         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14124         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14125         esac
14126         case "$getprotoent_r_proto" in
14127         ''|0)   d_getprotoent_r=undef
14128                 getprotoent_r_proto=0
14129                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14130         * )     case "$getprotoent_r_proto" in
14131                 REENTRANT_PROTO*) ;;
14132                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14133                 esac
14134                 echo "Prototype: $try" ;;
14135         esac
14136         ;;
14137         *)      case "$usethreads" in
14138                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14139                 esac
14140                 d_getprotoent_r=undef
14141                 getprotoent_r_proto=0
14142                 ;;
14143         esac
14144         ;;
14145 *)      getprotoent_r_proto=0
14146         ;;
14147 esac
14148
14149 : see if prototypes for various getprotoxxx netdb.h functions are available
14150 echo " "
14151 set d_getprotoprotos getprotoent $i_netdb netdb.h
14152 eval $hasproto
14153
14154 : see if getprpwnam exists
14155 set getprpwnam d_getprpwnam
14156 eval $inlibc
14157
14158 : see if getpwent exists
14159 set getpwent d_getpwent
14160 eval $inlibc
14161
14162 : see if getpwent_r exists
14163 set getpwent_r d_getpwent_r
14164 eval $inlibc
14165 case "$d_getpwent_r" in
14166 "$define")
14167         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14168         case "$d_getpwent_r_proto:$usethreads" in
14169         ":define")      d_getpwent_r_proto=define
14170                 set d_getpwent_r_proto getpwent_r $hdrs
14171                 eval $hasproto ;;
14172         *)      ;;
14173         esac
14174         case "$d_getpwent_r_proto" in
14175         define)
14176         case "$getpwent_r_proto" in
14177         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14178         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14179         esac
14180         case "$getpwent_r_proto" in
14181         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14182         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14183         esac
14184         case "$getpwent_r_proto" in
14185         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14186         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14187         esac
14188         case "$getpwent_r_proto" in
14189         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14190         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14191         esac
14192         case "$getpwent_r_proto" in
14193         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14194         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14195         esac
14196         case "$getpwent_r_proto" in
14197         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14198         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14199         esac
14200         case "$getpwent_r_proto" in
14201         ''|0)   d_getpwent_r=undef
14202                 getpwent_r_proto=0
14203                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14204         * )     case "$getpwent_r_proto" in
14205                 REENTRANT_PROTO*) ;;
14206                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14207                 esac
14208                 echo "Prototype: $try" ;;
14209         esac
14210         ;;
14211         *)      case "$usethreads" in
14212                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14213                 esac
14214                 d_getpwent_r=undef
14215                 getpwent_r_proto=0
14216                 ;;
14217         esac
14218         ;;
14219 *)      getpwent_r_proto=0
14220         ;;
14221 esac
14222
14223 : see if getpwnam_r exists
14224 set getpwnam_r d_getpwnam_r
14225 eval $inlibc
14226 case "$d_getpwnam_r" in
14227 "$define")
14228         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14229         case "$d_getpwnam_r_proto:$usethreads" in
14230         ":define")      d_getpwnam_r_proto=define
14231                 set d_getpwnam_r_proto getpwnam_r $hdrs
14232                 eval $hasproto ;;
14233         *)      ;;
14234         esac
14235         case "$d_getpwnam_r_proto" in
14236         define)
14237         case "$getpwnam_r_proto" in
14238         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14239         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14240         esac
14241         case "$getpwnam_r_proto" in
14242         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14243         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14244         esac
14245         case "$getpwnam_r_proto" in
14246         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14247         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14248         esac
14249         case "$getpwnam_r_proto" in
14250         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14251         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14252         esac
14253         case "$getpwnam_r_proto" in
14254         ''|0)   d_getpwnam_r=undef
14255                 getpwnam_r_proto=0
14256                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14257         * )     case "$getpwnam_r_proto" in
14258                 REENTRANT_PROTO*) ;;
14259                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14260                 esac
14261                 echo "Prototype: $try" ;;
14262         esac
14263         ;;
14264         *)      case "$usethreads" in
14265                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14266                 esac
14267                 d_getpwnam_r=undef
14268                 getpwnam_r_proto=0
14269                 ;;
14270         esac
14271         ;;
14272 *)      getpwnam_r_proto=0
14273         ;;
14274 esac
14275
14276 : see if getpwuid_r exists
14277 set getpwuid_r d_getpwuid_r
14278 eval $inlibc
14279 case "$d_getpwuid_r" in
14280 "$define")
14281         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14282         case "$d_getpwuid_r_proto:$usethreads" in
14283         ":define")      d_getpwuid_r_proto=define
14284                 set d_getpwuid_r_proto getpwuid_r $hdrs
14285                 eval $hasproto ;;
14286         *)      ;;
14287         esac
14288         case "$d_getpwuid_r_proto" in
14289         define)
14290         case "$getpwuid_r_proto" in
14291         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14292         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14293         esac
14294         case "$getpwuid_r_proto" in
14295         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14296         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14297         esac
14298         case "$getpwuid_r_proto" in
14299         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14300         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14301         esac
14302         case "$getpwuid_r_proto" in
14303         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14304         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14305         esac
14306         case "$getpwuid_r_proto" in
14307         ''|0)   d_getpwuid_r=undef
14308                 getpwuid_r_proto=0
14309                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14310         * )     case "$getpwuid_r_proto" in
14311                 REENTRANT_PROTO*) ;;
14312                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14313                 esac
14314                 echo "Prototype: $try" ;;
14315         esac
14316         ;;
14317         *)      case "$usethreads" in
14318                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14319                 esac
14320                 d_getpwuid_r=undef
14321                 getpwuid_r_proto=0
14322                 ;;
14323         esac
14324         ;;
14325 *)      getpwuid_r_proto=0
14326         ;;
14327 esac
14328
14329 : Optional checks for getsbyname and getsbyport
14330
14331 : see if getservbyname exists
14332 set getservbyname d_getsbyname
14333 eval $inlibc
14334
14335 : see if getservbyport exists
14336 set getservbyport d_getsbyport
14337 eval $inlibc
14338
14339 : see if getservent exists
14340 set getservent d_getsent
14341 eval $inlibc
14342
14343 : see if getservbyname_r exists
14344 set getservbyname_r d_getservbyname_r
14345 eval $inlibc
14346 case "$d_getservbyname_r" in
14347 "$define")
14348         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14349         case "$d_getservbyname_r_proto:$usethreads" in
14350         ":define")      d_getservbyname_r_proto=define
14351                 set d_getservbyname_r_proto getservbyname_r $hdrs
14352                 eval $hasproto ;;
14353         *)      ;;
14354         esac
14355         case "$d_getservbyname_r_proto" in
14356         define)
14357         case "$getservbyname_r_proto" in
14358         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14359         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14360         esac
14361         case "$getservbyname_r_proto" in
14362         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14363         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14364         esac
14365         case "$getservbyname_r_proto" in
14366         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14367         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14368         esac
14369         case "$getservbyname_r_proto" in
14370         ''|0)   d_getservbyname_r=undef
14371                 getservbyname_r_proto=0
14372                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14373         * )     case "$getservbyname_r_proto" in
14374                 REENTRANT_PROTO*) ;;
14375                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14376                 esac
14377                 echo "Prototype: $try" ;;
14378         esac
14379         ;;
14380         *)      case "$usethreads" in
14381                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14382                 esac
14383                 d_getservbyname_r=undef
14384                 getservbyname_r_proto=0
14385                 ;;
14386         esac
14387         ;;
14388 *)      getservbyname_r_proto=0
14389         ;;
14390 esac
14391
14392 : see if getservbyport_r exists
14393 set getservbyport_r d_getservbyport_r
14394 eval $inlibc
14395 case "$d_getservbyport_r" in
14396 "$define")
14397         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14398         case "$d_getservbyport_r_proto:$usethreads" in
14399         ":define")      d_getservbyport_r_proto=define
14400                 set d_getservbyport_r_proto getservbyport_r $hdrs
14401                 eval $hasproto ;;
14402         *)      ;;
14403         esac
14404         case "$d_getservbyport_r_proto" in
14405         define)
14406         case "$getservbyport_r_proto" in
14407         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14408         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14409         esac
14410         case "$getservbyport_r_proto" in
14411         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14412         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14413         esac
14414         case "$getservbyport_r_proto" in
14415         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14416         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14417         esac
14418         case "$getservbyport_r_proto" in
14419         ''|0)   d_getservbyport_r=undef
14420                 getservbyport_r_proto=0
14421                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14422         * )     case "$getservbyport_r_proto" in
14423                 REENTRANT_PROTO*) ;;
14424                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14425                 esac
14426                 echo "Prototype: $try" ;;
14427         esac
14428         ;;
14429         *)      case "$usethreads" in
14430                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14431                 esac
14432                 d_getservbyport_r=undef
14433                 getservbyport_r_proto=0
14434                 ;;
14435         esac
14436         ;;
14437 *)      getservbyport_r_proto=0
14438         ;;
14439 esac
14440
14441 : see if getservent_r exists
14442 set getservent_r d_getservent_r
14443 eval $inlibc
14444 case "$d_getservent_r" in
14445 "$define")
14446         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14447         case "$d_getservent_r_proto:$usethreads" in
14448         ":define")      d_getservent_r_proto=define
14449                 set d_getservent_r_proto getservent_r $hdrs
14450                 eval $hasproto ;;
14451         *)      ;;
14452         esac
14453         case "$d_getservent_r_proto" in
14454         define)
14455         case "$getservent_r_proto" in
14456         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14457         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14458         esac
14459         case "$getservent_r_proto" in
14460         ''|0) try='int getservent_r(struct servent*, char*, int);'
14461         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14462         esac
14463         case "$getservent_r_proto" in
14464         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14465         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14466         esac
14467         case "$getservent_r_proto" in
14468         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14469         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14470         esac
14471         case "$getservent_r_proto" in
14472         ''|0)   d_getservent_r=undef
14473                 getservent_r_proto=0
14474                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14475         * )     case "$getservent_r_proto" in
14476                 REENTRANT_PROTO*) ;;
14477                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14478                 esac
14479                 echo "Prototype: $try" ;;
14480         esac
14481         ;;
14482         *)      case "$usethreads" in
14483                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14484                 esac
14485                 d_getservent_r=undef
14486                 getservent_r_proto=0
14487                 ;;
14488         esac
14489         ;;
14490 *)      getservent_r_proto=0
14491         ;;
14492 esac
14493
14494 : see if prototypes for various getservxxx netdb.h functions are available
14495 echo " "
14496 set d_getservprotos getservent $i_netdb netdb.h
14497 eval $hasproto
14498
14499 : see if getspnam exists
14500 set getspnam d_getspnam
14501 eval $inlibc
14502
14503 : see if this is a shadow.h system
14504 set shadow.h i_shadow
14505 eval $inhdr
14506
14507 : see if getspnam_r exists
14508 set getspnam_r d_getspnam_r
14509 eval $inlibc
14510 case "$d_getspnam_r" in
14511 "$define")
14512         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14513         case "$d_getspnam_r_proto:$usethreads" in
14514         ":define")      d_getspnam_r_proto=define
14515                 set d_getspnam_r_proto getspnam_r $hdrs
14516                 eval $hasproto ;;
14517         *)      ;;
14518         esac
14519         case "$d_getspnam_r_proto" in
14520         define)
14521         case "$getspnam_r_proto" in
14522         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14523         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14524         esac
14525         case "$getspnam_r_proto" in
14526         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14527         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14528         esac
14529         case "$getspnam_r_proto" in
14530         ''|0)   d_getspnam_r=undef
14531                 getspnam_r_proto=0
14532                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14533         * )     case "$getspnam_r_proto" in
14534                 REENTRANT_PROTO*) ;;
14535                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14536                 esac
14537                 echo "Prototype: $try" ;;
14538         esac
14539         ;;
14540         *)      case "$usethreads" in
14541                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14542                 esac
14543                 d_getspnam_r=undef
14544                 getspnam_r_proto=0
14545                 ;;
14546         esac
14547         ;;
14548 *)      getspnam_r_proto=0
14549         ;;
14550 esac
14551
14552 : see if gettimeofday or ftime exists
14553 set gettimeofday d_gettimeod
14554 eval $inlibc
14555 case "$d_gettimeod" in
14556 "$undef")
14557         set ftime d_ftime 
14558         eval $inlibc
14559         ;;
14560 *)
14561         val="$undef"; set d_ftime; eval $setvar
14562         ;;
14563 esac
14564 case "$d_gettimeod$d_ftime" in
14565 "$undef$undef")
14566         echo " "
14567         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14568         ;;
14569 esac
14570
14571 : see if gmtime_r exists
14572 set gmtime_r d_gmtime_r
14573 eval $inlibc
14574 case "$d_gmtime_r" in
14575 "$define")
14576         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14577         case "$d_gmtime_r_proto:$usethreads" in
14578         ":define")      d_gmtime_r_proto=define
14579                 set d_gmtime_r_proto gmtime_r $hdrs
14580                 eval $hasproto ;;
14581         *)      ;;
14582         esac
14583         case "$d_gmtime_r_proto" in
14584         define)
14585         case "$gmtime_r_proto" in
14586         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14587         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14588         esac
14589         case "$gmtime_r_proto" in
14590         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14591         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14592         esac
14593         case "$gmtime_r_proto" in
14594         ''|0)   d_gmtime_r=undef
14595                 gmtime_r_proto=0
14596                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14597         * )     case "$gmtime_r_proto" in
14598                 REENTRANT_PROTO*) ;;
14599                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14600                 esac
14601                 echo "Prototype: $try" ;;
14602         esac
14603         ;;
14604         *)      case "$usethreads" in
14605                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14606                 esac
14607                 d_gmtime_r=undef
14608                 gmtime_r_proto=0
14609                 ;;
14610         esac
14611         ;;
14612 *)      gmtime_r_proto=0
14613         ;;
14614 esac
14615
14616 : see if hasmntopt exists
14617 set hasmntopt d_hasmntopt
14618 eval $inlibc
14619
14620 : see if this is a netinet/in.h or sys/in.h system
14621 set netinet/in.h i_niin sys/in.h i_sysin
14622 eval $inhdr
14623
14624 : see if arpa/inet.h has to be included
14625 set arpa/inet.h i_arpainet
14626 eval $inhdr
14627
14628 : see if htonl --and friends-- exists
14629 val=''
14630 set htonl val
14631 eval $inlibc
14632
14633 : Maybe they are macros.
14634 case "$val" in
14635 $undef)
14636         $cat >htonl.c <<EOM
14637 #include <stdio.h>
14638 #include <sys/types.h>
14639 #$i_niin I_NETINET_IN
14640 #$i_sysin I_SYS_IN
14641 #$i_arpainet I_ARPA_INET
14642 #ifdef I_NETINET_IN
14643 #include <netinet/in.h>
14644 #endif
14645 #ifdef I_SYS_IN
14646 #include <sys/in.h>
14647 #endif
14648 #ifdef I_ARPA_INET
14649 #include <arpa/inet.h>
14650 #endif
14651 #ifdef htonl
14652 printf("Defined as a macro.");
14653 #endif
14654 EOM
14655         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14656         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14657                 val="$define"
14658                 echo "But it seems to be defined as a macro." >&4
14659         fi
14660         $rm -f htonl.?
14661         ;;
14662 esac
14663 set d_htonl
14664 eval $setvar
14665
14666 : see if ilogbl exists
14667 set ilogbl d_ilogbl
14668 eval $inlibc
14669
14670 : index or strchr
14671 echo " "
14672 if set index val -f; eval $csym; $val; then
14673         if set strchr val -f d_strchr; eval $csym; $val; then
14674                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14675                         val="$define"
14676                         vali="$undef"
14677                         echo "strchr() found." >&4
14678                 else
14679                         val="$undef"
14680                         vali="$define"
14681                         echo "index() found." >&4
14682                 fi
14683         else
14684                 val="$undef"
14685                 vali="$define"
14686                 echo "index() found." >&4
14687         fi
14688 else
14689         if set strchr val -f d_strchr; eval $csym; $val; then
14690                 val="$define"
14691                 vali="$undef"
14692                 echo "strchr() found." >&4
14693         else
14694                 echo "No index() or strchr() found!" >&4
14695                 val="$undef"
14696                 vali="$undef"
14697         fi
14698 fi
14699 set d_strchr; eval $setvar
14700 val="$vali"
14701 set d_index; eval $setvar
14702
14703 : check whether inet_aton exists
14704 set inet_aton d_inetaton
14705 eval $inlibc
14706
14707 : Look for isascii
14708 echo " "
14709 $cat >isascii.c <<EOCP
14710 #include <stdio.h>
14711 #include <ctype.h>
14712 #$i_stdlib I_STDLIB
14713 #ifdef I_STDLIB
14714 #include <stdlib.h>
14715 #endif
14716 int main() {
14717         int c = 'A';
14718         if (isascii(c))
14719                 exit(0);
14720         else
14721                 exit(1);
14722 }
14723 EOCP
14724 set isascii
14725 if eval $compile; then
14726         echo "isascii() found." >&4
14727         val="$define"
14728 else
14729         echo "isascii() NOT found." >&4
14730         val="$undef"
14731 fi
14732 set d_isascii
14733 eval $setvar
14734 $rm -f isascii*
14735
14736 : see if isfinite exists
14737 set isfinite d_isfinite
14738 eval $inlibc
14739
14740 : see if isinf exists
14741 set isinf d_isinf
14742 eval $inlibc
14743
14744 : see if isnan exists
14745 set isnan d_isnan
14746 eval $inlibc
14747
14748 : see if isnanl exists
14749 set isnanl d_isnanl
14750 eval $inlibc
14751
14752 : see if killpg exists
14753 set killpg d_killpg
14754 eval $inlibc
14755
14756 : see if lchown exists
14757 echo " "
14758 $cat > try.c <<'EOCP'
14759 /* System header to define __stub macros and hopefully few prototypes,
14760     which can conflict with char lchown(); below.  */
14761 #include <assert.h>
14762 /* Override any gcc2 internal prototype to avoid an error.  */
14763 /* We use char because int might match the return type of a gcc2
14764    builtin and then its argument prototype would still apply.  */
14765 char lchown();
14766 int main() {
14767     /*  The GNU C library defines this for functions which it implements
14768         to always fail with ENOSYS.  Some functions are actually named
14769         something starting with __ and the normal name is an alias.  */
14770 #if defined (__stub_lchown) || defined (__stub___lchown)
14771 choke me
14772 #else
14773 lchown();
14774 #endif
14775 ; return 0; }
14776 EOCP
14777 set try
14778 if eval $compile; then
14779     $echo "lchown() found." >&4
14780     val="$define"
14781 else
14782     $echo "lchown() NOT found." >&4
14783     val="$undef"
14784 fi
14785 set d_lchown
14786 eval $setvar
14787
14788 : See if number of significant digits in a double precision number is known
14789 echo " "
14790 $cat >ldbl_dig.c <<EOM
14791 #$i_limits I_LIMITS
14792 #$i_float I_FLOAT
14793 #ifdef I_LIMITS
14794 #include <limits.h>
14795 #endif
14796 #ifdef I_FLOAT
14797 #include <float.h>
14798 #endif
14799 #ifdef LDBL_DIG
14800 printf("Contains LDBL_DIG");
14801 #endif
14802 EOM
14803 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14804 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14805         echo "LDBL_DIG found." >&4
14806         val="$define"
14807 else
14808         echo "LDBL_DIG NOT found." >&4
14809         val="$undef"
14810 fi
14811 $rm -f ldbl_dig.?
14812 set d_ldbl_dig
14813 eval $setvar
14814
14815 : see if this is a math.h system
14816 set math.h i_math
14817 eval $inhdr
14818
14819 : check to see if math.h defines _LIB_VERSION
14820 d_libm_lib_version="$undef"
14821 case $i_math in
14822     $define)
14823         echo " "
14824         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14825         $cat >try.c <<EOCP
14826 #include <unistd.h>
14827 #include <math.h>
14828 int main (int argc, char *argv[])
14829 {
14830     printf ("%d\n", _LIB_VERSION);
14831     return (0);
14832     } /* main */
14833 EOCP
14834         set try
14835         if eval $compile; then
14836             foo=`$run ./try`
14837             echo "Yes, it does ($foo)" >&4
14838             d_libm_lib_version="$define"
14839         else
14840             echo "No, it does not (probably harmless)" >&4
14841             fi
14842         $rm_try
14843         ;;
14844
14845     esac
14846
14847 : see if link exists
14848 set link d_link
14849 eval $inlibc
14850
14851 : see if localtime_r exists
14852 set localtime_r d_localtime_r
14853 eval $inlibc
14854 case "$d_localtime_r" in
14855 "$define")
14856         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14857         case "$d_localtime_r_proto:$usethreads" in
14858         ":define")      d_localtime_r_proto=define
14859                 set d_localtime_r_proto localtime_r $hdrs
14860                 eval $hasproto ;;
14861         *)      ;;
14862         esac
14863         case "$d_localtime_r_proto" in
14864         define)
14865         case "$localtime_r_proto" in
14866         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14867         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14868         esac
14869         case "$localtime_r_proto" in
14870         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14871         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14872         esac
14873         case "$localtime_r_proto" in
14874         ''|0)   d_localtime_r=undef
14875                 localtime_r_proto=0
14876                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14877         * )     case "$localtime_r_proto" in
14878                 REENTRANT_PROTO*) ;;
14879                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14880                 esac
14881                 echo "Prototype: $try" ;;
14882         esac
14883         ;;
14884         *)      case "$usethreads" in
14885                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14886                 esac
14887                 d_localtime_r=undef
14888                 localtime_r_proto=0
14889                 ;;
14890         esac
14891         ;;
14892 *)      localtime_r_proto=0
14893         ;;
14894 esac
14895
14896 : see if localtime_r calls tzset
14897 case "$localtime_r_proto" in
14898 REENTRANT_PROTO*)
14899         $cat >try.c <<EOCP
14900 /*  Does our libc's localtime_r call tzset ?
14901  *  return 0 if so, 1 otherwise.
14902  */
14903 #include <sys/types.h>
14904 #include <unistd.h>
14905 #include <time.h>
14906 #include <string.h>
14907 #include <malloc.h>
14908 int main()
14909 {
14910     time_t t = time(0L);
14911     char w_tz[]="TZ" "=GMT+5",
14912          e_tz[]="TZ" "=GMT-5",
14913         *tz_e = (char*)malloc(16),
14914         *tz_w = (char*)malloc(16);
14915     struct tm tm_e, tm_w;
14916     memset(&tm_e,'\0',sizeof(struct tm));
14917     memset(&tm_w,'\0',sizeof(struct tm));
14918     strcpy(tz_e,e_tz);
14919     strcpy(tz_w,w_tz);
14920
14921     putenv(tz_e);
14922     localtime_r(&t, &tm_e);
14923
14924     putenv(tz_w);
14925     localtime_r(&t, &tm_w);
14926
14927     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14928         return 1;
14929     return 0;
14930 }
14931 EOCP
14932         set try
14933         if eval $compile; then
14934             if $run ./try; then
14935                 d_localtime_r_needs_tzset=undef;
14936             else
14937                 d_localtime_r_needs_tzset=define;
14938             fi;
14939         else
14940             d_localtime_r_needs_tzset=undef;
14941         fi;
14942      ;;
14943   *)
14944      d_localtime_r_needs_tzset=undef;
14945      ;;
14946 esac
14947 $rm_try
14948
14949 : see if localeconv exists
14950 set localeconv d_locconv
14951 eval $inlibc
14952
14953 : see if lockf exists
14954 set lockf d_lockf
14955 eval $inlibc
14956
14957 : see if prototype for lseek is available
14958 echo " "
14959 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14960 eval $hasproto
14961
14962 : see if lstat exists
14963 set lstat d_lstat
14964 eval $inlibc
14965
14966 : see if madvise exists
14967 set madvise d_madvise
14968 eval $inlibc
14969
14970 : see if malloc_size exists
14971 set malloc_size d_malloc_size
14972 eval $inlibc
14973
14974 : see if malloc_size_good exists
14975 set malloc_good_size d_malloc_good_size
14976 eval $inlibc
14977
14978 : see if mblen exists
14979 set mblen d_mblen
14980 eval $inlibc
14981
14982 : see if mbstowcs exists
14983 set mbstowcs d_mbstowcs
14984 eval $inlibc
14985
14986 : see if mbtowc exists
14987 set mbtowc d_mbtowc
14988 eval $inlibc
14989
14990 : see if memchr exists
14991 set memchr d_memchr
14992 eval $inlibc
14993
14994 : see if memcmp exists
14995 set memcmp d_memcmp
14996 eval $inlibc
14997
14998 : see if memcpy exists
14999 set memcpy d_memcpy
15000 eval $inlibc
15001
15002 : see if memmove exists
15003 set memmove d_memmove
15004 eval $inlibc
15005
15006 : see if memset exists
15007 set memset d_memset
15008 eval $inlibc
15009
15010 : see if mkdir exists
15011 set mkdir d_mkdir
15012 eval $inlibc
15013
15014 : see if mkdtemp exists
15015 set mkdtemp d_mkdtemp
15016 eval $inlibc
15017
15018 : see if mkfifo exists
15019 set mkfifo d_mkfifo
15020 eval $inlibc
15021
15022 : see if mkstemp exists
15023 set mkstemp d_mkstemp
15024 eval $inlibc
15025
15026 : see if mkstemps exists
15027 set mkstemps d_mkstemps
15028 eval $inlibc
15029
15030 : see if mktime exists
15031 set mktime d_mktime
15032 eval $inlibc
15033
15034 : see if this is a sys/mman.h system
15035 set sys/mman.h i_sysmman
15036 eval $inhdr
15037
15038 : see if mmap exists
15039 set mmap d_mmap
15040 eval $inlibc
15041 : see what shmat returns
15042 : default to something harmless
15043 mmaptype='void *'
15044 case "$i_sysmman$d_mmap" in
15045 "$define$define")
15046         $cat >mmap.c <<'END'
15047 #include <sys/mman.h>
15048 void *mmap();
15049 END
15050         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15051                 mmaptype='void *'
15052         else
15053                 mmaptype='caddr_t'
15054         fi
15055         echo "and it returns ($mmaptype)." >&4
15056         ;;
15057 esac
15058
15059
15060
15061 : see if sqrtl exists
15062 set sqrtl d_sqrtl
15063 eval $inlibc
15064
15065 : see if scalbnl exists
15066 set scalbnl d_scalbnl
15067 eval $inlibc
15068
15069 : see if modfl exists
15070 set modfl d_modfl
15071 eval $inlibc
15072
15073 : see if prototype for modfl is available
15074 echo " "
15075 set d_modflproto modfl $i_math math.h
15076 eval $hasproto
15077
15078 d_modfl_pow32_bug="$undef"
15079
15080 case "$d_longdbl$d_modfl" in
15081 $define$define)
15082         $cat <<EOM
15083 Checking to see whether your modfl() is okay for large values...
15084 EOM
15085 $cat >try.c <<EOCP
15086 #include <math.h>
15087 #include <stdio.h>
15088 EOCP
15089 if $test "X$d_modflproto" != "X$define"; then
15090         $cat >>try.c <<EOCP
15091 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15092 long double modfl (long double, long double *);
15093 EOCP
15094 fi
15095 $cat >>try.c <<EOCP
15096 int main() {
15097     long double nv = 4294967303.15;
15098     long double v, w;
15099     v = modfl(nv, &w);
15100 #ifdef __GLIBC__
15101     printf("glibc");
15102 #endif
15103     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15104     return 0;
15105 }
15106 EOCP
15107         case "$osname:$gccversion" in
15108         aix:)   saveccflags="$ccflags"
15109                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15110         esac
15111         set try
15112         if eval $compile; then
15113                 foo=`$run ./try`
15114                 case "$foo" in
15115                 *" 4294967303.150000 1.150000 4294967302.000000")
15116                         echo >&4 "Your modfl() is broken for large values."
15117                         d_modfl_pow32_bug="$define"
15118                         case "$foo" in
15119                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15120                         ;;
15121                         esac
15122                         ;;
15123                 *" 4294967303.150000 0.150000 4294967303.000000")
15124                         echo >&4 "Your modfl() seems okay for large values."
15125                         ;;
15126                 *)      echo >&4 "I don't understand your modfl() at all."
15127                         d_modfl="$undef"
15128                         ;;
15129                 esac
15130                 $rm_try
15131         else
15132                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15133                 d_modfl="$undef"
15134         fi
15135         case "$osname:$gccversion" in
15136         aix:)   ccflags="$saveccflags" ;; # restore
15137         esac
15138         ;;
15139 esac
15140
15141 if $test "$uselongdouble" = "$define"; then
15142     message=""
15143     if $test "$d_sqrtl" != "$define"; then
15144         message="$message sqrtl"
15145     fi
15146     if $test "$d_modfl" != "$define"; then
15147         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15148             echo "You have both aintl and copysignl, so I can emulate modfl."
15149         else
15150             message="$message modfl"
15151         fi
15152     fi
15153     if $test "$d_frexpl" != "$define"; then
15154         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15155             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15156         else
15157             message="$message frexpl"
15158         fi
15159     fi
15160
15161     if $test "$message" != ""; then
15162         $cat <<EOM >&4
15163
15164 *** You requested the use of long doubles but you do not seem to have
15165 *** the following mathematical functions needed for long double support:
15166 ***    $message
15167 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15168 *** Cannot continue, aborting.
15169
15170 EOM
15171
15172         exit 1
15173     fi
15174 fi
15175
15176 : see if mprotect exists
15177 set mprotect d_mprotect
15178 eval $inlibc
15179
15180 : see if msgctl exists
15181 set msgctl d_msgctl
15182 eval $inlibc
15183
15184 : see if msgget exists
15185 set msgget d_msgget
15186 eval $inlibc
15187
15188 : see if msgsnd exists
15189 set msgsnd d_msgsnd
15190 eval $inlibc
15191
15192 : see if msgrcv exists
15193 set msgrcv d_msgrcv
15194 eval $inlibc
15195
15196 : see how much of the 'msg*(2)' library is present.
15197 h_msg=true
15198 echo " "
15199 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15200 *"$undef"*) h_msg=false;;
15201 esac
15202 case "$osname" in
15203 freebsd)
15204     case "`ipcs 2>&1`" in
15205     "SVID messages"*"not configured"*)
15206         echo "Your $osname does not have the msg*(2) configured." >&4
15207         h_msg=false
15208         val="$undef"
15209         set msgctl d_msgctl
15210         eval $setvar
15211         set msgget d_msgget
15212         eval $setvar
15213         set msgsnd d_msgsnd
15214         eval $setvar
15215         set msgrcv d_msgrcv
15216         eval $setvar
15217         ;;
15218     esac
15219     ;;
15220 esac
15221 : we could also check for sys/ipc.h ...
15222 if $h_msg && $test `./findhdr sys/msg.h`; then
15223         echo "You have the full msg*(2) library." >&4
15224         val="$define"
15225 else
15226         echo "You don't have the full msg*(2) library." >&4
15227         val="$undef"
15228 fi
15229 set d_msg
15230 eval $setvar
15231
15232 : Check for msghdr_s
15233 echo " "
15234 echo "Checking to see if your system supports struct msghdr..." >&4
15235 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15236 eval $hasstruct
15237 case "$d_msghdr_s" in
15238 "$define")      echo "Yes, it does."   ;;
15239 *)              echo "No, it doesn't." ;;
15240 esac
15241
15242
15243 : see if msync exists
15244 set msync d_msync
15245 eval $inlibc
15246
15247 : see if munmap exists
15248 set munmap d_munmap
15249 eval $inlibc
15250
15251 : see if nice exists
15252 set nice d_nice
15253 eval $inlibc
15254
15255 : see if this is a langinfo.h system
15256 set langinfo.h i_langinfo
15257 eval $inhdr
15258
15259 : see if nl_langinfo exists
15260 set nl_langinfo d_nl_langinfo
15261 eval $inlibc
15262
15263 : check for volatile keyword
15264 echo " "
15265 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15266 $cat >try.c <<'EOCP'
15267 int main()
15268 {
15269         typedef struct _goo_struct goo_struct;
15270         goo_struct * volatile goo = ((goo_struct *)0);
15271         struct _goo_struct {
15272                 long long_int;
15273                 int reg_int;
15274                 char char_var;
15275         };
15276         typedef unsigned short foo_t;
15277         char *volatile foo;
15278         volatile int bar;
15279         volatile foo_t blech;
15280         foo = foo;
15281 }
15282 EOCP
15283 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15284         val="$define"
15285         echo "Yup, it does."
15286 else
15287         val="$undef"
15288         echo "Nope, it doesn't."
15289 fi
15290 set d_volatile
15291 eval $setvar
15292 $rm_try
15293
15294 : Check basic sizes
15295 echo " "
15296 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15297
15298 case "$use64bitint:$d_quad:$quadtype" in
15299 define:define:?*)
15300         ivtype="$quadtype"
15301         uvtype="$uquadtype"
15302         ivsize=8
15303         uvsize=8
15304         ;;
15305 *)      ivtype="long"
15306         uvtype="unsigned long"
15307         ivsize=$longsize
15308         uvsize=$longsize
15309         ;;
15310 esac
15311
15312 case "$uselongdouble:$d_longdbl" in
15313 define:define)
15314         nvtype="long double"
15315         nvsize=$longdblsize
15316         ;;
15317 *)      nvtype=double
15318         nvsize=$doublesize
15319         ;;
15320 esac
15321
15322 $echo "(IV will be "$ivtype", $ivsize bytes)"
15323 $echo "(UV will be "$uvtype", $uvsize bytes)"
15324 $echo "(NV will be "$nvtype", $nvsize bytes)"
15325
15326 $cat >try.c <<EOCP
15327 #$i_inttypes I_INTTYPES
15328 #ifdef I_INTTYPES
15329 #include <inttypes.h>
15330 #endif
15331 #include <stdio.h>
15332 int main() {
15333 #ifdef INT8
15334    int8_t i =  INT8_MAX;
15335   uint8_t u = UINT8_MAX;
15336   printf("int8_t\n");
15337 #endif
15338 #ifdef INT16
15339    int16_t i =  INT16_MAX;
15340   uint16_t i = UINT16_MAX;
15341   printf("int16_t\n");
15342 #endif
15343 #ifdef INT32
15344    int32_t i =  INT32_MAX;
15345   uint32_t u = UINT32_MAX;
15346   printf("int32_t\n");
15347 #endif
15348 }
15349 EOCP
15350
15351 i8type="signed char"
15352 u8type="unsigned char"
15353 i8size=1
15354 u8size=1
15355
15356 case "$i16type" in
15357 '')     case "$shortsize" in
15358         2)      i16type=short
15359                 u16type="unsigned short"
15360                 i16size=$shortsize
15361                 u16size=$shortsize
15362                 ;;
15363         esac
15364         ;;
15365 esac
15366 case "$i16type" in
15367 '')     set try -DINT16
15368         if eval $compile; then
15369                 case "`$run ./try`" in
15370                 int16_t)
15371                         i16type=int16_t
15372                         u16type=uint16_t
15373                         i16size=2
15374                         u16size=2
15375                         ;;
15376                 esac
15377         fi
15378         ;;
15379 esac
15380 case "$i16type" in
15381 '')     if $test $shortsize -ge 2; then
15382                 i16type=short
15383                 u16type="unsigned short"
15384                 i16size=$shortsize
15385                 u16size=$shortsize
15386         fi
15387         ;;
15388 esac
15389
15390 case "$i32type" in
15391 '')     case "$longsize" in
15392         4)      i32type=long
15393                 u32type="unsigned long"
15394                 i32size=$longsize
15395                 u32size=$longsize
15396                 ;;
15397         *)      case "$intsize" in
15398                 4)      i32type=int
15399                         u32type="unsigned int"
15400                         i32size=$intsize
15401                         u32size=$intsize
15402                         ;;
15403                 esac
15404                 ;;
15405         esac
15406         ;;
15407 esac
15408 case "$i32type" in
15409 '')     set try -DINT32
15410         if eval $compile; then
15411                 case "`$run ./try`" in
15412                 int32_t)
15413                         i32type=int32_t
15414                         u32type=uint32_t
15415                         i32size=4
15416                         u32size=4
15417                         ;;
15418                 esac
15419         fi
15420         ;;
15421 esac
15422 case "$i32type" in
15423 '')     if $test $intsize -ge 4; then
15424                 i32type=int
15425                 u32type="unsigned int"
15426                 i32size=$intsize
15427                 u32size=$intsize
15428         fi
15429         ;;
15430 esac
15431
15432 case "$i64type" in
15433 '')     case "$d_quad:$quadtype" in
15434         define:?*)
15435                 i64type="$quadtype"
15436                 u64type="$uquadtype"
15437                 i64size=8
15438                 u64size=8
15439                 ;;
15440         esac
15441         ;;
15442 esac
15443
15444 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15445 : volatile so that the compiler has to store it out to memory.
15446 if test X"$d_volatile" = X"$define"; then
15447         volatile=volatile
15448 fi
15449 $cat <<EOP >try.c
15450 #include <stdio.h>
15451 #$i_stdlib I_STDLIB
15452 #ifdef I_STDLIB
15453 #include <stdlib.h>
15454 #endif
15455 #include <sys/types.h>
15456 #include <signal.h>
15457 #ifdef SIGFPE
15458 $volatile int bletched = 0;
15459 $signal_t blech(int s) { bletched = 1; }
15460 #endif
15461 int main() {
15462     $uvtype u = 0;
15463     $nvtype d;
15464     int     n = 8 * $uvsize;
15465     int     i;
15466 #ifdef SIGFPE
15467     signal(SIGFPE, blech);
15468 #endif
15469
15470     for (i = 0; i < n; i++) {
15471       u = u << 1 | ($uvtype)1;
15472       d = ($nvtype)u;
15473       if (($uvtype)d != u)
15474         break;
15475       if (d <= 0)
15476         break;
15477       d = ($nvtype)(u - 1);
15478       if (($uvtype)d != (u - 1))
15479         break;
15480 #ifdef SIGFPE
15481       if (bletched)
15482         break;
15483 #endif
15484     }
15485     printf("%d\n", ((i == n) ? -n : i));
15486     exit(0);
15487 }
15488 EOP
15489 set try
15490
15491 d_nv_preserves_uv="$undef"
15492 if eval $compile; then
15493         nv_preserves_uv_bits="`$run ./try`"
15494 fi
15495 case "$nv_preserves_uv_bits" in
15496 \-[1-9]*)
15497         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15498         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15499         d_nv_preserves_uv="$define"
15500         ;;
15501 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15502         d_nv_preserves_uv="$undef" ;;
15503 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15504         nv_preserves_uv_bits="0" ;;
15505 esac
15506 $rm_try
15507
15508 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15509 : volatile so that the compiler has to store it out to memory.
15510 if test X"$d_volatile" = X"$define"; then
15511         volatile=volatile
15512 fi
15513 $cat <<EOP >try.c
15514 #include <stdio.h>
15515
15516 typedef $nvtype NV;
15517
15518 int
15519 main() {
15520   NV value = 2;
15521   int count = 1;
15522
15523   while(count < 256) {
15524     $volatile NV up = value + 1.0;
15525     $volatile NV negated = -value;
15526     $volatile NV down = negated - 1.0;
15527     $volatile NV got_up = up - value;
15528     int up_good = got_up == 1.0;
15529     int got_down = down - negated;
15530     int down_good = got_down == -1.0;
15531
15532     if (down_good != up_good) {
15533       fprintf(stderr,
15534               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15535               up_good, (double) got_up, down_good, (double) got_down,
15536               count, (double) value);
15537       return 1;
15538     }
15539     if (!up_good) {
15540       while (1) {
15541         if (count > 8) {
15542           count -= 8;
15543           fputs("256.0", stdout);
15544         } else {
15545           count--;
15546           fputs("2.0", stdout);
15547         }
15548         if (!count) {
15549           puts("");
15550           return 0;
15551         }
15552         fputs("*", stdout);
15553       }
15554     }
15555     value *= 2;
15556     ++count;
15557   }
15558   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15559           count, (double) value);
15560   return 1;
15561 }
15562 EOP
15563 set try
15564
15565 nv_overflows_integers_at='0'
15566 if eval $compile; then
15567     xxx="`$run ./try`"
15568     case "$?" in
15569         0)
15570             case "$xxx" in
15571                 2*)  cat >&4 <<EOM
15572 The largest integer your NVs can preserve is equal to $xxx
15573 EOM
15574                     nv_overflows_integers_at="$xxx"
15575                     ;;
15576                 *)  cat >&4 <<EOM
15577 Cannot determine the largest integer value your NVs can hold, unexpected output
15578 '$xxx'
15579 EOM
15580                     ;;
15581             esac
15582             ;;
15583         *)  cat >&4 <<EOM
15584 Cannot determine the largest integer value your NVs can hold
15585 EOM
15586             ;;
15587     esac
15588 fi
15589 $rm_try
15590
15591 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15592 : volatile so that the compiler has to store it out to memory.
15593 if test X"$d_volatile" = X"$define"; then
15594         volatile=volatile
15595 fi
15596 $cat <<EOP >try.c
15597 #include <stdio.h>
15598 #$i_stdlib I_STDLIB
15599 #ifdef I_STDLIB
15600 #include <stdlib.h>
15601 #endif
15602 #$i_string I_STRING
15603 #ifdef I_STRING
15604 #  include <string.h>
15605 #else
15606 #  include <strings.h>
15607 #endif
15608 #include <sys/types.h>
15609 #include <signal.h>
15610 #ifdef SIGFPE
15611 $volatile int bletched = 0;
15612 $signal_t blech(int s) { bletched = 1; }
15613 #endif
15614
15615 int checkit($nvtype d, char *where) {
15616     unsigned char *p = (char *)&d;
15617     unsigned char *end = p + sizeof(d);
15618     int fail = 0;
15619
15620     while (p < end)
15621         fail += *p++;
15622
15623     if (!fail)
15624         return 0;
15625
15626     p = (char *)&d;
15627     printf("No - %s: 0x", where);
15628     while (p < end)
15629         printf ("%02X", *p++);
15630     printf("\n");
15631     return 1;
15632 }
15633
15634 int main(int argc, char **argv) {
15635     $nvtype d = 0.0;
15636     int fail = 0;
15637     fail += checkit(d, "0.0");
15638
15639     /* The compiler shouldn't be assuming that bletched is 0  */
15640     d = bletched;
15641
15642     fail += checkit(d, "bleched");
15643
15644 #ifdef SIGFPE
15645     signal(SIGFPE, blech);
15646 #endif
15647
15648     /* Paranoia - the compiler should have no way of knowing that ANSI says
15649        that argv[argc] will always be NULL.  Actually, if it did assume this it
15650        would be buggy, as this is C and main() can be called from elsewhere in
15651        the program.  */
15652     d = argv[argc] ? 1 : 0;
15653
15654     if (d) {
15655         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15656     }
15657
15658     fail += checkit(d, "ternary");
15659
15660     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15661
15662     if (d != 0.0) {
15663         printf("No - memset doesn't give 0.0\n");
15664         /* This might just blow up:  */
15665         printf("(gives %g)\n", d);
15666         return 1;
15667     }
15668
15669 #ifdef SIGFPE
15670     if (bletched) {
15671         printf("No - something bleched\n");
15672         return 1;
15673     }
15674 #endif
15675     if (fail) {
15676       printf("No - %d fail(s)\n", fail);
15677       return 1;
15678     }
15679     printf("Yes\n");
15680     return 0;
15681 }
15682 EOP
15683 set try
15684
15685 d_nv_zero_is_allbits_zero="$undef"
15686 if eval $compile; then
15687     xxx="`$run ./try`"
15688     case "$?" in
15689         0)
15690             case "$xxx" in
15691                 Yes)  cat >&4 <<EOM
15692 0.0 is represented as all bits zero in memory
15693 EOM
15694                     d_nv_zero_is_allbits_zero="$define"
15695                     ;;
15696                 *)  cat >&4 <<EOM
15697 0.0 is not represented as all bits zero in memory
15698 EOM
15699                     d_nv_zero_is_allbits_zero="$undef"
15700                     ;;
15701             esac
15702             ;;
15703         *)  cat >&4 <<EOM
15704 0.0 is not represented as all bits zero in memory
15705 EOM
15706             d_nv_zero_is_allbits_zero="$undef"
15707             ;;
15708     esac
15709 fi
15710 $rm_try
15711
15712 : check for off64_t
15713 echo " "
15714 echo "Checking to see if you have off64_t..." >&4
15715 $cat >try.c <<EOCP
15716 #include <sys/types.h>
15717 #include <unistd.h>
15718 int main() { off64_t x = 7; }
15719 EOCP
15720 set try
15721 if eval $compile; then
15722         val="$define"
15723         echo "You have off64_t."
15724 else
15725         val="$undef"
15726         echo "You do not have off64_t."
15727         case "$lseeksize" in
15728         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15729         esac
15730 fi
15731 $rm_try
15732 set d_off64_t
15733 eval $setvar
15734
15735 : how to create joinable pthreads
15736 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15737         echo " "
15738         echo "Checking what constant to use for creating joinable pthreads..." >&4
15739         $cat >try.c <<'EOCP'
15740 #include <pthread.h>
15741 int main() {
15742     int detachstate = JOINABLE;
15743 }
15744 EOCP
15745         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15746         if eval $compile; then
15747                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15748                 val="$undef" # Yes, undef.
15749                 set d_old_pthread_create_joinable
15750                 eval $setvar
15751                 val=""
15752                 set old_pthread_create_joinable
15753                 eval $setvar
15754         else
15755                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15756                 if eval $compile; then
15757                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15758                         val="$define"
15759                         set d_old_pthread_create_joinable
15760                         eval $setvar
15761                         val=PTHREAD_CREATE_UNDETACHED
15762                         set old_pthread_create_joinable
15763                         eval $setvar
15764                 else
15765                         set try -DJOINABLE=__UNDETACHED
15766                         if eval $compile; then
15767                                 echo "You seem to use __UNDETACHED." >&4
15768                                 val="$define"
15769                                 set d_old_pthread_create_joinable
15770                                 eval $setvar
15771                                 val=__UNDETACHED
15772                                 set old_pthread_create_joinable
15773                                 eval $setvar
15774                         else
15775                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15776                                 val="$define"
15777                                 set d_old_pthread_create_joinable
15778                                 eval $setvar
15779                                 val=0
15780                                 set old_pthread_create_joinable
15781                                 eval $setvar
15782                         fi
15783                 fi
15784         fi
15785         $rm_try
15786 else
15787     d_old_pthread_create_joinable="$undef"
15788     old_pthread_create_joinable=""
15789 fi
15790
15791 : see if pause exists
15792 set pause d_pause
15793 eval $inlibc
15794
15795 : see if poll exists
15796 set poll d_poll
15797 eval $inlibc
15798
15799 : see if readlink exists
15800 set readlink d_readlink
15801 eval $inlibc
15802
15803 : Check if exe is symlink to abs path of executing program
15804 echo " "
15805 procselfexe=''
15806 val="$undef"
15807 case "$d_readlink" in
15808 "$define")
15809         if $issymlink /proc/self/exe ; then
15810                 $ls -l /proc/self/exe > reflect
15811                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15812                         echo "You have Linux-like /proc/self/exe."
15813                         procselfexe='"/proc/self/exe"'
15814                         val="$define"
15815                 fi
15816         fi
15817         if $issymlink /proc/curproc/file ; then
15818                 $ls -l /proc/curproc/file > reflect
15819                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15820                         echo "You have BSD-like /proc/curproc/file."
15821                         procselfexe='"/proc/curproc/file"'
15822                         val="$define"
15823                 fi
15824         fi
15825         ;;
15826 esac
15827 $rm -f reflect
15828 set d_procselfexe
15829 eval $setvar
15830
15831 : backward compatibility for d_hvfork
15832 if test X$d_hvfork != X; then
15833         d_vfork="$d_hvfork"
15834         d_hvfork=''
15835 fi
15836 : see if there is a vfork
15837 val=''
15838 set vfork val
15839 eval $inlibc
15840
15841 d_pseudofork=$undef
15842
15843 : Ok, but do we want to use it. vfork is reportedly unreliable in
15844 : perl on Solaris 2.x, and probably elsewhere.
15845 case "$val" in
15846 $define)
15847         echo " "
15848         case "$usevfork" in
15849         false) dflt='n';;
15850         *) dflt='y';;
15851         esac
15852         cat <<'EOM'
15853
15854 Perl can only use a vfork() that doesn't suffer from strict
15855 restrictions on calling functions or modifying global data in
15856 the child.  For example, glibc-2.1 contains such a vfork()
15857 that is unsuitable.  If your system provides a proper fork()
15858 call, chances are that you do NOT want perl to use vfork().
15859
15860 EOM
15861         rp="Do you still want to use vfork()?"
15862         . ./myread
15863         case "$ans" in
15864         y|Y) ;;
15865         *)
15866                 echo "Ok, we won't use vfork()."
15867                 val="$undef"
15868                 ;;
15869         esac
15870         ;;
15871 esac
15872 set d_vfork
15873 eval $setvar
15874 case "$d_vfork" in
15875 $define) usevfork='true';;
15876 *) usevfork='false';;
15877 esac
15878
15879 : see whether the pthread_atfork exists
15880 $cat >try.c <<EOP
15881 #include <pthread.h>
15882 #include <stdio.h>
15883 int main() {
15884 #ifdef  PTHREAD_ATFORK
15885         pthread_atfork(NULL,NULL,NULL);
15886 #endif
15887 }
15888 EOP
15889
15890 : see if pthread_atfork exists
15891 set try -DPTHREAD_ATFORK
15892 if eval $compile; then
15893     val="$define"
15894 else
15895     val="$undef"
15896 fi
15897 case "$usethreads" in
15898 $define)
15899         case "$val" in
15900         $define) echo 'pthread_atfork found.' >&4        ;;
15901         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15902         esac
15903 esac
15904 set d_pthread_atfork
15905 eval $setvar
15906
15907 : see if pthread_attr_setscope exists
15908 set pthread_attr_setscope d_pthread_attr_setscope
15909 eval $inlibc
15910
15911 : see whether the various POSIXish _yields exist
15912 $cat >try.c <<EOP
15913 #include <pthread.h>
15914 #include <stdio.h>
15915 int main() {
15916 #ifdef SCHED_YIELD
15917         sched_yield();
15918 #else
15919 #ifdef PTHREAD_YIELD
15920         pthread_yield();
15921 #else
15922 #ifdef PTHREAD_YIELD_NULL
15923         pthread_yield(NULL);
15924 #endif
15925 #endif
15926 #endif
15927 }
15928 EOP
15929 : see if sched_yield exists
15930 set try -DSCHED_YIELD
15931 if eval $compile; then
15932     val="$define"
15933     sched_yield='sched_yield()'
15934 else
15935     val="$undef"
15936 fi
15937 case "$usethreads" in
15938 $define)
15939         case "$val" in
15940         $define) echo 'sched_yield() found.' >&4        ;;
15941         *)       echo 'sched_yield() NOT found.' >&4    ;;
15942         esac
15943 esac
15944 set d_sched_yield
15945 eval $setvar
15946
15947 : see if pthread_yield exists
15948 set try -DPTHREAD_YIELD
15949 if eval $compile; then
15950     val="$define"
15951     case "$sched_yield" in
15952     '') sched_yield='pthread_yield()' ;;
15953     esac
15954 else
15955     set try -DPTHREAD_YIELD_NULL
15956     if eval $compile; then
15957         val="$define"
15958         case "$sched_yield" in
15959         '') sched_yield='pthread_yield(NULL)' ;;
15960         esac
15961     else
15962         val="$undef"
15963     fi
15964 fi
15965 case "$usethreads" in
15966 $define)
15967         case "$val" in
15968         $define) echo 'pthread_yield() found.' >&4      ;;
15969         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15970         esac
15971         ;;
15972 esac
15973 set d_pthread_yield
15974 eval $setvar
15975 case "$sched_yield" in
15976 '') sched_yield=undef ;;
15977 esac
15978 $rm_try
15979
15980 : see if random_r exists
15981 set random_r d_random_r
15982 eval $inlibc
15983 case "$d_random_r" in
15984 "$define")
15985         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15986         case "$d_random_r_proto:$usethreads" in
15987         ":define")      d_random_r_proto=define
15988                 set d_random_r_proto random_r $hdrs
15989                 eval $hasproto ;;
15990         *)      ;;
15991         esac
15992         case "$d_random_r_proto" in
15993         define)
15994         case "$random_r_proto" in
15995         ''|0) try='int random_r(int*, struct random_data*);'
15996         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15997         esac
15998         case "$random_r_proto" in
15999         ''|0) try='int random_r(long*, struct random_data*);'
16000         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16001         esac
16002         case "$random_r_proto" in
16003         ''|0) try='int random_r(struct random_data*, int32_t*);'
16004         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16005         esac
16006         case "$random_r_proto" in
16007         ''|0)   d_random_r=undef
16008                 random_r_proto=0
16009                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16010         * )     case "$random_r_proto" in
16011                 REENTRANT_PROTO*) ;;
16012                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16013                 esac
16014                 echo "Prototype: $try" ;;
16015         esac
16016         ;;
16017         *)      case "$usethreads" in
16018                 define) echo "random_r has no prototype, not using it." >&4 ;;
16019                 esac
16020                 d_random_r=undef
16021                 random_r_proto=0
16022                 ;;
16023         esac
16024         ;;
16025 *)      random_r_proto=0
16026         ;;
16027 esac
16028
16029 : see if readdir and friends exist
16030 set readdir d_readdir
16031 eval $inlibc
16032 set seekdir d_seekdir
16033 eval $inlibc
16034 set telldir d_telldir
16035 eval $inlibc
16036 set rewinddir d_rewinddir
16037 eval $inlibc
16038
16039 : see if readdir64_r exists
16040 set readdir64_r d_readdir64_r
16041 eval $inlibc
16042 case "$d_readdir64_r" in
16043 "$define")
16044         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16045         case "$d_readdir64_r_proto:$usethreads" in
16046         ":define")      d_readdir64_r_proto=define
16047                 set d_readdir64_r_proto readdir64_r $hdrs
16048                 eval $hasproto ;;
16049         *)      ;;
16050         esac
16051         case "$d_readdir64_r_proto" in
16052         define)
16053         case "$readdir64_r_proto" in
16054         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16055         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16056         esac
16057         case "$readdir64_r_proto" in
16058         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16059         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16060         esac
16061         case "$readdir64_r_proto" in
16062         ''|0)   d_readdir64_r=undef
16063                 readdir64_r_proto=0
16064                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16065         * )     case "$readdir64_r_proto" in
16066                 REENTRANT_PROTO*) ;;
16067                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16068                 esac
16069                 echo "Prototype: $try" ;;
16070         esac
16071         ;;
16072         *)      case "$usethreads" in
16073                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16074                 esac
16075                 d_readdir64_r=undef
16076                 readdir64_r_proto=0
16077                 ;;
16078         esac
16079         ;;
16080 *)      readdir64_r_proto=0
16081         ;;
16082 esac
16083
16084 : see if readdir_r exists
16085 set readdir_r d_readdir_r
16086 eval $inlibc
16087 case "$d_readdir_r" in
16088 "$define")
16089         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16090         case "$d_readdir_r_proto:$usethreads" in
16091         ":define")      d_readdir_r_proto=define
16092                 set d_readdir_r_proto readdir_r $hdrs
16093                 eval $hasproto ;;
16094         *)      ;;
16095         esac
16096         case "$d_readdir_r_proto" in
16097         define)
16098         case "$readdir_r_proto" in
16099         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16100         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16101         esac
16102         case "$readdir_r_proto" in
16103         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16104         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16105         esac
16106         case "$readdir_r_proto" in
16107         ''|0)   d_readdir_r=undef
16108                 readdir_r_proto=0
16109                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16110         * )     case "$readdir_r_proto" in
16111                 REENTRANT_PROTO*) ;;
16112                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16113                 esac
16114                 echo "Prototype: $try" ;;
16115         esac
16116         ;;
16117         *)      case "$usethreads" in
16118                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16119                 esac
16120                 d_readdir_r=undef
16121                 readdir_r_proto=0
16122                 ;;
16123         esac
16124         ;;
16125 *)      readdir_r_proto=0
16126         ;;
16127 esac
16128
16129 : see if readv exists
16130 set readv d_readv
16131 eval $inlibc
16132
16133 : see if recvmsg exists
16134 set recvmsg d_recvmsg
16135 eval $inlibc
16136
16137 : see if rename exists
16138 set rename d_rename
16139 eval $inlibc
16140
16141 : see if rmdir exists
16142 set rmdir d_rmdir
16143 eval $inlibc
16144
16145 : see if memory.h is available.
16146 val=''
16147 set memory.h val
16148 eval $inhdr
16149
16150 : See if it conflicts with string.h
16151 case "$val" in
16152 $define)
16153         case "$strings" in
16154         '') ;;
16155         *)
16156                 $cppstdin $cppflags $cppminus < $strings > mem.h
16157                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16158                         echo " "
16159                         echo "We won't be including <memory.h>."
16160                         val="$undef"
16161                 fi
16162                 $rm -f mem.h
16163                 ;;
16164         esac
16165 esac
16166 set i_memory
16167 eval $setvar
16168
16169 : can bcopy handle overlapping blocks?
16170 echo " "
16171 val="$undef"
16172 case "$d_memmove" in
16173 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16174 *)      case "$d_bcopy" in
16175         "$define")
16176                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16177                 $cat >try.c <<EOCP
16178 #$i_memory I_MEMORY
16179 #$i_stdlib I_STDLIB
16180 #$i_string I_STRING
16181 #$i_unistd I_UNISTD
16182 EOCP
16183         $cat >>try.c <<'EOCP'
16184 #include <stdio.h>
16185 #ifdef I_MEMORY
16186 #  include <memory.h>
16187 #endif
16188 #ifdef I_STDLIB
16189 #  include <stdlib.h>
16190 #endif
16191 #ifdef I_STRING
16192 #  include <string.h>
16193 #else
16194 #  include <strings.h>
16195 #endif
16196 #ifdef I_UNISTD
16197 #  include <unistd.h>  /* Needed for NetBSD */
16198 #endif
16199 int main()
16200 {
16201 char buf[128], abc[128];
16202 char *b;
16203 int len;
16204 int off;
16205 int align;
16206
16207 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16208    try to store the string in read-only memory. */
16209 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16210
16211 for (align = 7; align >= 0; align--) {
16212         for (len = 36; len; len--) {
16213                 b = buf+align;
16214                 bcopy(abc, b, len);
16215                 for (off = 1; off <= len; off++) {
16216                         bcopy(b, b+off, len);
16217                         bcopy(b+off, b, len);
16218                         if (bcmp(b, abc, len))
16219                                 exit(1);
16220                 }
16221         }
16222 }
16223 exit(0);
16224 }
16225 EOCP
16226                 set try
16227                 if eval $compile_ok; then
16228                         if $run ./try 2>/dev/null; then
16229                                 echo "Yes, it can."
16230                                 val="$define"
16231                         else
16232                                 echo "It can't, sorry."
16233                         fi
16234                 else
16235                         echo "(I can't compile the test program, so we'll assume not...)"
16236                 fi
16237                 ;;
16238         esac
16239         $rm_try
16240         ;;
16241 esac
16242 set d_safebcpy
16243 eval $setvar
16244
16245 : can memcpy handle overlapping blocks?
16246 echo " "
16247 val="$undef"
16248 case "$d_memmove" in
16249 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16250 *)      case "$d_memcpy" in
16251         "$define")
16252                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16253                 $cat >try.c <<EOCP
16254 #$i_memory I_MEMORY
16255 #$i_stdlib I_STDLIB
16256 #$i_string I_STRING
16257 #$i_unistd I_UNISTD
16258 EOCP
16259         $cat >>try.c <<'EOCP'
16260 #include <stdio.h>
16261 #ifdef I_MEMORY
16262 #  include <memory.h>
16263 #endif
16264 #ifdef I_STDLIB
16265 #  include <stdlib.h>
16266 #endif
16267 #ifdef I_STRING
16268 #  include <string.h>
16269 #else
16270 #  include <strings.h>
16271 #endif
16272 #ifdef I_UNISTD
16273 #  include <unistd.h>  /* Needed for NetBSD */
16274 #endif
16275 int main()
16276 {
16277 char buf[128], abc[128];
16278 char *b;
16279 int len;
16280 int off;
16281 int align;
16282
16283 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16284    try to store the string in read-only memory. */
16285 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16286
16287 for (align = 7; align >= 0; align--) {
16288         for (len = 36; len; len--) {
16289                 b = buf+align;
16290                 memcpy(b, abc, len);
16291                 for (off = 1; off <= len; off++) {
16292                         memcpy(b+off, b, len);
16293                         memcpy(b, b+off, len);
16294                         if (memcmp(b, abc, len))
16295                                 exit(1);
16296                 }
16297         }
16298 }
16299 exit(0);
16300 }
16301 EOCP
16302                 set try
16303                 if eval $compile_ok; then
16304                         if $run ./try 2>/dev/null; then
16305                                 echo "Yes, it can."
16306                                 val="$define"
16307                         else
16308                                 echo "It can't, sorry."
16309                         fi
16310                 else
16311                         echo "(I can't compile the test program, so we'll assume not...)"
16312                 fi
16313                 ;;
16314         esac
16315         $rm_try
16316         ;;
16317 esac
16318 set d_safemcpy
16319 eval $setvar
16320
16321 : can memcmp be trusted to compare relative magnitude?
16322 val="$undef"
16323 case "$d_memcmp" in
16324 "$define")
16325         echo " "
16326         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16327         $cat >try.c <<EOCP
16328 #$i_memory I_MEMORY
16329 #$i_stdlib I_STDLIB
16330 #$i_string I_STRING
16331 #$i_unistd I_UNISTD
16332 EOCP
16333         $cat >>try.c <<'EOCP'
16334 #include <stdio.h>
16335 #ifdef I_MEMORY
16336 #  include <memory.h>
16337 #endif
16338 #ifdef I_STDLIB
16339 #  include <stdlib.h>
16340 #endif
16341 #ifdef I_STRING
16342 #  include <string.h>
16343 #else
16344 #  include <strings.h>
16345 #endif
16346 #ifdef I_UNISTD
16347 #  include <unistd.h>  /* Needed for NetBSD */
16348 #endif
16349 int main()
16350 {
16351 char a = -1;
16352 char b = 0;
16353 if ((a < b) && memcmp(&a, &b, 1) < 0)
16354         exit(1);
16355 exit(0);
16356 }
16357 EOCP
16358         set try
16359         if eval $compile_ok; then
16360                 if $run ./try 2>/dev/null; then
16361                         echo "Yes, it can."
16362                         val="$define"
16363                 else
16364                         echo "No, it can't (it uses signed chars)."
16365                 fi
16366         else
16367                 echo "(I can't compile the test program, so we'll assume not...)"
16368         fi
16369         ;;
16370 esac
16371 $rm_try
16372 set d_sanemcmp
16373 eval $setvar
16374
16375 : see if prototype for sbrk is available
16376 echo " "
16377 set d_sbrkproto sbrk $i_unistd unistd.h
16378 eval $hasproto
16379
16380 : see if select exists
16381 set select d_select
16382 eval $inlibc
16383
16384 : see if semctl exists
16385 set semctl d_semctl
16386 eval $inlibc
16387
16388 : see if semget exists
16389 set semget d_semget
16390 eval $inlibc
16391
16392 : see if semop exists
16393 set semop d_semop
16394 eval $inlibc
16395
16396 : see how much of the 'sem*(2)' library is present.
16397 h_sem=true
16398 echo " "
16399 case "$d_semctl$d_semget$d_semop" in
16400 *"$undef"*) h_sem=false;;
16401 esac
16402 case "$osname" in
16403 freebsd)
16404     case "`ipcs 2>&1`" in
16405     "SVID messages"*"not configured"*)
16406         echo "Your $osname does not have the sem*(2) configured." >&4
16407         h_sem=false
16408         val="$undef"
16409         set semctl d_semctl
16410         eval $setvar
16411         set semget d_semget
16412         eval $setvar
16413         set semop d_semop
16414         eval $setvar
16415         ;;
16416     esac
16417     ;;
16418 esac
16419 : we could also check for sys/ipc.h ...
16420 if $h_sem && $test `./findhdr sys/sem.h`; then
16421         echo "You have the full sem*(2) library." >&4
16422         val="$define"
16423 else
16424         echo "You don't have the full sem*(2) library." >&4
16425         val="$undef"
16426 fi
16427 set d_sem
16428 eval $setvar
16429
16430 : see whether sys/sem.h defines union semun
16431 echo " "
16432 $cat > try.c <<'END'
16433 #include <sys/types.h>
16434 #include <sys/ipc.h>
16435 #include <sys/sem.h>
16436 int main () { union semun semun; semun.buf = 0; }
16437 END
16438 set try
16439 if eval $compile; then
16440     echo "You have union semun in <sys/sem.h>." >&4
16441     val="$define"
16442 else
16443     echo "You do not have union semun in <sys/sem.h>." >&4
16444     val="$undef"
16445 fi
16446 $rm_try
16447 set d_union_semun
16448 eval $setvar
16449
16450 : see how to do semctl IPC_STAT
16451 case "$d_sem" in
16452 $define)
16453     echo " "
16454     $cat > tryh.h <<END
16455 #ifndef S_IRUSR
16456 #   ifdef S_IREAD
16457 #       define S_IRUSR S_IREAD
16458 #       define S_IWUSR S_IWRITE
16459 #       define S_IXUSR S_IEXEC
16460 #   else
16461 #       define S_IRUSR 0400
16462 #       define S_IWUSR 0200
16463 #       define S_IXUSR 0100
16464 #   endif
16465 #   define S_IRGRP (S_IRUSR>>3)
16466 #   define S_IWGRP (S_IWUSR>>3)
16467 #   define S_IXGRP (S_IXUSR>>3)
16468 #   define S_IROTH (S_IRUSR>>6)
16469 #   define S_IWOTH (S_IWUSR>>6)
16470 #   define S_IXOTH (S_IXUSR>>6)
16471 #endif
16472 #ifndef S_IRWXU
16473 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16474 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16475 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16476 #endif
16477 END
16478     : see whether semctl IPC_STAT can use union semun
16479     case "$d_semctl_semun" in
16480     '')
16481       val="$undef"
16482       $cat > try.c <<END
16483 #include <sys/types.h>
16484 #include <sys/ipc.h>
16485 #include <sys/sem.h>
16486 #include <sys/stat.h>
16487 #include <stdio.h>
16488 #include <errno.h>
16489 #include "tryh.h"
16490 #ifndef errno
16491 extern int errno;
16492 #endif
16493 #$d_union_semun HAS_UNION_SEMUN
16494 int main() {
16495     union semun
16496 #ifndef HAS_UNION_SEMUN
16497     {
16498         int val;
16499         struct semid_ds *buf;
16500         unsigned short *array;
16501     }
16502 #endif
16503     arg;
16504     int sem, st;
16505
16506 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16507     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16508     if (sem > -1) {
16509         struct semid_ds argbuf;
16510         arg.buf = &argbuf;
16511 #       ifdef IPC_STAT
16512         st = semctl(sem, 0, IPC_STAT, arg);
16513         if (st == 0)
16514             printf("semun\n");
16515         else
16516 #       endif /* IPC_STAT */
16517             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16518 #       ifdef IPC_RMID
16519         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16520 #       endif /* IPC_RMID */
16521             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16522     } else
16523 #endif /* IPC_PRIVATE && ... */
16524         printf("semget failed: errno = %d\n", errno);
16525   return 0;
16526 }
16527 END
16528       set try
16529       if eval $compile; then
16530           xxx=`$run ./try`
16531           case "$xxx" in
16532           semun) val="$define" ;;
16533           esac
16534       fi
16535       $rm_try
16536       set d_semctl_semun
16537       eval $setvar
16538       ;;
16539     esac
16540     case "$d_semctl_semun" in
16541     $define)
16542         echo "You can use union semun for semctl IPC_STAT." >&4
16543         also='also'
16544         ;;
16545     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16546         also=''
16547         ;;
16548     esac
16549
16550     : see whether semctl IPC_STAT can use struct semid_ds pointer
16551     case "$d_semctl_semid_ds" in
16552     '')
16553       val="$undef"
16554       $cat > try.c <<'END'
16555 #include <sys/types.h>
16556 #include <sys/ipc.h>
16557 #include <sys/sem.h>
16558 #include <sys/stat.h>
16559 #include "tryh.h"
16560 #include <stdio.h>
16561 #include <errno.h>
16562 #ifndef errno
16563 extern int errno;
16564 #endif
16565 int main() {
16566     struct semid_ds arg;
16567     int sem, st;
16568
16569 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16570     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16571     if (sem > -1) {
16572 #       ifdef IPC_STAT
16573         st = semctl(sem, 0, IPC_STAT, &arg);
16574         if (st == 0)
16575             printf("semid_ds\n");
16576         else
16577 #       endif /* IPC_STAT */
16578             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16579 #       ifdef IPC_RMID
16580         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16581 #       endif /* IPC_RMID */
16582             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16583     } else
16584 #endif /* IPC_PRIVATE && ... */
16585         printf("semget failed: errno = %d\n", errno);
16586
16587     return 0;
16588 }
16589 END
16590       set try
16591       if eval $compile; then
16592           xxx=`$run ./try`
16593           case "$xxx" in
16594           semid_ds) val="$define" ;;
16595           esac
16596       fi
16597       $rm_try
16598       set d_semctl_semid_ds
16599       eval $setvar
16600       ;;
16601     esac
16602     case "$d_semctl_semid_ds" in
16603     $define)
16604         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16605         ;;
16606     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16607         ;;
16608     esac
16609     ;;
16610 *)  val="$undef"
16611
16612     # We do not have the full sem*(2) library, so assume we can not
16613     # use either.
16614
16615     set d_semctl_semun
16616     eval $setvar
16617
16618     set d_semctl_semid_ds
16619     eval $setvar
16620     ;;
16621 esac
16622 $rm_try tryh.h
16623
16624 : see if sendmsg exists
16625 set sendmsg d_sendmsg
16626 eval $inlibc
16627
16628 : see if setegid exists
16629 set setegid d_setegid
16630 eval $inlibc
16631
16632 : see if seteuid exists
16633 set seteuid d_seteuid
16634 eval $inlibc
16635
16636 : see if setgrent exists
16637 set setgrent d_setgrent
16638 eval $inlibc
16639
16640 : see if setgrent_r exists
16641 set setgrent_r d_setgrent_r
16642 eval $inlibc
16643 case "$d_setgrent_r" in
16644 "$define")
16645         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16646         case "$d_setgrent_r_proto:$usethreads" in
16647         ":define")      d_setgrent_r_proto=define
16648                 set d_setgrent_r_proto setgrent_r $hdrs
16649                 eval $hasproto ;;
16650         *)      ;;
16651         esac
16652         case "$d_setgrent_r_proto" in
16653         define)
16654         case "$setgrent_r_proto" in
16655         ''|0) try='int setgrent_r(FILE**);'
16656         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16657         esac
16658         case "$setgrent_r_proto" in
16659         ''|0) try='void setgrent_r(FILE**);'
16660         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16661         esac
16662         case "$setgrent_r_proto" in
16663         ''|0)   d_setgrent_r=undef
16664                 setgrent_r_proto=0
16665                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16666         * )     case "$setgrent_r_proto" in
16667                 REENTRANT_PROTO*) ;;
16668                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16669                 esac
16670                 echo "Prototype: $try" ;;
16671         esac
16672         ;;
16673         *)      case "$usethreads" in
16674                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16675                 esac
16676                 d_setgrent_r=undef
16677                 setgrent_r_proto=0
16678                 ;;
16679         esac
16680         ;;
16681 *)      setgrent_r_proto=0
16682         ;;
16683 esac
16684
16685 : see if sethostent exists
16686 set sethostent d_sethent
16687 eval $inlibc
16688
16689 : see if sethostent_r exists
16690 set sethostent_r d_sethostent_r
16691 eval $inlibc
16692 case "$d_sethostent_r" in
16693 "$define")
16694         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16695         case "$d_sethostent_r_proto:$usethreads" in
16696         ":define")      d_sethostent_r_proto=define
16697                 set d_sethostent_r_proto sethostent_r $hdrs
16698                 eval $hasproto ;;
16699         *)      ;;
16700         esac
16701         case "$d_sethostent_r_proto" in
16702         define)
16703         case "$sethostent_r_proto" in
16704         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16705         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16706         esac
16707         case "$sethostent_r_proto" in
16708         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16709         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16710         esac
16711         case "$sethostent_r_proto" in
16712         ''|0)   d_sethostent_r=undef
16713                 sethostent_r_proto=0
16714                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16715         * )     case "$sethostent_r_proto" in
16716                 REENTRANT_PROTO*) ;;
16717                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16718                 esac
16719                 echo "Prototype: $try" ;;
16720         esac
16721         ;;
16722         *)      case "$usethreads" in
16723                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16724                 esac
16725                 d_sethostent_r=undef
16726                 sethostent_r_proto=0
16727                 ;;
16728         esac
16729         ;;
16730 *)      sethostent_r_proto=0
16731         ;;
16732 esac
16733
16734 : see if setitimer exists
16735 set setitimer d_setitimer
16736 eval $inlibc
16737
16738 : see if setlinebuf exists
16739 set setlinebuf d_setlinebuf
16740 eval $inlibc
16741
16742 : see if setlocale exists
16743 set setlocale d_setlocale
16744 eval $inlibc
16745
16746 : see if locale.h is available
16747 set locale.h i_locale
16748 eval $inhdr
16749
16750 : see if setlocale_r exists
16751 set setlocale_r d_setlocale_r
16752 eval $inlibc
16753 case "$d_setlocale_r" in
16754 "$define")
16755         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16756         case "$d_setlocale_r_proto:$usethreads" in
16757         ":define")      d_setlocale_r_proto=define
16758                 set d_setlocale_r_proto setlocale_r $hdrs
16759                 eval $hasproto ;;
16760         *)      ;;
16761         esac
16762         case "$d_setlocale_r_proto" in
16763         define)
16764         case "$setlocale_r_proto" in
16765         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16766         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16767         esac
16768         case "$setlocale_r_proto" in
16769         ''|0)   d_setlocale_r=undef
16770                 setlocale_r_proto=0
16771                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16772         * )     case "$setlocale_r_proto" in
16773                 REENTRANT_PROTO*) ;;
16774                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16775                 esac
16776                 echo "Prototype: $try" ;;
16777         esac
16778         ;;
16779         *)      case "$usethreads" in
16780                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16781                 esac
16782                 d_setlocale_r=undef
16783                 setlocale_r_proto=0
16784                 ;;
16785         esac
16786         ;;
16787 *)      setlocale_r_proto=0
16788         ;;
16789 esac
16790
16791 : see if setnetent exists
16792 set setnetent d_setnent
16793 eval $inlibc
16794
16795 : see if setnetent_r exists
16796 set setnetent_r d_setnetent_r
16797 eval $inlibc
16798 case "$d_setnetent_r" in
16799 "$define")
16800         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16801         case "$d_setnetent_r_proto:$usethreads" in
16802         ":define")      d_setnetent_r_proto=define
16803                 set d_setnetent_r_proto setnetent_r $hdrs
16804                 eval $hasproto ;;
16805         *)      ;;
16806         esac
16807         case "$d_setnetent_r_proto" in
16808         define)
16809         case "$setnetent_r_proto" in
16810         ''|0) try='int setnetent_r(int, struct netent_data*);'
16811         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16812         esac
16813         case "$setnetent_r_proto" in
16814         ''|0) try='void setnetent_r(int, struct netent_data*);'
16815         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16816         esac
16817         case "$setnetent_r_proto" in
16818         ''|0)   d_setnetent_r=undef
16819                 setnetent_r_proto=0
16820                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16821         * )     case "$setnetent_r_proto" in
16822                 REENTRANT_PROTO*) ;;
16823                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16824                 esac
16825                 echo "Prototype: $try" ;;
16826         esac
16827         ;;
16828         *)      case "$usethreads" in
16829                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16830                 esac
16831                 d_setnetent_r=undef
16832                 setnetent_r_proto=0
16833                 ;;
16834         esac
16835         ;;
16836 *)      setnetent_r_proto=0
16837         ;;
16838 esac
16839
16840 : see if setprotoent exists
16841 set setprotoent d_setpent
16842 eval $inlibc
16843
16844 : see if setpgid exists
16845 set setpgid d_setpgid
16846 eval $inlibc
16847
16848 : see if setpgrp2 exists
16849 set setpgrp2 d_setpgrp2
16850 eval $inlibc
16851
16852 : see if setpriority exists
16853 set setpriority d_setprior
16854 eval $inlibc
16855
16856 : see if setproctitle exists
16857 set setproctitle d_setproctitle
16858 eval $inlibc
16859
16860 : see if setprotoent_r exists
16861 set setprotoent_r d_setprotoent_r
16862 eval $inlibc
16863 case "$d_setprotoent_r" in
16864 "$define")
16865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16866         case "$d_setprotoent_r_proto:$usethreads" in
16867         ":define")      d_setprotoent_r_proto=define
16868                 set d_setprotoent_r_proto setprotoent_r $hdrs
16869                 eval $hasproto ;;
16870         *)      ;;
16871         esac
16872         case "$d_setprotoent_r_proto" in
16873         define)
16874         case "$setprotoent_r_proto" in
16875         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16876         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16877         esac
16878         case "$setprotoent_r_proto" in
16879         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16880         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16881         esac
16882         case "$setprotoent_r_proto" in
16883         ''|0)   d_setprotoent_r=undef
16884                 setprotoent_r_proto=0
16885                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16886         * )     case "$setprotoent_r_proto" in
16887                 REENTRANT_PROTO*) ;;
16888                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16889                 esac
16890                 echo "Prototype: $try" ;;
16891         esac
16892         ;;
16893         *)      case "$usethreads" in
16894                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16895                 esac
16896                 d_setprotoent_r=undef
16897                 setprotoent_r_proto=0
16898                 ;;
16899         esac
16900         ;;
16901 *)      setprotoent_r_proto=0
16902         ;;
16903 esac
16904
16905 : see if setpwent exists
16906 set setpwent d_setpwent
16907 eval $inlibc
16908
16909 : see if setpwent_r exists
16910 set setpwent_r d_setpwent_r
16911 eval $inlibc
16912 case "$d_setpwent_r" in
16913 "$define")
16914         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16915         case "$d_setpwent_r_proto:$usethreads" in
16916         ":define")      d_setpwent_r_proto=define
16917                 set d_setpwent_r_proto setpwent_r $hdrs
16918                 eval $hasproto ;;
16919         *)      ;;
16920         esac
16921         case "$d_setpwent_r_proto" in
16922         define)
16923         case "$setpwent_r_proto" in
16924         ''|0) try='int setpwent_r(FILE**);'
16925         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16926         esac
16927         case "$setpwent_r_proto" in
16928         ''|0) try='void setpwent_r(FILE**);'
16929         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16930         esac
16931         case "$setpwent_r_proto" in
16932         ''|0)   d_setpwent_r=undef
16933                 setpwent_r_proto=0
16934                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16935         * )     case "$setpwent_r_proto" in
16936                 REENTRANT_PROTO*) ;;
16937                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16938                 esac
16939                 echo "Prototype: $try" ;;
16940         esac
16941         ;;
16942         *)      case "$usethreads" in
16943                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16944                 esac
16945                 d_setpwent_r=undef
16946                 setpwent_r_proto=0
16947                 ;;
16948         esac
16949         ;;
16950 *)      setpwent_r_proto=0
16951         ;;
16952 esac
16953
16954 : see if setregid exists
16955 set setregid d_setregid
16956 eval $inlibc
16957 set setresgid d_setresgid
16958 eval $inlibc
16959
16960 : see if setreuid exists
16961 set setreuid d_setreuid
16962 eval $inlibc
16963 set setresuid d_setresuid
16964 eval $inlibc
16965
16966 : see if setrgid exists
16967 set setrgid d_setrgid
16968 eval $inlibc
16969
16970 : see if setruid exists
16971 set setruid d_setruid
16972 eval $inlibc
16973
16974 : see if setservent exists
16975 set setservent d_setsent
16976 eval $inlibc
16977
16978 : see if setservent_r exists
16979 set setservent_r d_setservent_r
16980 eval $inlibc
16981 case "$d_setservent_r" in
16982 "$define")
16983         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16984         case "$d_setservent_r_proto:$usethreads" in
16985         ":define")      d_setservent_r_proto=define
16986                 set d_setservent_r_proto setservent_r $hdrs
16987                 eval $hasproto ;;
16988         *)      ;;
16989         esac
16990         case "$d_setservent_r_proto" in
16991         define)
16992         case "$setservent_r_proto" in
16993         ''|0) try='int setservent_r(int, struct servent_data*);'
16994         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16995         esac
16996         case "$setservent_r_proto" in
16997         ''|0) try='void setservent_r(int, struct servent_data*);'
16998         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16999         esac
17000         case "$setservent_r_proto" in
17001         ''|0)   d_setservent_r=undef
17002                 setservent_r_proto=0
17003                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17004         * )     case "$setservent_r_proto" in
17005                 REENTRANT_PROTO*) ;;
17006                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17007                 esac
17008                 echo "Prototype: $try" ;;
17009         esac
17010         ;;
17011         *)      case "$usethreads" in
17012                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17013                 esac
17014                 d_setservent_r=undef
17015                 setservent_r_proto=0
17016                 ;;
17017         esac
17018         ;;
17019 *)      setservent_r_proto=0
17020         ;;
17021 esac
17022
17023 : see if setsid exists
17024 set setsid d_setsid
17025 eval $inlibc
17026
17027 : see if setvbuf exists
17028 set setvbuf d_setvbuf
17029 eval $inlibc
17030
17031 : see if sfio.h is available
17032 set sfio.h i_sfio
17033 eval $inhdr
17034
17035 : see if sfio library is available
17036 case "$i_sfio" in
17037 $define)
17038         val=''
17039         set sfreserve val
17040         eval $inlibc
17041         ;;
17042 *)
17043         val="$undef"
17044         ;;
17045 esac
17046 : Ok, but do we want to use it.
17047 case "$val" in
17048 $define)
17049         case "$usesfio" in
17050         true|$define|[yY]*) dflt='y';;
17051         *) dflt='n';;
17052         esac
17053         echo "$package can use the sfio library, but it is experimental."
17054         case "$useperlio" in
17055         "$undef")
17056             echo "For sfio also the PerlIO abstraction layer is needed."
17057             echo "Earlier you said you wouldn't want that."
17058             ;;
17059         esac
17060         rp="You seem to have sfio available, do you want to try using it?"
17061         . ./myread
17062         case "$ans" in
17063         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17064                 useperlio="$define"
17065                 val="$define"
17066                 ;;
17067         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17068                 val="$undef"
17069                 ;;
17070         esac
17071         ;;
17072 *)      case "$usesfio" in
17073         true|$define|[yY]*)
17074                 echo "Sorry, cannot find sfio on this machine." >&4
17075                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17076                 val="$undef"
17077                 ;;
17078         esac
17079         ;;
17080 esac
17081 set d_sfio
17082 eval $setvar
17083 case "$d_sfio" in
17084 $define) usesfio='true';;
17085 *) usesfio='false';;
17086 esac
17087 case "$d_sfio" in
17088 $define) ;;
17089 *)      : Remove sfio from list of libraries to use
17090         case "$libs" in
17091         *-lsfio*)
17092                 echo "Removing unneeded -lsfio from library list" >&4
17093                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17094                 shift
17095                 libs="$*"
17096                 echo "libs = $libs" >&4
17097                 ;;
17098         esac
17099 ;;
17100 esac
17101
17102
17103 : see if shmctl exists
17104 set shmctl d_shmctl
17105 eval $inlibc
17106
17107 : see if shmget exists
17108 set shmget d_shmget
17109 eval $inlibc
17110
17111 : see if shmat exists
17112 set shmat d_shmat
17113 eval $inlibc
17114 : see what shmat returns
17115 case "$d_shmat" in
17116 "$define")
17117         $cat >shmat.c <<'END'
17118 #include <sys/shm.h>
17119 void *shmat();
17120 END
17121         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17122                 shmattype='void *'
17123         else
17124                 shmattype='char *'
17125         fi
17126         echo "and it returns ($shmattype)." >&4
17127         : see if a prototype for shmat is available
17128         xxx=`./findhdr sys/shm.h`
17129         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17130         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17131                 val="$define"
17132         else
17133                 val="$undef"
17134         fi
17135         $rm -f shmat.[co]
17136         ;;
17137 *)
17138         val="$undef"
17139         ;;
17140 esac
17141 set d_shmatprototype
17142 eval $setvar
17143
17144 : see if shmdt exists
17145 set shmdt d_shmdt
17146 eval $inlibc
17147
17148 : see how much of the 'shm*(2)' library is present.
17149 h_shm=true
17150 echo " "
17151 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17152 *"$undef"*) h_shm=false;;
17153 esac
17154 case "$osname" in
17155 freebsd)
17156     case "`ipcs 2>&1`" in
17157     "SVID shared memory"*"not configured"*)
17158         echo "Your $osname does not have the shm*(2) configured." >&4
17159         h_shm=false
17160         val="$undef"
17161         set shmctl d_shmctl
17162         evat $setvar
17163         set shmget d_shmget
17164         evat $setvar
17165         set shmat d_shmat
17166         evat $setvar
17167         set shmdt d_shmdt
17168         evat $setvar
17169         ;;
17170     esac
17171     ;;
17172 esac
17173 : we could also check for sys/ipc.h ...
17174 if $h_shm && $test `./findhdr sys/shm.h`; then
17175         echo "You have the full shm*(2) library." >&4
17176         val="$define"
17177 else
17178         echo "You don't have the full shm*(2) library." >&4
17179         val="$undef"
17180 fi
17181 set d_shm
17182 eval $setvar
17183
17184 : see if we have sigaction
17185 echo " "
17186 if set sigaction val -f d_sigaction; eval $csym; $val; then
17187         echo 'sigaction() found.' >&4
17188         $cat > try.c <<EOP
17189 #include <stdio.h>
17190 #include <sys/types.h>
17191 #include <signal.h>
17192 #$i_stdlib I_STDLIB
17193 #ifdef I_STDLIB
17194 #include <stdlib.h>
17195 #endif
17196 int main()
17197 {
17198     struct sigaction act, oact;
17199     act.sa_flags = 0;
17200     oact.sa_handler = 0;
17201     /* so that act and oact are used */
17202     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17203 }
17204 EOP
17205         set try
17206         if eval $compile_ok; then
17207                 val="$define"
17208         else
17209                 echo "But you don't seem to have a useable struct sigaction." >&4
17210                 val="$undef"
17211         fi
17212 else
17213         echo 'sigaction NOT found.' >&4
17214         val="$undef"
17215 fi
17216 set d_sigaction; eval $setvar
17217 $rm_try
17218
17219 : see if this is a sunmath.h system
17220 set sunmath.h i_sunmath
17221 eval $inhdr
17222
17223 : see if signbit exists
17224 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17225 $cat >try.c <<EOCP
17226 #$i_math I_MATH
17227 #$i_sunmath I_SUNMATH
17228 #ifdef I_MATH
17229 #  include <math.h>
17230 #endif
17231 #ifdef I_SUNMATH  /* Solaris special math library */
17232 #  include <sunmath.h>
17233 #endif
17234 #define NV $nvtype
17235 int main(int argc, char **argv)
17236 {
17237     NV x = 0.0;
17238     NV y = -0.0;
17239     if ((signbit(x) == 0) && (signbit(y) != 0))
17240         return 0;
17241     else
17242         return 1;
17243 }
17244 EOCP
17245 val="$undef"
17246 set try
17247 if eval $compile; then
17248     if $run ./try; then
17249         $echo "Yes." >&4
17250         val="$define"
17251     else
17252         $echo "Signbit seems to be available, but doesn't work as I expected."
17253         $echo "I won't use it." >&4
17254         val="$undef"
17255     fi
17256 else
17257     $echo "Nope." >&4
17258     dflt="$undef"
17259 fi
17260 set d_signbit
17261 eval $setvar
17262 $rm_try
17263
17264 : see if sigprocmask exists
17265 set sigprocmask d_sigprocmask
17266 eval $inlibc
17267
17268 : see if sigsetjmp exists
17269 echo " "
17270 case "$d_sigsetjmp" in
17271 '')
17272         $cat >try.c <<EOP
17273 #include <setjmp.h>
17274 #$i_stdlib I_STDLIB
17275 #ifdef I_STDLIB
17276 #include <stdlib.h>
17277 #endif
17278 sigjmp_buf env;
17279 int set = 1;
17280 int main()
17281 {
17282         if (sigsetjmp(env,1))
17283                 exit(set);
17284         set = 0;
17285         siglongjmp(env, 1);
17286         exit(1);
17287 }
17288 EOP
17289         set try
17290         if eval $compile; then
17291                 if $run ./try >/dev/null 2>&1; then
17292                         echo "POSIX sigsetjmp found." >&4
17293                         val="$define"
17294                 else
17295                         $cat >&4 <<EOM
17296 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17297 I'll ignore them.
17298 EOM
17299                         val="$undef"
17300                 fi
17301         else
17302                 echo "sigsetjmp not found." >&4
17303                 val="$undef"
17304         fi
17305         ;;
17306 *) val="$d_sigsetjmp"
17307         case "$d_sigsetjmp" in
17308         $define) echo "POSIX sigsetjmp found." >&4;;
17309         $undef) echo "sigsetjmp not found." >&4;;
17310         esac
17311         ;;
17312 esac
17313 set d_sigsetjmp
17314 eval $setvar
17315 $rm_try
17316
17317 : see if snprintf exists
17318 set snprintf d_snprintf
17319 eval $inlibc
17320
17321 : see if vsnprintf exists
17322 set vsnprintf d_vsnprintf
17323 eval $inlibc
17324
17325 case "$d_snprintf-$d_vsnprintf" in
17326 "$define-$define")
17327     $cat <<EOM
17328 Checking whether your snprintf() and vsnprintf() work okay...
17329 EOM
17330     $cat >try.c <<'EOCP'
17331 /* v?snprintf testing logic courtesy of Russ Allbery.
17332  * According to C99:
17333  * - if the buffer is too short it still must be \0-terminated
17334  * - if the buffer is too short the potentially required length
17335  *   must be returned and not -1
17336  * - if the buffer is NULL the potentially required length
17337  *   must be returned and not -1 or core dump
17338  */
17339 #include <stdio.h>
17340 #include <stdarg.h>
17341
17342 char buf[2];
17343
17344 int test (char *format, ...)
17345 {
17346     va_list args;
17347     int count;
17348
17349     va_start (args, format);
17350     count = vsnprintf (buf, sizeof buf, format, args);
17351     va_end (args);
17352     return count;
17353 }
17354
17355 int main ()
17356 {
17357     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17358              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17359 }
17360 EOCP
17361     set try
17362     if eval $compile; then
17363         `$run ./try`
17364         case "$?" in
17365         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17366         *) cat <<EOM >&4
17367 Your snprintf() and snprintf() don't seem to be working okay.
17368 EOM
17369            d_snprintf="$undef"
17370            d_vsnprintf="$undef"
17371            ;;
17372         esac
17373     else
17374         echo "(I can't seem to compile the test program--assuming they don't)"
17375         d_snprintf="$undef"
17376         d_vsnprintf="$undef"
17377     fi
17378     $rm_try
17379     ;;
17380 esac
17381
17382 : see if sockatmark exists
17383 set sockatmark d_sockatmark
17384 eval $inlibc
17385
17386 : see if prototype for sockatmark is available
17387 echo " "
17388 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17389 eval $hasproto
17390
17391 : see if socks5_init exists
17392 set socks5_init d_socks5_init
17393 eval $inlibc
17394
17395 : see if sprintf returns the length of the string in the buffer as per ANSI
17396 $echo "Checking whether sprintf returns the length of the string..." >&4
17397 $cat <<EOP >try.c
17398 #include <stdio.h>
17399 #$i_stdlib I_STDLIB
17400 #ifdef I_STDLIB
17401 #include <stdlib.h>
17402 #endif
17403 #$i_string I_STRING
17404 #ifdef I_STRING
17405 #  include <string.h>
17406 #else
17407 #  include <strings.h>
17408 #endif
17409 #$i_math I_MATH
17410 #ifdef I_MATH
17411 #include <math.h>
17412 #endif
17413
17414 char buffer[256];
17415
17416 int check (size_t expect, int test) {
17417   size_t got = strlen(buffer);
17418   if (expect == got)
17419     return 0;
17420
17421   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17422        test, buffer);
17423   exit (test);
17424 }
17425
17426 int main(int argc, char **argv) {
17427   int test = 0;
17428
17429   check(sprintf(buffer, ""), ++test);
17430   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17431   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17432
17433   return 0;
17434 }
17435 EOP
17436 set try
17437
17438 d_sprintf_returns_strlen="$undef"
17439 if eval $compile; then
17440     xxx="`$run ./try`"
17441     case "$?" in
17442         0) cat >&4 <<EOM
17443 sprintf returns the length of the string (as ANSI says it should)
17444 EOM
17445         d_sprintf_returns_strlen="$define"
17446         ;;
17447         *) cat >&4 <<EOM
17448 sprintf does not return the length of the string (how old is this system?)
17449 EOM
17450         d_sprintf_returns_strlen="$undef"
17451         ;;
17452     esac
17453 fi
17454 $rm_try
17455
17456 : see if srand48_r exists
17457 set srand48_r d_srand48_r
17458 eval $inlibc
17459 case "$d_srand48_r" in
17460 "$define")
17461         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17462         case "$d_srand48_r_proto:$usethreads" in
17463         ":define")      d_srand48_r_proto=define
17464                 set d_srand48_r_proto srand48_r $hdrs
17465                 eval $hasproto ;;
17466         *)      ;;
17467         esac
17468         case "$d_srand48_r_proto" in
17469         define)
17470         case "$srand48_r_proto" in
17471         ''|0) try='int srand48_r(long, struct drand48_data*);'
17472         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17473         esac
17474         case "$srand48_r_proto" in
17475         ''|0)   d_srand48_r=undef
17476                 srand48_r_proto=0
17477                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17478         * )     case "$srand48_r_proto" in
17479                 REENTRANT_PROTO*) ;;
17480                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17481                 esac
17482                 echo "Prototype: $try" ;;
17483         esac
17484         ;;
17485         *)      case "$usethreads" in
17486                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17487                 esac
17488                 d_srand48_r=undef
17489                 srand48_r_proto=0
17490                 ;;
17491         esac
17492         ;;
17493 *)      srand48_r_proto=0
17494         ;;
17495 esac
17496
17497 : see if srandom_r exists
17498 set srandom_r d_srandom_r
17499 eval $inlibc
17500 case "$d_srandom_r" in
17501 "$define")
17502         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17503         case "$d_srandom_r_proto:$usethreads" in
17504         ":define")      d_srandom_r_proto=define
17505                 set d_srandom_r_proto srandom_r $hdrs
17506                 eval $hasproto ;;
17507         *)      ;;
17508         esac
17509         case "$d_srandom_r_proto" in
17510         define)
17511         case "$srandom_r_proto" in
17512         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17513         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17514         esac
17515         case "$srandom_r_proto" in
17516         ''|0)   d_srandom_r=undef
17517                 srandom_r_proto=0
17518                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17519         * )     case "$srandom_r_proto" in
17520                 REENTRANT_PROTO*) ;;
17521                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17522                 esac
17523                 echo "Prototype: $try" ;;
17524         esac
17525         ;;
17526         *)      case "$usethreads" in
17527                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17528                 esac
17529                 d_srandom_r=undef
17530                 srandom_r_proto=0
17531                 ;;
17532         esac
17533         ;;
17534 *)      srandom_r_proto=0
17535         ;;
17536 esac
17537
17538 : see if prototype for setresgid is available
17539 echo " "
17540 set d_sresgproto setresgid $i_unistd unistd.h
17541 eval $hasproto
17542
17543 : see if prototype for setresuid is available
17544 echo " "
17545 set d_sresuproto setresuid $i_unistd unistd.h
17546 eval $hasproto
17547
17548 : see if sys/stat.h is available
17549 set sys/stat.h i_sysstat
17550 eval $inhdr
17551
17552 : see if stat knows about block sizes
17553 echo " "
17554 echo "Checking to see if your struct stat has st_blocks field..." >&4
17555 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17556 eval $hasfield
17557
17558 : see if this is a sys/vfs.h system
17559 set sys/vfs.h i_sysvfs
17560 eval $inhdr
17561
17562 : see if this is a sys/statfs.h system
17563 set sys/statfs.h i_sysstatfs
17564 eval $inhdr
17565
17566 : Check for statfs_s
17567 echo " "
17568 echo "Checking to see if your system supports struct statfs..." >&4
17569 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
17570 eval $hasstruct
17571 case "$d_statfs_s" in
17572 "$define")      echo "Yes, it does."   ;;
17573 *)              echo "No, it doesn't." ;;
17574 esac
17575
17576
17577 : see if struct statfs knows about f_flags
17578 case "$d_statfs_s" in
17579 define)
17580         echo " "
17581         echo "Checking to see if your struct statfs has f_flags field..." >&4
17582         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
17583         eval $hasfield
17584         ;;
17585 *)      val="$undef"
17586         set d_statfs_f_flags
17587         eval $setvar
17588         ;;
17589 esac
17590 case "$d_statfs_f_flags" in
17591 "$define")      echo "Yes, it does."   ;;
17592 *)              echo "No, it doesn't." ;;
17593 esac
17594
17595 : Check stream access
17596 $cat >&4 <<EOM
17597 Checking how to access stdio streams by file descriptor number...
17598 EOM
17599 case "$stdio_stream_array" in
17600 '')     $cat >try.c <<EOCP
17601 #include <stdio.h>
17602 int main() {
17603   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17604     printf("yes\n");
17605 }
17606 EOCP
17607         for s in _iob __iob __sF
17608         do
17609                 set try -DSTDIO_STREAM_ARRAY=$s
17610                 if eval $compile; then
17611                         case "`$run ./try`" in
17612                         yes)    stdio_stream_array=$s; break ;;
17613                         esac
17614                 fi
17615         done
17616         $rm_try
17617 esac
17618 case "$stdio_stream_array" in
17619 '')     $cat >&4 <<EOM
17620 I can't figure out how to access stdio streams by file descriptor number.
17621 EOM
17622         d_stdio_stream_array="$undef"
17623         ;;
17624 *)      $cat >&4 <<EOM
17625 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17626 EOM
17627         d_stdio_stream_array="$define"
17628         ;;
17629 esac
17630
17631 : see if strcoll exists
17632 set strcoll d_strcoll
17633 eval $inlibc
17634
17635 : check for structure copying
17636 echo " "
17637 echo "Checking to see if your C compiler can copy structs..." >&4
17638 $cat >try.c <<'EOCP'
17639 int main()
17640 {
17641         struct blurfl {
17642                 int dyick;
17643         } foo, bar;
17644
17645         foo = bar;
17646 }
17647 EOCP
17648 if $cc -c try.c >/dev/null 2>&1 ; then
17649         val="$define"
17650         echo "Yup, it can."
17651 else
17652         val="$undef"
17653         echo "Nope, it can't."
17654 fi
17655 set d_strctcpy
17656 eval $setvar
17657 $rm_try
17658
17659 : see if strerror and/or sys_errlist[] exist
17660 echo " "
17661 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17662     if set strerror val -f d_strerror; eval $csym; $val; then
17663                 echo 'strerror() found.' >&4
17664                 d_strerror="$define"
17665                 d_strerrm='strerror(e)'
17666                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17667                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17668                         d_syserrlst="$define"
17669                 else
17670                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17671                         d_syserrlst="$undef"
17672                 fi
17673     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17674                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17675                 echo 'strerror() found in string header.' >&4
17676                 d_strerror="$define"
17677                 d_strerrm='strerror(e)'
17678                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17679                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17680                                 d_syserrlst="$define"
17681                 else
17682                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17683                         d_syserrlst="$undef"
17684                 fi
17685     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17686                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17687                 d_strerror="$undef"
17688                 d_syserrlst="$define"
17689                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17690     else
17691                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17692                 d_strerror="$undef"
17693                 d_syserrlst="$undef"
17694                 d_strerrm='"unknown"'
17695     fi
17696 fi
17697
17698 : see if strerror_r exists
17699 set strerror_r d_strerror_r
17700 eval $inlibc
17701 case "$d_strerror_r" in
17702 "$define")
17703         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17704         case "$d_strerror_r_proto:$usethreads" in
17705         ":define")      d_strerror_r_proto=define
17706                 set d_strerror_r_proto strerror_r $hdrs
17707                 eval $hasproto ;;
17708         *)      ;;
17709         esac
17710         case "$d_strerror_r_proto" in
17711         define)
17712         case "$strerror_r_proto" in
17713         ''|0) try='int strerror_r(int, char*, size_t);'
17714         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17715         esac
17716         case "$strerror_r_proto" in
17717         ''|0) try='int strerror_r(int, char*, int);'
17718         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17719         esac
17720         case "$strerror_r_proto" in
17721         ''|0) try='char* strerror_r(int, char*, size_t);'
17722         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17723         esac
17724         case "$strerror_r_proto" in
17725         ''|0)   d_strerror_r=undef
17726                 strerror_r_proto=0
17727                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17728         * )     case "$strerror_r_proto" in
17729                 REENTRANT_PROTO*) ;;
17730                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17731                 esac
17732                 echo "Prototype: $try" ;;
17733         esac
17734         ;;
17735         *)      case "$usethreads" in
17736                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17737                 esac
17738                 d_strerror_r=undef
17739                 strerror_r_proto=0
17740                 ;;
17741         esac
17742         ;;
17743 *)      strerror_r_proto=0
17744         ;;
17745 esac
17746
17747 : see if strftime exists
17748 set strftime d_strftime
17749 eval $inlibc
17750
17751 : see if strlcat exists
17752 set strlcat d_strlcat
17753 eval $inlibc
17754
17755 : see if strlcpy exists
17756 set strlcpy d_strlcpy
17757 eval $inlibc
17758
17759 : see if strtod exists
17760 set strtod d_strtod
17761 eval $inlibc
17762
17763 : see if strtol exists
17764 set strtol d_strtol
17765 eval $inlibc
17766
17767 : see if strtold exists
17768 set strtold d_strtold
17769 eval $inlibc
17770
17771 : see if strtoll exists
17772 set strtoll d_strtoll
17773 eval $inlibc
17774
17775 case "$d_longlong-$d_strtoll" in
17776 "$define-$define")
17777         $cat <<EOM
17778 Checking whether your strtoll() works okay...
17779 EOM
17780         $cat >try.c <<'EOCP'
17781 #include <errno.h>
17782 #ifdef __hpux
17783 #define strtoll __strtoll
17784 #endif
17785 #ifdef __EMX__
17786 #define strtoll _strtoll
17787 #endif
17788 #include <stdio.h>
17789 extern long long int strtoll(char *s, char **, int);
17790 static int bad = 0;
17791 int check(char *s, long long ell, int een) {
17792         long long gll;
17793         errno = 0;
17794         gll = strtoll(s, 0, 10);
17795         if (!((gll == ell) && (errno == een)))
17796                 bad++;
17797 }
17798 int main() {
17799         check(" 1",                                      1LL, 0);
17800         check(" 0",                                      0LL, 0);
17801         check("-1",                                     -1LL, 0);
17802         check("-9223372036854775808", -9223372036854775808LL, 0);
17803         check("-9223372036854775808", -9223372036854775808LL, 0);
17804         check(" 9223372036854775807",  9223372036854775807LL, 0);
17805         check("-9223372036854775808", -9223372036854775808LL, 0);
17806         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17807         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17808         if (!bad)
17809                 printf("ok\n");
17810 }
17811 EOCP
17812         set try
17813         if eval $compile; then
17814                 yyy=`$run ./try`
17815                 case "$yyy" in
17816                 ok) echo "Your strtoll() seems to be working okay." ;;
17817                 *) cat <<EOM >&4
17818 Your strtoll() doesn't seem to be working okay.
17819 EOM
17820                    d_strtoll="$undef"
17821                    ;;
17822                 esac
17823         else
17824                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17825                 d_strtoll="$undef"
17826         fi
17827         ;;
17828 esac
17829
17830 : see if strtoq exists
17831 set strtoq d_strtoq
17832 eval $inlibc
17833
17834 : see if strtoul exists
17835 set strtoul d_strtoul
17836 eval $inlibc
17837
17838 case "$d_strtoul" in
17839 "$define")
17840         $cat <<EOM
17841 Checking whether your strtoul() works okay...
17842 EOM
17843         $cat >try.c <<'EOCP'
17844 #include <errno.h>
17845 #include <stdio.h>
17846 extern unsigned long int strtoul(char *s, char **, int);
17847 static int bad = 0;
17848 void check(char *s, unsigned long eul, int een) {
17849         unsigned long gul;
17850         errno = 0;
17851         gul = strtoul(s, 0, 10);
17852         if (!((gul == eul) && (errno == een)))
17853                 bad++;
17854 }
17855 int main() {
17856         check(" 1", 1L, 0);
17857         check(" 0", 0L, 0);
17858 EOCP
17859         case "$longsize" in
17860         8)
17861             $cat >>try.c <<'EOCP'
17862         check("18446744073709551615", 18446744073709551615UL, 0);
17863         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17864 #if 0 /* strtoul() for /^-/ strings is undefined. */
17865         check("-1", 18446744073709551615UL, 0);
17866         check("-18446744073709551614", 2, 0);
17867         check("-18446744073709551615", 1, 0);
17868         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17869         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17870 #endif
17871 EOCP
17872                 ;;
17873         4)
17874                     $cat >>try.c <<'EOCP'
17875         check("4294967295", 4294967295UL, 0);
17876         check("4294967296", 4294967295UL, ERANGE);
17877 #if 0 /* strtoul() for /^-/ strings is undefined. */
17878         check("-1", 4294967295UL, 0);
17879         check("-4294967294", 2, 0);
17880         check("-4294967295", 1, 0);
17881         check("-4294967296", 4294967295UL, ERANGE);
17882         check("-4294967297", 4294967295UL, ERANGE);
17883 #endif
17884 EOCP
17885                 ;;
17886         *)
17887 : Should we write these tests to be more portable by sprintf-ing
17888 : ~0 and then manipulating that char string as input for strtol?
17889                 ;;
17890         esac
17891         $cat >>try.c <<'EOCP'
17892         if (!bad)
17893                 printf("ok\n");
17894         return 0;
17895 }
17896 EOCP
17897         set try
17898         if eval $compile; then
17899                 case "`$run ./try`" in
17900                 ok) echo "Your strtoul() seems to be working okay." ;;
17901                 *) cat <<EOM >&4
17902 Your strtoul() doesn't seem to be working okay.
17903 EOM
17904                    d_strtoul="$undef"
17905                    ;;
17906                 esac
17907         else
17908                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17909                 d_strtoul="$undef"
17910         fi
17911         ;;
17912 esac
17913
17914 : see if strtoull exists
17915 set strtoull d_strtoull
17916 eval $inlibc
17917
17918 case "$d_longlong-$d_strtoull" in
17919 "$define-$define")
17920         $cat <<EOM
17921 Checking whether your strtoull() works okay...
17922 EOM
17923         $cat >try.c <<'EOCP'
17924 #include <errno.h>
17925 #ifdef __hpux
17926 #define strtoull __strtoull
17927 #endif
17928 #include <stdio.h>
17929 extern unsigned long long int strtoull(char *s, char **, int);
17930 static int bad = 0;
17931 int check(char *s, long long eull, int een) {
17932         long long gull;
17933         errno = 0;
17934         gull = strtoull(s, 0, 10);
17935         if (!((gull == eull) && (errno == een)))
17936                 bad++;
17937 }
17938 int main() {
17939         check(" 1",                                        1LL, 0);
17940         check(" 0",                                        0LL, 0);
17941         check("18446744073709551615",  18446744073709551615ULL, 0);
17942         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17943 #if 0 /* strtoull() for /^-/ strings is undefined. */
17944         check("-1",                    18446744073709551615ULL, 0);
17945         check("-18446744073709551614",                     2LL, 0);
17946         check("-18446744073709551615",                     1LL, 0);
17947         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17948         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17949 #endif
17950         if (!bad)
17951                 printf("ok\n");
17952 }
17953 EOCP
17954         set try
17955         if eval $compile; then
17956                 case "`$run ./try`" in
17957                 ok) echo "Your strtoull() seems to be working okay." ;;
17958                 *) cat <<EOM >&4
17959 Your strtoull() doesn't seem to be working okay.
17960 EOM
17961                    d_strtoull="$undef"
17962                    ;;
17963                 esac
17964         else
17965                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17966                 d_strtoull="$undef"
17967         fi
17968         ;;
17969 esac
17970
17971 : see if strtouq exists
17972 set strtouq d_strtouq
17973 eval $inlibc
17974
17975 case "$d_strtouq" in
17976 "$define")
17977         $cat <<EOM
17978 Checking whether your strtouq() works okay...
17979 EOM
17980         $cat >try.c <<'EOCP'
17981 #include <errno.h>
17982 #include <stdio.h>
17983 extern unsigned long long int strtouq(char *s, char **, int);
17984 static int bad = 0;
17985 void check(char *s, unsigned long long eull, int een) {
17986         unsigned long long gull;
17987         errno = 0;
17988         gull = strtouq(s, 0, 10);
17989         if (!((gull == eull) && (errno == een)))
17990                 bad++;
17991 }
17992 int main() {
17993         check(" 1",                                        1LL, 0);
17994         check(" 0",                                        0LL, 0);
17995         check("18446744073709551615",  18446744073709551615ULL, 0);
17996         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17997 #if 0 /* strtouq() for /^-/ strings is undefined. */
17998         check("-1",                    18446744073709551615ULL, 0);
17999         check("-18446744073709551614",                     2LL, 0);
18000         check("-18446744073709551615",                     1LL, 0);
18001         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18002         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18003 #endif
18004         if (!bad)
18005                 printf("ok\n");
18006         return 0;
18007 }
18008 EOCP
18009         set try
18010         if eval $compile; then
18011                 case "`$run ./try`" in
18012                 ok) echo "Your strtouq() seems to be working okay." ;;
18013                 *) cat <<EOM >&4
18014 Your strtouq() doesn't seem to be working okay.
18015 EOM
18016                    d_strtouq="$undef"
18017                    ;;
18018                 esac
18019         else
18020                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18021                 d_strtouq="$undef"
18022         fi
18023         ;;
18024 esac
18025
18026 : see if strxfrm exists
18027 set strxfrm d_strxfrm
18028 eval $inlibc
18029
18030 : see if symlink exists
18031 set symlink d_symlink
18032 eval $inlibc
18033
18034 : see if syscall exists
18035 set syscall d_syscall
18036 eval $inlibc
18037
18038 : see if prototype for syscall is available
18039 echo " "
18040 set d_syscallproto syscall $i_unistd unistd.h
18041 eval $hasproto
18042
18043 : see if sysconf exists
18044 set sysconf d_sysconf
18045 eval $inlibc
18046
18047 : see if system exists
18048 set system d_system
18049 eval $inlibc
18050
18051 : see if tcgetpgrp exists
18052 set tcgetpgrp d_tcgetpgrp
18053 eval $inlibc
18054
18055 : see if tcsetpgrp exists
18056 set tcsetpgrp d_tcsetpgrp
18057 eval $inlibc
18058
18059 : see if prototype for telldir is available
18060 echo " "
18061 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18062 eval $hasproto
18063
18064 : see if time exists
18065 echo " "
18066 if test "X$d_time" = X -o X"$timetype" = X; then
18067     if set time val -f d_time; eval $csym; $val; then
18068                 echo 'time() found.' >&4
18069                 val="$define"
18070                 rp="What is the type returned by time() on this system?"
18071                 set time_t timetype long stdio.h sys/types.h
18072                 eval $typedef_ask
18073     else
18074                 echo 'time() not found, hope that will do.' >&4
18075                 val="$undef"
18076                 timetype='int';
18077     fi
18078     set d_time
18079     eval $setvar
18080 fi
18081
18082 : see if this is a sys/times.h system
18083 set sys/times.h i_systimes
18084 eval $inhdr
18085
18086 : see if times exists
18087 echo " "
18088 if set times val -f d_times; eval $csym; $val; then
18089         echo 'times() found.' >&4
18090         d_times="$define"
18091         inc=''
18092         case "$i_systimes" in
18093         "$define") inc='sys/times.h';;
18094         esac
18095         rp="What is the type returned by times() on this system?"
18096         set clock_t clocktype long stdio.h sys/types.h $inc
18097         eval $typedef_ask
18098 else
18099         echo 'times() NOT found, hope that will do.' >&4
18100         d_times="$undef"
18101         clocktype='int'
18102 fi
18103
18104 : see if tmpnam_r exists
18105 set tmpnam_r d_tmpnam_r
18106 eval $inlibc
18107 case "$d_tmpnam_r" in
18108 "$define")
18109         hdrs="$i_systypes sys/types.h define stdio.h "
18110         case "$d_tmpnam_r_proto:$usethreads" in
18111         ":define")      d_tmpnam_r_proto=define
18112                 set d_tmpnam_r_proto tmpnam_r $hdrs
18113                 eval $hasproto ;;
18114         *)      ;;
18115         esac
18116         case "$d_tmpnam_r_proto" in
18117         define)
18118         case "$tmpnam_r_proto" in
18119         ''|0) try='char* tmpnam_r(char*);'
18120         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18121         esac
18122         case "$tmpnam_r_proto" in
18123         ''|0)   d_tmpnam_r=undef
18124                 tmpnam_r_proto=0
18125                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18126         * )     case "$tmpnam_r_proto" in
18127                 REENTRANT_PROTO*) ;;
18128                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18129                 esac
18130                 echo "Prototype: $try" ;;
18131         esac
18132         ;;
18133         *)      case "$usethreads" in
18134                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18135                 esac
18136                 d_tmpnam_r=undef
18137                 tmpnam_r_proto=0
18138                 ;;
18139         esac
18140         ;;
18141 *)      tmpnam_r_proto=0
18142         ;;
18143 esac
18144
18145 : see if truncate exists
18146 set truncate d_truncate
18147 eval $inlibc
18148
18149 : see if ttyname_r exists
18150 set ttyname_r d_ttyname_r
18151 eval $inlibc
18152 case "$d_ttyname_r" in
18153 "$define")
18154         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18155         case "$d_ttyname_r_proto:$usethreads" in
18156         ":define")      d_ttyname_r_proto=define
18157                 set d_ttyname_r_proto ttyname_r $hdrs
18158                 eval $hasproto ;;
18159         *)      ;;
18160         esac
18161         case "$d_ttyname_r_proto" in
18162         define)
18163         case "$ttyname_r_proto" in
18164         ''|0) try='int ttyname_r(int, char*, size_t);'
18165         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18166         esac
18167         case "$ttyname_r_proto" in
18168         ''|0) try='int ttyname_r(int, char*, int);'
18169         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18170         esac
18171         case "$ttyname_r_proto" in
18172         ''|0) try='char* ttyname_r(int, char*, int);'
18173         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18174         esac
18175         case "$ttyname_r_proto" in
18176         ''|0)   d_ttyname_r=undef
18177                 ttyname_r_proto=0
18178                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18179         * )     case "$ttyname_r_proto" in
18180                 REENTRANT_PROTO*) ;;
18181                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18182                 esac
18183                 echo "Prototype: $try" ;;
18184         esac
18185         ;;
18186         *)      case "$usethreads" in
18187                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18188                 esac
18189                 d_ttyname_r=undef
18190                 ttyname_r_proto=0
18191                 ;;
18192         esac
18193         ;;
18194 *)      ttyname_r_proto=0
18195         ;;
18196 esac
18197
18198 : see if tzname[] exists
18199 echo " "
18200 if set tzname val -a d_tzname; eval $csym; $val; then
18201         val="$define"
18202         echo 'tzname[] found.' >&4
18203 else
18204         val="$undef"
18205         echo 'tzname[] NOT found.' >&4
18206 fi
18207 set d_tzname
18208 eval $setvar
18209
18210 : Check if is a multiplatform env
18211 case "$osname" in
18212 next|rhapsody|darwin) multiarch="$define" ;;
18213 esac
18214 case "$multiarch" in
18215 ''|[nN]*) multiarch="$undef" ;;
18216 esac
18217
18218 : check for ordering of bytes in a UV
18219 echo " "
18220 case "$usecrosscompile$multiarch" in
18221 *$define*)
18222         $cat <<EOM
18223 You seem to be either cross-compiling or doing a multiarchitecture build,
18224 skipping the byteorder check.
18225
18226 EOM
18227         byteorder='ffff'
18228         ;;
18229 *)
18230         case "$byteorder" in
18231         '')
18232                 $cat <<'EOM'
18233 In the following, larger digits indicate more significance.  A big-endian
18234 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18235 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18236 machines may have weird orders like 3412.  A Cray will report 87654321,
18237 an Alpha will report 12345678. If the test program works the default is
18238 probably right.
18239 I'm now running the test program...
18240 EOM
18241                 $cat >try.c <<EOCP
18242 #include <stdio.h>
18243 #$i_stdlib I_STDLIB
18244 #ifdef I_STDLIB
18245 #include <stdlib.h>
18246 #endif
18247 #include <sys/types.h>
18248 typedef $uvtype UV;
18249 int main()
18250 {
18251         int i;
18252         union {
18253                 UV l;
18254                 char c[$uvsize];
18255         } u;
18256
18257         if ($uvsize > 4)
18258                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18259         else
18260                 u.l = (UV)0x04030201;
18261         for (i = 0; i < $uvsize; i++)
18262                 printf("%c", u.c[i]+'0');
18263         printf("\n");
18264         exit(0);
18265 }
18266 EOCP
18267                 xxx_prompt=y
18268                 set try
18269                 if eval $compile && $run ./try > /dev/null; then
18270                         dflt=`$run ./try`
18271                         case "$dflt" in
18272                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18273                                 echo "(The test program ran ok.)"
18274                                 echo "byteorder=$dflt"
18275                                 xxx_prompt=n
18276                         ;;
18277                         ????|????????) echo "(The test program ran ok.)" ;;
18278                         *) echo "(The test program didn't run right for some reason.)" ;;
18279                         esac
18280                 else
18281                         dflt='4321'
18282                         cat <<'EOM'
18283 (I can't seem to compile the test program.  Guessing big-endian...)
18284 EOM
18285                 fi
18286                 case "$xxx_prompt" in
18287                 y)
18288                         rp="What is the order of bytes in $uvtype?"
18289                         . ./myread
18290                         byteorder="$ans"
18291                         ;;
18292                 *)      byteorder=$dflt
18293                         ;;
18294                 esac
18295                 ;;
18296         esac
18297         $rm_try
18298         ;;
18299 esac
18300
18301 : Checking 32bit aligndness
18302 $cat <<EOM
18303
18304 Checking to see whether you can access character data unalignedly...
18305 EOM
18306 case "$d_u32align" in
18307 '')   $cat >try.c <<EOCP
18308 #include <stdio.h>
18309 #$i_stdlib I_STDLIB
18310 #ifdef I_STDLIB
18311 #include <stdlib.h>
18312 #endif
18313 #define U32 $u32type
18314 #define BYTEORDER 0x$byteorder
18315 #define U8 $u8type
18316 #include <signal.h>
18317 #ifdef SIGBUS
18318 $signal_t bletch(int s) { exit(4); }
18319 #endif
18320 int main() {
18321 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18322     U8 buf[8];
18323     U32 *up;
18324     int i;
18325
18326     if (sizeof(U32) != 4) {
18327         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18328         exit(1);
18329     }
18330
18331     fflush(stdout);
18332
18333 #ifdef SIGBUS
18334     signal(SIGBUS, bletch);
18335 #endif
18336
18337     buf[0] = 0;
18338     buf[1] = 0;
18339     buf[2] = 0;
18340     buf[3] = 1;
18341     buf[4] = 0;
18342     buf[5] = 0;
18343     buf[6] = 0;
18344     buf[7] = 1;
18345
18346     for (i = 0; i < 4; i++) {
18347         up = (U32*)(buf + i);
18348         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18349                (*up == 1 << (8*(3-i)))  /* little-endian */
18350               )
18351            )
18352         {
18353             printf("read failed (%x)\n", *up);
18354             exit(2);
18355         }
18356     }
18357
18358     /* write test */
18359     for (i = 0; i < 4; i++) {
18360         up = (U32*)(buf + i);
18361         *up = 0xBeef;
18362         if (*up != 0xBeef) {
18363             printf("write failed (%x)\n", *up);
18364             exit(3);
18365         }
18366     }
18367
18368     exit(0);
18369 #else
18370     printf("1\n");
18371     exit(1);
18372 #endif
18373     return 0;
18374 }
18375 EOCP
18376 set try
18377 if eval $compile_ok; then
18378         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18379         $run ./try 2>&1 >/dev/null
18380         case "$?" in
18381         0)      cat >&4 <<EOM
18382 You can access character data pretty unalignedly.
18383 EOM
18384                 d_u32align="$undef"
18385                 ;;
18386         *)      cat >&4 <<EOM
18387 It seems that you must access character data in an aligned manner.
18388 EOM
18389                 d_u32align="$define"
18390                 ;;
18391         esac
18392 else
18393         rp='Can you access character data at unaligned addresses?'
18394         dflt='n'
18395         . ./myread
18396         case "$ans" in
18397         [yY]*)  d_u32align="$undef"  ;;
18398         *)      d_u32align="$define" ;;
18399         esac
18400 fi
18401 $rm_try
18402 ;;
18403 esac
18404
18405 : see if ualarm exists
18406 set ualarm d_ualarm
18407 eval $inlibc
18408
18409 : see if umask exists
18410 set umask d_umask
18411 eval $inlibc
18412
18413 : see if unordered exists
18414 set unordered d_unordered
18415 eval $inlibc
18416
18417 : see if unsetenv exists
18418 set unsetenv d_unsetenv
18419 eval $inlibc
18420
18421 : see if usleep exists
18422 set usleep d_usleep
18423 eval $inlibc
18424
18425 : see if prototype for usleep is available
18426 echo " "
18427 set d_usleepproto usleep $i_unistd unistd.h
18428 eval $hasproto
18429
18430 : see if ustat exists
18431 set ustat d_ustat
18432 eval $inlibc
18433
18434 : see if closedir exists
18435 set closedir d_closedir
18436 eval $inlibc
18437
18438 case "$d_closedir" in
18439 "$define")
18440         echo " "
18441         echo "Checking whether closedir() returns a status..." >&4
18442         cat > try.c <<EOM
18443 #$i_dirent I_DIRENT             /**/
18444 #$i_sysdir I_SYS_DIR            /**/
18445 #$i_sysndir I_SYS_NDIR          /**/
18446 #$i_systypes I_SYS_TYPES        /**/
18447
18448 #if defined(I_SYS_TYPES)
18449 #include <sys/types.h>
18450 #endif
18451 #if defined(I_DIRENT)
18452 #include <dirent.h>
18453 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18454 #include <sys/dir.h>
18455 #endif
18456 #else
18457 #ifdef I_SYS_NDIR
18458 #include <sys/ndir.h>
18459 #else
18460 #ifdef I_SYS_DIR
18461 #ifdef hp9000s500
18462 #include <ndir.h>       /* may be wrong in the future */
18463 #else
18464 #include <sys/dir.h>
18465 #endif
18466 #endif
18467 #endif
18468 #endif
18469 int main() { return closedir(opendir(".")); }
18470 EOM
18471         set try
18472         if eval $compile_ok; then
18473                 if $run ./try > /dev/null 2>&1 ; then
18474                         echo "Yes, it does."
18475                         val="$undef"
18476                 else
18477                         echo "No, it doesn't."
18478                         val="$define"
18479                 fi
18480         else
18481                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18482                 val="$define"
18483         fi
18484         ;;
18485 *)
18486         val="$undef";
18487         ;;
18488 esac
18489 set d_void_closedir
18490 eval $setvar
18491 $rm_try
18492
18493 : see if there is a wait4
18494 set wait4 d_wait4
18495 eval $inlibc
18496
18497 : see if waitpid exists
18498 set waitpid d_waitpid
18499 eval $inlibc
18500
18501 : see if wcstombs exists
18502 set wcstombs d_wcstombs
18503 eval $inlibc
18504
18505 : see if wctomb exists
18506 set wctomb d_wctomb
18507 eval $inlibc
18508
18509 : see if writev exists
18510 set writev d_writev
18511 eval $inlibc
18512
18513 : preserve RCS keywords in files with variable substitution, grrr
18514 Date='$Date'
18515 Id='$Id'
18516 Log='$Log'
18517 RCSfile='$RCSfile'
18518 Revision='$Revision'
18519
18520 : check for alignment requirements
18521 echo " "
18522 case "$usecrosscompile$multiarch" in
18523 *$define*)
18524         $cat <<EOM
18525 You seem to be either cross-compiling or doing a multiarchitecture build,
18526 skipping the memory alignment check.
18527
18528 EOM
18529         case "$alignbytes" in
18530         '') alignbytes=8 ;;
18531         esac
18532         ;;
18533 *)
18534         case "$alignbytes" in
18535         '') echo "Checking alignment constraints..." >&4
18536                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18537                         $cat >try.c <<'EOCP'
18538 typedef long double NV;
18539 EOCP
18540                 else
18541                         $cat >try.c <<'EOCP'
18542 typedef double NV;
18543 EOCP
18544                 fi
18545                 $cat >>try.c <<'EOCP'
18546 #include <stdio.h>
18547 struct foobar {
18548         char foo;
18549         NV bar;
18550 } try_algn;
18551 int main()
18552 {
18553     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18554     return(0);
18555 }
18556 EOCP
18557                 set try
18558                 if eval $compile_ok; then
18559                         dflt=`$run ./try`
18560                 else
18561                         dflt='8'
18562                         echo "(I can't seem to compile the test program...)"
18563                 fi
18564                 ;;
18565         *) dflt="$alignbytes"
18566                 ;;
18567         esac
18568         rp="Doubles must be aligned on a how-many-byte boundary?"
18569         . ./myread
18570         alignbytes="$ans"
18571         $rm_try
18572         ;;
18573 esac
18574
18575
18576 : set the base revision
18577 baserev=5.0
18578
18579 : how do we concatenate cpp tokens here?
18580 echo " "
18581 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18582 $cat >cpp_stuff.c <<'EOCP'
18583 #define RCAT(a,b)a/**/b
18584 #define ACAT(a,b)a ## b
18585 RCAT(Rei,ser)
18586 ACAT(Cir,cus)
18587 EOCP
18588 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18589 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18590         echo "Oh!  Smells like ANSI's been here." >&4
18591         echo "We can catify or stringify, separately or together!"
18592         cpp_stuff=42
18593 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18594         echo "Ah, yes!  The good old days!" >&4
18595         echo "However, in the good old days we don't know how to stringify and"
18596         echo "catify at the same time."
18597         cpp_stuff=1
18598 else
18599         $cat >&4 <<EOM
18600 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18601 You're going to have to edit the values of CAT[2-5] in config.h...
18602 EOM
18603         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18604 fi
18605 $rm -f cpp_stuff.*
18606
18607 : see if this is a db.h system
18608 set db.h i_db
18609 eval $inhdr
18610
18611 case "$i_db" in
18612 $define)
18613         : Check db version.
18614         echo " "
18615         echo "Checking Berkeley DB version ..." >&4
18616         $cat >try.c <<EOCP
18617 #$d_const HASCONST
18618 #ifndef HASCONST
18619 #define const
18620 #endif
18621 #include <sys/types.h>
18622 #include <stdio.h>
18623 #$i_stdlib I_STDLIB
18624 #ifdef I_STDLIB
18625 #include <stdlib.h>
18626 #endif
18627 #include <db.h>
18628 int main(int argc, char *argv[])
18629 {
18630 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18631     int Major, Minor, Patch ;
18632     unsigned long Version ;
18633     (void)db_version(&Major, &Minor, &Patch) ;
18634     if (argc == 2) {
18635         printf("%d %d %d %d %d %d\n",
18636                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18637                Major, Minor, Patch);
18638         exit(0);
18639     }
18640     printf("You have Berkeley DB Version 2 or greater.\n");
18641
18642     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18643                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18644     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18645                 Major, Minor, Patch) ;
18646
18647     /* check that db.h & libdb are compatible */
18648     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18649         printf("db.h and libdb are incompatible.\n") ;
18650         exit(3);
18651     }
18652
18653     printf("db.h and libdb are compatible.\n") ;
18654
18655     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18656                 + DB_VERSION_PATCH ;
18657
18658     /* needs to be >= 2.3.4 */
18659     if (Version < 2003004) {
18660     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18661         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18662         exit(2);
18663     }
18664
18665     exit(0);
18666 #else
18667 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18668     if (argc == 2) {
18669         printf("1 0 0\n");
18670         exit(0);
18671     }
18672     printf("You have Berkeley DB Version 1.\n");
18673     exit(0);    /* DB version < 2: the coast is clear. */
18674 #else
18675     exit(1);    /* <db.h> not Berkeley DB? */
18676 #endif
18677 #endif
18678 }
18679 EOCP
18680         set try
18681         if eval $compile_ok && $run ./try; then
18682                 echo 'Looks OK.' >&4
18683                 set `$run ./try 1`
18684                 db_version_major=$1
18685                 db_version_minor=$2
18686                 db_version_patch=$3
18687         else
18688                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18689                 i_db=$undef
18690                 case " $libs " in
18691                 *"-ldb "*)
18692                         : Remove db from list of libraries to use
18693                         echo "Removing unusable -ldb from library list" >&4
18694                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18695                         shift
18696                         libs="$*"
18697                         echo "libs = $libs" >&4
18698                         ;;
18699                 esac
18700         fi
18701         $rm_try
18702         ;;
18703 esac
18704
18705 case "$i_db" in
18706 define)
18707         : Check the return type needed for hash
18708         echo " "
18709         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18710         $cat >try.c <<EOCP
18711 #$d_const HASCONST
18712 #ifndef HASCONST
18713 #define const
18714 #endif
18715 #include <sys/types.h>
18716 #include <db.h>
18717
18718 #ifndef DB_VERSION_MAJOR
18719 u_int32_t hash_cb (ptr, size)
18720 const void *ptr;
18721 size_t size;
18722 {
18723 }
18724 HASHINFO info;
18725 int main()
18726 {
18727         info.hash = hash_cb;
18728 }
18729 #endif
18730 EOCP
18731         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18732                 if $contains warning try.out >>/dev/null 2>&1 ; then
18733                         db_hashtype='int'
18734                 else
18735                         db_hashtype='u_int32_t'
18736                 fi
18737         else
18738                 : XXX Maybe we should just give up here.
18739                 db_hashtype=u_int32_t
18740                 $cat try.out >&4
18741                 echo "Help:  I can't seem to compile the db test program." >&4
18742                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18743         fi
18744         $rm_try
18745         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18746         ;;
18747 *)      db_hashtype=u_int32_t
18748         ;;
18749 esac
18750 case "$i_db" in
18751 define)
18752         : Check the return type needed for prefix
18753         echo " "
18754         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18755         cat >try.c <<EOCP
18756 #$d_const HASCONST
18757 #ifndef HASCONST
18758 #define const
18759 #endif
18760 #include <sys/types.h>
18761 #include <db.h>
18762
18763 #ifndef DB_VERSION_MAJOR
18764 size_t prefix_cb (key1, key2)
18765 const DBT *key1;
18766 const DBT *key2;
18767 {
18768 }
18769 BTREEINFO info;
18770 int main()
18771 {
18772         info.prefix = prefix_cb;
18773 }
18774 #endif
18775 EOCP
18776         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18777                 if $contains warning try.out >>/dev/null 2>&1 ; then
18778                         db_prefixtype='int'
18779                 else
18780                         db_prefixtype='size_t'
18781                 fi
18782         else
18783                 db_prefixtype='size_t'
18784                 : XXX Maybe we should just give up here.
18785                 $cat try.out >&4
18786                 echo "Help:  I can't seem to compile the db test program." >&4
18787                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18788         fi
18789         $rm_try
18790         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18791         ;;
18792 *)      db_prefixtype='size_t'
18793         ;;
18794 esac
18795
18796 : How can we generate normalized random numbers ?
18797 echo " "
18798 echo "Looking for a random number function..." >&4
18799 case "$randfunc" in
18800 '')
18801         if set drand48 val -f; eval $csym; $val; then
18802                 dflt="drand48"
18803                 echo "Good, found drand48()." >&4
18804         elif set random val -f; eval $csym; $val; then
18805                 dflt="random"
18806                 echo "OK, found random()." >&4
18807         else
18808                 dflt="rand"
18809                 echo "Yick, looks like I have to use rand()." >&4
18810         fi
18811         echo " "
18812         ;;
18813 *)
18814         dflt="$randfunc"
18815         ;;
18816 esac
18817 cont=true
18818
18819 case "$ccflags" in
18820 *-Dmy_rand=*|*-Dmy_srand=*)
18821         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18822         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18823         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18824         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18825         ;;
18826 esac
18827
18828 while $test "$cont"; do
18829         rp="Use which function to generate random numbers?"
18830         . ./myread
18831         if $test "$ans" = "$dflt"; then
18832                 : null
18833         else
18834                 randbits=''
18835         fi
18836         randfunc="$ans"
18837         if set $ans val -f; eval $csym; $val; then
18838                 cont=''
18839         else
18840                 dflt=y
18841                 rp="I cannot find function $ans. Use that name anyway?"
18842                 . ./myread
18843                 dflt=rand
18844                 case "$ans" in
18845                         [yY]*) cont='';;
18846                 esac
18847         fi
18848         case "$cont" in
18849         '')
18850                 case "$randfunc" in
18851                 drand48)
18852                         drand01="drand48()"
18853                         seedfunc="srand48"
18854                         randbits=48
18855                         randseedtype=long
18856                         ;;
18857                 rand|random)
18858                         case "$randbits" in
18859                         '')
18860 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18861                                 $cat >try.c <<EOCP
18862 #$i_unistd I_UNISTD
18863 #$i_stdlib I_STDLIB
18864 #include <stdio.h>
18865 #ifdef I_UNISTD
18866 #  include <unistd.h>
18867 #endif
18868 #ifdef I_STDLIB
18869 #  include <stdlib.h>
18870 #endif
18871 int main()
18872 {
18873         register int i;
18874         register unsigned long tmp;
18875         register unsigned long max = 0L;
18876
18877         for (i = 1000; i; i--) {
18878                 tmp = (unsigned long) $randfunc();
18879                 if (tmp > max) max = tmp;
18880         }
18881         for (i = 0; max; i++)
18882                 max /= 2;
18883         printf("%d\n",i);
18884 }
18885 EOCP
18886                                 set try
18887                                 if eval $compile_ok; then
18888                                         dflt=`try`
18889                                 else
18890                                         dflt='?'
18891                                         echo "(I can't seem to compile the test program...)"
18892                                 fi
18893                                 ;;
18894                         *)
18895                                 dflt="$randbits"
18896                                 ;;
18897                         esac
18898                         rp="How many bits does your $randfunc() function produce?"
18899                         . ./myread
18900                         randbits="$ans"
18901                         $rm_try
18902                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18903                         seedfunc="s$randfunc"
18904                         randseedtype=unsigned
18905                         ;;
18906                 *)
18907                         dflt="31"
18908                         rp="How many bits does your $randfunc() function produce?"
18909                         . ./myread
18910                         randbits="$ans"
18911                         seedfunc="s$randfunc"
18912                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18913                         if set $seedfunc val -f; eval $csym; $val; then
18914                                 echo "(Using $seedfunc() to seed random generator)"
18915                         else
18916                                 echo "(Warning: no $seedfunc() to seed random generator)"
18917                                 seedfunc=rand
18918                         fi
18919                         randseedtype=unsigned
18920                         ;;
18921                 esac
18922                 ;;
18923         esac
18924 done
18925
18926 : Determine if this is an EBCDIC system
18927 echo " "
18928 echo "Determining whether or not we are on an EBCDIC system..." >&4
18929 $cat >try.c <<'EOM'
18930 int main()
18931 {
18932   if ('M'==0xd4) return 0;
18933   return 1;
18934 }
18935 EOM
18936
18937 val=$undef
18938 set try
18939 if eval $compile_ok; then
18940         if $run ./try; then
18941                 echo "You seem to speak EBCDIC." >&4
18942                 val="$define"
18943         else
18944                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18945         fi
18946 else
18947         echo "I'm unable to compile the test program." >&4
18948         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18949 fi
18950 $rm_try
18951 set ebcdic
18952 eval $setvar
18953
18954 : Check how to flush
18955 echo " "
18956 $cat >&4 <<EOM
18957 Checking how to flush all pending stdio output...
18958 EOM
18959 # I only know how to find the first 32 possibly open files on SunOS.
18960 # See also hints/sunos_4_1.sh and util.c  --AD
18961 case "$osname" in
18962 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18963 esac
18964 $cat >>try.c <<EOCP
18965 #include <stdio.h>
18966 #$i_stdlib I_STDLIB
18967 #ifdef I_STDLIB
18968 #include <stdlib.h>
18969 #endif
18970 #$i_unistd I_UNISTD
18971 #ifdef I_UNISTD
18972 # include <unistd.h>
18973 #endif
18974 #$d_sysconf HAS_SYSCONF
18975 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18976 #ifdef HAS_STDIO_STREAM_ARRAY
18977 # define STDIO_STREAM_ARRAY $stdio_stream_array
18978 #endif
18979 int main() {
18980   FILE* p;
18981   unlink("try.out");
18982   p = fopen("try.out", "w");
18983 #ifdef TRY_FPUTC
18984   fputc('x', p);
18985 #else
18986 # ifdef TRY_FPRINTF
18987   fprintf(p, "x");
18988 # endif
18989 #endif
18990 #ifdef TRY_FFLUSH_NULL
18991   fflush(NULL);
18992 #endif
18993 #ifdef TRY_FFLUSH_ALL
18994   {
18995     long open_max = -1;
18996 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18997     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18998 # else
18999 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19000     open_max = sysconf(_SC_OPEN_MAX);
19001 #  else
19002 #   ifdef FOPEN_MAX
19003     open_max = FOPEN_MAX;
19004 #   else
19005 #    ifdef OPEN_MAX
19006     open_max = OPEN_MAX;
19007 #    else
19008 #     ifdef _NFILE
19009     open_max = _NFILE;
19010 #     endif
19011 #    endif
19012 #   endif
19013 #  endif
19014 # endif
19015 # ifdef HAS_STDIO_STREAM_ARRAY
19016     if (open_max > 0) {
19017       long i;
19018       for (i = 0; i < open_max; i++)
19019             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19020                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19021                 STDIO_STREAM_ARRAY[i]._flag)
19022                 fflush(&STDIO_STREAM_ARRAY[i]);
19023     }
19024   }
19025 # endif
19026 #endif
19027   _exit(42);
19028 }
19029 EOCP
19030 : first we have to find out how _not_ to flush
19031 $to try.c
19032 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19033     output=''
19034     set try -DTRY_FPUTC
19035     if eval $compile; then
19036             $run ./try 2>/dev/null
19037             code="$?"
19038             $from try.out
19039             if $test ! -s try.out -a "X$code" = X42; then
19040                 output=-DTRY_FPUTC
19041             fi
19042     fi
19043     case "$output" in
19044     '')
19045             set try -DTRY_FPRINTF
19046             if eval $compile; then
19047                     $run ./try 2>/dev/null
19048                     code="$?"
19049                     $from try.out
19050                     if $test ! -s try.out -a "X$code" = X42; then
19051                         output=-DTRY_FPRINTF
19052                     fi
19053             fi
19054         ;;
19055     esac
19056 fi
19057 : check for fflush NULL behaviour
19058 case "$fflushNULL" in
19059 '')     set try -DTRY_FFLUSH_NULL $output
19060         if eval $compile; then
19061                 $run ./try 2>/dev/null
19062                 code="$?"
19063                 $from try.out
19064                 if $test -s try.out -a "X$code" = X42; then
19065                         fflushNULL="`$cat try.out`"
19066                 else
19067                         if $test "X$code" != X42; then
19068                                 $cat >&4 <<EOM
19069 (If this test failed, don't worry, we'll try another method shortly.)
19070 EOM
19071                         fi
19072                 fi
19073         fi
19074         $rm_try
19075         case "$fflushNULL" in
19076         x)      $cat >&4 <<EOM
19077 Your fflush(NULL) works okay for output streams.
19078 Let's see if it clobbers input pipes...
19079 EOM
19080 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19081 # bug that improperly flushes the input end of pipes.  So we avoid the
19082 # autoflush on fork/system/exec support for now. :-(
19083 $cat >tryp.c <<EOCP
19084 #include <stdio.h>
19085 int
19086 main(int argc, char **argv)
19087 {
19088     char buf[1024];
19089     int i;
19090     char *bp = buf;
19091     while (1) {
19092         while ((i = getc(stdin)) != -1
19093                && (*bp++ = i) != '\n'
19094                && bp < &buf[1024])
19095         /* DO NOTHING */ ;
19096         *bp = '\0';
19097         fprintf(stdout, "%s", buf);
19098         fflush(NULL);
19099         if (i == -1)
19100             return 0;
19101         bp = buf;
19102     }
19103 }
19104 EOCP
19105                 fflushNULL="$define"
19106                 set tryp
19107                 if eval $compile; then
19108                     $rm -f tryp.out
19109                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19110                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19111                        $cat >&4 <<EOM
19112 fflush(NULL) seems to behave okay with input streams.
19113 EOM
19114                         fflushNULL="$define"
19115                     else
19116                         $cat >&4 <<EOM
19117 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19118 EOM
19119                         fflushNULL="$undef"
19120                     fi
19121                 fi
19122                 $rm -f core tryp.c tryp.core core.tryp.*
19123                 ;;
19124         '')     $cat >&4 <<EOM
19125 Your fflush(NULL) isn't working (contrary to ANSI C).
19126 EOM
19127                 fflushNULL="$undef"
19128                 ;;
19129         *)      $cat >&4 <<EOM
19130 Cannot figure out whether your fflush(NULL) works or not.
19131 I'm assuming it doesn't (contrary to ANSI C).
19132 EOM
19133                 fflushNULL="$undef"
19134                 ;;
19135         esac
19136         ;;
19137 $define|true|[yY]*)
19138         fflushNULL="$define"
19139         ;;
19140 *)
19141         fflushNULL="$undef"
19142         ;;
19143 esac
19144 : check explicit looping only if NULL did not work, and if the pipe
19145 : bug does not show up on an explicit flush too
19146 case "$fflushNULL" in
19147 "$undef")
19148         $cat >tryp.c <<EOCP
19149 #include <stdio.h>
19150 int
19151 main(int argc, char **argv)
19152 {
19153     char buf[1024];
19154     int i;
19155     char *bp = buf;
19156     while (1) {
19157         while ((i = getc(stdin)) != -1
19158                && (*bp++ = i) != '\n'
19159                && bp < &buf[1024])
19160         /* DO NOTHING */ ;
19161         *bp = '\0';
19162         fprintf(stdout, "%s", buf);
19163         fflush(stdin);
19164         if (i == -1)
19165             return 0;
19166         bp = buf;
19167     }
19168 }
19169 EOCP
19170         set tryp
19171         if eval $compile; then
19172             $rm -f tryp.out
19173             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19174             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19175                $cat >&4 <<EOM
19176 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19177 EOM
19178                 : now check for fflushall behaviour
19179                 case "$fflushall" in
19180                 '')     set try -DTRY_FFLUSH_ALL $output
19181                         if eval $compile; then
19182                                 $cat >&4 <<EOM
19183 (Now testing the other method--but note that this also may fail.)
19184 EOM
19185                                 $run ./try 2>/dev/null
19186                                 code=$?
19187                                 $from try.out
19188                                 if $test -s try.out -a "X$code" = X42; then
19189                                         fflushall="`$cat try.out`"
19190                                 fi
19191                         fi
19192                         $rm_try
19193                         case "$fflushall" in
19194                         x)      $cat >&4 <<EOM
19195 Whew. Flushing explicitly all the stdio streams works.
19196 EOM
19197                                 fflushall="$define"
19198                                 ;;
19199                         '')     $cat >&4 <<EOM
19200 Sigh. Flushing explicitly all the stdio streams doesn't work.
19201 EOM
19202                                 fflushall="$undef"
19203                                 ;;
19204                         *)      $cat >&4 <<EOM
19205 Cannot figure out whether flushing stdio streams explicitly works or not.
19206 I'm assuming it doesn't.
19207 EOM
19208                                 fflushall="$undef"
19209                                 ;;
19210                         esac
19211                         ;;
19212                 "$define"|true|[yY]*)
19213                         fflushall="$define"
19214                         ;;
19215                 *)
19216                         fflushall="$undef"
19217                         ;;
19218                 esac
19219             else
19220                 $cat >&4 <<EOM
19221 All is futile.  Even fflush(stdin) clobbers input pipes!
19222 EOM
19223                 fflushall="$undef"
19224             fi
19225         else
19226             fflushall="$undef"
19227         fi
19228         $rm -f core tryp.c tryp.core core.tryp.*
19229         ;;
19230 *)      fflushall="$undef"
19231         ;;
19232 esac
19233
19234 case "$fflushNULL$fflushall" in
19235 undefundef)
19236         $cat <<EOM
19237 OK, I give up.  I cannot figure out how to flush pending stdio output.
19238 We won't be flushing handles at all before fork/exec/popen.
19239 EOM
19240         ;;
19241 esac
19242 $rm_try tryp
19243
19244 : Store the full pathname to the ar program for use in the C program
19245 : Respect a hint or command line value for full_ar.
19246 case "$full_ar" in
19247 '') full_ar=$ar ;;
19248 esac
19249
19250 : Store the full pathname to the sed program for use in the C program
19251 full_sed=$sed
19252
19253 : see what type gids are declared as in the kernel
19254 echo " "
19255 echo "Looking for the type for group ids returned by getgid()."
19256 set gid_t gidtype xxx stdio.h sys/types.h
19257 eval $typedef
19258 case "$gidtype" in
19259 xxx)
19260         xxx=`./findhdr sys/user.h`
19261         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19262         case $1 in
19263         unsigned) dflt="$1 $2" ;;
19264         *) dflt="$1" ;;
19265         esac
19266         ;;
19267 *) dflt="$gidtype";;
19268 esac
19269 case "$gidtype" in
19270 gid_t) echo "gid_t found." ;;
19271 *)      rp="What is the type for group ids returned by getgid()?"
19272         . ./myread
19273         gidtype="$ans"
19274         ;;
19275 esac
19276
19277 : Check the size of GID
19278 echo " "
19279 case "$gidtype" in
19280 *_t) zzz="$gidtype"     ;;
19281 *)   zzz="gid"          ;;
19282 esac
19283 echo "Checking the size of $zzz..." >&4
19284 cat > try.c <<EOCP
19285 #include <sys/types.h>
19286 #include <stdio.h>
19287 #$i_stdlib I_STDLIB
19288 #ifdef I_STDLIB
19289 #include <stdlib.h>
19290 #endif
19291 int main() {
19292     printf("%d\n", (int)sizeof($gidtype));
19293     exit(0);
19294 }
19295 EOCP
19296 set try
19297 if eval $compile_ok; then
19298         yyy=`$run ./try`
19299         case "$yyy" in
19300         '')     gidsize=4
19301                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19302                 ;;
19303         *)      gidsize=$yyy
19304                 echo "Your $zzz is $gidsize bytes long."
19305                 ;;
19306         esac
19307 else
19308         gidsize=4
19309         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19310 fi
19311
19312
19313 : Check if GID is signed
19314 echo " "
19315 case "$gidtype" in
19316 *_t) zzz="$gidtype"     ;;
19317 *)   zzz="gid"          ;;
19318 esac
19319 echo "Checking the sign of $zzz..." >&4
19320 cat > try.c <<EOCP
19321 #include <sys/types.h>
19322 #include <stdio.h>
19323 int main() {
19324         $gidtype foo = -1;
19325         if (foo < 0)
19326                 printf("-1\n");
19327         else
19328                 printf("1\n");
19329 }
19330 EOCP
19331 set try
19332 if eval $compile; then
19333         yyy=`$run ./try`
19334         case "$yyy" in
19335         '')     gidsign=1
19336                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19337                 ;;
19338         *)      gidsign=$yyy
19339                 case "$gidsign" in
19340                  1) echo "Your $zzz is unsigned." ;;
19341                 -1) echo "Your $zzz is signed."   ;;
19342                 esac
19343                 ;;
19344         esac
19345 else
19346         gidsign=1
19347         echo "(I can't compile the test program--guessing unsigned.)" >&4
19348 fi
19349
19350
19351 : Check 64bit sizes
19352 echo " "
19353
19354 if $test X"$quadtype" != X; then
19355
19356 echo "Checking how to print 64-bit integers..." >&4
19357
19358 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19359         $cat >try.c <<'EOCP'
19360 #include <sys/types.h>
19361 #include <stdio.h>
19362 int main() {
19363   int q = 12345678901;
19364   printf("%ld\n", q);
19365 }
19366 EOCP
19367         set try
19368         if eval $compile; then
19369                 yyy=`$run ./try`
19370                 case "$yyy" in
19371                 12345678901)
19372                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19373                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19374                         echo "We will use %d."
19375                         ;;
19376                 esac
19377         fi
19378 fi
19379
19380 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19381         $cat >try.c <<'EOCP'
19382 #include <sys/types.h>
19383 #include <stdio.h>
19384 int main() {
19385   long q = 12345678901;
19386   printf("%ld\n", q);
19387 }
19388 EOCP
19389         set try
19390         if eval $compile; then
19391                 yyy=`$run ./try`
19392                 case "$yyy" in
19393                 12345678901)
19394                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19395                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19396                         echo "We will use %ld."
19397                         ;;
19398                 esac
19399         fi
19400 fi
19401
19402 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19403         $cat >try.c <<'EOCP'
19404 #include <sys/types.h>
19405 #include <inttypes.h>
19406 #include <stdio.h>
19407 int main() {
19408   int64_t q = 12345678901;
19409   printf("%" PRId64 "\n", q);
19410 }
19411 EOCP
19412         set try
19413         if eval $compile; then
19414                 yyy=`$run ./try`
19415                 case "$yyy" in
19416                 12345678901)
19417                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19418                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19419                         echo "We will use the C9X style."
19420                         ;;
19421                 esac
19422         fi
19423 fi
19424
19425 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19426         $cat >try.c <<EOCP
19427 #include <sys/types.h>
19428 #include <stdio.h>
19429 int main() {
19430   $quadtype q = 12345678901;
19431   printf("%Ld\n", q);
19432 }
19433 EOCP
19434         set try
19435         if eval $compile; then
19436                 yyy=`$run ./try`
19437                 case "$yyy" in
19438                 12345678901)
19439                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19440                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19441                         echo "We will use %Ld."
19442                         ;;
19443                 esac
19444         fi
19445 fi
19446
19447 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19448         $cat >try.c <<'EOCP'
19449 #include <sys/types.h>
19450 #include <stdio.h>
19451 int main() {
19452   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19453   printf("%lld\n", q);
19454 }
19455 EOCP
19456         set try
19457         if eval $compile; then
19458                 yyy=`$run ./try`
19459                 case "$yyy" in
19460                 12345678901)
19461                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19462                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19463                         echo "We will use the %lld style."
19464                         ;;
19465                 esac
19466         fi
19467 fi
19468
19469 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19470         $cat >try.c <<EOCP
19471 #include <sys/types.h>
19472 #include <stdio.h>
19473 int main() {
19474   $quadtype q = 12345678901;
19475   printf("%qd\n", q);
19476 }
19477 EOCP
19478         set try
19479         if eval $compile; then
19480                 yyy=`$run ./try`
19481                 case "$yyy" in
19482                 12345678901)
19483                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19484                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19485                         echo "We will use %qd."
19486                         ;;
19487                 esac
19488         fi
19489 fi
19490
19491 if $test X"$sPRId64" = X; then
19492         echo "Cannot figure out how to print 64-bit integers." >&4
19493 fi
19494 $rm_try
19495
19496 fi
19497
19498 case "$sPRId64" in
19499 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19500         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19501         ;;
19502 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19503         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19504         ;;
19505 esac
19506
19507 : Check format strings for internal types
19508 echo " "
19509 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19510
19511 if $test X"$ivsize" = X8; then
19512         ivdformat="$sPRId64"
19513         uvuformat="$sPRIu64"
19514         uvoformat="$sPRIo64"
19515         uvxformat="$sPRIx64"
19516         uvXUformat="$sPRIXU64"
19517 else
19518         if $test X"$ivsize" = X"$longsize"; then
19519                 ivdformat='"ld"'
19520                 uvuformat='"lu"'
19521                 uvoformat='"lo"'
19522                 uvxformat='"lx"'
19523                 uvXUformat='"lX"'
19524         else
19525                 if $test X"$ivsize" = X"$intsize"; then
19526                         ivdformat='"d"'
19527                         uvuformat='"u"'
19528                         uvoformat='"o"'
19529                         uvxformat='"x"'
19530                         uvXUformat='"X"'
19531                 else
19532                         : far out
19533                         if $test X"$ivsize" = X"$shortsize"; then
19534                                 ivdformat='"hd"'
19535                                 uvuformat='"hu"'
19536                                 uvoformat='"ho"'
19537                                 uvxformat='"hx"'
19538                                 uvXUformat='"hX"'
19539                         fi
19540                 fi
19541         fi
19542 fi
19543
19544 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19545         nveformat="$sPRIeldbl"
19546         nvfformat="$sPRIfldbl"
19547         nvgformat="$sPRIgldbl"
19548         nvEUformat="$sPRIEUldbl"
19549         nvFUformat="$sPRIFUldbl"
19550         nvGUformat="$sPRIGUldbl"
19551 else
19552         nveformat='"e"'
19553         nvfformat='"f"'
19554         nvgformat='"g"'
19555         nvEUformat='"E"'
19556         nvFUformat='"F"'
19557         nvGUformat='"G"'
19558 fi
19559
19560 case "$ivdformat" in
19561 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19562     exit 1
19563     ;;
19564 esac
19565
19566 : Check format string for GID
19567
19568 echo " "
19569 $echo "Checking the format string to be used for gids..." >&4
19570
19571 case "$gidsign" in
19572 -1)     if $test X"$gidsize" = X"$ivsize"; then
19573                 gidformat="$ivdformat"
19574         else
19575                 if $test X"$gidsize" = X"$longsize"; then
19576                         gidformat='"ld"'
19577                 else
19578                         if $test X"$gidsize" = X"$intsize"; then
19579                                 gidformat='"d"'
19580                         else
19581                                 if $test X"$gidsize" = X"$shortsize"; then
19582                                         gidformat='"hd"'
19583                                 fi
19584                         fi
19585                 fi
19586         fi
19587         ;;
19588 *)      if $test X"$gidsize" = X"$uvsize"; then
19589                 gidformat="$uvuformat"
19590         else
19591                 if $test X"$gidsize" = X"$longsize"; then
19592                         gidformat='"lu"'
19593                 else
19594                         if $test X"$gidsize" = X"$intsize"; then
19595                                 gidformat='"u"'
19596                         else
19597                                 if $test X"$gidsize" = X"$shortsize"; then
19598                                         gidformat='"hu"'
19599                                 fi
19600                         fi
19601                 fi
19602         fi
19603         ;;
19604 esac
19605
19606 : see if getgroups exists
19607 set getgroups d_getgrps
19608 eval $inlibc
19609
19610 : see if setgroups exists
19611 set setgroups d_setgrps
19612 eval $inlibc
19613
19614 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19615 echo " "
19616 case "$d_getgrps$d_setgrps" in
19617 *define*)
19618         case "$groupstype" in
19619         '') dflt="$gidtype" ;;
19620         *)  dflt="$groupstype" ;;
19621         esac
19622         $cat <<EOM
19623 What type of pointer is the second argument to getgroups() and setgroups()?
19624 Usually this is the same as group ids, $gidtype, but not always.
19625
19626 EOM
19627         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19628         . ./myread
19629         groupstype="$ans"
19630         ;;
19631 *)  groupstype="$gidtype";;
19632 esac
19633
19634 : MAD = Misc Attribute Definition
19635
19636 if $test $patchlevel -lt 9; then
19637 : MAD is not available in 5.8.x or earlier.
19638     ans=n;
19639 else
19640     case "$mad" in
19641     $define|true|[yY]*) dflt='y' ;;
19642     *)                  dflt='n' ;;
19643     esac
19644     cat <<EOM
19645
19646 Would you like to build with Misc Attribute Decoration? This is development
19647 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19648 overhead on the interpreter.
19649
19650 If this doesn't make any sense to you, just accept the default '$dflt'.
19651 EOM
19652     rp='Build Perl with MAD?'
19653     . ./myread
19654 fi
19655 case "$ans" in
19656 y|Y)    val="$define"
19657         madlyh='madly.h madly.act madly.tab'
19658         madlysrc='madly.c'
19659         madlyobj="madly$_o" ;;
19660 *)      val="$undef"
19661         madlyh=''
19662         madlysrc=''
19663         madlyobj='' ;;
19664 esac
19665 set mad
19666 eval $setvar
19667
19668 : check whether make sets MAKE
19669 echo " "
19670 echo "Checking if your $make program sets \$(MAKE)..." >&4
19671 case "$make_set_make" in
19672 '')
19673         $sed 's/^X //' > testmake.mak << 'EOF'
19674 Xall:
19675 X       @echo 'maketemp="$(MAKE)"'
19676 EOF
19677         case "`$make -f testmake.mak 2>/dev/null`" in
19678         *maketemp=*) make_set_make='#' ;;
19679         *)      make_set_make="MAKE=$make" ;;
19680         esac
19681         $rm -f testmake.mak
19682         ;;
19683 esac
19684 case "$make_set_make" in
19685 '#') echo "Yup, it does.";;
19686 *) echo "Nope, it doesn't.";;
19687 esac
19688
19689 : see what type is used for mode_t
19690 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19691 set mode_t modetype int stdio.h sys/types.h
19692 eval $typedef_ask
19693
19694 : see if we need va_copy
19695 echo " "
19696 case "$i_stdarg" in
19697 "$define")
19698         $cat >try.c <<EOCP
19699 #include <stdarg.h>
19700 #include <stdio.h>
19701 #$i_stdlib I_STDLIB
19702 #ifdef I_STDLIB
19703 #include <stdlib.h>
19704 #endif
19705 #include <signal.h>
19706
19707 int
19708 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19709 {
19710   return vfprintf(f, fmt, *valp);
19711 }
19712
19713 int
19714 myvfprintf(FILE *f, const  char *fmt, va_list val)
19715 {
19716   return ivfprintf(f, fmt, &val);
19717 }
19718
19719 int
19720 myprintf(char *fmt, ...)
19721 {
19722   va_list val;
19723   va_start(val, fmt);
19724   return myvfprintf(stdout, fmt, val);
19725 }
19726
19727 int
19728 main(int ac, char **av)
19729 {
19730   signal(SIGSEGV, exit);
19731
19732   myprintf("%s%cs all right, then\n", "that", '\'');
19733   exit(0);
19734 }
19735 EOCP
19736         set try
19737         if eval $compile && $run ./try 2>&1 >/dev/null; then
19738                 case "`$run ./try`" in
19739                 "that's all right, then")
19740                         okay=yes
19741                         ;;
19742                 esac
19743         fi
19744         case "$okay" in
19745         yes)    echo "It seems that you don't need va_copy()." >&4
19746                 need_va_copy="$undef"
19747                 ;;
19748         *)      echo "It seems that va_copy() or similar will be needed." >&4
19749                 need_va_copy="$define"
19750                 ;;
19751         esac
19752         $rm_try
19753         ;;
19754 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19755         ;;
19756 esac
19757
19758 : see what type is used for size_t
19759 rp="What is the type used for the length parameter for string functions?"
19760 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19761 eval $typedef_ask
19762
19763 : check for type of arguments to gethostbyaddr. 
19764 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19765         case "$d_gethbyaddr" in
19766         $define)
19767                 $cat <<EOM
19768
19769 Checking to see what type of arguments are accepted by gethostbyaddr().
19770 EOM
19771                 hdrs="$define sys/types.h
19772                         $d_socket sys/socket.h 
19773                         $i_niin netinet/in.h 
19774                         $i_netdb netdb.h
19775                         $i_unistd unistd.h"
19776                 : The first arg can 'char *' or 'void *'
19777                 : The second arg is some of integral type
19778                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19779                         for yyy in size_t long int; do
19780                                 case "$netdb_host_type" in
19781                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19782                                         if ./protochk "$try" $hdrs; then
19783                                                 echo "Your system accepts $xxx for the first arg."
19784                                                 echo "...and $yyy for the second arg."
19785                                                 netdb_host_type="$xxx"
19786                                                 netdb_hlen_type="$yyy"
19787                                         fi
19788                                         ;;
19789                                 esac
19790                         done
19791                 done
19792                 : In case none of those worked, prompt the user.
19793                 case "$netdb_host_type" in
19794                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19795                         dflt='char *'
19796                         . ./myread
19797                         netdb_host_type=$ans
19798                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19799                         dflt="$sizetype"
19800                         . ./myread
19801                         netdb_hlen_type=$ans
19802                         ;;
19803                 esac
19804                 ;;
19805         *)      : no gethostbyaddr, so pick harmless defaults
19806                 netdb_host_type='char *'
19807                 netdb_hlen_type="$sizetype"
19808                 ;;
19809         esac
19810         # Remove the "const" if needed. -- but then we'll have a 
19811         # prototype clash!
19812         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19813 fi
19814
19815 : check for type of argument to gethostbyname. 
19816 if test "X$netdb_name_type" = X ; then
19817         case "$d_gethbyname" in
19818         $define)
19819                 $cat <<EOM
19820
19821 Checking to see what type of argument is accepted by gethostbyname().
19822 EOM
19823                 hdrs="$define sys/types.h
19824                         $d_socket sys/socket.h 
19825                         $i_niin netinet/in.h 
19826                         $i_netdb netdb.h
19827                         $i_unistd unistd.h"
19828                 for xxx in "const char *" "char *"; do
19829                         case "$netdb_name_type" in
19830                         '')     try="extern struct hostent *gethostbyname($xxx);"
19831                                 if ./protochk "$try" $hdrs; then
19832                                         echo "Your system accepts $xxx."
19833                                         netdb_name_type="$xxx"
19834                                 fi
19835                                 ;;
19836                         esac
19837                 done
19838                 : In case none of those worked, prompt the user.
19839                 case "$netdb_name_type" in
19840                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19841                         dflt='char *'
19842                         . ./myread
19843                         netdb_name_type=$ans
19844                         ;;
19845                 esac
19846                 ;;
19847         *)      : no gethostbyname, so pick harmless default
19848                 netdb_name_type='char *'
19849                 ;;
19850         esac
19851 fi
19852
19853 : check for type of 1st argument to getnetbyaddr. 
19854 if test "X$netdb_net_type" = X ; then
19855         case "$d_getnbyaddr" in
19856         $define)
19857                 $cat <<EOM
19858
19859 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19860 EOM
19861                 hdrs="$define sys/types.h
19862                         $d_socket sys/socket.h 
19863                         $i_niin netinet/in.h 
19864                         $i_netdb netdb.h
19865                         $i_unistd unistd.h"
19866                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19867                         case "$netdb_net_type" in
19868                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19869                                 if ./protochk "$try" $hdrs; then
19870                                         echo "Your system accepts $xxx."
19871                                         netdb_net_type="$xxx"
19872                                 fi
19873                                 ;;
19874                         esac
19875                 done
19876                 : In case none of those worked, prompt the user.
19877                 case "$netdb_net_type" in
19878                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19879                         dflt='long'
19880                         . ./myread
19881                         netdb_net_type=$ans
19882                         ;;
19883                 esac
19884                 ;;
19885         *)      : no getnetbyaddr, so pick harmless default
19886                 netdb_net_type='long'
19887                 ;;
19888         esac
19889 fi
19890 : locate the preferred pager for this system
19891 fn=f/
19892 case "$pager" in
19893 '')
19894         dflt=''
19895         case "$pg" in
19896         /*) dflt=$pg;;
19897         [a-zA-Z]:/*) dflt=$pg;;
19898         esac
19899         case "$more" in
19900         /*) dflt=$more;;
19901         [a-zA-Z]:/*) dflt=$more;;
19902         esac
19903         case "$less" in
19904         /*) dflt=$less;;
19905         [a-zA-Z]:/*) dflt=$less;;
19906         esac
19907         case "$dflt" in
19908         '') dflt=/usr/ucb/more;;
19909         esac
19910         ;;
19911 *)      dflt="$pager"
19912         : Instruct ./getfile to trust the hinted or previous pager value,
19913         : even if it does not begin with a slash.  For example, on os2,
19914         : pager might be cmd /c more.  See comments in UU/getfile.
19915         fn="f/($pager)"
19916         ;;
19917 esac
19918 echo " "
19919 rp='What pager is used on your system?'
19920 . ./getfile
19921 pager="$ans"
19922
19923 : see what type pids are declared as in the kernel
19924 rp="What is the type of process ids on this system?"
19925 set pid_t pidtype int stdio.h sys/types.h
19926 eval $typedef_ask
19927
19928 : see if ar generates random libraries by itself
19929 echo " "
19930 echo "Checking how to generate random libraries on your machine..." >&4
19931 echo 'int bar1() { return bar2(); }' > bar1.c
19932 echo 'int bar2() { return 2; }' > bar2.c
19933 $cat > foo.c <<EOP
19934 #$i_stdlib I_STDLIB
19935 #ifdef I_STDLIB
19936 #include <stdlib.h>
19937 #endif
19938 int main() { printf("%d\n", bar1()); exit(0); }
19939 EOP
19940 $cc $ccflags -c bar1.c >/dev/null 2>&1
19941 $cc $ccflags -c bar2.c >/dev/null 2>&1
19942 $cc $ccflags -c foo.c >/dev/null 2>&1
19943 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19944 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19945         $run ./foobar >/dev/null 2>&1; then
19946         echo "$ar appears to generate random libraries itself."
19947         orderlib=false
19948         if [ "X$ranlib" = "X" ]; then
19949             ranlib=":"
19950         fi
19951 elif $ar s bar$_a >/dev/null 2>&1 &&
19952         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19953         $run ./foobar >/dev/null 2>&1; then
19954                 echo "a table of contents needs to be added with '$ar s'."
19955                 orderlib=false
19956                 ranlib="$ar s"
19957 elif $ar ts bar$_a >/dev/null 2>&1 &&
19958         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19959         $run ./foobar >/dev/null 2>&1; then
19960                 echo "a table of contents needs to be added with '$ar ts'."
19961                 orderlib=false
19962                 ranlib="$ar ts"
19963 else
19964         case "$ranlib" in
19965         :) ranlib='';;
19966         '')
19967                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19968                 $test -f $ranlib || ranlib=''
19969                 ;;
19970         esac
19971         if $test -n "$ranlib"; then
19972                 echo "your system has '$ranlib'; we'll use that."
19973                 orderlib=false
19974         else
19975                 echo "your system doesn't seem to support random libraries"
19976                 echo "so we'll use lorder and tsort to order the libraries."
19977                 orderlib=true
19978                 ranlib=":"
19979         fi
19980 fi
19981 $rm -f foo* bar*
19982
19983 : check for type of arguments to select.
19984 case "$selecttype" in
19985 '') case "$d_select" in
19986         $define)
19987                 echo " "
19988                 $cat <<EOM
19989 Checking to see what type of arguments are accepted by select().
19990 EOM
19991                 hdrs="$define sys/types.h
19992                         $i_systime sys/time.h
19993                         $i_sysselct sys/select.h
19994                         $d_socket sys/socket.h"
19995                 : The first arg can be int, unsigned, or size_t
19996                 : The last arg may or may not be 'const'
19997                 val=''
19998                 : void pointer has been seen but using that
19999                 : breaks the selectminbits test
20000                 for xxx in 'fd_set *' 'int *'; do
20001                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20002                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20003                                         case "$val" in
20004                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20005                                                 if ./protochk "$try" $hdrs; then
20006                                                         echo "Your system accepts $xxx."
20007                                                         val="$xxx"
20008                                                 fi
20009                                                 ;;
20010                                         esac
20011                                 done
20012                         done
20013                 done
20014                 case "$val" in
20015                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20016                         case "$d_fd_set" in
20017                                 $define) dflt="fd_set *" ;;
20018                                 *)              dflt="int *" ;;
20019                         esac
20020                         . ./myread
20021                         val=$ans
20022                         ;;
20023                 esac
20024                 selecttype="$val"
20025                 ;;
20026         *)      : no select, so pick a harmless default
20027                 selecttype='int *'
20028                 ;;
20029         esac
20030         ;;
20031 esac
20032
20033 : check for the select 'width'
20034 case "$selectminbits" in
20035 '') safebits=`expr $ptrsize \* 8`
20036     case "$d_select" in
20037         $define)
20038                 $cat <<EOM
20039
20040 Checking to see on how many bits at a time your select() operates...
20041 EOM
20042                 $cat >try.c <<EOCP
20043 #include <sys/types.h>
20044 #$i_time I_TIME
20045 #$i_systime I_SYS_TIME
20046 #$i_systimek I_SYS_TIME_KERNEL
20047 #ifdef I_TIME
20048 #   include <time.h>
20049 #endif
20050 #ifdef I_SYS_TIME
20051 #   ifdef I_SYS_TIME_KERNEL
20052 #       define KERNEL
20053 #   endif
20054 #   include <sys/time.h>
20055 #   ifdef I_SYS_TIME_KERNEL
20056 #       undef KERNEL
20057 #   endif
20058 #endif
20059 #$i_sysselct I_SYS_SELECT
20060 #ifdef I_SYS_SELECT
20061 #include <sys/select.h>
20062 #endif
20063 #$d_socket HAS_SOCKET
20064 #ifdef HAS_SOCKET
20065 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20066 #endif
20067 #include <stdio.h>
20068 #$i_stdlib I_STDLIB
20069 #ifdef I_STDLIB
20070 #include <stdlib.h>
20071 #endif
20072 $selecttype b;
20073 #define S sizeof(*(b))
20074 #define MINBITS 64
20075 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20076 #define NBITS  (NBYTES * 8)
20077 int main() {
20078     char *s = (char *)malloc(NBYTES);
20079     struct timeval t;
20080     int i;
20081     FILE* fp;
20082     int fd;
20083
20084     if (!s)
20085         exit(1);
20086     fclose(stdin);
20087     fp = fopen("try.c", "r");
20088     if (fp == 0)
20089       exit(2);
20090     fd = fileno(fp);
20091     if (fd < 0)
20092       exit(3);
20093     b = ($selecttype)s;
20094     for (i = 0; i < NBITS; i++)
20095         FD_SET(i, b);
20096     t.tv_sec  = 0;
20097     t.tv_usec = 0;
20098     select(fd + 1, b, 0, 0, &t);
20099     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20100     free(s);
20101     printf("%d\n", i + 1);
20102     return 0;
20103 }
20104 EOCP
20105                 set try
20106                 if eval $compile_ok; then
20107                         selectminbits=`$run ./try`
20108                         case "$selectminbits" in
20109                         '')     cat >&4 <<EOM
20110 Cannot figure out on how many bits at a time your select() operates.
20111 I'll play safe and guess it is $safebits bits.
20112 EOM
20113                                 selectminbits=$safebits
20114                                 bits="$safebits bits"
20115                                 ;;
20116                         1)      bits="1 bit" ;;
20117                         *)      bits="$selectminbits bits" ;;
20118                         esac
20119                         echo "Your select() operates on $bits at a time." >&4
20120                 else
20121                         rp='What is the minimum number of bits your select() operates on?'
20122                         case "$byteorder" in
20123                         12345678)       dflt=64 ;;
20124                         1234)           dflt=32 ;;
20125                         *)              dflt=1  ;;
20126                         esac
20127                         . ./myread
20128                         val=$ans
20129                         selectminbits="$val"
20130                 fi
20131                 $rm_try
20132                 ;;
20133         *)      : no select, so pick a harmless default
20134                 selectminbits=$safebits
20135                 ;;
20136         esac
20137         ;;
20138 esac
20139
20140 : Trace out the files included by signal.h, then look for SIGxxx names.
20141 if [ "X$fieldn" = X ]; then
20142         : Just make some guesses.  We check them later.
20143         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20144 else
20145         xxx=`echo '#include <signal.h>' |
20146         $cppstdin $cppminus $cppflags 2>/dev/null |
20147         $grep '^[       ]*#.*include' |
20148         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20149                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20150 fi
20151 xxxfiles=''
20152 for xx in $xxx /dev/null ; do
20153         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20154 done
20155 case "$xxxfiles" in
20156 '')     xxxfiles=`./findhdr signal.h` ;;
20157 esac
20158 xxx=`awk '
20159 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20160         print substr($2, 4, 20)
20161 }
20162 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20163         print substr($3, 4, 20)
20164 }' $xxxfiles`
20165 : Append some common names just in case the awk scan failed.
20166 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20167 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20168 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20169 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20170 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20171
20172 : generate a few handy files for later
20173 $cat > signal.c <<EOCP
20174 #include <sys/types.h>
20175 #include <signal.h>
20176 #$i_stdlib I_STDLIB
20177 #ifdef I_STDLIB
20178 #include <stdlib.h>
20179 #endif
20180 #include <stdio.h>
20181 int main() {
20182
20183 /* Strange style to avoid deeply-nested #if/#else/#endif */
20184 #ifndef NSIG
20185 #  ifdef _NSIG
20186 #    define NSIG (_NSIG)
20187 #  endif
20188 #endif
20189
20190 #ifndef NSIG
20191 #  ifdef SIGMAX
20192 #    define NSIG (SIGMAX+1)
20193 #  endif
20194 #endif
20195
20196 #ifndef NSIG
20197 #  ifdef SIG_MAX
20198 #    define NSIG (SIG_MAX+1)
20199 #  endif
20200 #endif
20201
20202 #ifndef NSIG
20203 #  ifdef _SIG_MAX
20204 #    define NSIG (_SIG_MAX+1)
20205 #  endif
20206 #endif
20207
20208 #ifndef NSIG
20209 #  ifdef MAXSIG
20210 #    define NSIG (MAXSIG+1)
20211 #  endif
20212 #endif
20213
20214 #ifndef NSIG
20215 #  ifdef MAX_SIG
20216 #    define NSIG (MAX_SIG+1)
20217 #  endif
20218 #endif
20219
20220 #ifndef NSIG
20221 #  ifdef SIGARRAYSIZE
20222 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20223 #  endif
20224 #endif
20225
20226 #ifndef NSIG
20227 #  ifdef _sys_nsig
20228 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20229 #  endif
20230 #endif
20231
20232 /* Default to some arbitrary number that's big enough to get most
20233    of the common signals.
20234 */
20235 #ifndef NSIG
20236 #    define NSIG 50
20237 #endif
20238
20239 printf("NSIG %d\n", NSIG);
20240
20241 #ifndef JUST_NSIG
20242
20243 EOCP
20244
20245 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20246 {
20247         printf "#ifdef SIG"; printf $1; printf "\n"
20248         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20249         printf $1; printf ");\n"
20250         printf "#endif\n"
20251 }
20252 END {
20253         printf "#endif /* JUST_NSIG */\n";
20254         printf "exit(0);\n}\n";
20255 }
20256 ' >>signal.c
20257 $cat >signal.awk <<'EOP'
20258 BEGIN { ndups = 0 }
20259 $1 ~ /^NSIG$/ { nsig = $2 }
20260 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20261     if ($2 > maxsig) { maxsig = $2 }
20262     if (sig_name[$2]) {
20263         dup_name[ndups] = $1
20264         dup_num[ndups] = $2
20265         ndups++
20266     }
20267     else {
20268         sig_name[$2] = $1
20269         sig_num[$2] = $2
20270     }
20271 }
20272 END {
20273     if (nsig == 0) {
20274         nsig = maxsig + 1
20275     }
20276     printf("NSIG %d\n", nsig);
20277     for (n = 1; n < nsig; n++) {
20278         if (sig_name[n]) {
20279             printf("%s %d\n", sig_name[n], sig_num[n])
20280         }
20281         else {
20282             printf("NUM%d %d\n", n, n)
20283         }
20284     }
20285     for (n = 0; n < ndups; n++) {
20286         printf("%s %d\n", dup_name[n], dup_num[n])
20287     }
20288 }
20289 EOP
20290 $cat >signal_cmd <<EOS
20291 $startsh
20292 if $test -s signal.lst; then
20293     echo "Using your existing signal.lst file"
20294         exit 0
20295 fi
20296 xxx="$xxx"
20297 EOS
20298 $cat >>signal_cmd <<'EOS'
20299
20300 set signal
20301 if eval $compile_ok; then
20302         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20303                 $uniq | $awk -f signal.awk >signal.lst
20304 else
20305         echo "(I can't seem be able to compile the whole test program)" >&4
20306         echo "(I'll try it in little pieces.)" >&4
20307         set signal -DJUST_NSIG
20308         if eval $compile_ok; then
20309                 $run ./signal$_exe > signal.nsg
20310                 $cat signal.nsg
20311         else
20312                 echo "I can't seem to figure out how many signals you have." >&4
20313                 echo "Guessing 50." >&4
20314                 echo 'NSIG 50' > signal.nsg
20315         fi
20316         : Now look at all the signal names, one at a time.
20317         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20318                 $cat > signal.c <<EOCP
20319 #include <sys/types.h>
20320 #include <signal.h>
20321 #include <stdio.h>
20322 int main() {
20323 printf("$xx %d\n", SIG${xx});
20324 return 0;
20325 }
20326 EOCP
20327                 set signal
20328                 if eval $compile; then
20329                         echo "SIG${xx} found."
20330                         $run ./signal$_exe  >> signal.ls1
20331                 else
20332                         echo "SIG${xx} NOT found."
20333                 fi
20334         done
20335         if $test -s signal.ls1; then
20336                 $cat signal.nsg signal.ls1 |
20337                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20338         fi
20339
20340 fi
20341 if $test -s signal.lst; then
20342         :
20343 else
20344         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20345         echo 'kill -l' >signal
20346         set X `csh -f <signal`
20347         $rm -f signal
20348         shift
20349         case $# in
20350         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20351         esac
20352         echo $@ | $tr ' ' $trnl | \
20353             $awk '{ printf "%s %d\n", $1, ++s; }
20354                   END { printf "NSIG %d\n", ++s }' >signal.lst
20355 fi
20356 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20357 EOS
20358 chmod a+x signal_cmd
20359 $eunicefix signal_cmd
20360
20361 : generate list of signal names
20362 echo " "
20363 case "$sig_name_init" in
20364 '') doinit=yes ;;
20365 *)  case "$sig_num_init" in
20366     ''|*,*) doinit=yes ;;
20367     esac ;;
20368 esac
20369 case "$doinit" in
20370 yes)
20371         echo "Generating a list of signal names and numbers..." >&4
20372         . ./signal_cmd
20373         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20374         sig_name=`$awk 'BEGIN { printf "ZERO " }
20375                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20376         sig_num=`$awk  'BEGIN { printf "0 " }
20377                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20378         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20379                              !/^NSIG/   { printf "\"%s\", ", $1 }
20380                              END        { printf "0\n" }' signal.lst`
20381         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20382                              !/^NSIG/   { printf "%d, ", $2}
20383                              END        { printf "0\n"}' signal.lst`
20384         ;;
20385 esac
20386 echo "The following $sig_count signals are available:"
20387 echo " "
20388 echo $sig_name | $awk \
20389 'BEGIN { linelen = 0 }
20390 {
20391         for (i = 1; i <= NF; i++) {
20392                 name = "SIG" $i " "
20393                 linelen = linelen + length(name)
20394                 if (linelen > 70) {
20395                         printf "\n"
20396                         linelen = length(name)
20397                 }
20398                 printf "%s", name
20399         }
20400         printf "\n"
20401 }'
20402 sig_size=`echo $sig_name | awk '{print NF}'`
20403 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20404
20405 : Check size of size
20406 echo " "
20407 case "$sizetype" in
20408 *_t) zzz="$sizetype"    ;;
20409 *)   zzz="filesize"     ;;
20410 esac
20411 echo "Checking the size of $zzz..." >&4
20412 cat > try.c <<EOCP
20413 #include <sys/types.h>
20414 #include <stdio.h>
20415 #$i_stdlib I_STDLIB
20416 #ifdef I_STDLIB
20417 #include <stdlib.h>
20418 #endif
20419 int main() {
20420     printf("%d\n", (int)sizeof($sizetype));
20421     exit(0);
20422 }
20423 EOCP
20424 set try
20425 if eval $compile_ok; then
20426         yyy=`$run ./try`
20427         case "$yyy" in
20428         '')     sizesize=4
20429                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20430                 ;;
20431         *)      sizesize=$yyy
20432                 echo "Your $zzz size is $sizesize bytes."
20433                 ;;
20434         esac
20435 else
20436         sizesize=4
20437         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20438 fi
20439
20440
20441 : check for socklen_t
20442 echo " "
20443 echo "Checking to see if you have socklen_t..." >&4
20444 $cat >try.c <<EOCP
20445 #include <sys/types.h>
20446 #$d_socket HAS_SOCKET
20447 #ifdef HAS_SOCKET
20448 #include <sys/socket.h>
20449 #endif
20450 int main() { socklen_t x = 16; }
20451 EOCP
20452 set try
20453 if eval $compile; then
20454         val="$define"
20455         echo "You have socklen_t."
20456 else
20457         val="$undef"
20458         echo "You do not have socklen_t."
20459         case "$sizetype" in
20460         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20461         esac
20462 fi
20463 $rm_try
20464 set d_socklen_t
20465 eval $setvar
20466
20467 : see if this is a socks.h system
20468 set socks.h i_socks
20469 eval $inhdr
20470
20471 : check for type of the size argument to socket calls
20472 case "$d_socket" in
20473 "$define")
20474         $cat <<EOM
20475
20476 Checking to see what type is the last argument of accept().
20477 EOM
20478         yyy=''
20479         case "$d_socklen_t" in
20480         "$define") yyy="$yyy socklen_t"
20481         esac
20482         yyy="$yyy $sizetype int long unsigned"
20483         for xxx in $yyy; do
20484                 case "$socksizetype" in
20485                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20486                         case "$usesocks" in
20487                         "$define")
20488                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20489                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20490                                         socksizetype="$xxx"
20491                                 fi
20492                                 ;;
20493                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20494                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20495                                         socksizetype="$xxx"
20496                                 fi
20497                                 ;;
20498                         esac
20499                         ;;
20500                 esac
20501         done
20502 : In case none of those worked, prompt the user.
20503         case "$socksizetype" in
20504         '')     rp='What is the type for socket address structure sizes?'
20505                 dflt='int'
20506                 . ./myread
20507                 socksizetype=$ans
20508                 ;;
20509         esac
20510         ;;
20511 *)      : no sockets, so pick relatively harmless default
20512         socksizetype='int'
20513         ;;
20514 esac
20515
20516 : see what type is used for signed size_t
20517 set ssize_t ssizetype int stdio.h sys/types.h
20518 eval $typedef
20519 dflt="$ssizetype"
20520 $cat > try.c <<EOM
20521 #include <stdio.h>
20522 #$i_stdlib I_STDLIB
20523 #ifdef I_STDLIB
20524 #include <stdlib.h>
20525 #endif
20526 #include <sys/types.h>
20527 #define Size_t $sizetype
20528 #define SSize_t $dflt
20529 int main()
20530 {
20531         if (sizeof(Size_t) == sizeof(SSize_t))
20532                 printf("$dflt\n");
20533         else if (sizeof(Size_t) == sizeof(int))
20534                 printf("int\n");
20535         else
20536                 printf("long\n");
20537         exit(0);
20538 }
20539 EOM
20540 echo " "
20541 set try
20542 if eval $compile_ok && $run ./try > /dev/null; then
20543         ssizetype=`$run ./try`
20544         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20545 else
20546         $cat >&4 <<EOM
20547 Help! I can't compile and run the ssize_t test program: please enlighten me!
20548 (This is probably a misconfiguration in your system or libraries, and
20549 you really ought to fix it.  Still, I'll try anyway.)
20550
20551 I need a type that is the same size as $sizetype, but is guaranteed to
20552 be signed.  Common values are ssize_t, int and long.
20553
20554 EOM
20555         rp="What signed type is the same size as $sizetype?"
20556         . ./myread
20557         ssizetype="$ans"
20558 fi
20559 $rm_try
20560
20561 : see what type of char stdio uses.
20562 echo " "
20563 echo '#include <stdio.h>' > stdio.c
20564 $cppstdin $cppminus < stdio.c > stdioh
20565 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20566         echo "Your stdio uses unsigned chars." >&4
20567         stdchar="unsigned char"
20568 else
20569         echo "Your stdio uses signed chars." >&4
20570         stdchar="char"
20571 fi
20572 $rm -f stdio.* stdioh
20573
20574 : see what type uids are declared as in the kernel
20575 echo " "
20576 echo "Looking for the type for user ids returned by getuid()."
20577 set uid_t uidtype xxx stdio.h sys/types.h
20578 eval $typedef
20579 case "$uidtype" in
20580 xxx)
20581         xxx=`./findhdr sys/user.h`
20582         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20583         case $1 in
20584         unsigned) dflt="$1 $2" ;;
20585         *) dflt="$1" ;;
20586         esac
20587         ;;
20588 *) dflt="$uidtype";;
20589 esac
20590 case "$uidtype" in
20591 uid_t)  echo "uid_t found." ;;
20592 *)      rp="What is the type for user ids returned by getuid()?"
20593         . ./myread
20594         uidtype="$ans"
20595         ;;
20596 esac
20597
20598 : Check size of UID
20599 echo " "
20600 case "$uidtype" in
20601 *_t) zzz="$uidtype"     ;;
20602 *)   zzz="uid"          ;;
20603 esac
20604 echo "Checking the size of $zzz..." >&4
20605 cat > try.c <<EOCP
20606 #include <sys/types.h>
20607 #include <stdio.h>
20608 #$i_stdlib I_STDLIB
20609 #ifdef I_STDLIB
20610 #include <stdlib.h>
20611 #endif
20612 int main() {
20613     printf("%d\n", (int)sizeof($uidtype));
20614     exit(0);
20615 }
20616 EOCP
20617 set try
20618 if eval $compile_ok; then
20619         yyy=`$run ./try`
20620         case "$yyy" in
20621         '')     uidsize=4
20622                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20623                 ;;
20624         *)      uidsize=$yyy
20625                 echo "Your $zzz is $uidsize bytes long."
20626                 ;;
20627         esac
20628 else
20629         uidsize=4
20630         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20631 fi
20632
20633 : Check if UID is signed
20634 echo " "
20635 case "$uidtype" in
20636 *_t) zzz="$uidtype"     ;;
20637 *)   zzz="uid"          ;;
20638 esac
20639 echo "Checking the sign of $zzz..." >&4
20640 cat > try.c <<EOCP
20641 #include <sys/types.h>
20642 #include <stdio.h>
20643 int main() {
20644         $uidtype foo = -1;
20645         if (foo < 0)
20646                 printf("-1\n");
20647         else
20648                 printf("1\n");
20649 }
20650 EOCP
20651 set try
20652 if eval $compile; then
20653         yyy=`$run ./try`
20654         case "$yyy" in
20655         '')     uidsign=1
20656                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20657                 ;;
20658         *)      uidsign=$yyy
20659                 case "$uidsign" in
20660                  1) echo "Your $zzz is unsigned." ;;
20661                 -1) echo "Your $zzz is signed."   ;;
20662                 esac
20663                 ;;
20664         esac
20665 else
20666         uidsign=1
20667         echo "(I can't compile the test program--guessing unsigned.)" >&4
20668 fi
20669
20670
20671 : Check format string for UID
20672 echo " "
20673 $echo "Checking the format string to be used for uids..." >&4
20674
20675 case "$uidsign" in
20676 -1)     if $test X"$uidsize" = X"$ivsize"; then
20677                 uidformat="$ivdformat"
20678         else
20679                 if $test X"$uidsize" = X"$longsize"; then
20680                         uidformat='"ld"'
20681                 else
20682                         if $test X"$uidsize" = X"$intsize"; then
20683                                 uidformat='"d"'
20684                         else
20685                                 if $test X"$uidsize" = X"$shortsize"; then
20686                                         uidformat='"hd"'
20687                                 fi
20688                         fi
20689                 fi
20690         fi
20691         ;;
20692 *)      if $test X"$uidsize" = X"$uvsize"; then
20693                 uidformat="$uvuformat"
20694         else
20695                 if $test X"$uidsize" = X"$longsize"; then
20696                         uidformat='"lu"'
20697                 else
20698                         if $test X"$uidsize" = X"$intsize"; then
20699                                 uidformat='"u"'
20700                         else
20701                                 if $test X"$uidsize" = X"$shortsize"; then
20702                                         uidformat='"hu"'
20703                                 fi
20704                         fi
20705                 fi
20706         fi
20707         ;;
20708 esac
20709
20710 : Check if site customization support was requested
20711 case "$usesitecustomize" in
20712     $define|true|[Yy]*)
20713         usesitecustomize="$define"
20714         ;;
20715     *)
20716         usesitecustomize="$undef"
20717         ;;
20718     esac
20719
20720 : determine compiler compiler
20721 case "$yacc" in
20722 '')
20723         dflt=yacc;;
20724 *)
20725         dflt="$yacc";;
20726 esac
20727 echo " "
20728 comp='yacc'
20729 if $test -f "$byacc$_exe"; then
20730         dflt="$byacc"
20731         comp="byacc or $comp"
20732 fi
20733 if $test -f "$bison$_exe"; then
20734         comp="$comp or bison -y"
20735 fi
20736 rp="Which compiler compiler ($comp) shall I use?"
20737 . ./myread
20738 yacc="$ans"
20739 case "$yacc" in
20740 *bis*)
20741         case "$yacc" in
20742         *-y*) ;;
20743         *)
20744                 yacc="$yacc -y"
20745                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20746                 ;;
20747         esac
20748         ;;
20749 esac
20750
20751 : see if this is a assert.h system
20752 set assert.h i_assert
20753 eval $inhdr
20754
20755 : see if this is a fp.h system
20756 set fp.h i_fp
20757 eval $inhdr
20758
20759 : see if this is a fp_class.h system
20760 set fp_class.h i_fp_class
20761 eval $inhdr
20762
20763 : see if gdbm.h is available
20764 set gdbm.h t_gdbm
20765 eval $inhdr
20766 case "$t_gdbm" in
20767 $define)
20768         : see if gdbm_open exists
20769         set gdbm_open d_gdbm_open
20770         eval $inlibc
20771         case "$d_gdbm_open" in
20772         $undef)
20773                 t_gdbm="$undef"
20774                 echo "We won't be including <gdbm.h>"
20775                 ;;
20776         esac
20777         ;;
20778 esac
20779 val="$t_gdbm"
20780 set i_gdbm
20781 eval $setvar
20782
20783 : see if this is a ieeefp.h system
20784 case "$i_ieeefp" in
20785 '' ) set ieeefp.h i_ieeefp
20786      eval $inhdr
20787      ;;
20788 esac
20789
20790 : see if this is a libutil.h system
20791 set libutil.h i_libutil
20792 eval $inhdr
20793
20794 : see if mach cthreads are available
20795 if test "X$usethreads" = "X$define"; then
20796         set mach/cthreads.h i_machcthr
20797         eval $inhdr
20798 else
20799         i_machcthr="$undef"
20800 fi
20801
20802 : see if this is a mntent.h system
20803 set mntent.h i_mntent
20804 eval $inhdr
20805
20806 : see if ndbm.h is available
20807 set ndbm.h t_ndbm
20808 eval $inhdr
20809
20810 case "$t_ndbm" in
20811 $undef)
20812     # Some Linux distributions such as RedHat 7.1 put the
20813     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20814     if $test -f /usr/include/gdbm/ndbm.h; then
20815         echo '<gdbm/ndbm.h> found.'
20816         ccflags="$ccflags -I/usr/include/gdbm"
20817         cppflags="$cppflags -I/usr/include/gdbm"
20818         t_ndbm=$define
20819     fi
20820     ;;
20821 esac
20822
20823 case "$t_ndbm" in
20824 $define)
20825         : see if dbm_open exists
20826         set dbm_open d_dbm_open
20827         eval $inlibc
20828         case "$d_dbm_open" in
20829         $undef)
20830                 t_ndbm="$undef"
20831                 echo "We won't be including <ndbm.h>"
20832                 ;;
20833         esac
20834         ;;
20835 esac
20836 val="$t_ndbm"
20837 set i_ndbm
20838 eval $setvar
20839
20840 : see if net/errno.h is available
20841 val=''
20842 set net/errno.h val
20843 eval $inhdr
20844
20845 : Unfortunately, it causes problems on some systems.  Arrgh.
20846 case "$val" in
20847 $define)
20848         cat > try.c <<'EOM'
20849 #include <stdio.h>
20850 #include <errno.h>
20851 #include <net/errno.h>
20852 int func()
20853 {
20854         return ENOTSOCK;
20855 }
20856 EOM
20857         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20858                 echo "We'll be including <net/errno.h>." >&4
20859         else
20860                 echo "We won't be including <net/errno.h>." >&4
20861                 val="$undef"
20862         fi
20863         $rm_try
20864         ;;
20865 esac
20866 set i_neterrno
20867 eval $setvar
20868
20869 : see if netinet/tcp.h is available
20870 set netinet/tcp.h i_netinettcp
20871 eval $inhdr
20872
20873 : see if this is a poll.h system
20874 set poll.h i_poll
20875 eval $inhdr
20876
20877 : see if this is a prot.h system
20878 set prot.h i_prot
20879 eval $inhdr
20880
20881 : Preprocessor symbols
20882 echo " "
20883 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20884 $cat <<'EOSH' > Cppsym.know
20885 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20886 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20887 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20888 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20889 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20890 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20891 bull c cadmus clipper CMU COFF COMPILER_VERSION
20892 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20893 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20894 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20895 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20896 GLIBC GLIBC_MINOR
20897 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20898 H3050R H3050RX hbullx20 hcx host_mips
20899 hp200 hp300 hp700 HP700 hp800 hp9000
20900 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20901 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20902 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20903 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20904 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20905 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20906 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20907 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20908 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20909 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20910 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20911 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20912 MATH_HAS_NO_SIDE_EFFECTS
20913 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20914 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20915 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20916 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20917 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20918 NetBSD news1500 news1700 news1800 news1900 news3700
20919 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20920 ns32016 ns32332 ns32k nsc32000
20921 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20922 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20923 pc532 pdp11 PGC PIC plexus PORTAR posix
20924 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20925 POSIX_C_SOURCE POSIX_SOURCE POWER
20926 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20927 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20928 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20929 sony sony_news sonyrisc sparc sparclite spectrum
20930 stardent stdc STDC_EXT stratos sun sun3 sun386
20931 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20932 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20933 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20934 sysV68 sysV88 Tek4132 Tek4300 titan
20935 TM3200 TM5400 TM5600
20936 tower tower32 tower32_200 tower32_600 tower32_700
20937 tower32_800 tower32_850 tss
20938 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20939 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20940 unix UNIX95 UNIX99 unixpc unos
20941 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20942 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20943 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20944 USGr4 USGr4_2
20945 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20946 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20947 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20948 z8000
20949 EOSH
20950 # Maybe put other stuff here too.
20951 cat <<EOSH >>Cppsym.know
20952 $osname
20953 EOSH
20954 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20955 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20956 $cat Cppsym.know > Cppsym.c
20957 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20958 $rm -f Cppsym.a Cppsym.b Cppsym.c
20959 cat <<EOSH > Cppsym
20960 $startsh
20961 if $test \$# -gt 0; then
20962     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20963     if $test -s Cppsym.got; then
20964         $rm -f Cppsym.got
20965         exit 0
20966     fi
20967     $rm -f Cppsym.got
20968     exit 1
20969 else
20970     $tr " " "$trnl" | ./Cppsym.try
20971     exit 0
20972 fi
20973 EOSH
20974 chmod +x Cppsym
20975 $eunicefix Cppsym
20976 cat <<EOSH > Cppsym.try
20977 $startsh
20978 cat <<'EOCP' > try.c
20979 #include <stdio.h>
20980 #if cpp_stuff == 1
20981 #define STRINGIFY(a)    "a"
20982 #endif
20983 #if cpp_stuff == 42
20984 #define StGiFy(a)  #a
20985 #define STRINGIFY(a)    StGiFy(a)
20986 #endif
20987 #if $cpp_stuff != 1 && $cpp_stuff != 42
20988 #   include "Bletch: How does this C preprocessor stringify macros?"
20989 #endif
20990 int main() {
20991 EOCP
20992 $awk \\
20993 EOSH
20994 cat <<'EOSH' >> Cppsym.try
20995 'length($1) > 0 {
20996     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20997     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20998     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20999     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21000 }'       >> try.c
21001 echo 'return 0;}' >> try.c
21002 EOSH
21003 cat <<EOSH >> Cppsym.try
21004 ccflags="$ccflags"
21005 case "$osname-$gccversion" in
21006 irix-) ccflags="\$ccflags -woff 1178" ;;
21007 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21008 esac
21009 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21010 EOSH
21011 chmod +x Cppsym.try
21012 $eunicefix Cppsym.try
21013 ./Cppsym < Cppsym.know > Cppsym.true
21014 : Add in any linux cpp "predefined macros":
21015 case "$osname::$gccversion" in
21016   *linux*::*.*)
21017     tHdrH=_tmpHdr
21018     rm -f $tHdrH'.h' $tHdrH
21019     touch $tHdrH'.h'
21020     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21021        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21022        if [ -s $tHdrH'_cppsym.real' ]; then
21023           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21024        fi
21025     fi
21026     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21027   ;;
21028 esac
21029 : now check the C compiler for additional symbols
21030 postprocess_cc_v=''
21031 case "$osname" in
21032 aix) postprocess_cc_v="|$tr , ' '" ;;
21033 esac
21034 $cat >ccsym <<EOS
21035 $startsh
21036 $cat >tmp.c <<EOF
21037 extern int foo;
21038 EOF
21039 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21040 do
21041         case "\$i" in
21042         -D*) echo "\$i" | $sed 's/^-D//';;
21043         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21044         esac
21045 done
21046 $rm_try
21047 EOS
21048 postprocess_cc_v=''
21049 chmod +x ccsym
21050 $eunicefix ccsym
21051 ./ccsym > ccsym1.raw
21052 if $test -s ccsym1.raw; then
21053        $sort ccsym1.raw | $uniq >ccsym.raw
21054 else
21055        mv ccsym1.raw ccsym.raw
21056 fi
21057
21058 $awk '/\=/ { print $0; next }
21059         { print $0"=1" }' ccsym.raw >ccsym.list
21060 $comm -13 Cppsym.true ccsym.list >ccsym.own
21061 $comm -12 Cppsym.true ccsym.list >ccsym.com
21062 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21063 also=''
21064 if $test -z ccsym.raw; then
21065         echo "Your C compiler doesn't seem to define any symbols!" >&4
21066         echo " "
21067         echo "However, your C preprocessor defines the following symbols:"
21068         $cat Cppsym.true
21069         ccsymbols=''
21070         cppsymbols=`$cat Cppsym.true`
21071         cppsymbols=`echo $cppsymbols`
21072         cppccsymbols="$cppsymbols"
21073 else
21074         if $test -s ccsym.com; then
21075                 echo "Your C compiler and pre-processor define these symbols:"
21076                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21077                 also='also '
21078                 symbols='ones'
21079                 cppccsymbols=`$cat ccsym.com`
21080                 cppccsymbols=`echo $cppccsymbols`
21081                 $test "$silent" || sleep 1
21082         fi
21083         if $test -s ccsym.cpp; then
21084                 $test "$also" && echo " "
21085                 echo "Your C pre-processor ${also}defines the following symbols:"
21086                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21087                 also='further '
21088                 cppsymbols=`$cat ccsym.cpp`
21089                 cppsymbols=`echo $cppsymbols`
21090                 $test "$silent" || sleep 1
21091         fi
21092         if $test -s ccsym.own; then
21093                 $test "$also" && echo " "
21094                 echo "Your C compiler ${also}defines the following cpp symbols:"
21095                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21096                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21097                 ccsymbols=`$cat ccsym.own`
21098                 ccsymbols=`echo $ccsymbols`
21099                 $test "$silent" || sleep 1
21100         fi
21101 fi
21102
21103 : see if this is a termio system
21104 val="$undef"
21105 val2="$undef"
21106 val3="$undef"
21107 if $test `./findhdr termios.h`; then
21108         set tcsetattr i_termios
21109         eval $inlibc
21110         val3="$i_termios"
21111 fi
21112 echo " "
21113 case "$val3" in
21114 "$define") echo "You have POSIX termios.h... good!" >&4;;
21115 *) if ./Cppsym pyr; then
21116                 case "`/bin/universe`" in
21117                 ucb) if $test `./findhdr sgtty.h`; then
21118                                 val2="$define"
21119                                 echo "<sgtty.h> found." >&4
21120                         else
21121                                 echo "System is pyramid with BSD universe."
21122                                 ./warn "<sgtty.h> not found--you could have problems."
21123                         fi;;
21124                 *) if $test `./findhdr termio.h`; then
21125                                 val="$define"
21126                                 echo "<termio.h> found." >&4
21127                         else
21128                                 echo "System is pyramid with USG universe."
21129                                 ./warn "<termio.h> not found--you could have problems."
21130                         fi;;
21131                 esac
21132         elif ./usg; then
21133                 if $test `./findhdr termio.h`; then
21134                         echo "<termio.h> found." >&4
21135                         val="$define"
21136                 elif $test `./findhdr sgtty.h`; then
21137                         echo "<sgtty.h> found." >&4
21138                         val2="$define"
21139                 else
21140                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21141                 fi
21142         else
21143                 if $test `./findhdr sgtty.h`; then
21144                         echo "<sgtty.h> found." >&4
21145                         val2="$define"
21146                 elif $test `./findhdr termio.h`; then
21147                         echo "<termio.h> found." >&4
21148                         val="$define"
21149                 else
21150                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21151                 fi
21152         fi;;
21153 esac
21154 set i_termio; eval $setvar
21155 val=$val2; set i_sgtty; eval $setvar
21156 val=$val3; set i_termios; eval $setvar
21157
21158 : see if stddef is available
21159 set stddef.h i_stddef
21160 eval $inhdr
21161
21162 : see if sys/access.h is available
21163 set sys/access.h i_sysaccess
21164 eval $inhdr
21165
21166 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21167 set sys/filio.h i_sysfilio
21168 eval $inhdr
21169 echo " "
21170 if $test `./findhdr sys/ioctl.h`; then
21171         val="$define"
21172         echo '<sys/ioctl.h> found.' >&4
21173 else
21174         val="$undef"
21175         if $test $i_sysfilio = "$define"; then
21176             echo '<sys/ioctl.h> NOT found.' >&4
21177         else
21178                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21179                 $test $i_termio = "$define" && xxx="termio.h"
21180                 $test $i_termios = "$define" && xxx="termios.h"
21181 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21182         fi
21183 fi
21184 set i_sysioctl
21185 eval $setvar
21186
21187 : see if socket ioctl defs are in sys/sockio.h
21188 echo " "
21189 xxx=`./findhdr sys/sockio.h`
21190 if $test "$xxx"; then
21191         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21192                 val="$define"
21193                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21194         else
21195                 val="$undef"
21196                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21197         fi
21198 else
21199         val="$undef"
21200         $cat <<EOM
21201 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21202 EOM
21203 fi
21204 set i_syssockio
21205 eval $setvar
21206
21207 : see if this is a syslog.h system
21208 set syslog.h i_syslog
21209 eval $inhdr
21210
21211 : see if this is a sys/mode.h system
21212 set sys/mode.h i_sysmode
21213 eval $inhdr
21214
21215 : see if there is a sys/poll.h file
21216 set sys/poll.h i_syspoll
21217 eval $inhdr
21218
21219 : see if sys/resource.h has to be included
21220 set sys/resource.h i_sysresrc
21221 eval $inhdr
21222
21223 : see if sys/security.h is available
21224 set sys/security.h i_syssecrt
21225 eval $inhdr
21226
21227 : see if this is a sys/statvfs.h system
21228 set sys/statvfs.h i_sysstatvfs
21229 eval $inhdr
21230
21231 : see if this is a sys/un.h system
21232 set sys/un.h i_sysun
21233 eval $inhdr
21234
21235 : see if this is a sys/utsname.h system
21236 set sys/utsname.h i_sysutsname
21237 eval $inhdr
21238
21239 : see if this is a syswait system
21240 set sys/wait.h i_syswait
21241 eval $inhdr
21242
21243 : see if this is a ustat.h system
21244 set ustat.h i_ustat
21245 eval $inhdr
21246
21247 : see if this is an utime system
21248 set utime.h i_utime
21249 eval $inhdr
21250
21251 : see if this is a values.h system
21252 set values.h i_values
21253 eval $inhdr
21254
21255 : see if this is a vfork system
21256 case "$d_vfork" in
21257 "$define")
21258         set vfork.h i_vfork
21259         eval $inhdr
21260         ;;
21261 *)
21262         i_vfork="$undef"
21263         ;;
21264 esac
21265
21266 : Check extensions
21267 echo " "
21268 echo "Looking for extensions..." >&4
21269 : If we are using the old config.sh, known_extensions may contain
21270 : old or inaccurate or duplicate values.
21271 known_extensions=''
21272 nonxs_extensions=''
21273 : We do not use find because it might not be available.
21274 : We do not just use MANIFEST because the user may have dropped
21275 : some additional extensions into the source tree and expect them
21276 : to be built.
21277
21278 : Function to recursively find available extensions, ignoring DynaLoader
21279 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21280 find_extensions='
21281     for xxx in *; do
21282         case "$xxx" in
21283             DynaLoader|dynaload) ;;
21284             *)
21285             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21286                 known_extensions="$known_extensions $1$xxx";
21287             elif $test -f $xxx/Makefile.PL; then
21288                 nonxs_extensions="$nonxs_extensions $1$xxx";
21289             else
21290                 if $test -d $xxx -a $# -lt 10; then
21291                     set $1$xxx/ $*;
21292                     cd "$xxx";
21293                     eval $find_extensions;
21294                     cd ..;
21295                     shift;
21296                 fi;
21297             fi
21298             ;;
21299         esac;
21300     done'
21301 tdir=`pwd`
21302 cd "$rsrc/ext"
21303 set X
21304 shift
21305 eval $find_extensions
21306 # Special case:  Add in modules that nest beyond the first level.
21307 # Currently threads/shared and Hash/Util/FieldHash, since they are
21308 # not picked up by the recursive find above (and adding in general
21309 # recursive finding breaks SDBM_File/sdbm).
21310 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21311 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21312 set X $known_extensions
21313 shift
21314 known_extensions="$*"
21315 set X $nonxs_extensions
21316 shift
21317 nonxs_extensions="$*"
21318 cd "$tdir"
21319
21320 : Now see which are supported on this system.
21321 avail_ext=''
21322 for xxx in $known_extensions ; do
21323         case "$xxx" in
21324         DB_File|db_file)
21325                 case "$i_db" in
21326                 $define) avail_ext="$avail_ext $xxx" ;;
21327                 esac
21328                 ;;
21329         GDBM_File|gdbm_fil)
21330                 case "$i_gdbm" in
21331                 $define) avail_ext="$avail_ext $xxx" ;;
21332                 esac
21333                 ;;
21334         I18N/Langinfo|i18n_lan)
21335                 case "$i_langinfo$d_nl_langinfo" in
21336                 $define$define) avail_ext="$avail_ext $xxx" ;;
21337                 esac
21338                 ;;
21339         IPC/SysV|ipc/sysv)
21340                 : XXX Do we need a useipcsysv variable here
21341                 case "${d_msg}${d_sem}${d_shm}" in
21342                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21343                 esac
21344                 ;;
21345         NDBM_File|ndbm_fil)
21346                 case "$i_ndbm" in
21347                 $define)
21348                     case "$osname-$use64bitint" in
21349                     hpux-define)
21350                         case "$libs" in
21351                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21352                         esac
21353                         ;;
21354                     *) avail_ext="$avail_ext $xxx" ;;
21355                     esac
21356                     ;;
21357                 esac
21358                 ;;
21359         ODBM_File|odbm_fil)
21360                 case "${i_dbm}${i_rpcsvcdbm}" in
21361                 *"${define}"*)
21362                     case "$d_cplusplus" in
21363                     define) ;; # delete as a function name will not work
21364                     *)  case "$osname-$use64bitint" in
21365                         hpux-define)
21366                             case "$libs" in
21367                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21368                             esac
21369                             ;;
21370                         *) avail_ext="$avail_ext $xxx" ;;
21371                         esac
21372                         ;;
21373                     esac
21374                     ;;
21375                 esac
21376                 ;;
21377         Opcode|opcode)
21378                 case "$useopcode" in
21379                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21380                 esac
21381                 ;;
21382         POSIX|posix)
21383                 case "$useposix" in
21384                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21385                 esac
21386                 ;;
21387         Socket|socket)
21388                 case "$d_socket" in
21389                 true|$define|y)
21390                     case "$osname" in
21391                     beos) ;; # not unless BONE
21392                     *) avail_ext="$avail_ext $xxx" ;;
21393                     esac
21394                     ;;
21395                 esac
21396                 ;;
21397         Sys/Syslog|sys/syslog)
21398                 : XXX syslog requires socket
21399                 case "$d_socket" in
21400                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21401                 esac
21402                 ;;
21403         Thread|thread)
21404                 case "$usethreads" in
21405                 true|$define|y)
21406                         case "$use5005threads" in
21407                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21408                         esac
21409                 esac
21410                 ;;
21411         threads|threads/shared)
21412                 # threads and threads::shared are special cases.
21413                 # To stop people from asking "Perl 5.8.0 was supposed
21414                 # to have this new fancy threads implementation but my
21415                 # perl doesn't have it" and from people trying to
21416                 # (re)install the threads module using CPAN.pm and
21417                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21418                 # the threads.pm and threads/shared.pm will always be
21419                 # there, croaking informatively ("you need to rebuild
21420                 # all of Perl with threads, sorry") when threads haven't
21421                 # been compiled in.
21422                 # --jhi
21423                 avail_ext="$avail_ext $xxx"
21424                 ;;
21425         Win32*)
21426                 case "$osname" in
21427                 cygwin) avail_ext="$avail_ext $xxx" ;;
21428                 esac
21429                 ;;
21430         XS/APItest|xs/apitest)
21431                 # This is just for testing.  Skip it unless we have dynamic loading.
21432
21433                 case "$usedl" in
21434                 $define) avail_ext="$avail_ext $xxx" ;;
21435                 esac
21436                 ;;
21437         XS/Typemap|xs/typemap)
21438                 # This is just for testing.  Skip it unless we have dynamic loading.
21439                 case "$usedl" in
21440                 $define) avail_ext="$avail_ext $xxx" ;;
21441                 esac
21442                 ;;
21443         *)      avail_ext="$avail_ext $xxx"
21444                 ;;
21445         esac
21446 done
21447
21448 set X $avail_ext
21449 shift
21450 avail_ext="$*"
21451
21452 case "$onlyextensions" in
21453 '') ;;
21454 *)  keepextensions=''
21455     echo "You have requested that only certains extensions be included..." >&4
21456     for i in $onlyextensions; do
21457         case " $avail_ext " in
21458         *" $i "*)
21459             echo "Keeping extension $i."
21460             keepextensions="$keepextensions $i"
21461             ;;
21462         *) echo "Ignoring extension $i." ;;
21463         esac
21464     done
21465     avail_ext="$keepextensions"
21466     ;;
21467 esac
21468
21469 case "$noextensions" in
21470 '') ;;
21471 *)  keepextensions=''
21472     echo "You have requested that certain extensions be ignored..." >&4
21473     for i in $avail_ext; do
21474         case " $noextensions " in
21475         *" $i "*) echo "Ignoring extension $i." ;;
21476         *) echo "Keeping extension $i.";
21477            keepextensions="$keepextensions $i"
21478            ;;
21479         esac
21480     done
21481     avail_ext="$keepextensions"
21482     ;;
21483 esac
21484
21485 : Now see which nonxs extensions are supported on this system.
21486 : For now assume all are.
21487 nonxs_ext=''
21488 for xxx in $nonxs_extensions ; do
21489         case "$xxx" in
21490         *)      nonxs_ext="$nonxs_ext $xxx"
21491                 ;;
21492         esac
21493 done
21494
21495 set X $nonxs_ext
21496 shift
21497 nonxs_ext="$*"
21498
21499 case $usedl in
21500 $define)
21501         $cat <<EOM
21502 A number of extensions are supplied with $package.  You may choose to
21503 compile these extensions for dynamic loading (the default), compile
21504 them into the $package executable (static loading), or not include
21505 them at all.  Answer "none" to include no extensions.
21506 Note that DynaLoader is always built and need not be mentioned here.
21507
21508 EOM
21509         case "$dynamic_ext" in
21510         '')
21511                 : Exclude those listed in static_ext
21512                 dflt=''
21513                 for xxx in $avail_ext; do
21514                         case " $static_ext " in
21515                         *" $xxx "*) ;;
21516                         *) dflt="$dflt $xxx" ;;
21517                         esac
21518                 done
21519                 set X $dflt
21520                 shift
21521                 dflt="$*"
21522                 ;;
21523         *)      dflt="$dynamic_ext"
21524                 # Perhaps we are reusing an old out-of-date config.sh.
21525                 case "$hint" in
21526                 previous)
21527                         if test X"$dynamic_ext" != X"$avail_ext"; then
21528                                 $cat <<EOM
21529 NOTICE:  Your previous config.sh list may be incorrect.
21530 The extensions now available to you are
21531         ${avail_ext}
21532 but the default list from your previous config.sh is
21533         ${dynamic_ext}
21534
21535 EOM
21536                         fi
21537                         ;;
21538                 esac
21539                 ;;
21540         esac
21541         case "$dflt" in
21542         '')     dflt=none;;
21543         esac
21544         rp="What extensions do you wish to load dynamically?"
21545         . ./myread
21546         case "$ans" in
21547         none) dynamic_ext=' ' ;;
21548         *) dynamic_ext="$ans" ;;
21549         esac
21550
21551         case "$static_ext" in
21552         '')
21553                 : Exclude those already listed in dynamic linking
21554                 dflt=''
21555                 for xxx in $avail_ext; do
21556                         case " $dynamic_ext " in
21557                         *" $xxx "*) ;;
21558                         *) dflt="$dflt $xxx" ;;
21559                         esac
21560                 done
21561                 set X $dflt
21562                 shift
21563                 dflt="$*"
21564                 ;;
21565         *)  dflt="$static_ext"
21566                 ;;
21567         esac
21568
21569         case "$dflt" in
21570         '')     dflt=none;;
21571         esac
21572         rp="What extensions do you wish to load statically?"
21573         . ./myread
21574         case "$ans" in
21575         none) static_ext=' ' ;;
21576         *) static_ext="$ans" ;;
21577         esac
21578         ;;
21579 *)
21580         $cat <<EOM
21581 A number of extensions are supplied with $package.  Answer "none"
21582 to include no extensions.
21583 Note that DynaLoader is always built and need not be mentioned here.
21584
21585 EOM
21586         case "$static_ext" in
21587         '') dflt="$avail_ext" ;;
21588         *)      dflt="$static_ext"
21589                 # Perhaps we are reusing an old out-of-date config.sh.
21590                 case "$hint" in
21591                 previous)
21592                         if test X"$static_ext" != X"$avail_ext"; then
21593                                 $cat <<EOM
21594 NOTICE:  Your previous config.sh list may be incorrect.
21595 The extensions now available to you are
21596         ${avail_ext}
21597 but the default list from your previous config.sh is
21598         ${static_ext}
21599
21600 EOM
21601                         fi
21602                         ;;
21603                 esac
21604                 ;;
21605         esac
21606         : Exclude those that are not xs extensions
21607         case "$dflt" in
21608         '')     dflt=none;;
21609         esac
21610         rp="What extensions do you wish to include?"
21611         . ./myread
21612         case "$ans" in
21613         none) static_ext=' ' ;;
21614         *) static_ext="$ans" ;;
21615         esac
21616         ;;
21617 esac
21618 #
21619 # Encode is a special case.  If we are building Encode as a static
21620 # extension, we need to explicitly list its subextensions as well.
21621 # For other nested extensions, this is handled automatically by
21622 # the appropriate Makefile.PL.
21623 case " $static_ext " in
21624         *" Encode "*) # Add the subextensions of Encode
21625         cd "$rsrc/ext"
21626         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21627                 static_ext="$static_ext Encode/$xxx"
21628         done
21629         cd "$tdir"
21630         ;;
21631 esac
21632
21633 set X $dynamic_ext $static_ext $nonxs_ext
21634 shift
21635 extensions="$*"
21636
21637 # Sanity check:  We require an extension suitable for use with
21638 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21639 # should show up as failures in the test suite, but it's helpful to
21640 # catch them now.) The 'extensions' list is normally sorted
21641 # alphabetically, so we need to accept either
21642 #    DB_File ... Fcntl ... IO  ....
21643 # or something like
21644 #    Fcntl ... NDBM_File ... IO  ....
21645 case " $extensions"  in
21646 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21647 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21648 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21649 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21650    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21651    ;;
21652 esac
21653
21654 : Remove libraries needed only for extensions
21655 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21656 : The exception is SunOS 4.x, which needs them.
21657 case "${osname}X${osvers}" in
21658 sunos*X4*)
21659     perllibs="$libs"
21660     ;;
21661 *) case "$usedl" in
21662     $define|true|[yY]*)
21663             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21664             shift
21665             perllibs="$*"
21666             ;;
21667     *)  perllibs="$libs"
21668             ;;
21669     esac
21670     ;;
21671 esac
21672
21673 : Remove build directory name from cppstdin so it can be used from
21674 : either the present location or the final installed location.
21675 echo " "
21676 : Get out of the UU directory to get correct path name.
21677 cd ..
21678 case "$cppstdin" in
21679 `pwd`/cppstdin)
21680         echo "Stripping down cppstdin path name"
21681         cppstdin=cppstdin
21682         ;;
21683 esac
21684 cd UU
21685
21686 : end of configuration questions
21687 echo " "
21688 echo "End of configuration questions."
21689 echo " "
21690
21691 : back to where it started
21692 if test -d ../UU; then
21693         cd ..
21694 fi
21695
21696 : configuration may be unconditionally patched via a 'config.arch' file
21697 if $test -f config.arch; then
21698         echo "I see a config.arch file, loading it." >&4
21699         . ./config.arch
21700 fi
21701
21702 : configuration may be patched via a 'config.over' file
21703 if $test -f config.over; then
21704         echo " "
21705         dflt=y
21706         rp='I see a config.over file.  Do you wish to load it?'
21707         . UU/myread
21708         case "$ans" in
21709         n*) echo "OK, I'll ignore it.";;
21710         *)      . ./config.over
21711                 echo "Configuration override changes have been loaded."
21712                 ;;
21713         esac
21714 fi
21715
21716 : in case they want portability, strip down executable paths
21717 case "$d_portable" in
21718 "$define")
21719         echo " "
21720         echo "Stripping down executable paths..." >&4
21721         for file in $loclist $trylist; do
21722                 eval temp=\$$file
21723                 eval $file=`basename $temp`
21724         done
21725         ;;
21726 esac
21727
21728 : create config.sh file
21729 echo " "
21730 echo "Creating config.sh..." >&4
21731 $spitshell <<EOT >config.sh
21732 $startsh
21733 #
21734 # This file was produced by running the Configure script. It holds all the
21735 # definitions figured out by Configure. Should you modify one of these values,
21736 # do not forget to propagate your changes by running "Configure -der". You may
21737 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21738 #
21739
21740 # Package name      : $package
21741 # Source directory  : $src
21742 # Configuration time: $cf_time
21743 # Configured by     : $cf_by
21744 # Target system     : $myuname
21745
21746 EOT
21747 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21748 $spitshell <<EOT >>config.sh
21749
21750 Author='$Author'
21751 Date='$Date'
21752 Header='$Header'
21753 Id='$Id'
21754 Locker='$Locker'
21755 Log='$Log'
21756 RCSfile='$RCSfile'
21757 Revision='$Revision'
21758 Source='$Source'
21759 State='$State'
21760 _a='$_a'
21761 _exe='$_exe'
21762 _o='$_o'
21763 afs='$afs'
21764 afsroot='$afsroot'
21765 alignbytes='$alignbytes'
21766 ansi2knr='$ansi2knr'
21767 aphostname='$aphostname'
21768 api_revision='$api_revision'
21769 api_subversion='$api_subversion'
21770 api_version='$api_version'
21771 api_versionstring='$api_versionstring'
21772 ar='$ar'
21773 archlib='$archlib'
21774 archlibexp='$archlibexp'
21775 archname64='$archname64'
21776 archname='$archname'
21777 archobjs='$archobjs'
21778 asctime_r_proto='$asctime_r_proto'
21779 awk='$awk'
21780 baserev='$baserev'
21781 bash='$bash'
21782 bin='$bin'
21783 binexp='$binexp'
21784 bison='$bison'
21785 byacc='$byacc'
21786 byteorder='$byteorder'
21787 c='$c'
21788 castflags='$castflags'
21789 cat='$cat'
21790 cc='$cc'
21791 cccdlflags='$cccdlflags'
21792 ccdlflags='$ccdlflags'
21793 ccflags='$ccflags'
21794 ccflags_uselargefiles='$ccflags_uselargefiles'
21795 ccname='$ccname'
21796 ccsymbols='$ccsymbols'
21797 ccversion='$ccversion'
21798 cf_by='$cf_by'
21799 cf_email='$cf_email'
21800 cf_time='$cf_time'
21801 chgrp='$chgrp'
21802 chmod='$chmod'
21803 chown='$chown'
21804 clocktype='$clocktype'
21805 comm='$comm'
21806 compress='$compress'
21807 contains='$contains'
21808 cp='$cp'
21809 cpio='$cpio'
21810 cpp='$cpp'
21811 cpp_stuff='$cpp_stuff'
21812 cppccsymbols='$cppccsymbols'
21813 cppflags='$cppflags'
21814 cpplast='$cpplast'
21815 cppminus='$cppminus'
21816 cpprun='$cpprun'
21817 cppstdin='$cppstdin'
21818 cppsymbols='$cppsymbols'
21819 crypt_r_proto='$crypt_r_proto'
21820 cryptlib='$cryptlib'
21821 csh='$csh'
21822 ctermid_r_proto='$ctermid_r_proto'
21823 ctime_r_proto='$ctime_r_proto'
21824 d_Gconvert='$d_Gconvert'
21825 d_PRIEUldbl='$d_PRIEUldbl'
21826 d_PRIFUldbl='$d_PRIFUldbl'
21827 d_PRIGUldbl='$d_PRIGUldbl'
21828 d_PRIXU64='$d_PRIXU64'
21829 d_PRId64='$d_PRId64'
21830 d_PRIeldbl='$d_PRIeldbl'
21831 d_PRIfldbl='$d_PRIfldbl'
21832 d_PRIgldbl='$d_PRIgldbl'
21833 d_PRIi64='$d_PRIi64'
21834 d_PRIo64='$d_PRIo64'
21835 d_PRIu64='$d_PRIu64'
21836 d_PRIx64='$d_PRIx64'
21837 d_SCNfldbl='$d_SCNfldbl'
21838 d__fwalk='$d__fwalk'
21839 d_access='$d_access'
21840 d_accessx='$d_accessx'
21841 d_aintl='$d_aintl'
21842 d_alarm='$d_alarm'
21843 d_archlib='$d_archlib'
21844 d_asctime_r='$d_asctime_r'
21845 d_atolf='$d_atolf'
21846 d_atoll='$d_atoll'
21847 d_attribute_format='$d_attribute_format'
21848 d_attribute_malloc='$d_attribute_malloc'
21849 d_attribute_nonnull='$d_attribute_nonnull'
21850 d_attribute_noreturn='$d_attribute_noreturn'
21851 d_attribute_pure='$d_attribute_pure'
21852 d_attribute_unused='$d_attribute_unused'
21853 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21854 d_bcmp='$d_bcmp'
21855 d_bcopy='$d_bcopy'
21856 d_bsd='$d_bsd'
21857 d_bsdgetpgrp='$d_bsdgetpgrp'
21858 d_bsdsetpgrp='$d_bsdsetpgrp'
21859 d_builtin_choose_expr='$d_builtin_choose_expr'
21860 d_builtin_expect='$d_builtin_expect'
21861 d_bzero='$d_bzero'
21862 d_c99_variadic_macros='$d_c99_variadic_macros'
21863 d_casti32='$d_casti32'
21864 d_castneg='$d_castneg'
21865 d_charvspr='$d_charvspr'
21866 d_chown='$d_chown'
21867 d_chroot='$d_chroot'
21868 d_chsize='$d_chsize'
21869 d_class='$d_class'
21870 d_clearenv='$d_clearenv'
21871 d_closedir='$d_closedir'
21872 d_cmsghdr_s='$d_cmsghdr_s'
21873 d_const='$d_const'
21874 d_copysignl='$d_copysignl'
21875 d_cplusplus='$d_cplusplus'
21876 d_crypt='$d_crypt'
21877 d_crypt_r='$d_crypt_r'
21878 d_csh='$d_csh'
21879 d_ctermid='$d_ctermid'
21880 d_ctermid_r='$d_ctermid_r'
21881 d_ctime_r='$d_ctime_r'
21882 d_cuserid='$d_cuserid'
21883 d_dbl_dig='$d_dbl_dig'
21884 d_dbminitproto='$d_dbminitproto'
21885 d_difftime='$d_difftime'
21886 d_dir_dd_fd='$d_dir_dd_fd'
21887 d_dirfd='$d_dirfd'
21888 d_dirnamlen='$d_dirnamlen'
21889 d_dlerror='$d_dlerror'
21890 d_dlopen='$d_dlopen'
21891 d_dlsymun='$d_dlsymun'
21892 d_dosuid='$d_dosuid'
21893 d_drand48_r='$d_drand48_r'
21894 d_drand48proto='$d_drand48proto'
21895 d_dup2='$d_dup2'
21896 d_eaccess='$d_eaccess'
21897 d_endgrent='$d_endgrent'
21898 d_endgrent_r='$d_endgrent_r'
21899 d_endhent='$d_endhent'
21900 d_endhostent_r='$d_endhostent_r'
21901 d_endnent='$d_endnent'
21902 d_endnetent_r='$d_endnetent_r'
21903 d_endpent='$d_endpent'
21904 d_endprotoent_r='$d_endprotoent_r'
21905 d_endpwent='$d_endpwent'
21906 d_endpwent_r='$d_endpwent_r'
21907 d_endsent='$d_endsent'
21908 d_endservent_r='$d_endservent_r'
21909 d_eofnblk='$d_eofnblk'
21910 d_eunice='$d_eunice'
21911 d_faststdio='$d_faststdio'
21912 d_fchdir='$d_fchdir'
21913 d_fchmod='$d_fchmod'
21914 d_fchown='$d_fchown'
21915 d_fcntl='$d_fcntl'
21916 d_fcntl_can_lock='$d_fcntl_can_lock'
21917 d_fd_macros='$d_fd_macros'
21918 d_fd_set='$d_fd_set'
21919 d_fds_bits='$d_fds_bits'
21920 d_fgetpos='$d_fgetpos'
21921 d_finite='$d_finite'
21922 d_finitel='$d_finitel'
21923 d_flexfnam='$d_flexfnam'
21924 d_flock='$d_flock'
21925 d_flockproto='$d_flockproto'
21926 d_fork='$d_fork'
21927 d_fp_class='$d_fp_class'
21928 d_fpathconf='$d_fpathconf'
21929 d_fpclass='$d_fpclass'
21930 d_fpclassify='$d_fpclassify'
21931 d_fpclassl='$d_fpclassl'
21932 d_fpos64_t='$d_fpos64_t'
21933 d_frexpl='$d_frexpl'
21934 d_fs_data_s='$d_fs_data_s'
21935 d_fseeko='$d_fseeko'
21936 d_fsetpos='$d_fsetpos'
21937 d_fstatfs='$d_fstatfs'
21938 d_fstatvfs='$d_fstatvfs'
21939 d_fsync='$d_fsync'
21940 d_ftello='$d_ftello'
21941 d_ftime='$d_ftime'
21942 d_futimes='$d_futimes'
21943 d_getcwd='$d_getcwd'
21944 d_getespwnam='$d_getespwnam'
21945 d_getfsstat='$d_getfsstat'
21946 d_getgrent='$d_getgrent'
21947 d_getgrent_r='$d_getgrent_r'
21948 d_getgrgid_r='$d_getgrgid_r'
21949 d_getgrnam_r='$d_getgrnam_r'
21950 d_getgrps='$d_getgrps'
21951 d_gethbyaddr='$d_gethbyaddr'
21952 d_gethbyname='$d_gethbyname'
21953 d_gethent='$d_gethent'
21954 d_gethname='$d_gethname'
21955 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21956 d_gethostbyname_r='$d_gethostbyname_r'
21957 d_gethostent_r='$d_gethostent_r'
21958 d_gethostprotos='$d_gethostprotos'
21959 d_getitimer='$d_getitimer'
21960 d_getlogin='$d_getlogin'
21961 d_getlogin_r='$d_getlogin_r'
21962 d_getmnt='$d_getmnt'
21963 d_getmntent='$d_getmntent'
21964 d_getnbyaddr='$d_getnbyaddr'
21965 d_getnbyname='$d_getnbyname'
21966 d_getnent='$d_getnent'
21967 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21968 d_getnetbyname_r='$d_getnetbyname_r'
21969 d_getnetent_r='$d_getnetent_r'
21970 d_getnetprotos='$d_getnetprotos'
21971 d_getpagsz='$d_getpagsz'
21972 d_getpbyname='$d_getpbyname'
21973 d_getpbynumber='$d_getpbynumber'
21974 d_getpent='$d_getpent'
21975 d_getpgid='$d_getpgid'
21976 d_getpgrp2='$d_getpgrp2'
21977 d_getpgrp='$d_getpgrp'
21978 d_getppid='$d_getppid'
21979 d_getprior='$d_getprior'
21980 d_getprotobyname_r='$d_getprotobyname_r'
21981 d_getprotobynumber_r='$d_getprotobynumber_r'
21982 d_getprotoent_r='$d_getprotoent_r'
21983 d_getprotoprotos='$d_getprotoprotos'
21984 d_getprpwnam='$d_getprpwnam'
21985 d_getpwent='$d_getpwent'
21986 d_getpwent_r='$d_getpwent_r'
21987 d_getpwnam_r='$d_getpwnam_r'
21988 d_getpwuid_r='$d_getpwuid_r'
21989 d_getsbyname='$d_getsbyname'
21990 d_getsbyport='$d_getsbyport'
21991 d_getsent='$d_getsent'
21992 d_getservbyname_r='$d_getservbyname_r'
21993 d_getservbyport_r='$d_getservbyport_r'
21994 d_getservent_r='$d_getservent_r'
21995 d_getservprotos='$d_getservprotos'
21996 d_getspnam='$d_getspnam'
21997 d_getspnam_r='$d_getspnam_r'
21998 d_gettimeod='$d_gettimeod'
21999 d_gmtime_r='$d_gmtime_r'
22000 d_gnulibc='$d_gnulibc'
22001 d_grpasswd='$d_grpasswd'
22002 d_hasmntopt='$d_hasmntopt'
22003 d_htonl='$d_htonl'
22004 d_ilogbl='$d_ilogbl'
22005 d_inc_version_list='$d_inc_version_list'
22006 d_index='$d_index'
22007 d_inetaton='$d_inetaton'
22008 d_int64_t='$d_int64_t'
22009 d_isascii='$d_isascii'
22010 d_isfinite='$d_isfinite'
22011 d_isinf='$d_isinf'
22012 d_isnan='$d_isnan'
22013 d_isnanl='$d_isnanl'
22014 d_killpg='$d_killpg'
22015 d_lchown='$d_lchown'
22016 d_ldbl_dig='$d_ldbl_dig'
22017 d_libm_lib_version='$d_libm_lib_version'
22018 d_link='$d_link'
22019 d_localtime_r='$d_localtime_r'
22020 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22021 d_locconv='$d_locconv'
22022 d_lockf='$d_lockf'
22023 d_longdbl='$d_longdbl'
22024 d_longlong='$d_longlong'
22025 d_lseekproto='$d_lseekproto'
22026 d_lstat='$d_lstat'
22027 d_madvise='$d_madvise'
22028 d_malloc_good_size='$d_malloc_good_size'
22029 d_malloc_size='$d_malloc_size'
22030 d_mblen='$d_mblen'
22031 d_mbstowcs='$d_mbstowcs'
22032 d_mbtowc='$d_mbtowc'
22033 d_memchr='$d_memchr'
22034 d_memcmp='$d_memcmp'
22035 d_memcpy='$d_memcpy'
22036 d_memmove='$d_memmove'
22037 d_memset='$d_memset'
22038 d_mkdir='$d_mkdir'
22039 d_mkdtemp='$d_mkdtemp'
22040 d_mkfifo='$d_mkfifo'
22041 d_mkstemp='$d_mkstemp'
22042 d_mkstemps='$d_mkstemps'
22043 d_mktime='$d_mktime'
22044 d_mmap='$d_mmap'
22045 d_modfl='$d_modfl'
22046 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22047 d_modflproto='$d_modflproto'
22048 d_mprotect='$d_mprotect'
22049 d_msg='$d_msg'
22050 d_msg_ctrunc='$d_msg_ctrunc'
22051 d_msg_dontroute='$d_msg_dontroute'
22052 d_msg_oob='$d_msg_oob'
22053 d_msg_peek='$d_msg_peek'
22054 d_msg_proxy='$d_msg_proxy'
22055 d_msgctl='$d_msgctl'
22056 d_msgget='$d_msgget'
22057 d_msghdr_s='$d_msghdr_s'
22058 d_msgrcv='$d_msgrcv'
22059 d_msgsnd='$d_msgsnd'
22060 d_msync='$d_msync'
22061 d_munmap='$d_munmap'
22062 d_mymalloc='$d_mymalloc'
22063 d_nice='$d_nice'
22064 d_nl_langinfo='$d_nl_langinfo'
22065 d_nv_preserves_uv='$d_nv_preserves_uv'
22066 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22067 d_off64_t='$d_off64_t'
22068 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22069 d_oldpthreads='$d_oldpthreads'
22070 d_oldsock='$d_oldsock'
22071 d_open3='$d_open3'
22072 d_pathconf='$d_pathconf'
22073 d_pause='$d_pause'
22074 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22075 d_phostname='$d_phostname'
22076 d_pipe='$d_pipe'
22077 d_poll='$d_poll'
22078 d_portable='$d_portable'
22079 d_printf_format_null='$d_printf_format_null'
22080 d_procselfexe='$d_procselfexe'
22081 d_pseudofork='$d_pseudofork'
22082 d_pthread_atfork='$d_pthread_atfork'
22083 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22084 d_pthread_yield='$d_pthread_yield'
22085 d_pwage='$d_pwage'
22086 d_pwchange='$d_pwchange'
22087 d_pwclass='$d_pwclass'
22088 d_pwcomment='$d_pwcomment'
22089 d_pwexpire='$d_pwexpire'
22090 d_pwgecos='$d_pwgecos'
22091 d_pwpasswd='$d_pwpasswd'
22092 d_pwquota='$d_pwquota'
22093 d_qgcvt='$d_qgcvt'
22094 d_quad='$d_quad'
22095 d_random_r='$d_random_r'
22096 d_readdir64_r='$d_readdir64_r'
22097 d_readdir='$d_readdir'
22098 d_readdir_r='$d_readdir_r'
22099 d_readlink='$d_readlink'
22100 d_readv='$d_readv'
22101 d_recvmsg='$d_recvmsg'
22102 d_rename='$d_rename'
22103 d_rewinddir='$d_rewinddir'
22104 d_rmdir='$d_rmdir'
22105 d_safebcpy='$d_safebcpy'
22106 d_safemcpy='$d_safemcpy'
22107 d_sanemcmp='$d_sanemcmp'
22108 d_sbrkproto='$d_sbrkproto'
22109 d_scalbnl='$d_scalbnl'
22110 d_sched_yield='$d_sched_yield'
22111 d_scm_rights='$d_scm_rights'
22112 d_seekdir='$d_seekdir'
22113 d_select='$d_select'
22114 d_sem='$d_sem'
22115 d_semctl='$d_semctl'
22116 d_semctl_semid_ds='$d_semctl_semid_ds'
22117 d_semctl_semun='$d_semctl_semun'
22118 d_semget='$d_semget'
22119 d_semop='$d_semop'
22120 d_sendmsg='$d_sendmsg'
22121 d_setegid='$d_setegid'
22122 d_seteuid='$d_seteuid'
22123 d_setgrent='$d_setgrent'
22124 d_setgrent_r='$d_setgrent_r'
22125 d_setgrps='$d_setgrps'
22126 d_sethent='$d_sethent'
22127 d_sethostent_r='$d_sethostent_r'
22128 d_setitimer='$d_setitimer'
22129 d_setlinebuf='$d_setlinebuf'
22130 d_setlocale='$d_setlocale'
22131 d_setlocale_r='$d_setlocale_r'
22132 d_setnent='$d_setnent'
22133 d_setnetent_r='$d_setnetent_r'
22134 d_setpent='$d_setpent'
22135 d_setpgid='$d_setpgid'
22136 d_setpgrp2='$d_setpgrp2'
22137 d_setpgrp='$d_setpgrp'
22138 d_setprior='$d_setprior'
22139 d_setproctitle='$d_setproctitle'
22140 d_setprotoent_r='$d_setprotoent_r'
22141 d_setpwent='$d_setpwent'
22142 d_setpwent_r='$d_setpwent_r'
22143 d_setregid='$d_setregid'
22144 d_setresgid='$d_setresgid'
22145 d_setresuid='$d_setresuid'
22146 d_setreuid='$d_setreuid'
22147 d_setrgid='$d_setrgid'
22148 d_setruid='$d_setruid'
22149 d_setsent='$d_setsent'
22150 d_setservent_r='$d_setservent_r'
22151 d_setsid='$d_setsid'
22152 d_setvbuf='$d_setvbuf'
22153 d_sfio='$d_sfio'
22154 d_shm='$d_shm'
22155 d_shmat='$d_shmat'
22156 d_shmatprototype='$d_shmatprototype'
22157 d_shmctl='$d_shmctl'
22158 d_shmdt='$d_shmdt'
22159 d_shmget='$d_shmget'
22160 d_sigaction='$d_sigaction'
22161 d_signbit='$d_signbit'
22162 d_sigprocmask='$d_sigprocmask'
22163 d_sigsetjmp='$d_sigsetjmp'
22164 d_sitearch='$d_sitearch'
22165 d_snprintf='$d_snprintf'
22166 d_sockatmark='$d_sockatmark'
22167 d_sockatmarkproto='$d_sockatmarkproto'
22168 d_socket='$d_socket'
22169 d_socklen_t='$d_socklen_t'
22170 d_sockpair='$d_sockpair'
22171 d_socks5_init='$d_socks5_init'
22172 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22173 d_sqrtl='$d_sqrtl'
22174 d_srand48_r='$d_srand48_r'
22175 d_srandom_r='$d_srandom_r'
22176 d_sresgproto='$d_sresgproto'
22177 d_sresuproto='$d_sresuproto'
22178 d_statblks='$d_statblks'
22179 d_statfs_f_flags='$d_statfs_f_flags'
22180 d_statfs_s='$d_statfs_s'
22181 d_statvfs='$d_statvfs'
22182 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22183 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22184 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22185 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22186 d_stdio_stream_array='$d_stdio_stream_array'
22187 d_stdiobase='$d_stdiobase'
22188 d_stdstdio='$d_stdstdio'
22189 d_strchr='$d_strchr'
22190 d_strcoll='$d_strcoll'
22191 d_strctcpy='$d_strctcpy'
22192 d_strerrm='$d_strerrm'
22193 d_strerror='$d_strerror'
22194 d_strerror_r='$d_strerror_r'
22195 d_strftime='$d_strftime'
22196 d_strlcat='$d_strlcat'
22197 d_strlcpy='$d_strlcpy'
22198 d_strtod='$d_strtod'
22199 d_strtol='$d_strtol'
22200 d_strtold='$d_strtold'
22201 d_strtoll='$d_strtoll'
22202 d_strtoq='$d_strtoq'
22203 d_strtoul='$d_strtoul'
22204 d_strtoull='$d_strtoull'
22205 d_strtouq='$d_strtouq'
22206 d_strxfrm='$d_strxfrm'
22207 d_suidsafe='$d_suidsafe'
22208 d_symlink='$d_symlink'
22209 d_syscall='$d_syscall'
22210 d_syscallproto='$d_syscallproto'
22211 d_sysconf='$d_sysconf'
22212 d_sysernlst='$d_sysernlst'
22213 d_syserrlst='$d_syserrlst'
22214 d_system='$d_system'
22215 d_tcgetpgrp='$d_tcgetpgrp'
22216 d_tcsetpgrp='$d_tcsetpgrp'
22217 d_telldir='$d_telldir'
22218 d_telldirproto='$d_telldirproto'
22219 d_time='$d_time'
22220 d_times='$d_times'
22221 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22222 d_tm_tm_zone='$d_tm_tm_zone'
22223 d_tmpnam_r='$d_tmpnam_r'
22224 d_truncate='$d_truncate'
22225 d_ttyname_r='$d_ttyname_r'
22226 d_tzname='$d_tzname'
22227 d_u32align='$d_u32align'
22228 d_ualarm='$d_ualarm'
22229 d_umask='$d_umask'
22230 d_uname='$d_uname'
22231 d_union_semun='$d_union_semun'
22232 d_unordered='$d_unordered'
22233 d_unsetenv='$d_unsetenv'
22234 d_usleep='$d_usleep'
22235 d_usleepproto='$d_usleepproto'
22236 d_ustat='$d_ustat'
22237 d_vendorarch='$d_vendorarch'
22238 d_vendorbin='$d_vendorbin'
22239 d_vendorlib='$d_vendorlib'
22240 d_vendorscript='$d_vendorscript'
22241 d_vfork='$d_vfork'
22242 d_void_closedir='$d_void_closedir'
22243 d_voidsig='$d_voidsig'
22244 d_voidtty='$d_voidtty'
22245 d_volatile='$d_volatile'
22246 d_vprintf='$d_vprintf'
22247 d_vsnprintf='$d_vsnprintf'
22248 d_wait4='$d_wait4'
22249 d_waitpid='$d_waitpid'
22250 d_wcstombs='$d_wcstombs'
22251 d_wctomb='$d_wctomb'
22252 d_writev='$d_writev'
22253 d_xenix='$d_xenix'
22254 date='$date'
22255 db_hashtype='$db_hashtype'
22256 db_prefixtype='$db_prefixtype'
22257 db_version_major='$db_version_major'
22258 db_version_minor='$db_version_minor'
22259 db_version_patch='$db_version_patch'
22260 defvoidused='$defvoidused'
22261 direntrytype='$direntrytype'
22262 dlext='$dlext'
22263 dlsrc='$dlsrc'
22264 doublesize='$doublesize'
22265 drand01='$drand01'
22266 drand48_r_proto='$drand48_r_proto'
22267 dtrace='$dtrace'
22268 dynamic_ext='$dynamic_ext'
22269 eagain='$eagain'
22270 ebcdic='$ebcdic'
22271 echo='$echo'
22272 egrep='$egrep'
22273 emacs='$emacs'
22274 endgrent_r_proto='$endgrent_r_proto'
22275 endhostent_r_proto='$endhostent_r_proto'
22276 endnetent_r_proto='$endnetent_r_proto'
22277 endprotoent_r_proto='$endprotoent_r_proto'
22278 endpwent_r_proto='$endpwent_r_proto'
22279 endservent_r_proto='$endservent_r_proto'
22280 eunicefix='$eunicefix'
22281 exe_ext='$exe_ext'
22282 expr='$expr'
22283 extensions='$extensions'
22284 extras='$extras'
22285 fflushNULL='$fflushNULL'
22286 fflushall='$fflushall'
22287 find='$find'
22288 firstmakefile='$firstmakefile'
22289 flex='$flex'
22290 fpossize='$fpossize'
22291 fpostype='$fpostype'
22292 freetype='$freetype'
22293 from='$from'
22294 full_ar='$full_ar'
22295 full_csh='$full_csh'
22296 full_sed='$full_sed'
22297 gccansipedantic='$gccansipedantic'
22298 gccosandvers='$gccosandvers'
22299 gccversion='$gccversion'
22300 getgrent_r_proto='$getgrent_r_proto'
22301 getgrgid_r_proto='$getgrgid_r_proto'
22302 getgrnam_r_proto='$getgrnam_r_proto'
22303 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22304 gethostbyname_r_proto='$gethostbyname_r_proto'
22305 gethostent_r_proto='$gethostent_r_proto'
22306 getlogin_r_proto='$getlogin_r_proto'
22307 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22308 getnetbyname_r_proto='$getnetbyname_r_proto'
22309 getnetent_r_proto='$getnetent_r_proto'
22310 getprotobyname_r_proto='$getprotobyname_r_proto'
22311 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22312 getprotoent_r_proto='$getprotoent_r_proto'
22313 getpwent_r_proto='$getpwent_r_proto'
22314 getpwnam_r_proto='$getpwnam_r_proto'
22315 getpwuid_r_proto='$getpwuid_r_proto'
22316 getservbyname_r_proto='$getservbyname_r_proto'
22317 getservbyport_r_proto='$getservbyport_r_proto'
22318 getservent_r_proto='$getservent_r_proto'
22319 getspnam_r_proto='$getspnam_r_proto'
22320 gidformat='$gidformat'
22321 gidsign='$gidsign'
22322 gidsize='$gidsize'
22323 gidtype='$gidtype'
22324 glibpth='$glibpth'
22325 gmake='$gmake'
22326 gmtime_r_proto='$gmtime_r_proto'
22327 gnulibc_version='$gnulibc_version'
22328 grep='$grep'
22329 groupcat='$groupcat'
22330 groupstype='$groupstype'
22331 gzip='$gzip'
22332 h_fcntl='$h_fcntl'
22333 h_sysfile='$h_sysfile'
22334 hint='$hint'
22335 hostcat='$hostcat'
22336 html1dir='$html1dir'
22337 html1direxp='$html1direxp'
22338 html3dir='$html3dir'
22339 html3direxp='$html3direxp'
22340 i16size='$i16size'
22341 i16type='$i16type'
22342 i32size='$i32size'
22343 i32type='$i32type'
22344 i64size='$i64size'
22345 i64type='$i64type'
22346 i8size='$i8size'
22347 i8type='$i8type'
22348 i_arpainet='$i_arpainet'
22349 i_assert='$i_assert'
22350 i_bsdioctl='$i_bsdioctl'
22351 i_crypt='$i_crypt'
22352 i_db='$i_db'
22353 i_dbm='$i_dbm'
22354 i_dirent='$i_dirent'
22355 i_dld='$i_dld'
22356 i_dlfcn='$i_dlfcn'
22357 i_fcntl='$i_fcntl'
22358 i_float='$i_float'
22359 i_fp='$i_fp'
22360 i_fp_class='$i_fp_class'
22361 i_gdbm='$i_gdbm'
22362 i_grp='$i_grp'
22363 i_ieeefp='$i_ieeefp'
22364 i_inttypes='$i_inttypes'
22365 i_langinfo='$i_langinfo'
22366 i_libutil='$i_libutil'
22367 i_limits='$i_limits'
22368 i_locale='$i_locale'
22369 i_machcthr='$i_machcthr'
22370 i_malloc='$i_malloc'
22371 i_mallocmalloc='$i_mallocmalloc'
22372 i_math='$i_math'
22373 i_memory='$i_memory'
22374 i_mntent='$i_mntent'
22375 i_ndbm='$i_ndbm'
22376 i_netdb='$i_netdb'
22377 i_neterrno='$i_neterrno'
22378 i_netinettcp='$i_netinettcp'
22379 i_niin='$i_niin'
22380 i_poll='$i_poll'
22381 i_prot='$i_prot'
22382 i_pthread='$i_pthread'
22383 i_pwd='$i_pwd'
22384 i_rpcsvcdbm='$i_rpcsvcdbm'
22385 i_sfio='$i_sfio'
22386 i_sgtty='$i_sgtty'
22387 i_shadow='$i_shadow'
22388 i_socks='$i_socks'
22389 i_stdarg='$i_stdarg'
22390 i_stddef='$i_stddef'
22391 i_stdlib='$i_stdlib'
22392 i_string='$i_string'
22393 i_sunmath='$i_sunmath'
22394 i_sysaccess='$i_sysaccess'
22395 i_sysdir='$i_sysdir'
22396 i_sysfile='$i_sysfile'
22397 i_sysfilio='$i_sysfilio'
22398 i_sysin='$i_sysin'
22399 i_sysioctl='$i_sysioctl'
22400 i_syslog='$i_syslog'
22401 i_sysmman='$i_sysmman'
22402 i_sysmode='$i_sysmode'
22403 i_sysmount='$i_sysmount'
22404 i_sysndir='$i_sysndir'
22405 i_sysparam='$i_sysparam'
22406 i_syspoll='$i_syspoll'
22407 i_sysresrc='$i_sysresrc'
22408 i_syssecrt='$i_syssecrt'
22409 i_sysselct='$i_sysselct'
22410 i_syssockio='$i_syssockio'
22411 i_sysstat='$i_sysstat'
22412 i_sysstatfs='$i_sysstatfs'
22413 i_sysstatvfs='$i_sysstatvfs'
22414 i_systime='$i_systime'
22415 i_systimek='$i_systimek'
22416 i_systimes='$i_systimes'
22417 i_systypes='$i_systypes'
22418 i_sysuio='$i_sysuio'
22419 i_sysun='$i_sysun'
22420 i_sysutsname='$i_sysutsname'
22421 i_sysvfs='$i_sysvfs'
22422 i_syswait='$i_syswait'
22423 i_termio='$i_termio'
22424 i_termios='$i_termios'
22425 i_time='$i_time'
22426 i_unistd='$i_unistd'
22427 i_ustat='$i_ustat'
22428 i_utime='$i_utime'
22429 i_values='$i_values'
22430 i_varargs='$i_varargs'
22431 i_varhdr='$i_varhdr'
22432 i_vfork='$i_vfork'
22433 ignore_versioned_solibs='$ignore_versioned_solibs'
22434 inc_version_list='$inc_version_list'
22435 inc_version_list_init='$inc_version_list_init'
22436 incpath='$incpath'
22437 inews='$inews'
22438 initialinstalllocation='$initialinstalllocation'
22439 installarchlib='$installarchlib'
22440 installbin='$installbin'
22441 installhtml1dir='$installhtml1dir'
22442 installhtml3dir='$installhtml3dir'
22443 installman1dir='$installman1dir'
22444 installman3dir='$installman3dir'
22445 installprefix='$installprefix'
22446 installprefixexp='$installprefixexp'
22447 installprivlib='$installprivlib'
22448 installscript='$installscript'
22449 installsitearch='$installsitearch'
22450 installsitebin='$installsitebin'
22451 installsitehtml1dir='$installsitehtml1dir'
22452 installsitehtml3dir='$installsitehtml3dir'
22453 installsitelib='$installsitelib'
22454 installsiteman1dir='$installsiteman1dir'
22455 installsiteman3dir='$installsiteman3dir'
22456 installsitescript='$installsitescript'
22457 installstyle='$installstyle'
22458 installusrbinperl='$installusrbinperl'
22459 installvendorarch='$installvendorarch'
22460 installvendorbin='$installvendorbin'
22461 installvendorhtml1dir='$installvendorhtml1dir'
22462 installvendorhtml3dir='$installvendorhtml3dir'
22463 installvendorlib='$installvendorlib'
22464 installvendorman1dir='$installvendorman1dir'
22465 installvendorman3dir='$installvendorman3dir'
22466 installvendorscript='$installvendorscript'
22467 intsize='$intsize'
22468 issymlink='$issymlink'
22469 ivdformat='$ivdformat'
22470 ivsize='$ivsize'
22471 ivtype='$ivtype'
22472 known_extensions='$known_extensions'
22473 ksh='$ksh'
22474 ld='$ld'
22475 lddlflags='$lddlflags'
22476 ldflags='$ldflags'
22477 ldflags_uselargefiles='$ldflags_uselargefiles'
22478 ldlibpthname='$ldlibpthname'
22479 less='$less'
22480 lib_ext='$lib_ext'
22481 libc='$libc'
22482 libperl='$libperl'
22483 libpth='$libpth'
22484 libs='$libs'
22485 libsdirs='$libsdirs'
22486 libsfiles='$libsfiles'
22487 libsfound='$libsfound'
22488 libspath='$libspath'
22489 libswanted='$libswanted'
22490 libswanted_uselargefiles='$libswanted_uselargefiles'
22491 line='$line'
22492 lint='$lint'
22493 lkflags='$lkflags'
22494 ln='$ln'
22495 lns='$lns'
22496 localtime_r_proto='$localtime_r_proto'
22497 locincpth='$locincpth'
22498 loclibpth='$loclibpth'
22499 longdblsize='$longdblsize'
22500 longlongsize='$longlongsize'
22501 longsize='$longsize'
22502 lp='$lp'
22503 lpr='$lpr'
22504 ls='$ls'
22505 lseeksize='$lseeksize'
22506 lseektype='$lseektype'
22507 mad='$mad'
22508 madlyh='$madlyh'
22509 madlyobj='$madlyobj'
22510 madlysrc='$madlysrc'
22511 mail='$mail'
22512 mailx='$mailx'
22513 make='$make'
22514 make_set_make='$make_set_make'
22515 mallocobj='$mallocobj'
22516 mallocsrc='$mallocsrc'
22517 malloctype='$malloctype'
22518 man1dir='$man1dir'
22519 man1direxp='$man1direxp'
22520 man1ext='$man1ext'
22521 man3dir='$man3dir'
22522 man3direxp='$man3direxp'
22523 man3ext='$man3ext'
22524 mips_type='$mips_type'
22525 mistrustnm='$mistrustnm'
22526 mkdir='$mkdir'
22527 mmaptype='$mmaptype'
22528 modetype='$modetype'
22529 more='$more'
22530 multiarch='$multiarch'
22531 mv='$mv'
22532 myarchname='$myarchname'
22533 mydomain='$mydomain'
22534 myhostname='$myhostname'
22535 myuname='$myuname'
22536 n='$n'
22537 need_va_copy='$need_va_copy'
22538 netdb_hlen_type='$netdb_hlen_type'
22539 netdb_host_type='$netdb_host_type'
22540 netdb_name_type='$netdb_name_type'
22541 netdb_net_type='$netdb_net_type'
22542 nm='$nm'
22543 nm_opt='$nm_opt'
22544 nm_so_opt='$nm_so_opt'
22545 nonxs_ext='$nonxs_ext'
22546 nroff='$nroff'
22547 nvEUformat='$nvEUformat'
22548 nvFUformat='$nvFUformat'
22549 nvGUformat='$nvGUformat'
22550 nv_overflows_integers_at='$nv_overflows_integers_at'
22551 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22552 nveformat='$nveformat'
22553 nvfformat='$nvfformat'
22554 nvgformat='$nvgformat'
22555 nvsize='$nvsize'
22556 nvtype='$nvtype'
22557 o_nonblock='$o_nonblock'
22558 obj_ext='$obj_ext'
22559 old_pthread_create_joinable='$old_pthread_create_joinable'
22560 optimize='$optimize'
22561 orderlib='$orderlib'
22562 osname='$osname'
22563 osvers='$osvers'
22564 otherlibdirs='$otherlibdirs'
22565 package='$package'
22566 pager='$pager'
22567 passcat='$passcat'
22568 patchlevel='$patchlevel'
22569 path_sep='$path_sep'
22570 perl5='$perl5'
22571 perl='$perl'
22572 perl_patchlevel='$perl_patchlevel'
22573 perladmin='$perladmin'
22574 perllibs='$perllibs'
22575 perlpath='$perlpath'
22576 pg='$pg'
22577 phostname='$phostname'
22578 pidtype='$pidtype'
22579 plibpth='$plibpth'
22580 pmake='$pmake'
22581 pr='$pr'
22582 prefix='$prefix'
22583 prefixexp='$prefixexp'
22584 privlib='$privlib'
22585 privlibexp='$privlibexp'
22586 procselfexe='$procselfexe'
22587 prototype='$prototype'
22588 ptrsize='$ptrsize'
22589 quadkind='$quadkind'
22590 quadtype='$quadtype'
22591 randbits='$randbits'
22592 randfunc='$randfunc'
22593 random_r_proto='$random_r_proto'
22594 randseedtype='$randseedtype'
22595 ranlib='$ranlib'
22596 rd_nodata='$rd_nodata'
22597 readdir64_r_proto='$readdir64_r_proto'
22598 readdir_r_proto='$readdir_r_proto'
22599 revision='$revision'
22600 rm='$rm'
22601 rm_try='$rm_try'
22602 rmail='$rmail'
22603 run='$run'
22604 runnm='$runnm'
22605 sPRIEUldbl='$sPRIEUldbl'
22606 sPRIFUldbl='$sPRIFUldbl'
22607 sPRIGUldbl='$sPRIGUldbl'
22608 sPRIXU64='$sPRIXU64'
22609 sPRId64='$sPRId64'
22610 sPRIeldbl='$sPRIeldbl'
22611 sPRIfldbl='$sPRIfldbl'
22612 sPRIgldbl='$sPRIgldbl'
22613 sPRIi64='$sPRIi64'
22614 sPRIo64='$sPRIo64'
22615 sPRIu64='$sPRIu64'
22616 sPRIx64='$sPRIx64'
22617 sSCNfldbl='$sSCNfldbl'
22618 sched_yield='$sched_yield'
22619 scriptdir='$scriptdir'
22620 scriptdirexp='$scriptdirexp'
22621 sed='$sed'
22622 seedfunc='$seedfunc'
22623 selectminbits='$selectminbits'
22624 selecttype='$selecttype'
22625 sendmail='$sendmail'
22626 setgrent_r_proto='$setgrent_r_proto'
22627 sethostent_r_proto='$sethostent_r_proto'
22628 setlocale_r_proto='$setlocale_r_proto'
22629 setnetent_r_proto='$setnetent_r_proto'
22630 setprotoent_r_proto='$setprotoent_r_proto'
22631 setpwent_r_proto='$setpwent_r_proto'
22632 setservent_r_proto='$setservent_r_proto'
22633 sh='$sh'
22634 shar='$shar'
22635 sharpbang='$sharpbang'
22636 shmattype='$shmattype'
22637 shortsize='$shortsize'
22638 shrpenv='$shrpenv'
22639 shsharp='$shsharp'
22640 sig_count='$sig_count'
22641 sig_name='$sig_name'
22642 sig_name_init='$sig_name_init'
22643 sig_num='$sig_num'
22644 sig_num_init='$sig_num_init'
22645 sig_size='$sig_size'
22646 signal_t='$signal_t'
22647 sitearch='$sitearch'
22648 sitearchexp='$sitearchexp'
22649 sitebin='$sitebin'
22650 sitebinexp='$sitebinexp'
22651 sitehtml1dir='$sitehtml1dir'
22652 sitehtml1direxp='$sitehtml1direxp'
22653 sitehtml3dir='$sitehtml3dir'
22654 sitehtml3direxp='$sitehtml3direxp'
22655 sitelib='$sitelib'
22656 sitelib_stem='$sitelib_stem'
22657 sitelibexp='$sitelibexp'
22658 siteman1dir='$siteman1dir'
22659 siteman1direxp='$siteman1direxp'
22660 siteman3dir='$siteman3dir'
22661 siteman3direxp='$siteman3direxp'
22662 siteprefix='$siteprefix'
22663 siteprefixexp='$siteprefixexp'
22664 sitescript='$sitescript'
22665 sitescriptexp='$sitescriptexp'
22666 sizesize='$sizesize'
22667 sizetype='$sizetype'
22668 sleep='$sleep'
22669 smail='$smail'
22670 so='$so'
22671 sockethdr='$sockethdr'
22672 socketlib='$socketlib'
22673 socksizetype='$socksizetype'
22674 sort='$sort'
22675 spackage='$spackage'
22676 spitshell='$spitshell'
22677 srand48_r_proto='$srand48_r_proto'
22678 srandom_r_proto='$srandom_r_proto'
22679 src='$src'
22680 ssizetype='$ssizetype'
22681 startperl='$startperl'
22682 startsh='$startsh'
22683 static_ext='$static_ext'
22684 stdchar='$stdchar'
22685 stdio_base='$stdio_base'
22686 stdio_bufsiz='$stdio_bufsiz'
22687 stdio_cnt='$stdio_cnt'
22688 stdio_filbuf='$stdio_filbuf'
22689 stdio_ptr='$stdio_ptr'
22690 stdio_stream_array='$stdio_stream_array'
22691 strerror_r_proto='$strerror_r_proto'
22692 strings='$strings'
22693 submit='$submit'
22694 subversion='$subversion'
22695 sysman='$sysman'
22696 tail='$tail'
22697 tar='$tar'
22698 targetarch='$targetarch'
22699 tbl='$tbl'
22700 tee='$tee'
22701 test='$test'
22702 timeincl='$timeincl'
22703 timetype='$timetype'
22704 tmpnam_r_proto='$tmpnam_r_proto'
22705 to='$to'
22706 touch='$touch'
22707 tr='$tr'
22708 trnl='$trnl'
22709 troff='$troff'
22710 ttyname_r_proto='$ttyname_r_proto'
22711 u16size='$u16size'
22712 u16type='$u16type'
22713 u32size='$u32size'
22714 u32type='$u32type'
22715 u64size='$u64size'
22716 u64type='$u64type'
22717 u8size='$u8size'
22718 u8type='$u8type'
22719 uidformat='$uidformat'
22720 uidsign='$uidsign'
22721 uidsize='$uidsize'
22722 uidtype='$uidtype'
22723 uname='$uname'
22724 uniq='$uniq'
22725 uquadtype='$uquadtype'
22726 use5005threads='$use5005threads'
22727 use64bitall='$use64bitall'
22728 use64bitint='$use64bitint'
22729 usecrosscompile='$usecrosscompile'
22730 usedl='$usedl'
22731 usedtrace='$usedtrace'
22732 usefaststdio='$usefaststdio'
22733 useithreads='$useithreads'
22734 uselargefiles='$uselargefiles'
22735 uselongdouble='$uselongdouble'
22736 usemallocwrap='$usemallocwrap'
22737 usemorebits='$usemorebits'
22738 usemultiplicity='$usemultiplicity'
22739 usemymalloc='$usemymalloc'
22740 usenm='$usenm'
22741 useopcode='$useopcode'
22742 useperlio='$useperlio'
22743 useposix='$useposix'
22744 usereentrant='$usereentrant'
22745 userelocatableinc='$userelocatableinc'
22746 usesfio='$usesfio'
22747 useshrplib='$useshrplib'
22748 usesitecustomize='$usesitecustomize'
22749 usesocks='$usesocks'
22750 usethreads='$usethreads'
22751 usevendorprefix='$usevendorprefix'
22752 usevfork='$usevfork'
22753 usrinc='$usrinc'
22754 uuname='$uuname'
22755 uvXUformat='$uvXUformat'
22756 uvoformat='$uvoformat'
22757 uvsize='$uvsize'
22758 uvtype='$uvtype'
22759 uvuformat='$uvuformat'
22760 uvxformat='$uvxformat'
22761 vendorarch='$vendorarch'
22762 vendorarchexp='$vendorarchexp'
22763 vendorbin='$vendorbin'
22764 vendorbinexp='$vendorbinexp'
22765 vendorhtml1dir='$vendorhtml1dir'
22766 vendorhtml1direxp='$vendorhtml1direxp'
22767 vendorhtml3dir='$vendorhtml3dir'
22768 vendorhtml3direxp='$vendorhtml3direxp'
22769 vendorlib='$vendorlib'
22770 vendorlib_stem='$vendorlib_stem'
22771 vendorlibexp='$vendorlibexp'
22772 vendorman1dir='$vendorman1dir'
22773 vendorman1direxp='$vendorman1direxp'
22774 vendorman3dir='$vendorman3dir'
22775 vendorman3direxp='$vendorman3direxp'
22776 vendorprefix='$vendorprefix'
22777 vendorprefixexp='$vendorprefixexp'
22778 vendorscript='$vendorscript'
22779 vendorscriptexp='$vendorscriptexp'
22780 version='$version'
22781 version_patchlevel_string='$version_patchlevel_string'
22782 versiononly='$versiononly'
22783 vi='$vi'
22784 voidflags='$voidflags'
22785 xlibpth='$xlibpth'
22786 yacc='$yacc'
22787 yaccflags='$yaccflags'
22788 zcat='$zcat'
22789 zip='$zip'
22790 EOT
22791
22792 : Add in command line options if available
22793 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22794
22795 : add special variables
22796 $test -f $src/patchlevel.h && \
22797 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22798 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22799 echo "PERL_CONFIG_SH=true" >>config.sh
22800
22801 : propagate old symbols
22802 if $test -f UU/config.sh; then
22803         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22804         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22805                 config.sh config.sh UU/oldconfig.sh |\
22806                 $sort | $uniq -u >UU/oldsyms
22807         set X `cat UU/oldsyms`
22808         shift
22809         case $# in
22810         0) ;;
22811         *)
22812                 cat <<EOM
22813 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22814 EOM
22815                 echo ": Variables propagated from previous config.sh file." >>config.sh
22816                 for sym in `cat UU/oldsyms`; do
22817                         echo "    Propagating $hint variable "'$'"$sym..."
22818                         eval 'tmp="$'"${sym}"'"'
22819                         echo "$tmp" | \
22820                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22821                 done
22822                 ;;
22823         esac
22824 fi
22825
22826 : Finish up by extracting the .SH files
22827 case "$alldone" in
22828 exit)
22829         $rm -rf UU
22830         echo "Extraction done."
22831         exit 0
22832         ;;
22833 cont)
22834         ;;
22835 '')
22836         dflt=''
22837         nostick=true
22838         $cat <<EOM
22839
22840 If you'd like to make any changes to the config.sh file before I begin
22841 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22842
22843 EOM
22844         rp="Press return or use a shell escape to edit config.sh:"
22845         . UU/myread
22846         nostick=''
22847         case "$ans" in
22848         '') ;;
22849         *) : in case they cannot read
22850                 sh 1>&4 -c "$ans";;
22851         esac
22852         ;;
22853 esac
22854
22855 : if this fails, just run all the .SH files by hand
22856 . ./config.sh
22857
22858 echo " "
22859 exec 1>&4
22860 pwd=`pwd`
22861 . ./UU/extract
22862 cd "$pwd"
22863
22864 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22865         dflt=y
22866         case "$silent" in
22867         true) ;;
22868         *)
22869                 $cat <<EOM
22870
22871 Now you need to generate make dependencies by running "$make depend".
22872 You might prefer to run it in background: "$make depend > makedepend.out &"
22873 It can take a while, so you might not want to run it right now.
22874
22875 EOM
22876                 ;;
22877         esac
22878         rp="Run $make depend now?"
22879         . UU/myread
22880         case "$ans" in
22881         y*)
22882                 $make depend && echo "Now you must run '$make'."
22883                 ;;
22884         *)
22885                 echo "You must run '$make depend' then '$make'."
22886                 ;;
22887         esac
22888 elif test -f [Mm]akefile; then
22889         echo " "
22890         echo "Now you must run a $make."
22891 else
22892         echo "Configure done."
22893 fi
22894
22895 if $test -f Policy.sh; then
22896     $cat <<EOM
22897
22898 If you compile $package on a different machine or from a different object
22899 directory, copy the Policy.sh file from this object directory to the
22900 new one before you run Configure -- this will help you with most of
22901 the policy defaults.
22902
22903 EOM
22904 fi
22905 if $test -f config.msg; then
22906     echo "Hmm.  I also noted the following information while running:"
22907     echo " "
22908     $cat config.msg >&4
22909     $rm -f config.msg
22910 fi
22911 $rm -f kit*isdone ark*isdone
22912 $rm -rf UU
22913
22914 : End of Configure
22915