This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_2iv_flags(), Perl_sv_2uv_flags, Perl_sv_2nv and
[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 Tue Jan 22 17:46:32 CET 2008 [metaconfig 3.0 PL70]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_assert=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nv_overflows_integers_at=''
1062 nvsize=''
1063 nvtype=''
1064 u16size=''
1065 u16type=''
1066 u32size=''
1067 u32type=''
1068 u64size=''
1069 u64type=''
1070 u8size=''
1071 u8type=''
1072 uvsize=''
1073 uvtype=''
1074 ivdformat=''
1075 nvEUformat=''
1076 nvFUformat=''
1077 nvGUformat=''
1078 nveformat=''
1079 nvfformat=''
1080 nvgformat=''
1081 uvXUformat=''
1082 uvoformat=''
1083 uvuformat=''
1084 uvxformat=''
1085 pidtype=''
1086 prefix=''
1087 prefixexp=''
1088 installprivlib=''
1089 privlib=''
1090 privlibexp=''
1091 prototype=''
1092 ptrsize=''
1093 d_PRIXU64=''
1094 d_PRId64=''
1095 d_PRIi64=''
1096 d_PRIo64=''
1097 d_PRIu64=''
1098 d_PRIx64=''
1099 sPRIXU64=''
1100 sPRId64=''
1101 sPRIi64=''
1102 sPRIo64=''
1103 sPRIu64=''
1104 sPRIx64=''
1105 d_quad=''
1106 quadkind=''
1107 quadtype=''
1108 uquadtype=''
1109 drand01=''
1110 randbits=''
1111 randfunc=''
1112 randseedtype=''
1113 seedfunc=''
1114 installscript=''
1115 scriptdir=''
1116 scriptdirexp=''
1117 selectminbits=''
1118 selecttype=''
1119 sh=''
1120 sig_count=''
1121 sig_name=''
1122 sig_name_init=''
1123 sig_num=''
1124 sig_num_init=''
1125 sig_size=''
1126 d_sitearch=''
1127 installsitearch=''
1128 sitearch=''
1129 sitearchexp=''
1130 installsitebin=''
1131 sitebin=''
1132 sitebinexp=''
1133 installsitehtml1dir=''
1134 sitehtml1dir=''
1135 sitehtml1direxp=''
1136 installsitehtml3dir=''
1137 sitehtml3dir=''
1138 sitehtml3direxp=''
1139 installsitelib=''
1140 sitelib=''
1141 sitelib_stem=''
1142 sitelibexp=''
1143 installsiteman1dir=''
1144 siteman1dir=''
1145 siteman1direxp=''
1146 installsiteman3dir=''
1147 siteman3dir=''
1148 siteman3direxp=''
1149 siteprefix=''
1150 siteprefixexp=''
1151 installsitescript=''
1152 sitescript=''
1153 sitescriptexp=''
1154 sizesize=''
1155 sizetype=''
1156 so=''
1157 socksizetype=''
1158 sharpbang=''
1159 shsharp=''
1160 spitshell=''
1161 src=''
1162 ssizetype=''
1163 startperl=''
1164 startsh=''
1165 stdchar=''
1166 d_stdio_stream_array=''
1167 stdio_stream_array=''
1168 sysman=''
1169 trnl=''
1170 uidformat=''
1171 uidsign=''
1172 uidsize=''
1173 uidtype=''
1174 archname64=''
1175 use64bitall=''
1176 use64bitint=''
1177 dtrace=''
1178 usedtrace=''
1179 usefaststdio=''
1180 ccflags_uselargefiles=''
1181 ldflags_uselargefiles=''
1182 libswanted_uselargefiles=''
1183 uselargefiles=''
1184 uselongdouble=''
1185 usemorebits=''
1186 usemultiplicity=''
1187 nm_opt=''
1188 nm_so_opt=''
1189 runnm=''
1190 usenm=''
1191 useperlio=''
1192 usesocks=''
1193 d_oldpthreads=''
1194 use5005threads=''
1195 useithreads=''
1196 usereentrant=''
1197 usethreads=''
1198 incpath=''
1199 mips_type=''
1200 usrinc=''
1201 d_vendorarch=''
1202 installvendorarch=''
1203 vendorarch=''
1204 vendorarchexp=''
1205 d_vendorbin=''
1206 installvendorbin=''
1207 vendorbin=''
1208 vendorbinexp=''
1209 installvendorhtml1dir=''
1210 vendorhtml1dir=''
1211 vendorhtml1direxp=''
1212 installvendorhtml3dir=''
1213 vendorhtml3dir=''
1214 vendorhtml3direxp=''
1215 d_vendorlib=''
1216 installvendorlib=''
1217 vendorlib=''
1218 vendorlib_stem=''
1219 vendorlibexp=''
1220 installvendorman1dir=''
1221 vendorman1dir=''
1222 vendorman1direxp=''
1223 installvendorman3dir=''
1224 vendorman3dir=''
1225 vendorman3direxp=''
1226 usevendorprefix=''
1227 vendorprefix=''
1228 vendorprefixexp=''
1229 d_vendorscript=''
1230 installvendorscript=''
1231 vendorscript=''
1232 vendorscriptexp=''
1233 versiononly=''
1234 defvoidused=''
1235 voidflags=''
1236 yacc=''
1237 yaccflags=''
1238 CONFIG=''
1239
1240 : Detect odd OSs
1241 define='define'
1242 undef='undef'
1243 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1244 rmlist=''
1245
1246 : We must find out about Eunice early
1247 eunicefix=':'
1248 if test -f /etc/unixtovms; then
1249         eunicefix=/etc/unixtovms
1250 fi
1251 if test -f /etc/unixtovms.exe; then
1252         eunicefix=/etc/unixtovms.exe
1253 fi
1254
1255 : Set executable suffix now -- needed before hints available
1256 if test -f "/libs/version.library"; then
1257 : Amiga OS
1258     _exe=""
1259 elif test -f "/system/gnu_library/bin/ar.pm"; then
1260 : Stratus VOS
1261     _exe=".pm"
1262 elif test -n "$DJGPP"; then
1263 : DOS DJGPP
1264     _exe=".exe"
1265 elif test -d c:/. -o -n "$is_os2" ; then
1266 : OS/2 or cygwin
1267     _exe=".exe"
1268 fi
1269
1270 i_whoami=''
1271 : Trailing extension.  Override this in a hint file, if needed.
1272 : Extra object files, if any, needed on this platform.
1273 archobjs=''
1274 archname=''
1275 groupstype=''
1276 libnames=''
1277 : change the next line if compiling for Xenix/286 on Xenix/386
1278 xlibpth='/usr/lib/386 /lib/386'
1279 : Possible local library directories to search.
1280 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1281 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1282
1283 : general looking path for locating libraries
1284 glibpth="/lib /usr/lib $xlibpth"
1285 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1286 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1287 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1288 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1289
1290 : Private path used by Configure to find libraries.  Its value
1291 : is prepended to libpth. This variable takes care of special
1292 : machines, like the mips.  Usually, it should be empty.
1293 plibpth=''
1294
1295 : default library list
1296 libswanted=''
1297 : some systems want to use only the non-versioned libso:s
1298 ignore_versioned_solibs=''
1299 : set usethreads on the Configure command line to enable threads.
1300 usereentrant='undef'
1301 : full support for void wanted by default
1302 defvoidused=15
1303
1304 : Possible local include directories to search.
1305 : Set locincpth to "" in a hint file to defeat local include searches.
1306 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1307 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1308 :
1309 : no include file wanted by default
1310 inclwanted=''
1311
1312 : Enable -DEBUGGING and -DDEBUGGING from the command line
1313 EBUGGING=''
1314 DEBUGGING=old
1315
1316 ccname=''
1317 ccversion=''
1318 perllibs=''
1319 : set useposix=false in your hint file to disable the POSIX extension.
1320 useposix=true
1321 : set useopcode=false in your hint file to disable the Opcode extension.
1322 useopcode=true
1323 archname64=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 : set usemultiplicity on the Configure command line to enable multiplicity.
1328 : set usesocks on the Configure command line to enable socks.
1329 : List of libraries we want.
1330 : If anyone needs extra -lxxx, put those in a hint file.
1331 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1332 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1333 : We probably want to search /usr/shlib before most other libraries.
1334 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1335 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1336 glibpth="/usr/shlib $glibpth"
1337 : Do not use vfork unless overridden by a hint file.
1338 usevfork=false
1339
1340 : Find the basic shell for Bourne shell scripts
1341 case "$sh" in
1342 '')
1343         case "$SYSTYPE" in
1344         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1345         *) xxx='/bin/sh';;
1346         esac
1347         if test -f "$xxx"; then
1348                 sh="$xxx"
1349         else
1350                 : Build up a list and do a single loop so we can 'break' out.
1351                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1352                 for xxx in sh bash ksh pdksh ash; do
1353                         for p in $pth; do
1354                                 try="$try ${p}/${xxx}"
1355                         done
1356                 done
1357                 for xxx in $try; do
1358                         if test -f "$xxx"; then
1359                                 sh="$xxx";
1360                                 break
1361                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1362                                 sh="$xxx";
1363                                 break
1364                         elif test -f "$xxx.exe"; then
1365                                 sh="$xxx";
1366                                 break
1367                         fi
1368                 done
1369         fi
1370         ;;
1371 esac
1372
1373 case "$sh" in
1374 '')     cat >&2 <<EOM
1375 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1376
1377 Usually it's in /bin/sh.  How did you even get this far?
1378 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1379 we'll try to straighten this all out.
1380 EOM
1381         exit 1
1382         ;;
1383 esac
1384
1385 : see if sh knows # comments
1386 if `$sh -c '#' >/dev/null 2>&1`; then
1387         shsharp=true
1388         spitshell=cat
1389         xcat=/bin/cat
1390         test -f $xcat$_exe || xcat=/usr/bin/cat
1391         if test ! -f $xcat$_exe; then
1392                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1393                         if test -f $p/cat$_exe; then
1394                                 xcat=$p/cat
1395                                 break
1396                         fi
1397                 done
1398                 if test ! -f $xcat$_exe; then
1399                         echo "Can't find cat anywhere!"
1400                         exit 1
1401                 fi
1402         fi
1403         echo "#!$xcat" >sharp
1404         $eunicefix sharp
1405         chmod +x sharp
1406         ./sharp > today
1407         if test -s today; then
1408                 sharpbang='#!'
1409         else
1410                 echo "#! $xcat" > sharp
1411                 $eunicefix sharp
1412                 chmod +x sharp
1413                 ./sharp > today
1414                 if test -s today; then
1415                         sharpbang='#! '
1416                 else
1417                         sharpbang=': use '
1418                 fi
1419         fi
1420 else
1421         echo " "
1422         echo "Your $sh doesn't grok # comments--I will strip them later on."
1423         shsharp=false
1424         cd ..
1425         echo "exec grep -v '^[  ]*#'" >spitshell
1426         chmod +x spitshell
1427         $eunicefix spitshell
1428         spitshell=`pwd`/spitshell
1429         cd UU
1430         echo "I presume that if # doesn't work, #! won't work either!"
1431         sharpbang=': use '
1432 fi
1433 rm -f sharp today
1434
1435 : figure out how to guarantee sh startup
1436 case "$startsh" in
1437 '') startsh=${sharpbang}${sh} ;;
1438 *)
1439 esac
1440 cat >sharp <<EOSS
1441 $startsh
1442 set abc
1443 test "$?abc" != 1
1444 EOSS
1445
1446 chmod +x sharp
1447 $eunicefix sharp
1448 if ./sharp; then
1449         : echo "Yup, it does."
1450 else
1451         echo "Hmm... '$startsh' does not guarantee sh startup..."
1452         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1453 fi
1454 rm -f sharp
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 : Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1472 $arg
1473 EOC
1474         arg_exp=`cat cmdl.opt`
1475         args_exp="$args_exp$args_sep'$arg_exp'"
1476         argn=`expr $argn + 1`
1477         args_sep=' '
1478 done
1479 rm -f cmdl.opt
1480
1481 : produce awk script to parse command line options
1482 cat >options.awk <<'EOF'
1483 BEGIN {
1484         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1485
1486         len = length(optstr);
1487         for (i = 1; i <= len; i++) {
1488                 c = substr(optstr, i, 1);
1489                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1490                 if (a == ":") {
1491                         arg[c] = 1;
1492                         i++;
1493                 }
1494                 opt[c] = 1;
1495         }
1496 }
1497 {
1498         expect = 0;
1499         str = $0;
1500         if (substr(str, 1, 1) != "-") {
1501                 printf("'%s'\n", str);
1502                 next;
1503         }
1504         len = length($0);
1505         for (i = 2; i <= len; i++) {
1506                 c = substr(str, i, 1);
1507                 if (!opt[c]) {
1508                         printf("-%s\n", substr(str, i));
1509                         next;
1510                 }
1511                 printf("-%s\n", c);
1512                 if (arg[c]) {
1513                         if (i < len)
1514                                 printf("'%s'\n", substr(str, i + 1));
1515                         else
1516                                 expect = 1;
1517                         next;
1518                 }
1519         }
1520 }
1521 END {
1522         if (expect)
1523                 print "?";
1524 }
1525 EOF
1526
1527 : process the command line options
1528 set X `for arg in "$@"; do echo "X$arg"; done |
1529         sed -e s/X// | awk -f options.awk`
1530 eval "set $*"
1531 shift
1532 rm -f options.awk
1533
1534 : set up default values
1535 fastread=''
1536 reuseval=false
1537 config_sh=''
1538 alldone=''
1539 error=''
1540 silent=''
1541 extractsh=''
1542 override=''
1543 knowitall=''
1544 rm -f optdef.sh posthint.sh
1545 cat >optdef.sh <<EOS
1546 $startsh
1547 EOS
1548
1549
1550 : option parsing
1551 while test $# -gt 0; do
1552         case "$1" in
1553         -d) shift; fastread=yes;;
1554         -e) shift; alldone=cont;;
1555         -f)
1556                 shift
1557                 cd ..
1558                 if test -r "$1"; then
1559                         config_sh="$1"
1560                 else
1561                         echo "$me: cannot read config file $1." >&2
1562                         error=true
1563                 fi
1564                 cd UU
1565                 shift;;
1566         --help|\
1567         -h) shift; error=true;;
1568         -r) shift; reuseval=true;;
1569         -s) shift; silent=true; realsilent=true;;
1570         -E) shift; alldone=exit;;
1571         -K) shift; knowitall=true;;
1572         -O) shift; override=true;;
1573         -S) shift; silent=true; extractsh=true;;
1574         -D)
1575                 shift
1576                 case "$1" in
1577                 *=)
1578                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1579                         echo "$me: ignoring -D $1" >&2
1580                         ;;
1581                 *=*) echo "$1" | \
1582                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1583                 *) echo "$1='define'" >> optdef.sh;;
1584                 esac
1585                 shift
1586                 ;;
1587         -U)
1588                 shift
1589                 case "$1" in
1590                 *=) echo "$1" >> optdef.sh;;
1591                 *=*)
1592                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1593                         echo "$me: ignoring -U $1" >&2
1594                         ;;
1595                 *) echo "$1='undef'" >> optdef.sh;;
1596                 esac
1597                 shift
1598                 ;;
1599         -A)
1600             shift
1601             xxx=''
1602             yyy="$1"
1603             zzz=''
1604             uuu=undef
1605             case "$yyy" in
1606             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1607                  case "$zzz" in
1608                  *:*) zzz='' ;;
1609                  *)   xxx=append
1610                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1611                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1612                  esac
1613                  ;;
1614             esac
1615             case "$xxx" in
1616             '')  case "$yyy" in
1617                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1618                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1619                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1620                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1621                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1622                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1623                  esac
1624                  ;;
1625             esac
1626             case "$xxx" in
1627             append)
1628                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1629             clear)
1630                 echo "$yyy=''"                  >> posthint.sh ;;
1631             define)
1632                 case "$zzz" in
1633                 '') zzz=define ;;
1634                 esac
1635                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1636             eval)
1637                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1638             prepend)
1639                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1640             undef)
1641                 case "$zzz" in
1642                 '') zzz="$uuu" ;;
1643                 esac
1644                 echo "$yyy=$zzz"                >> posthint.sh ;;
1645             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1646             esac
1647             shift
1648             ;;
1649         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1650             exit 0;;
1651         --) break;;
1652         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1653         *) break;;
1654         esac
1655 done
1656
1657 case "$error" in
1658 true)
1659         cat >&2 <<EOM
1660 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1661                  [-U symbol] [-U symbol=] [-A command:symbol...]
1662   -d : use defaults for all answers.
1663   -e : go on without questioning past the production of config.sh.
1664   -f : specify an alternate default configuration file.
1665   -h : print this help message and exit (with an error status).
1666   -r : reuse C symbols value if possible (skips costly nm extraction).
1667   -s : silent mode, only echoes questions and essential information.
1668   -D : define symbol to have some value:
1669          -D symbol         symbol gets the value 'define'
1670          -D symbol=value   symbol gets the value 'value'
1671        common used examples (see INSTALL for more info):
1672          -Duse64bitint            use 64bit integers
1673          -Duse64bitall            use 64bit integers and pointers
1674          -Dusethreads             use thread support
1675          -Dinc_version_list=none  do not include older perl trees in @INC
1676          -DEBUGGING=none          DEBUGGING options
1677          -Dcc=gcc                 choose your compiler
1678          -Dprefix=/opt/perl5      choose your destination
1679   -E : stop at the end of questions, after having produced config.sh.
1680   -K : do not use unless you know what you are doing.
1681   -O : let -D and -U override definitions from loaded configuration file.
1682   -S : perform variable substitutions on all .SH files (can mix with -f)
1683   -U : undefine symbol:
1684          -U symbol    symbol gets the value 'undef'
1685          -U symbol=   symbol gets completely empty
1686        e.g.:  -Uversiononly
1687   -A : manipulate symbol after the platform specific hints have been applied:
1688          -A append:symbol=value   append value to symbol
1689          -A symbol=value          like append:, but with a separating space
1690          -A define:symbol=value   define symbol to have value
1691          -A clear:symbol          define symbol to be ''
1692          -A define:symbol         define symbol to be 'define'
1693          -A eval:symbol=value     define symbol to be eval of value
1694          -A prepend:symbol=value  prepend value to symbol
1695          -A undef:symbol          define symbol to be 'undef'
1696          -A undef:symbol=         define symbol to be ''
1697        e.g.:  -A prepend:libswanted='cl pthread '
1698               -A ccflags=-DSOME_MACRO
1699   -V : print version number and exit (with a zero status).
1700 EOM
1701         exit 1
1702         ;;
1703 esac
1704
1705 : Sanity checks
1706 case "$fastread$alldone" in
1707 yescont|yesexit) ;;
1708 *)
1709         case "$extractsh" in
1710         true) ;;
1711         *)
1712                 if test ! -t 0; then
1713                         echo "Say 'sh Configure', not 'sh <Configure'"
1714                         exit 1
1715                 fi
1716                 ;;
1717         esac
1718         ;;
1719 esac
1720
1721 exec 4>&1
1722 case "$silent" in
1723 true) exec 1>/dev/null;;
1724 esac
1725
1726 : run the defines and the undefines, if any, but leave the file out there...
1727 touch optdef.sh
1728 . ./optdef.sh
1729 : create the posthint manipulation script and leave the file out there...
1730 touch posthint.sh
1731
1732 : set package name
1733 package='perl5'
1734 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1735 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1736 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1737 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1738 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1739 esac
1740
1741 : Some greps do not return status, grrr.
1742 echo "grimblepritz" >grimble
1743 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1744         contains=contains
1745 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1746         contains=grep
1747 else
1748         contains=contains
1749 fi
1750 rm -f grimble
1751 : the following should work in any shell
1752 case "$contains" in
1753 contains*)
1754         echo " "
1755         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1756         cat >contains <<'EOSS'
1757 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1758 EOSS
1759 chmod +x contains
1760 esac
1761
1762 : Find the path to the source tree
1763 case "$src" in
1764 '') case "$0" in
1765     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1766          case "$src" in
1767          /*)    ;;
1768          .)     ;;
1769          *)     src=`cd ../$src && pwd` ;;
1770          esac
1771          ;;
1772     *)   src='.';;
1773     esac;;
1774 esac
1775 case "$src" in
1776 '')     src=/
1777         rsrc=/
1778         ;;
1779 /*)     rsrc="$src";;
1780 *)      rsrc="../$src";;
1781 esac
1782 if test -f $rsrc/Configure && \
1783         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1784 then
1785    : found it, so we are ok.
1786 else
1787         rsrc=''
1788         for src in . .. ../.. ../../.. ../../../..; do
1789                 if test -f ../$src/Configure && \
1790                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1791                 then
1792                         rsrc=../$src
1793                         break
1794                 fi
1795         done
1796 fi
1797 case "$rsrc" in
1798 '')
1799         cat <<EOM >&4
1800
1801 Sorry, I can't seem to locate the source dir for $package.  Please start
1802 Configure with an explicit path -- i.e. /some/path/Configure.
1803
1804 EOM
1805         exit 1
1806         ;;
1807 ../.)   rsrc='..';;
1808 *)
1809         echo " "
1810         echo "Sources for $package found in \"$src\"." >&4
1811         ;;
1812 esac
1813
1814 : script used to extract .SH files with variable substitutions
1815 cat >extract <<'EOS'
1816 PERL_CONFIG_SH=true
1817 echo "Doing variable substitutions on .SH files..."
1818 if test -f MANIFEST; then
1819         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1820 else
1821         echo "(Looking for .SH files under the source directory.)"
1822         set x `(cd "$src"; find . -name "*.SH" -print)`
1823 fi
1824 shift
1825 case $# in
1826 0) set x `(cd "$src"; echo *.SH)`; shift;;
1827 esac
1828 if test ! -f "$src/$1"; then
1829         shift
1830 fi
1831 mkdir_p='
1832 name=$1;
1833 create="";
1834 while test $name; do
1835         if test ! -d "$name"; then
1836                 create="$name $create";
1837                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1838                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1839         else
1840                 name="";
1841         fi;
1842 done;
1843 for file in $create; do
1844         mkdir $file;
1845 done
1846 '
1847 for file in $*; do
1848         case "$src" in
1849         ".")
1850                 case "$file" in
1851                 */*)
1852                         dir=`expr X$file : 'X\(.*\)/'`
1853                         file=`expr X$file : 'X.*/\(.*\)'`
1854                         (cd "$dir" && . ./$file)
1855                         ;;
1856                 *)
1857                         . ./$file
1858                         ;;
1859                 esac
1860                 ;;
1861         *)
1862                 case "$file" in
1863                 */*)
1864                         dir=`expr X$file : 'X\(.*\)/'`
1865                         file=`expr X$file : 'X.*/\(.*\)'`
1866                         (set x $dir; shift; eval $mkdir_p)
1867                         sh <"$src/$dir/$file"
1868                         ;;
1869                 *)
1870                         sh <"$src/$file"
1871                         ;;
1872                 esac
1873                 ;;
1874         esac
1875 done
1876 if test -f "$src/config_h.SH"; then
1877         if test ! -f config.h; then
1878         : oops, they left it out of MANIFEST, probably, so do it anyway.
1879         . "$src/config_h.SH"
1880         fi
1881 fi
1882 EOS
1883
1884 : extract files and exit if asked to do so
1885 case "$extractsh" in
1886 true)
1887         case "$realsilent" in
1888         true) ;;
1889         *) exec 1>&4;;
1890         esac
1891         case "$config_sh" in
1892         '') config_sh='config.sh';;
1893         esac
1894         echo " "
1895         echo "Fetching answers from $config_sh..."
1896         cd ..
1897         . $config_sh
1898         test "$override" && . ./optdef.sh
1899         echo " "
1900         . UU/extract
1901         rm -rf UU
1902         echo "Extraction done."
1903         exit 0
1904         ;;
1905 esac
1906
1907 : Eunice requires " " instead of "", can you believe it
1908 echo " "
1909 : Here we go...
1910 echo "Beginning of configuration questions for $package."
1911
1912 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1913
1914 : first determine how to suppress newline on echo command
1915 echo " "
1916 echo "Checking echo to see how to suppress newlines..."
1917 (echo "hi there\c" ; echo " ") >.echotmp
1918 if $contains c .echotmp >/dev/null 2>&1 ; then
1919         echo "...using -n."
1920         n='-n'
1921         c=''
1922 else
1923         cat <<'EOM'
1924 ...using \c
1925 EOM
1926         n=''
1927         c='\c'
1928 fi
1929 echo $n "The star should be here-->$c"
1930 echo '*'
1931 rm -f .echotmp
1932
1933 : Now test for existence of everything in MANIFEST
1934 echo " "
1935 if test -f "$rsrc/MANIFEST"; then
1936         echo "First let's make sure your kit is complete.  Checking..." >&4
1937         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1938                 (split -l 50 2>/dev/null || split -50)
1939         rm -f missing
1940         tmppwd=`pwd`
1941         for filelist in x??; do
1942                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1943                         >/dev/null 2>>"$tmppwd/missing")
1944         done
1945         if test -s missing; then
1946                 cat missing >&4
1947                 cat >&4 <<'EOM'
1948
1949 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1950
1951 You have the option of continuing the configuration process, despite the
1952 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1953 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1954 and contact the author (perlbug@perl.org).
1955
1956 EOM
1957                 echo $n "Continue? [n] $c" >&4
1958                 read ans
1959                 case "$ans" in
1960                 y*)
1961                         echo "Continuing..." >&4
1962                         rm -f missing
1963                         ;;
1964                 *)
1965                         echo "ABORTING..." >&4
1966                         kill $$
1967                         ;;
1968                 esac
1969         else
1970                 echo "Looks good..."
1971         fi
1972 else
1973         echo "There is no MANIFEST file.  I hope your kit is complete !"
1974 fi
1975 rm -f missing x??
1976
1977 : Find the appropriate value for a newline for tr
1978 echo " "
1979 if test -n "$DJGPP"; then
1980        trnl='\012'
1981 fi
1982 if test X"$trnl" = X; then
1983         case "`echo foo|tr '\n' x 2>/dev/null`" in
1984         foox) trnl='\n' ;;
1985         esac
1986 fi
1987 if test X"$trnl" = X; then
1988         case "`echo foo|tr '\012' x 2>/dev/null`" in
1989         foox) trnl='\012' ;;
1990         esac
1991 fi
1992 if test X"$trnl" = X; then
1993        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1994        fooxy) trnl='\n\r' ;;
1995        esac
1996 fi
1997 if test X"$trnl" = X; then
1998         cat <<EOM >&2
1999
2000 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2001
2002 EOM
2003         exit 1
2004 fi
2005
2006 : compute the number of columns on the terminal for proper question formatting
2007 case "$COLUMNS" in
2008 '') COLUMNS='80';;
2009 esac
2010
2011 : set up the echo used in my read
2012 myecho="case \"\$xxxm\" in
2013 '') echo $n \"\$rp $c\" >&4;;
2014 *) case \"\$rp\" in
2015         '') echo $n \"[\$xxxm] $c\";;
2016         *)
2017                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2018                         echo \"\$rp\" >&4
2019                         echo $n \"[\$xxxm] $c\" >&4
2020                 else
2021                         echo $n \"\$rp [\$xxxm] $c\" >&4
2022                 fi
2023                 ;;
2024         esac;;
2025 esac"
2026
2027 : now set up to do reads with possible shell escape and default assignment
2028 cat <<EOSC >myread
2029 $startsh
2030 xxxm=\$dflt
2031 $myecho
2032 ans='!'
2033 case "\$fastread" in
2034 yes) case "\$dflt" in
2035         '') ;;
2036         *) ans='';
2037                 case "\$silent-\$rp" in
2038                 true-) ;;
2039                 *) echo " " >&4;;
2040                 esac;;
2041         esac;;
2042 *) case "\$silent" in
2043         true) case "\$rp" in
2044                 '') ans='';;
2045                 esac;;
2046         esac;;
2047 esac
2048 while expr "X\$ans" : "X!" >/dev/null; do
2049         read answ
2050         set x \$xxxm
2051         shift
2052         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2053         case  "\$answ" in
2054         "!")
2055                 sh 1>&4
2056                 echo " "
2057                 $myecho
2058                 ;;
2059         !*)
2060                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2061                 shift
2062                 sh 1>&4 -c "\$*"
2063                 echo " "
2064                 $myecho
2065                 ;;
2066         "\$ans")
2067                 case "\$ans" in
2068                 \\&*)
2069                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2070                         shift
2071                         case "\$1" in
2072                         -d)
2073                                 fastread=yes
2074                                 echo "(OK, I'll run with -d after this question.)" >&4
2075                                 ;;
2076                         -*)
2077                                 echo "*** Sorry, \$1 not supported yet." >&4
2078                                 ;;
2079                         esac
2080                         $myecho
2081                         ans=!
2082                         ;;
2083                 esac;;
2084         *)
2085                 case "\$aok" in
2086                 y)
2087                         echo "*** Substitution done -- please confirm."
2088                         xxxm="\$ans"
2089                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2090                         xxxm="\$ans"
2091                         ans=!
2092                         ;;
2093                 *)
2094                         echo "*** Error -- try again."
2095                         ans=!
2096                         ;;
2097                 esac
2098                 $myecho
2099                 ;;
2100         esac
2101         case "\$ans\$xxxm\$nostick" in
2102         '')
2103                 ans=!
2104                 $myecho
2105                 ;;
2106         esac
2107 done
2108 case "\$ans" in
2109 '') ans="\$xxxm";;
2110 esac
2111 EOSC
2112
2113 : create .config dir to save info across Configure sessions
2114 test -d ../.config || mkdir ../.config
2115 cat >../.config/README <<EOF
2116 This directory created by Configure to save information that should
2117 persist across sessions for $package.
2118
2119 You may safely delete it if you wish.
2120 EOF
2121
2122 : See if we are using a devel version and want that
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                 fi
2291                 exit 0
2292         fi
2293         ;;
2294         esac
2295 done
2296 echo \$dflt
2297 exit 1
2298 EOSC
2299 chmod +x loc
2300 $eunicefix loc
2301 loclist="
2302 awk
2303 cat
2304 chmod
2305 comm
2306 cp
2307 echo
2308 expr
2309 grep
2310 ls
2311 mkdir
2312 rm
2313 sed
2314 sort
2315 touch
2316 tr
2317 uniq
2318 "
2319 trylist="
2320 ar
2321 bison
2322 byacc
2323 cpp
2324 csh
2325 date
2326 egrep
2327 gmake
2328 gzip
2329 less
2330 ln
2331 make
2332 more
2333 nm
2334 nroff
2335 pg
2336 test
2337 uname
2338 zip
2339 "
2340 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2341 pth="$pth /lib /usr/lib"
2342 for file in $loclist; do
2343         eval xxx=\$$file
2344         case "$xxx" in
2345         /*|?:[\\/]*)
2346                 if test -f "$xxx"; then
2347                         : ok
2348                 else
2349                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2350                         xxx=`./loc $file $file $pth`
2351                 fi
2352                 ;;
2353         '') xxx=`./loc $file $file $pth`;;
2354         *) xxx=`./loc $xxx $xxx $pth`;;
2355         esac
2356         eval $file=$xxx$_exe
2357         eval _$file=$xxx
2358         case "$xxx" in
2359         /*)
2360                 echo $file is in $xxx.
2361                 ;;
2362         ?:[\\/]*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         *)
2366                 echo "I don't know where '$file' is, and my life depends on it." >&4
2367                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2368                 exit 1
2369                 ;;
2370         esac
2371 done
2372 echo " "
2373 echo "Don't worry if any of the following aren't found..."
2374 say=offhand
2375 for file in $trylist; do
2376         eval xxx=\$$file
2377         case "$xxx" in
2378         /*|?:[\\/]*)
2379                 if test -f "$xxx"; then
2380                         : ok
2381                 else
2382                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2383                         xxx=`./loc $file $file $pth`
2384                 fi
2385                 ;;
2386         '') xxx=`./loc $file $file $pth`;;
2387         *) xxx=`./loc $xxx $xxx $pth`;;
2388         esac
2389         eval $file=$xxx$_exe
2390         eval _$file=$xxx
2391         case "$xxx" in
2392         /*)
2393                 echo $file is in $xxx.
2394                 ;;
2395         ?:[\\/]*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         *)
2399                 echo "I don't see $file out there, $say."
2400                 say=either
2401                 ;;
2402         esac
2403 done
2404 case "$egrep" in
2405 egrep)
2406         echo "Substituting grep for egrep."
2407         egrep=$grep
2408         _egrep=$grep
2409         ;;
2410 esac
2411 case "$ln" in
2412 ln)
2413         echo "Substituting cp for ln."
2414         ln=$cp
2415         _ln=$cp
2416         ;;
2417 esac
2418 case "$make" in
2419 make)
2420         case "$gmake" in
2421         gmake)
2422         echo "I can't find make or gmake, and my life depends on it." >&4
2423         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2424         exit 1
2425         ;;
2426         esac
2427         ;;
2428 esac
2429 case "$gmake" in
2430 gmake)  ;;
2431 *)      # We can't have osname yet.
2432         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2433                 # Assume that gmake, if found, is definitely GNU make
2434                 # and prefer it over the system make.
2435                 echo "Substituting gmake for make."
2436                 make=$gmake
2437                 _make=$gmake
2438         fi
2439         ;;
2440 esac
2441 case "$test" in
2442 test)
2443         echo "Hopefully test is built into your sh."
2444         ;;
2445 *)
2446         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2447                 echo "Using the test built into your sh."
2448                 test=test
2449                 _test=test
2450         fi
2451         ;;
2452 esac
2453 case "$echo" in
2454 echo)
2455         echo "Hopefully echo is built into your sh."
2456         ;;
2457 '') ;;
2458 *)
2459         echo " "
2460 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2461         $echo $n "hi there$c" >foo1
2462         echo $n "hi there$c" >foo2
2463         if cmp foo1 foo2 >/dev/null 2>&1; then
2464                 echo "They are compatible.  In fact, they may be identical."
2465         else
2466                 case "$n" in
2467                 '-n') n='' c='\c';;
2468                 *) n='-n' c='';;
2469                 esac
2470                 cat <<FOO
2471 They are not compatible!  You are probably running ksh on a non-USG system.
2472 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2473 have echo built in and we may have to run some Bourne shell scripts.  That
2474 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2475
2476 FOO
2477                 $echo $n "The star should be here-->$c"
2478                 $echo "*"
2479         fi
2480         $rm -f foo1 foo2
2481         ;;
2482 esac
2483
2484 # This question was auctioned at YAPC::Europe-2007 in Vienna
2485 # I never promised you could answer it. I only auctioned the question.
2486 cat <<FOO
2487 The following message is sponsored by
2488
2489   Dresden.pm<--The stars should be here.
2490
2491 Dear Perl user, system administrator or package
2492 maintainer, the Perl community sends greetings to
2493 you. Do you (emblematical) greet back [Y/n]? n
2494
2495 FOO
2496
2497 : Check what type of C compiler we use
2498 cat <<EOS >trygcc
2499 $startsh
2500 EOS
2501 cat <<'EOSC' >>trygcc
2502 case "$cc" in
2503 '') ;;
2504 *)  $rm -f try try.*
2505     $cat >try.c <<EOM
2506 int main(int argc, char *argv[]) {
2507   return 0;
2508 }
2509 EOM
2510     if $cc -o try $ccflags $ldflags try.c; then
2511        :
2512     else
2513         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2514         despair=yes
2515         trygcc=yes
2516         case "$cc" in
2517         *gcc*) trygcc=no ;;
2518         esac
2519         # Skip this test because it gives a false match on output like:
2520         #    ./trygcc: line 23: cc: command not found
2521         # case "`$cc -v -c try.c 2>&1`" in
2522         # *gcc*) trygcc=no ;;
2523         # esac
2524         if $test X"$trygcc" = Xyes; then
2525             if gcc -o try -c try.c; then
2526                 echo " "
2527                 echo "You seem to have a working gcc, though." >&4
2528                 # Switching compilers may undo the work of hints files.
2529                 # The most common problem is -D_REENTRANT for threads.
2530                 # This heuristic catches that case, but gets false positives
2531                 # if -Dusethreads was not actually specified.  Better to
2532                 # bail out here with a useful message than fail 
2533                 # mysteriously later. Should we perhaps just try to
2534                 # re-invoke Configure -Dcc=gcc config_args ?
2535                 if $test -f usethreads.cbu; then
2536                         $cat >&4 <<EOM 
2537
2538 *** However, any setting of the C compiler flags (e.g. for thread support)
2539 *** will be lost.  It may be necessary for you to restart Configure and
2540 *** add -Dcc=gcc to your Configure command line.
2541
2542 EOM
2543                         rp="Would you like to go ahead and try gcc anyway?"
2544                         dflt=n
2545                 else
2546                         rp="Would you like to use it?"
2547                         dflt=y
2548                 fi
2549                 if $test -f myread; then
2550                     . ./myread
2551                 else
2552                     if $test -f UU/myread; then
2553                         . ./UU/myread
2554                     else
2555                         echo "Cannot find myread, sorry.  Aborting." >&2
2556                         exit 1
2557                     fi
2558                 fi  
2559                 case "$ans" in
2560                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2561                 esac
2562             fi
2563         fi
2564     fi
2565     $rm -f try try.*
2566     ;;
2567 esac
2568 EOSC
2569
2570 cat <<EOS >checkcc
2571 $startsh
2572 EOS
2573 cat <<'EOSC' >>checkcc
2574 case "$cc" in        
2575 '') ;;
2576 *)  $rm -f try try.*              
2577     $cat >try.c <<EOM
2578 int main(int argc, char *argv[]) {
2579   return 0;
2580 }
2581 EOM
2582     if $cc -o try $ccflags $ldflags try.c; then
2583        :
2584     else
2585         if $test X"$despair" = Xyes; then
2586            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2587         fi
2588         $cat >&4 <<EOM         
2589 You need to find a working C compiler.
2590 Either (purchase and) install the C compiler supplied by your OS vendor,
2591 or for a free C compiler try http://gcc.gnu.org/
2592 I cannot continue any further, aborting.
2593 EOM
2594         exit 1
2595     fi
2596     $rm -f try try.*
2597     ;;
2598 esac
2599 EOSC
2600
2601 : determine whether symbolic links are supported
2602 echo " "
2603 $touch blurfl
2604 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2605         echo "Symbolic links are supported." >&4
2606         lns="$ln -s"
2607 else
2608         echo "Symbolic links are NOT supported." >&4
2609         lns="$ln"
2610 fi
2611 $rm -f blurfl sym
2612
2613 : determine whether symbolic links are supported
2614 echo " "
2615 case "$lns" in
2616 *"ln"*" -s")
2617         echo "Checking how to test for symbolic links..." >&4
2618         $lns blurfl sym
2619         if $test "X$issymlink" = X; then
2620                 case "$newsh" in
2621                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2622                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623                 esac
2624                 if test $? = 0; then
2625                         issymlink="test -h"
2626                 else
2627                         echo "Your builtin 'test -h' may be broken." >&4
2628                         case "$test" in
2629                         /*)     ;;
2630                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2631                                 for p in $pth
2632                                 do
2633                                         if test -f "$p/$test"; then
2634                                                 test="$p/$test"
2635                                                 break
2636                                         fi
2637                                 done
2638                                 ;;
2639                         esac
2640                         case "$test" in
2641                         /*)
2642                                 echo "Trying external '$test -h'." >&4
2643                                 issymlink="$test -h"
2644                                 if $test ! -h sym >/dev/null 2>&1; then
2645                                         echo "External '$test -h' is broken, too." >&4
2646                                         issymlink=''
2647                                 fi
2648                                 ;;
2649                         *)      issymlink='' ;;
2650                         esac
2651                 fi              
2652         fi
2653         if $test "X$issymlink" = X; then
2654                 if $test -L sym 2>/dev/null; then
2655                         issymlink="$test -L"
2656                         echo "The builtin '$test -L' worked." >&4
2657                 fi
2658         fi
2659         if $test "X$issymlink" != X; then
2660                 echo "You can test for symbolic links with '$issymlink'." >&4
2661         else
2662                 echo "I do not know how you can test for symbolic links." >&4
2663         fi
2664         $rm -f blurfl sym
2665         ;;
2666 *)      echo "No symbolic links, so not testing for their testing..." >&4
2667         ;;
2668 esac
2669 echo " "
2670
2671 : Make symlinks util
2672 case "$mksymlinks" in
2673 $define|true|[yY]*)
2674         case "$src" in
2675         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2676                 exit 1
2677                 ;;
2678         *)      case "$lns:$issymlink" in
2679                 *"ln"*" -s:"*"test -"?)
2680                         echo "Creating the symbolic links..." >&4
2681                         echo "(First creating the subdirectories...)" >&4
2682                         cd ..
2683                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2684                                 read directory
2685                                 test -z "$directory" && break
2686                                 mkdir -p $directory
2687                         done
2688                         # Sanity check 1.
2689                         if test ! -d t/base; then
2690                                 echo "Failed to create the subdirectories.  Aborting." >&4
2691                                 exit 1
2692                         fi
2693                         echo "(Then creating the symlinks...)" >&4
2694                         awk '{print $1}' $src/MANIFEST | while true; do
2695                                 read filename
2696                                 test -z "$filename" && break
2697                                 if test -f $filename; then
2698                                         if $issymlink $filename; then
2699                                                 rm -f $filename
2700                                         fi
2701                                 fi
2702                                 if test -f $filename; then
2703                                         echo "$filename already exists, not symlinking."
2704                                 else
2705                                         ln -s $src/$filename $filename
2706                                 fi
2707                         done
2708                         # Sanity check 2.
2709                         if test ! -f t/base/lex.t; then
2710                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2711                                 exit 1
2712                         fi
2713                         cd UU
2714                         ;;
2715                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2716                         ;;
2717                 esac
2718                 ;;
2719         esac
2720         ;;
2721 esac
2722
2723 : Check for Cross-Compilation
2724 case "$usecrosscompile" in
2725 $define|true|[yY]*)
2726         $echo "Cross-compiling..."
2727         croak=''
2728         case "$cc" in
2729         *-*-gcc) # A cross-compiling gcc, probably.
2730             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2731             ar=$targetarch-ar
2732             # leave out ld, choosing it is more complex
2733             nm=$targetarch-nm
2734             ranlib=$targetarch-ranlib
2735             $echo 'extern int foo;' > try.c
2736             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2737             shift
2738             if $test $# -gt 0; then
2739                 incpth="$incpth $*"
2740                 incpth="`$echo $incpth|$sed 's/^ //'`"
2741                 echo "Guessing incpth '$incpth'." >&4
2742                 for i in $*; do
2743                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2744                     if $test -d $j; then
2745                         libpth="$libpth $j"
2746                     fi
2747                 done   
2748                 libpth="`$echo $libpth|$sed 's/^ //'`"
2749                 echo "Guessing libpth '$libpth'." >&4
2750             fi
2751             $rm -f try.c
2752             ;;
2753         esac
2754         case "$targetarch" in
2755         '') echo "Targetarch not defined." >&4; croak=y ;;
2756         *)  echo "Using targetarch $targetarch." >&4 ;;
2757         esac
2758         case "$incpth" in
2759         '') echo "Incpth not defined." >&4; croak=y ;;
2760         *)  echo "Using incpth '$incpth'." >&4 ;;
2761         esac
2762         case "$libpth" in
2763         '') echo "Libpth not defined." >&4; croak=y ;;
2764         *)  echo "Using libpth '$libpth'." >&4 ;;
2765         esac
2766         case "$usrinc" in
2767         '') for i in $incpth; do
2768                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2769                     usrinc=$i
2770                     echo "Guessing usrinc $usrinc." >&4
2771                     break
2772                 fi
2773             done
2774             case "$usrinc" in
2775             '') echo "Usrinc not defined." >&4; croak=y ;;
2776             esac
2777             ;;
2778         *)  echo "Using usrinc $usrinc." >&4 ;;
2779         esac
2780         case "$targethost" in
2781         '') echo "Targethost not defined." >&4; croak=y ;;
2782         *)  echo "Using targethost $targethost." >&4
2783         esac
2784         locincpth=' '
2785         loclibpth=' '
2786         case "$croak" in
2787         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2788         esac
2789         case "$src" in
2790         /*) run=$src/Cross/run
2791             targetmkdir=$src/Cross/mkdir
2792             to=$src/Cross/to
2793             from=$src/Cross/from
2794             ;;
2795         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2796             run=$pwd/Cross/run
2797             targetmkdir=$pwd/Cross/mkdir
2798             to=$pwd/Cross/to
2799             from=$pwd/Cross/from
2800             ;;
2801         esac
2802         case "$targetrun" in
2803         '') targetrun=ssh ;;
2804         esac
2805         case "$targetto" in
2806         '') targetto=scp ;;
2807         esac
2808         case "$targetfrom" in
2809         '') targetfrom=scp ;;
2810         esac
2811         run=$run-$targetrun
2812         to=$to-$targetto
2813         from=$from-$targetfrom
2814         case "$targetdir" in
2815         '')  targetdir=/tmp
2816              echo "Guessing targetdir $targetdir." >&4
2817              ;;
2818         esac
2819         case "$targetuser" in
2820         '')  targetuser=root
2821              echo "Guessing targetuser $targetuser." >&4
2822              ;;
2823         esac
2824         case "$targetfrom" in
2825         scp)    q=-q ;;
2826         *)      q='' ;;
2827         esac
2828         case "$targetrun" in
2829         ssh|rsh)
2830             cat >$run <<EOF
2831 #!/bin/sh
2832 case "\$1" in
2833 -cwd)
2834   shift
2835   cwd=\$1
2836   shift
2837   ;;
2838 esac
2839 case "\$cwd" in
2840 '') cwd=$targetdir ;;
2841 esac
2842 exe=\$1
2843 shift
2844 if $test ! -f \$exe.xok; then
2845   $to \$exe
2846   $touch \$exe.xok
2847 fi
2848 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2849 EOF
2850             ;;
2851         *)  echo "Unknown targetrun '$targetrun'" >&4
2852             exit 1
2853             ;;
2854         esac
2855         case "$targetmkdir" in
2856         */Cross/mkdir)
2857             cat >$targetmkdir <<EOF
2858 #!/bin/sh
2859 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2860 EOF
2861             $chmod a+rx $targetmkdir
2862             ;;
2863         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2864             exit 1
2865             ;;
2866         esac
2867         case "$targetto" in
2868         scp|rcp)
2869             cat >$to <<EOF
2870 #!/bin/sh
2871 for f in \$@
2872 do
2873   case "\$f" in
2874   /*)
2875     $targetmkdir \`dirname \$f\`
2876     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2877     ;;
2878   *)
2879     $targetmkdir $targetdir/\`dirname \$f\`
2880     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2881     ;;
2882   esac
2883 done
2884 exit 0
2885 EOF
2886             ;;
2887         cp) cat >$to <<EOF
2888 #!/bin/sh
2889 for f in \$@
2890 do
2891   case "\$f" in
2892   /*)
2893     $mkdir -p $targetdir/\`dirname \$f\`
2894     $cp \$f $targetdir/\$f || exit 1
2895     ;;
2896   *)
2897     $targetmkdir $targetdir/\`dirname \$f\`
2898     $cp \$f $targetdir/\$f || exit 1
2899     ;;
2900   esac
2901 done
2902 exit 0
2903 EOF
2904             ;;
2905         *)  echo "Unknown targetto '$targetto'" >&4
2906             exit 1
2907             ;;
2908         esac
2909         case "$targetfrom" in
2910         scp|rcp)
2911           cat >$from <<EOF
2912 #!/bin/sh
2913 for f in \$@
2914 do
2915   $rm -f \$f
2916   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2917 done
2918 exit 0
2919 EOF
2920             ;;
2921         cp) cat >$from <<EOF
2922 #!/bin/sh
2923 for f in \$@
2924 do
2925   $rm -f \$f
2926   cp $targetdir/\$f . || exit 1
2927 done
2928 exit 0
2929 EOF
2930             ;;
2931         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2932             exit 1
2933             ;;
2934         esac
2935         if $test ! -f $run; then
2936             echo "Target 'run' script '$run' not found." >&4
2937         else
2938             $chmod a+rx $run
2939         fi
2940         if $test ! -f $to; then
2941             echo "Target 'to' script '$to' not found." >&4
2942         else
2943             $chmod a+rx $to
2944         fi
2945         if $test ! -f $from; then
2946             echo "Target 'from' script '$from' not found." >&4
2947         else
2948             $chmod a+rx $from
2949         fi
2950         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2951             exit 1
2952         fi
2953         cat >&4 <<EOF
2954 Using '$run' for remote execution,
2955 and '$from' and '$to'
2956 for remote file transfer.
2957 EOF
2958         ;;
2959 *)      run=''
2960         to=:
2961         from=:
2962         usecrosscompile='undef'
2963         targetarch=''
2964         ;;
2965 esac
2966
2967 : see whether [:lower:] and [:upper:] are supported character classes
2968 echo " "
2969 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2970 ABYZ)
2971         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2972         up='[:upper:]'
2973         low='[:lower:]'
2974         ;;
2975 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2976         # (0xd9 and 0xe2), therefore that is a nice testing point.
2977         if test "X$up" = X -o "X$low" = X; then
2978             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2979             rs) up='[A-Z]'
2980                 low='[a-z]'
2981                 ;;
2982             esac
2983         fi
2984         if test "X$up" = X -o "X$low" = X; then
2985             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2986             rs) up='A-Z'
2987                 low='a-z'
2988                 ;;
2989             esac
2990         fi
2991         if test "X$up" = X -o "X$low" = X; then
2992             case "`echo RS | od -x 2>/dev/null`" in
2993             *D9E2*|*d9e2*)
2994                 echo "Hey, this might be EBCDIC." >&4
2995                 if test "X$up" = X -o "X$low" = X; then
2996                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2997                     rs) up='[A-IJ-RS-Z]'
2998                         low='[a-ij-rs-z]'
2999                         ;;
3000                     esac
3001                 fi
3002                 if test "X$up" = X -o "X$low" = X; then
3003                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3004                     rs) up='A-IJ-RS-Z'
3005                         low='a-ij-rs-z'
3006                         ;;
3007                     esac
3008                 fi
3009                 ;;
3010             esac
3011         fi
3012 esac
3013 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3014 rs)
3015     echo "Using $up and $low to convert case." >&4
3016     ;;
3017 *)
3018     echo "I don't know how to translate letters from upper to lower case." >&4
3019     echo "Your tr is not acting any way I know of." >&4
3020     exit 1
3021     ;;
3022 esac
3023 : set up the translation script tr, must be called with ./tr of course
3024 cat >tr <<EOSC
3025 $startsh
3026 case "\$1\$2" in
3027 '[A-Z][a-z]') exec $tr '$up' '$low';;
3028 '[a-z][A-Z]') exec $tr '$low' '$up';;
3029 esac
3030 exec $tr "\$@"
3031 EOSC
3032 chmod +x tr
3033 $eunicefix tr
3034
3035 : Try to determine whether config.sh was made on this system
3036 case "$config_sh" in
3037 '')
3038 myuname=`$uname -a 2>/dev/null`
3039 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3040 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3041 # because the A-Z/a-z are not consecutive.
3042 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3043         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3044 newmyuname="$myuname"
3045 dflt=n
3046 case "$knowitall" in
3047 '')
3048         if test -f ../config.sh; then
3049                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3050                         eval "`grep myuname= ../config.sh`"
3051                 fi
3052                 if test "X$myuname" = "X$newmyuname"; then
3053                         dflt=y
3054                 fi
3055         fi
3056         ;;
3057 *) dflt=y;;
3058 esac
3059
3060 : Get old answers from old config file if Configure was run on the
3061 : same system, otherwise use the hints.
3062 hint=default
3063 cd ..
3064 if test -f config.sh; then
3065         echo " "
3066         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3067         . UU/myread
3068         case "$ans" in
3069         n*|N*) echo "OK, I'll ignore it."
3070                 mv config.sh config.sh.old
3071                 myuname="$newmyuname"
3072                 ;;
3073         *)  echo "Fetching default answers from your old config.sh file..." >&4
3074                 tmp_n="$n"
3075                 tmp_c="$c"
3076                 tmp_sh="$sh"
3077                 . ./config.sh
3078                 cp config.sh UU
3079                 n="$tmp_n"
3080                 c="$tmp_c"
3081                 : Older versions did not always set $sh.  Catch re-use of such
3082                 : an old config.sh.
3083                 case "$sh" in
3084                 '') sh="$tmp_sh" ;;
3085                 esac
3086                 hint=previous
3087                 ;;
3088         esac
3089 fi
3090 . ./UU/checkcc
3091 if test ! -f config.sh; then
3092         $cat <<EOM
3093
3094 First time through, eh?  I have some defaults handy for some systems
3095 that need some extra help getting the Configure answers right:
3096
3097 EOM
3098         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3099         dflt=''
3100         : Half the following guesses are probably wrong... If you have better
3101         : tests or hints, please send them to perlbug@perl.org
3102         : The metaconfig authors would also appreciate a copy...
3103         $test -f /irix && osname=irix
3104         $test -f /xenix && osname=sco_xenix
3105         $test -f /dynix && osname=dynix
3106         $test -f /dnix && osname=dnix
3107         $test -f /lynx.os && osname=lynxos
3108         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3109         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3110         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3111         $test -f /bin/mips && /bin/mips && osname=mips
3112         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3113                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3114         $test -d /usr/apollo/bin && osname=apollo
3115         $test -f /etc/saf/_sactab && osname=svr4
3116         $test -d /usr/include/minix && osname=minix
3117         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3118         if $test -d /MachTen -o -d /MachTen_Folder; then
3119                 osname=machten
3120                 if $test -x /sbin/version; then
3121                         osvers=`/sbin/version | $awk '{print $2}' |
3122                         $sed -e 's/[A-Za-z]$//'`
3123                 elif $test -x /usr/etc/version; then
3124                         osvers=`/usr/etc/version | $awk '{print $2}' |
3125                         $sed -e 's/[A-Za-z]$//'`
3126                 else
3127                         osvers="$2.$3"
3128                 fi
3129         fi
3130
3131         $test -f /sys/posix.dll &&
3132                 $test -f /usr/bin/what &&
3133                 set X `/usr/bin/what /sys/posix.dll` &&
3134                 $test "$3" = UWIN &&
3135                 osname=uwin &&
3136                 osvers="$5"
3137
3138         if $test -f $uname; then
3139                 set X $myuname
3140                 shift
3141
3142                 case "$5" in
3143                 fps*) osname=fps ;;
3144                 mips*)
3145                         case "$4" in
3146                         umips) osname=umips ;;
3147                         *) osname=mips ;;
3148                         esac;;
3149                 [23]100) osname=mips ;;
3150                 next*) osname=next ;;
3151                 i386*)
3152                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3153                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3154                                 osname='sco'
3155                                 osvers=$tmp
3156                         elif $test -f /etc/kconfig; then
3157                                 osname=isc
3158                                 if test "$lns" = "$ln -s"; then
3159                                         osvers=4
3160                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3161                                         osvers=3
3162                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=2
3164                                 fi
3165                         fi
3166                         tmp=''
3167                         ;;
3168                 pc*)
3169                         if test -n "$DJGPP"; then
3170                                 osname=dos
3171                                 osvers=djgpp
3172                         fi
3173                         ;;
3174                 esac
3175
3176                 case "$1" in
3177                 aix) osname=aix
3178                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3179                         case "$tmp" in
3180                         # oslevel can fail with:
3181                         # oslevel: Unable to acquire lock.
3182                         *not\ found) osvers="$4"."$3" ;;
3183                         '<3240'|'<>3240') osvers=3.2.0 ;;
3184                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3185                         '=3250'|'>3250') osvers=3.2.5 ;;
3186                         *) osvers=$tmp;;
3187                         esac
3188                         ;;
3189                 bsd386) osname=bsd386
3190                         osvers=`$uname -r`
3191                         ;;
3192                 cygwin*) osname=cygwin
3193                         osvers="$3"
3194                         ;;
3195                 *dc.osx) osname=dcosx
3196                         osvers="$3"
3197                         ;;
3198                 dnix) osname=dnix
3199                         osvers="$3"
3200                         ;;
3201                 domainos) osname=apollo
3202                         osvers="$3"
3203                         ;;
3204                 dgux)   osname=dgux
3205                         osvers="$3"
3206                         ;;
3207                 dragonfly) osname=dragonfly
3208                         osvers="$3"
3209                         ;;
3210                 dynixptx*) osname=dynixptx
3211                         osvers=`echo "$4"|sed 's/^v//'`
3212                         ;;
3213                 freebsd) osname=freebsd
3214                         osvers="$3" ;;
3215                 genix)  osname=genix ;;
3216                 gnu)    osname=gnu
3217                         osvers="$3" ;;
3218                 hp*)    osname=hpux
3219                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3220                         ;;
3221                 irix*)  osname=irix
3222                         case "$3" in
3223                         4*) osvers=4 ;;
3224                         5*) osvers=5 ;;
3225                         *)      osvers="$3" ;;
3226                         esac
3227                         ;;
3228                 linux)  osname=linux
3229                         case "$3" in
3230                         *)      osvers="$3" ;;
3231                         esac
3232                         ;;
3233                 MiNT)   osname=mint
3234                         ;;
3235                 netbsd*) osname=netbsd
3236                         osvers="$3"
3237                         ;;
3238                 news-os) osvers="$3"
3239                         case "$3" in
3240                         4*) osname=newsos4 ;;
3241                         *) osname=newsos ;;
3242                         esac
3243                         ;;
3244                 next*) osname=next ;;
3245                 nonstop-ux) osname=nonstopux ;;
3246                 openbsd) osname=openbsd
3247                         osvers="$3"
3248                         ;;
3249                 os2)    osname=os2
3250                         osvers="$4"
3251                         ;;
3252                 POSIX-BC | posix-bc ) osname=posix-bc
3253                         osvers="$3"
3254                         ;;
3255                 powerux | power_ux | powermax_os | powermaxos | \
3256                 powerunix | power_unix) osname=powerux
3257                         osvers="$3"
3258                         ;;
3259                 qnx) osname=qnx
3260                         osvers="$4"
3261                         ;;
3262                 solaris) osname=solaris
3263                         case "$3" in
3264                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3265                         *)      osvers="$3" ;;
3266                         esac
3267                         ;;
3268                 sunos) osname=sunos
3269                         case "$3" in
3270                         5*) osname=solaris
3271                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3272                         *)      osvers="$3" ;;
3273                         esac
3274                         ;;
3275                 titanos) osname=titanos
3276                         case "$3" in
3277                         1*) osvers=1 ;;
3278                         2*) osvers=2 ;;
3279                         3*) osvers=3 ;;
3280                         4*) osvers=4 ;;
3281                         *)      osvers="$3" ;;
3282                         esac
3283                         ;;
3284                 ultrix) osname=ultrix
3285                         osvers="$3"
3286                         ;;
3287                 osf1|mls+)      case "$5" in
3288                                 alpha)
3289                                         osname=dec_osf
3290                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3291                                         case "$osvers" in
3292                                         [1-9].[0-9]*) ;;
3293                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3294                                         esac
3295                                         ;;
3296                         hp*)    osname=hp_osf1  ;;
3297                         mips)   osname=mips_osf1 ;;
3298                         esac
3299                         ;;
3300                 # UnixWare 7.1.2 is known as Open UNIX 8
3301                 openunix|unixware) osname=svr5
3302                         osvers="$4"
3303                         ;;
3304                 uts)    osname=uts
3305                         osvers="$3"
3306                         ;;
3307                 vos) osvers="$3"
3308                         ;;
3309                 $2) case "$osname" in
3310                         *isc*) ;;
3311                         *freebsd*) ;;
3312                         svr*)
3313                                 : svr4.x or possibly later
3314                                 case "svr$3" in
3315                                 ${osname}*)
3316                                         osname=svr$3
3317                                         osvers=$4
3318                                         ;;
3319                                 esac
3320                                 case "$osname" in
3321                                 svr4.0)
3322                                         : Check for ESIX
3323                                         if test -f /stand/boot ; then
3324                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3325                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3326                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3327                                                         if test -n "$isesix"; then
3328                                                                 osname=esix4
3329                                                         fi
3330                                                 fi
3331                                         fi
3332                                         ;;
3333                                 esac
3334                                 ;;
3335                         *)      if test -f /etc/systemid; then
3336                                         osname=sco
3337                                         set `echo $3 | $sed 's/\./ /g'` $4
3338                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3339                                                 osvers=$1.$2.$3
3340                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3341                                                 osvers=$1.$2
3342                                         elif $test -f $src/hints/sco_$1.sh; then
3343                                                 osvers=$1
3344                                         fi
3345                                 else
3346                                         case "$osname" in
3347                                         '') : Still unknown.  Probably a generic Sys V.
3348                                                 osname="sysv"
3349                                                 osvers="$3"
3350                                                 ;;
3351                                         esac
3352                                 fi
3353                                 ;;
3354                         esac
3355                         ;;
3356                 *)      case "$osname" in
3357                         '') : Still unknown.  Probably a generic BSD.
3358                                 osname="$1"
3359                                 osvers="$3"
3360                                 ;;
3361                         esac
3362                         ;;
3363                 esac
3364         else
3365                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3366                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3367                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3368                                 osname=news_os
3369                         fi
3370                         $rm -f UU/kernel.what
3371                 elif test -d c:/. -o -n "$is_os2" ; then
3372                         set X $myuname
3373                         osname=os2
3374                         osvers="$5"
3375                 fi
3376         fi
3377
3378         case "$targetarch" in
3379         '') ;;
3380         *)  hostarch=$osname
3381             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3382             osvers=''
3383             ;;
3384         esac
3385
3386         : Now look for a hint file osname_osvers, unless one has been
3387         : specified already.
3388         case "$hintfile" in
3389         ''|' ')
3390                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3391                 : Also try without trailing minor version numbers.
3392                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3393                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3394                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3395                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3396                 case "$file" in
3397                 '') dflt=none ;;
3398                 *)  case "$osvers" in
3399                         '') dflt=$file
3400                                 ;;
3401                         *)  if $test -f $src/hints/$file.sh ; then
3402                                         dflt=$file
3403                                 elif $test -f $src/hints/$xfile.sh ; then
3404                                         dflt=$xfile
3405                                 elif $test -f $src/hints/$xxfile.sh ; then
3406                                         dflt=$xxfile
3407                                 elif $test -f $src/hints/$xxxfile.sh ; then
3408                                         dflt=$xxxfile
3409                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3410                                         dflt=$xxxxfile
3411                                 elif $test -f "$src/hints/${osname}.sh" ; then
3412                                         dflt="${osname}"
3413                                 else
3414                                         dflt=none
3415                                 fi
3416                                 ;;
3417                         esac
3418                         ;;
3419                 esac
3420                 if $test -f Policy.sh ; then
3421                         case "$dflt" in
3422                         *Policy*) ;;
3423                         none) dflt="Policy" ;;
3424                         *) dflt="Policy $dflt" ;;
3425                         esac
3426                 fi
3427                 ;;
3428         *)
3429                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3430                 ;;
3431         esac
3432
3433         if $test -f Policy.sh ; then
3434                 $cat <<EOM
3435
3436 There's also a Policy hint file available, which should make the
3437 site-specific (policy) questions easier to answer.
3438 EOM
3439
3440         fi
3441
3442         $cat <<EOM
3443
3444 You may give one or more space-separated answers, or "none" if appropriate.
3445 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3446 previous run of Configure, you may specify it as well as or instead of
3447 OS-specific hints.  If hints are provided for your OS, you should use them:
3448 although Perl can probably be built without hints on many platforms, using
3449 hints often improve performance and may enable features that Configure can't
3450 set up on its own. If there are no hints that match your OS, specify "none";
3451 DO NOT give a wrong version or a wrong OS.
3452
3453 EOM
3454
3455         rp="Which of these apply, if any?"
3456         . UU/myread
3457         tans=$ans
3458         for file in $tans; do
3459                 if $test X$file = XPolicy -a -f Policy.sh; then
3460                         . Policy.sh
3461                         $cat Policy.sh >> UU/config.sh
3462                 elif $test -f $src/hints/$file.sh; then
3463                         . $src/hints/$file.sh
3464                         $cat $src/hints/$file.sh >> UU/config.sh
3465                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3466                         : nothing
3467                 else
3468                         : Give one chance to correct a possible typo.
3469                         echo "$file.sh does not exist"
3470                         dflt=$file
3471                         rp="hint to use instead?"
3472                         . UU/myread
3473                         for file in $ans; do
3474                                 if $test -f "$src/hints/$file.sh"; then
3475                                         . $src/hints/$file.sh
3476                                         $cat $src/hints/$file.sh >> UU/config.sh
3477                                 elif $test X$ans = X -o X$ans = Xnone ; then
3478                                         : nothing
3479                                 else
3480                                         echo "$file.sh does not exist -- ignored."
3481                                 fi
3482                         done
3483                 fi
3484         done
3485
3486         hint=recommended
3487         : Remember our hint file for later.
3488         if $test -f "$src/hints/$file.sh" ; then
3489                 hintfile="$file"
3490         else
3491                 hintfile=''
3492         fi
3493 fi
3494 cd UU
3495 ;;
3496 *)
3497         echo " "
3498         echo "Fetching default answers from $config_sh..." >&4
3499         tmp_n="$n"
3500         tmp_c="$c"
3501         cd ..
3502         cp $config_sh config.sh 2>/dev/null
3503         chmod +w config.sh
3504         . ./config.sh
3505         cd UU
3506         cp ../config.sh .
3507         n="$tmp_n"
3508         c="$tmp_c"
3509         hint=previous
3510         ;;
3511 esac
3512 test "$override" && . ./optdef.sh
3513
3514 : Restore computed paths
3515 for file in $loclist $trylist; do
3516         eval $file="\$_$file"
3517 done
3518
3519 cat << EOM
3520
3521 Configure uses the operating system name and version to set some defaults.
3522 The default value is probably right if the name rings a bell. Otherwise,
3523 since spelling matters for me, either accept the default or answer "none"
3524 to leave it blank.
3525
3526 EOM
3527 case "$osname" in
3528         ''|' ')
3529                 case "$hintfile" in
3530                 ''|' '|none) dflt=none ;;
3531                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3532                 esac
3533                 ;;
3534         *) dflt="$osname" ;;
3535 esac
3536 rp="Operating system name?"
3537 . ./myread
3538 case "$ans" in
3539 none)  osname='' ;;
3540 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3541 esac
3542 echo " "
3543 case "$osvers" in
3544         ''|' ')
3545                 case "$hintfile" in
3546                 ''|' '|none) dflt=none ;;
3547                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3548                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3549                         case "$dflt" in
3550                         ''|' ') dflt=none ;;
3551                         esac
3552                         ;;
3553                 esac
3554                 ;;
3555         *) dflt="$osvers" ;;
3556 esac
3557 rp="Operating system version?"
3558 . ./myread
3559 case "$ans" in
3560 none)  osvers='' ;;
3561 *) osvers="$ans" ;;
3562 esac
3563
3564
3565 . ./posthint.sh
3566
3567 : who configured the system
3568 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3569 case "$cf_by" in
3570 "")
3571         cf_by=`(logname) 2>/dev/null`
3572         case "$cf_by" in
3573         "")
3574                 cf_by=`(whoami) 2>/dev/null`
3575                 case "$cf_by" in
3576                 "") cf_by=unknown ;;
3577                 esac ;;
3578         esac ;;
3579 esac
3580
3581 : decide how portable to be.  Allow command line overrides.
3582 case "$d_portable" in
3583 "$undef") ;;
3584 *)      d_portable="$define" ;;
3585 esac
3586
3587 : set up shell script to do ~ expansion
3588 cat >filexp <<EOSS
3589 $startsh
3590 : expand filename
3591 case "\$1" in
3592  ~/*|~)
3593         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3594         ;;
3595  ~*)
3596         if $test -f /bin/csh; then
3597                 /bin/csh -f -c "glob \$1"
3598                 failed=\$?
3599                 echo ""
3600                 exit \$failed
3601         else
3602                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3603                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3604                 if $test ! -d "\$dir"; then
3605                         me=\`basename \$0\`
3606                         echo "\$me: can't locate home directory for: \$name" >&2
3607                         exit 1
3608                 fi
3609                 case "\$1" in
3610                 */*)
3611                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3612                         ;;
3613                 *)
3614                         echo \$dir
3615                         ;;
3616                 esac
3617         fi
3618         ;;
3619 *)
3620         echo \$1
3621         ;;
3622 esac
3623 EOSS
3624 chmod +x filexp
3625 $eunicefix filexp
3626
3627 : now set up to get a file name
3628 cat <<EOS >getfile
3629 $startsh
3630 EOS
3631 cat <<'EOSC' >>getfile
3632 tilde=''
3633 fullpath=''
3634 already=''
3635 skip=''
3636 none_ok=''
3637 exp_file=''
3638 nopath_ok=''
3639 orig_rp="$rp"
3640 orig_dflt="$dflt"
3641 case "$gfpth" in
3642 '') gfpth='.' ;;
3643 esac
3644
3645 case "$fn" in
3646 *\(*)
3647         : getfile will accept an answer from the comma-separated list
3648         : enclosed in parentheses even if it does not meet other criteria.
3649         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3650         fn=`echo $fn | sed 's/(.*)//'`
3651         ;;
3652 esac
3653
3654 case "$fn" in
3655 *:*)
3656         loc_file=`expr $fn : '.*:\(.*\)'`
3657         fn=`expr $fn : '\(.*\):.*'`
3658         ;;
3659 esac
3660
3661 case "$fn" in
3662 *~*) tilde=true;;
3663 esac
3664 case "$fn" in
3665 */*) fullpath=true;;
3666 esac
3667 case "$fn" in
3668 *+*) skip=true;;
3669 esac
3670 case "$fn" in
3671 *n*) none_ok=true;;
3672 esac
3673 case "$fn" in
3674 *e*) exp_file=true;;
3675 esac
3676 case "$fn" in
3677 *p*) nopath_ok=true;;
3678 esac
3679
3680 case "$fn" in
3681 *f*) type='File';;
3682 *d*) type='Directory';;
3683 *l*) type='Locate';;
3684 esac
3685
3686 what="$type"
3687 case "$what" in
3688 Locate) what='File';;
3689 esac
3690
3691 case "$exp_file" in
3692 '')
3693         case "$d_portable" in
3694         "$define") ;;
3695         *) exp_file=true;;
3696         esac
3697         ;;
3698 esac
3699
3700 cd ..
3701 while test "$type"; do
3702         redo=''
3703         rp="$orig_rp"
3704         dflt="$orig_dflt"
3705         case "$tilde" in
3706         true) rp="$rp (~name ok)";;
3707         esac
3708         . UU/myread
3709         if test -f UU/getfile.ok && \
3710                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3711         then
3712                 value="$ans"
3713                 ansexp="$ans"
3714                 break
3715         fi
3716         case "$ans" in
3717         none)
3718                 value=''
3719                 ansexp=''
3720                 case "$none_ok" in
3721                 true) type='';;
3722                 esac
3723                 ;;
3724         *)
3725                 case "$tilde" in
3726                 '') value="$ans"
3727                         ansexp="$ans";;
3728                 *)
3729                         value=`UU/filexp $ans`
3730                         case $? in
3731                         0)
3732                                 if test "$ans" != "$value"; then
3733                                         echo "(That expands to $value on this system.)"
3734                                 fi
3735                                 ;;
3736                         *) value="$ans";;
3737                         esac
3738                         ansexp="$value"
3739                         case "$exp_file" in
3740                         '') value="$ans";;
3741                         esac
3742                         ;;
3743                 esac
3744                 case "$fullpath" in
3745                 true)
3746                         case "$ansexp" in
3747                         /*) value="$ansexp" ;;
3748                         [a-zA-Z]:/*) value="$ansexp" ;;
3749                         *)
3750                                 redo=true
3751                                 case "$already" in
3752                                 true)
3753                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3754                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3755                                         ;;
3756                                 *)
3757                                 echo "Please give a full path name, starting with slash." >&4
3758                                         case "$tilde" in
3759                                         true)
3760                                 echo "Note that using ~name is ok provided it expands well." >&4
3761                                                 already=true
3762                                                 ;;
3763                                         esac
3764                                 esac
3765                                 ;;
3766                         esac
3767                         ;;
3768                 esac
3769                 case "$redo" in
3770                 '')
3771                         case "$type" in
3772                         File)
3773                                 for fp in $gfpth; do
3774                                         if test "X$fp" = X.; then
3775                                             pf="$ansexp"
3776                                         else    
3777                                             pf="$fp/$ansexp"
3778                                         fi
3779                                         if test -f "$pf"; then
3780                                                 type=''
3781                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3782                                         then
3783                                                 echo "($value is not a plain file, but that's ok.)"
3784                                                 type=''
3785                                         fi
3786                                         if test X"$type" = X; then
3787                                             value="$pf"
3788                                             break
3789                                         fi
3790                                 done
3791                                 ;;
3792                         Directory)
3793                                 for fp in $gfpth; do
3794                                         if test "X$fp" = X.; then
3795                                             dir="$ans"
3796                                             direxp="$ansexp"
3797                                         else    
3798                                             dir="$fp/$ansexp"
3799                                             direxp="$fp/$ansexp"
3800                                         fi
3801                                         if test -d "$direxp"; then
3802                                                 type=''
3803                                                 value="$dir"
3804                                                 break
3805                                         fi
3806                                 done
3807                                 ;;
3808                         Locate)
3809                                 if test -d "$ansexp"; then
3810                                         echo "(Looking for $loc_file in directory $value.)"
3811                                         value="$value/$loc_file"
3812                                         ansexp="$ansexp/$loc_file"
3813                                 fi
3814                                 if test -f "$ansexp"; then
3815                                         type=''
3816                                 fi
3817                                 case "$nopath_ok" in
3818                                 true)   case "$value" in
3819                                         */*) ;;
3820                                         *)      echo "Assuming $value will be in people's path."
3821                                                 type=''
3822                                                 ;;
3823                                         esac
3824                                         ;;
3825                                 esac
3826                                 ;;
3827                         esac
3828
3829                         case "$skip" in
3830                         true) type='';
3831                         esac
3832
3833                         case "$type" in
3834                         '') ;;
3835                         *)
3836                                 if test "$fastread" = yes; then
3837                                         dflt=y
3838                                 else
3839                                         dflt=n
3840                                 fi
3841                                 rp="$what $value doesn't exist.  Use that name anyway?"
3842                                 . UU/myread
3843                                 dflt=''
3844                                 case "$ans" in
3845                                 y*) type='';;
3846                                 *) echo " ";;
3847                                 esac
3848                                 ;;
3849                         esac
3850                         ;;
3851                 esac
3852                 ;;
3853         esac
3854 done
3855 cd UU
3856 ans="$value"
3857 rp="$orig_rp"
3858 dflt="$orig_dflt"
3859 rm -f getfile.ok
3860 test "X$gfpthkeep" != Xy && gfpth=""
3861 EOSC
3862
3863 : determine root of directory hierarchy where package will be installed.
3864 case "$prefix" in
3865 '')
3866         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3867         ;;
3868 *?/)
3869         dflt=`echo "$prefix" | sed 's/.$//'`
3870         ;;
3871 *)
3872         dflt="$prefix"
3873         ;;
3874 esac
3875 $cat <<EOM
3876
3877 By default, $package will be installed in $dflt/bin, manual pages
3878 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3879 installation directories. Typically this is something like /usr/local.
3880 If you wish to have binaries under /usr/bin but other parts of the
3881 installation under /usr/local, that's ok: you will be prompted
3882 separately for each of the installation directories, the prefix being
3883 only used to set the defaults.
3884
3885 EOM
3886 fn=d~
3887 rp='Installation prefix to use?'
3888 . ./getfile
3889 oldprefix=''
3890 case "$prefix" in
3891 '') ;;
3892 *)
3893         case "$ans" in
3894         "$prefix") ;;
3895         *) oldprefix="$prefix";;
3896         esac
3897         ;;
3898 esac
3899 prefix="$ans"
3900 prefixexp="$ansexp"
3901
3902 : allow them to override the AFS root
3903 case "$afsroot" in
3904 '')     afsroot=/afs ;;
3905 *)      afsroot=$afsroot ;;
3906 esac
3907
3908 : is AFS running?
3909 echo " "
3910 case "$afs" in
3911 $define|true)   afs=true ;;
3912 $undef|false)   afs=false ;;
3913 *)      if $test -d $afsroot; then
3914                 afs=true
3915         else
3916                 afs=false
3917         fi
3918         ;;
3919 esac
3920 if $afs; then
3921         echo "AFS may be running... I'll be extra cautious then..." >&4
3922 else
3923         echo "AFS does not seem to be running..." >&4
3924 fi
3925
3926 : determine installation prefix for where package is to be installed.
3927 if $afs; then 
3928 $cat <<EOM
3929
3930 Since you are running AFS, I need to distinguish the directory in which
3931 files will reside from the directory in which they are installed (and from
3932 which they are presumably copied to the former directory by occult means).
3933
3934 EOM
3935         case "$installprefix" in
3936         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3937         *) dflt="$installprefix";;
3938         esac
3939 else
3940 $cat <<EOM
3941
3942 In some special cases, particularly when building $package for distribution,
3943 it is convenient to distinguish the directory in which files should be
3944 installed from the directory ($prefix) in which they will
3945 eventually reside.  For most users, these two directories are the same.
3946
3947 EOM
3948         case "$installprefix" in
3949         '') dflt=$prefix ;;
3950         *) dflt=$installprefix;;
3951         esac
3952 fi
3953 fn=d~
3954 rp='What installation prefix should I use for installing files?'
3955 . ./getfile
3956 installprefix="$ans"
3957 installprefixexp="$ansexp"
3958
3959 : Perform the prefixexp/installprefixexp correction if necessary
3960 cat <<EOS >installprefix
3961 $startsh
3962 EOS
3963 cat <<'EOSC' >>installprefix
3964 : Change installation prefix, if necessary.
3965 if $test X"$prefix" != X"$installprefix"; then
3966     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3967 else
3968     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3969 fi
3970 EOSC
3971 chmod +x installprefix
3972 $eunicefix installprefix
3973
3974 : Set variables such as privlib and privlibexp from the output of ./getfile
3975 : performing the prefixexp/installprefixexp correction if necessary.
3976 cat <<EOS >setprefixvar
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>setprefixvar
3980 eval "${prefixvar}=\"\$ans\""
3981 eval "${prefixvar}exp=\"\$ansexp\""
3982 . ./installprefix
3983 EOSC
3984 chmod +x setprefixvar
3985 $eunicefix setprefixvar
3986
3987 : set up the script used to warn in case of inconsistency
3988 cat <<EOS >whoa
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>whoa
3992 dflt=y
3993 case "$hint" in
3994     recommended)
3995         case "$hintfile" in
3996         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3997                 ;;
3998         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3999                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4000                 ;;
4001         esac
4002         ;;
4003     *)  echo " "
4004         echo "*** WHOA THERE!!! ***" >&4
4005         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4006         ;;
4007 esac
4008 rp="    Keep the $hint value?"
4009 . ./myread
4010 case "$ans" in
4011 y) td=$was; tu=$was;;
4012 esac
4013 EOSC
4014
4015 : function used to set $1 to $val
4016 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4017 case "$val$was" in
4018 $define$undef) . ./whoa; eval "$var=\$td";;
4019 $undef$define) . ./whoa; eval "$var=\$tu";;
4020 *) eval "$var=$val";;
4021 esac'
4022
4023 : Check is we will use socks
4024 case "$usesocks" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *) dflt='n';;
4027 esac
4028 cat <<EOM
4029
4030 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4031 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4032 to use the PerlIO abstraction layer, this will be implicitly selected.
4033
4034 If this doesn't make any sense to you, just accept the default '$dflt'.
4035 EOM
4036 rp='Build Perl for SOCKS?'
4037 . ./myread
4038 case "$ans" in
4039 y|Y)    val="$define" ;;
4040 *)      val="$undef" ;;
4041 esac
4042 set usesocks
4043 eval $setvar
4044
4045 case "$usesocks" in
4046 $define|true|[yY]*) useperlio="$define";;
4047 esac
4048
4049 : Check if we want perlio
4050 case "$useperlio" in
4051 $define|true|[yY]*|'')  dflt='y';;
4052 *) dflt='n';;
4053 esac
4054 cat <<EOM
4055
4056 Previous version of $package used the standard IO mechanisms as
4057 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4058 alternate IO mechanisms via the PerlIO abstraction layer, but the
4059 stdio mechanism is still available if needed.  The abstraction layer
4060 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4061 Using PerlIO with sfio may cause problems with some extension modules.
4062
4063 If this doesn't make any sense to you, just accept the default '$dflt'.
4064 EOM
4065 rp='Use the PerlIO abstraction layer?'
4066 . ./myread
4067 case "$ans" in
4068 y|Y)
4069         val="$define"
4070         ;;
4071 *)
4072         echo "Ok, doing things the stdio way."
4073         val="$undef"
4074         ;;
4075 esac
4076 set useperlio
4077 eval $setvar
4078
4079 case "$usesocks" in
4080 $define|true|[yY]*)
4081         case "$useperlio" in
4082         $define|true|[yY]*) ;;
4083         *)      cat >&4 <<EOM
4084
4085 You are using the SOCKS proxy protocol library which means that you
4086 should also use the PerlIO layer.  You may be headed for trouble.
4087
4088 EOM
4089                 ;;
4090         esac
4091         ;;
4092 esac
4093
4094 : get the patchlevel
4095 echo " "
4096 echo "Getting the current patchlevel..." >&4
4097 if $test -r $rsrc/patchlevel.h;then
4098         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4099         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4100         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4102         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4104         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4105 else
4106         revision=0
4107         patchlevel=0
4108         subversion=0
4109         api_revision=0
4110         api_version=0
4111         api_subversion=0
4112         perl_patchlevel=0
4113         $echo "(You do not have patchlevel.h.  Eek.)"
4114 fi
4115 if $test -r $rsrc/.patch ; then
4116         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4117                 perl_patchlevel=`cat $rsrc/.patch`
4118         fi
4119 fi
4120 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4121 version_patchlevel_string="version $patchlevel subversion $subversion"
4122 case "$perl_patchlevel" in
4123 0|'') ;;
4124 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4125 esac
4126
4127 $echo "(You have $package $version_patchlevel_string.)"
4128
4129 case "$osname" in
4130 dos|vms)
4131         : XXX Should be a Configure test for double-dots in filenames.
4132         version=`echo $revision $patchlevel $subversion | \
4133                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4134         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         ;;
4137 *)
4138         version=`echo $revision $patchlevel $subversion | \
4139                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4140         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         ;;
4143 esac
4144 : Special case the 5.005_xx maintenance series, which used 5.005
4145 : without any subversion label as a subdirectory in $sitelib
4146 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4147         api_versionstring='5.005'
4148 fi
4149
4150 : Do we want threads support and if so, what type
4151 case "$usethreads" in
4152 $define|true|[yY]*)     dflt='y';;
4153 *)     # Catch case where user specified ithreads or 5005threads but
4154        # forgot -Dusethreads (A.D. 4/2002)
4155        case "$useithreads$use5005threads" in
4156        *$define*)
4157                 case "$useperlio" in
4158                 "$define")      dflt='y' ;;
4159                 *)              dflt='n' ;;
4160                 esac
4161                 ;;
4162        *)       dflt='n';;
4163        esac
4164        ;;
4165 esac
4166 cat <<EOM
4167
4168 Perl can be built to take advantage of threads on some systems.
4169 To do so, Configure can be run with -Dusethreads.
4170
4171 Note that Perl built with threading support runs slightly slower
4172 and uses more memory than plain Perl. The current implementation
4173 is believed to be stable, but it is fairly new, and so should be
4174 treated with caution.
4175
4176 If this doesn't make any sense to you, just accept the default '$dflt'.
4177 EOM
4178 rp='Build a threading Perl?'
4179 . ./myread
4180 case "$ans" in
4181 y|Y)    val="$define" ;;
4182 *)      val="$undef" ;;
4183 esac
4184 set usethreads
4185 eval $setvar
4186
4187 if $test $patchlevel -lt 9; then
4188     case "$usethreads" in
4189     $define)
4190         $cat <<EOM
4191
4192 Since release 5.6, Perl has had two different threading implementations,
4193 the newer interpreter-based version (ithreads) with one interpreter per
4194 thread, and the older 5.005 version (5005threads).
4195 The 5005threads version is effectively unmaintained and will probably be
4196 removed in Perl 5.10, so there should be no need to build a Perl using it
4197 unless needed for backwards compatibility with some existing 5.005threads
4198 code.
4199
4200 EOM
4201         : Default to ithreads unless overridden on command line or with
4202         : old config.sh
4203         dflt='y'
4204         case "$use5005threads" in
4205                 $define|true|[yY]*) dflt='n';;
4206         esac
4207         case "$useithreads" in
4208                 $undef|false|[nN]*) dflt='n';;
4209         esac
4210         rp='Use the newer interpreter-based ithreads?'
4211         . ./myread
4212         case "$ans" in
4213         y|Y)    val="$define" ;;
4214         *)      val="$undef" ;;
4215         esac
4216         set useithreads
4217         eval $setvar
4218         : Now set use5005threads to the opposite value.
4219         case "$useithreads" in
4220         $define) val="$undef" ;;
4221         *) val="$define" ;;
4222         esac
4223         set use5005threads
4224         eval $setvar
4225         ;;
4226     *)
4227         useithreads="$undef"
4228         use5005threads="$undef"
4229         ;;
4230     esac
4231
4232     case "$useithreads$use5005threads" in
4233     "$define$define")
4234         $cat >&4 <<EOM
4235
4236 You cannot have both the ithreads and the 5.005 threads enabled
4237 at the same time.  Disabling the 5.005 threads since they are
4238 much less stable than the ithreads.
4239
4240 EOM
4241         use5005threads="$undef"
4242         ;;
4243     esac
4244
4245 else
4246 : perl-5.9.x and later
4247
4248     if test X"$usethreads" = "X$define"; then
4249         case "$use5005threads" in
4250             $define|true|[yY]*)
4251                 $cat >&4 <<EOM
4252
4253 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4254
4255 EOM
4256             ;;
4257         esac
4258     fi
4259
4260     use5005threads="$undef"
4261     useithreads="$usethreads"
4262 fi
4263
4264 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4265         cat >&4 <<EOF
4266 ***
4267 *** To build with ithreads you must also use the PerlIO layer.
4268 *** Cannot continue, aborting.
4269 ***
4270 EOF
4271         exit 1
4272 fi
4273
4274 case "$d_oldpthreads" in
4275 '')     : Configure tests would be welcome here.  For now, assume undef.
4276         val="$undef" ;;
4277 *)      val="$d_oldpthreads" ;;
4278 esac
4279 set d_oldpthreads
4280 eval $setvar
4281
4282
4283 : Look for a hint-file generated 'call-back-unit'.  If the
4284 : user has specified that a threading perl is to be built,
4285 : we may need to set or change some other defaults.
4286 if $test -f usethreads.cbu; then
4287     echo "Your platform has some specific hints regarding threaded builds, using them..."
4288     . ./usethreads.cbu
4289 else
4290     case "$usethreads" in
4291         "$define"|true|[yY]*)
4292                 $cat <<EOM
4293 (Your platform does not have any specific hints for threaded builds.
4294  Assuming POSIX threads, then.)
4295 EOM
4296         ;;
4297     esac
4298 fi
4299
4300 : Check if multiplicity is required
4301 cat <<EOM
4302
4303 Perl can be built so that multiple Perl interpreters can coexist
4304 within the same Perl executable.
4305 EOM
4306
4307 case "$useithreads" in
4308 $define)
4309         cat <<EOM
4310 This multiple interpreter support is required for interpreter-based threads.
4311 EOM
4312         val="$define"
4313         ;;
4314 *)      case "$usemultiplicity" in
4315         $define|true|[yY]*)     dflt='y';;
4316         *) dflt='n';;
4317         esac
4318         echo " "
4319         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4320         rp='Build Perl for multiplicity?'
4321         . ./myread
4322         case "$ans" in
4323         y|Y)    val="$define" ;;
4324         *)      val="$undef" ;;
4325         esac
4326         ;;
4327 esac
4328 set usemultiplicity
4329 eval $setvar
4330
4331 : Check if morebits is requested
4332 case "$usemorebits" in
4333 "$define"|true|[yY]*)
4334         use64bitint="$define"
4335         uselongdouble="$define"
4336         usemorebits="$define"
4337         ;;
4338 *)      usemorebits="$undef"
4339         ;;
4340 esac
4341
4342 : Determine the C compiler to be used
4343 echo " "
4344 case "$cc" in
4345 '') dflt=cc;;
4346 *) dflt="$cc";;
4347 esac
4348 rp="Use which C compiler?"
4349 . ./myread
4350 cc="$ans"
4351
4352 : See whether they have no cc but they do have gcc
4353 . ./trygcc
4354 if $test -f cc.cbu; then
4355     . ./cc.cbu
4356 fi
4357 . ./checkcc
4358
4359 : make some quick guesses about what we are up against
4360 echo " "
4361 $echo $n "Hmm...  $c"
4362 echo exit 1 >bsd
4363 echo exit 1 >usg
4364 echo exit 1 >v7
4365 echo exit 1 >osf1
4366 echo exit 1 >eunice
4367 echo exit 1 >xenix
4368 echo exit 1 >venix
4369 echo exit 1 >os2
4370 d_bsd="$undef"
4371 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4372 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4373 then
4374         echo "Looks kind of like an OSF/1 system, but we'll see..."
4375         echo exit 0 >osf1
4376 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4377         xxx=`./loc addbib blurfl $pth`
4378         if $test -f $xxx; then
4379         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4380                 echo exit 0 >bsd
4381                 echo exit 0 >usg
4382         else
4383                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4384                         echo "Looks kind of like an extended USG system, but we'll see..."
4385                 else
4386                         echo "Looks kind of like a USG system, but we'll see..."
4387                 fi
4388                 echo exit 0 >usg
4389         fi
4390 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4391         echo "Looks kind of like a BSD system, but we'll see..."
4392         d_bsd="$define"
4393         echo exit 0 >bsd
4394 else
4395         echo "Looks kind of like a Version 7 system, but we'll see..."
4396         echo exit 0 >v7
4397 fi
4398 case "$eunicefix" in
4399 *unixtovms*)
4400         $cat <<'EOI'
4401 There is, however, a strange, musty smell in the air that reminds me of
4402 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4403 EOI
4404         echo exit 0 >eunice
4405         d_eunice="$define"
4406 : it so happens the Eunice I know will not run shell scripts in Unix format
4407         ;;
4408 *)
4409         echo " "
4410         echo "Congratulations.  You aren't running Eunice."
4411         d_eunice="$undef"
4412         ;;
4413 esac
4414 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4415 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4416 : semicolon as a patch separator
4417 case "$p_" in
4418 :) ;;
4419 *)
4420         $cat <<'EOI'
4421 I have the feeling something is not exactly right, however...don't tell me...
4422 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4423 (Or you may be running DOS with DJGPP.)
4424 EOI
4425         echo exit 0 >os2
4426         ;;
4427 esac
4428 if test -f /xenix; then
4429         echo "Actually, this looks more like a XENIX system..."
4430         echo exit 0 >xenix
4431         d_xenix="$define"
4432 else
4433         echo " "
4434         echo "It's not Xenix..."
4435         d_xenix="$undef"
4436 fi
4437 chmod +x xenix
4438 $eunicefix xenix
4439 if test -f /venix; then
4440         echo "Actually, this looks more like a VENIX system..."
4441         echo exit 0 >venix
4442 else
4443         echo " "
4444         if ./xenix; then
4445                 : null
4446         else
4447                 echo "Nor is it Venix..."
4448         fi
4449 fi
4450 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4451 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4452 $rm -f foo
4453
4454 : Check if we are using GNU gcc and what its version is
4455 echo " "
4456 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4457 $cat >try.c <<EOM
4458 #include <stdio.h>
4459 int main() {
4460 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4461 #ifdef __VERSION__
4462         printf("%s\n", __VERSION__);
4463 #else
4464         printf("%s\n", "1");
4465 #endif
4466 #endif
4467         return(0);
4468 }
4469 EOM
4470 if $cc -o try $ccflags $ldflags try.c; then
4471         gccversion=`$run ./try`
4472         case "$gccversion" in
4473         '') echo "You are not using GNU cc." ;;
4474         *)  echo "You are using GNU cc $gccversion."
4475             ccname=gcc
4476             ;;
4477         esac
4478 else
4479         echo " "
4480         echo "*** WHOA THERE!!! ***" >&4
4481         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4482         case "$knowitall" in
4483         '')
4484         echo "    You'd better start hunting for one and let me know about it." >&4
4485                 exit 1
4486                 ;;
4487         esac
4488 fi
4489 $rm -f try try.*
4490 case "$gccversion" in
4491 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4492 esac
4493 case "$gccversion" in
4494 '') gccosandvers='' ;;
4495 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4496    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4497    gccshortvers=''
4498    case "$gccosandvers" in
4499    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4500    $osname$osvers) ;; # looking good
4501    $osname*) cat <<EOM >&4
4502
4503 *** WHOA THERE!!! ***
4504
4505     Your gcc has not been compiled for the exact release of
4506     your operating system ($gccosandvers versus $osname$osvers).
4507
4508     In general it is a good idea to keep gcc synchronized with
4509     the operating system because otherwise serious problems
4510     may ensue when trying to compile software, like Perl.
4511
4512     I'm trying to be optimistic here, though, and will continue.
4513     If later during the configuration and build icky compilation
4514     problems appear (headerfile conflicts being the most common
4515     manifestation), I suggest reinstalling the gcc to match
4516     your operating system release.
4517
4518 EOM
4519       ;;
4520    *) gccosandvers='' ;; # failed to parse, better be silent
4521    esac
4522    ;;
4523 esac
4524 case "$ccname" in
4525 '') ccname="$cc" ;;
4526 esac
4527
4528 # gcc 3.* complain about adding -Idirectories that they already know about,
4529 # so we will take those off from locincpth.
4530 case "$gccversion" in
4531 3*)
4532     echo "main(){}">try.c
4533     for incdir in $locincpth; do
4534        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4535              grep '^c[cp]p*[01]: warning: changing search order '`
4536        if test "X$warn" != X; then
4537            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4538        fi
4539     done
4540     $rm -f try try.*
4541 esac
4542
4543 : What should the include directory be ?
4544 echo " "
4545 $echo $n "Hmm...  $c"
4546 dflt='/usr/include'
4547 incpath=''
4548 mips_type=''
4549 if $test -f /bin/mips && /bin/mips; then
4550         echo "Looks like a MIPS system..."
4551         $cat >usr.c <<'EOCP'
4552 #ifdef SYSTYPE_BSD43
4553 /bsd43
4554 #endif
4555 EOCP
4556         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4557                 dflt='/bsd43/usr/include'
4558                 incpath='/bsd43'
4559                 mips_type='BSD 4.3'
4560         else
4561                 mips_type='System V'
4562         fi
4563         $rm -f usr.c usr.out
4564         echo "and you're compiling with the $mips_type compiler and libraries."
4565         xxx_prompt=y
4566         echo "exit 0" >mips
4567 else
4568         echo "Doesn't look like a MIPS system."
4569         xxx_prompt=n
4570         echo "exit 1" >mips
4571 fi
4572 chmod +x mips
4573 $eunicefix mips
4574 case "$usrinc" in
4575 '') ;;
4576 *) dflt="$usrinc";;
4577 esac
4578 case "$xxx_prompt" in
4579 y)      fn=d/
4580         echo " "
4581         rp='Where are the include files you want to use?'
4582         . ./getfile
4583         usrinc="$ans"
4584         ;;
4585 *)      usrinc="$dflt"
4586         ;;
4587 esac
4588
4589 : see how we invoke the C preprocessor
4590 echo " "
4591 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4592 cat <<'EOT' >testcpp.c
4593 #define ABC abc
4594 #define XYZ xyz
4595 ABC.XYZ
4596 EOT
4597 cd ..
4598 if test ! -f cppstdin; then
4599         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4600                 # AIX cc -E doesn't show the absolute headerfile
4601                 # locations but we'll cheat by using the -M flag.
4602                 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
4603         else
4604                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4605         fi
4606 else
4607         echo "Keeping your $hint cppstdin wrapper."
4608 fi
4609 chmod 755 cppstdin
4610 wrapper=`pwd`/cppstdin
4611 ok='false'
4612 cd UU
4613
4614 if $test "X$cppstdin" != "X" && \
4615         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4617 then
4618         echo "You used to use $cppstdin $cppminus so we'll use that again."
4619         case "$cpprun" in
4620         '') echo "But let's see if we can live without a wrapper..." ;;
4621         *)
4622                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4623                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4624                 then
4625                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4626                         ok='true'
4627                 else
4628                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4629                 fi
4630                 ;;
4631         esac
4632 else
4633         case "$cppstdin" in
4634         '') ;;
4635         *)
4636                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4637                 ;;
4638         esac
4639 fi
4640
4641 if $ok; then
4642         : nothing
4643 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4644         $cc -E <testcpp.c >testcpp.out 2>&1; \
4645         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646         echo "Yup, it does."
4647         x_cpp="$cc -E"
4648         x_minus='';
4649 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4650         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4651         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652         echo "Yup, it does."
4653         x_cpp="$cc -E"
4654         x_minus='-';
4655 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4656         $cc -P <testcpp.c >testcpp.out 2>&1; \
4657         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4658         echo "Yipee, that works!"
4659         x_cpp="$cc -P"
4660         x_minus='';
4661 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4662         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4663         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4664         echo "At long last!"
4665         x_cpp="$cc -P"
4666         x_minus='-';
4667 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4668         $cpp <testcpp.c >testcpp.out 2>&1; \
4669         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4670         echo "It works!"
4671         x_cpp="$cpp"
4672         x_minus='';
4673 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4674         $cpp - <testcpp.c >testcpp.out 2>&1; \
4675         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676         echo "Hooray, it works!  I was beginning to wonder."
4677         x_cpp="$cpp"
4678         x_minus='-';
4679 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4680         $wrapper <testcpp.c >testcpp.out 2>&1; \
4681         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4682         x_cpp="$wrapper"
4683         x_minus=''
4684         echo "Eureka!"
4685 else
4686         dflt=''
4687         rp="No dice.  I can't find a C preprocessor.  Name one:"
4688         . ./myread
4689         x_cpp="$ans"
4690         x_minus=''
4691         $x_cpp <testcpp.c >testcpp.out 2>&1
4692         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693                 echo "OK, that will do." >&4
4694         else
4695 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4696                 exit 1
4697         fi
4698 fi
4699
4700 case "$ok" in
4701 false)
4702         cppstdin="$x_cpp"
4703         cppminus="$x_minus"
4704         cpprun="$x_cpp"
4705         cpplast="$x_minus"
4706         set X $x_cpp
4707         shift
4708         case "$1" in
4709         "$cpp")
4710                 echo "Perhaps can we force $cc -E using a wrapper..."
4711                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4712                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4713                 then
4714                         echo "Yup, we can."
4715                         cppstdin="$wrapper"
4716                         cppminus='';
4717                 else
4718                         echo "Nope, we'll have to live without it..."
4719                 fi
4720                 ;;
4721         esac
4722         case "$cpprun" in
4723         "$wrapper")
4724                 cpprun=''
4725                 cpplast=''
4726                 ;;
4727         esac
4728         ;;
4729 esac
4730
4731 case "$cppstdin" in
4732 "$wrapper"|'cppstdin') ;;
4733 *) $rm -f $wrapper;;
4734 esac
4735 $rm -f testcpp.c testcpp.out
4736
4737 : Set private lib path
4738 case "$plibpth" in
4739 '') if ./mips; then
4740                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4741         fi;;
4742 esac
4743 case "$libpth" in
4744 ' ') dlist='';;
4745 '') dlist="$loclibpth $plibpth $glibpth";;
4746 *) dlist="$libpth";;
4747 esac
4748
4749 : Now check and see which directories actually exist, avoiding duplicates
4750 libpth=''
4751 for xxx in $dlist
4752 do
4753     if $test -d $xxx; then
4754                 case " $libpth " in
4755                 *" $xxx "*) ;;
4756                 *) libpth="$libpth $xxx";;
4757                 esac
4758     fi
4759 done
4760 $cat <<'EOM'
4761
4762 Some systems have incompatible or broken versions of libraries.  Among
4763 the directories listed in the question below, please remove any you
4764 know not to be holding relevant libraries, and add any that are needed.
4765 Say "none" for none.
4766
4767 EOM
4768 case "$libpth" in
4769 '') dflt='none';;
4770 *)
4771         set X $libpth
4772         shift
4773         dflt=${1+"$@"}
4774         ;;
4775 esac
4776 rp="Directories to use for library searches?"
4777 . ./myread
4778 case "$ans" in
4779 none) libpth=' ';;
4780 *) libpth="$ans";;
4781 esac
4782
4783 : compute shared library extension
4784 case "$so" in
4785 '')
4786         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4787                 dflt='sl'
4788         else
4789                 dflt='so'
4790         fi
4791         ;;
4792 *) dflt="$so";;
4793 esac
4794 $cat <<EOM
4795
4796 On some systems, shared libraries may be available.  Answer 'none' if
4797 you want to suppress searching of shared libraries for the remainder
4798 of this configuration.
4799
4800 EOM
4801 rp='What is the file extension used for shared libraries?'
4802 . ./myread
4803 so="$ans"
4804
4805 : Define several unixisms.
4806 : Hints files or command line option can be used to override them.
4807 : The convoluted testing is in case hints files set either the old
4808 : or the new name.
4809 case "$_exe" in
4810 '')     case "$exe_ext" in
4811         '')     ;;
4812         *)      _exe="$exe_ext" ;;
4813         esac
4814         ;;
4815 esac
4816 case "$_a" in
4817 '')     case "$lib_ext" in
4818     '') _a='.a';;
4819         *)      _a="$lib_ext" ;;
4820         esac
4821         ;;
4822 esac
4823 case "$_o" in
4824 '') case "$obj_ext" in
4825         '')     _o='.o';;
4826         *)      _o="$obj_ext";;
4827         esac
4828         ;;
4829 esac
4830 case "$p_" in
4831 '') case "$path_sep" in
4832         '')     p_=':';;
4833         *)      p_="$path_sep";;
4834         esac
4835         ;;
4836 esac
4837 exe_ext=$_exe
4838 lib_ext=$_a
4839 obj_ext=$_o
4840 path_sep=$p_
4841
4842 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4843
4844 : Which makefile gets called first.  This is used by make depend.
4845 case "$firstmakefile" in
4846 '') firstmakefile='makefile';;
4847 esac
4848
4849 : Check for uselongdouble support
4850 case "$ccflags" in
4851 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4852 esac
4853
4854 case "$uselongdouble" in
4855 $define|true|[yY]*)     dflt='y';;
4856 *) dflt='n';;
4857 esac
4858 cat <<EOM
4859
4860 Perl can be built to take advantage of long doubles which
4861 (if available) may give more accuracy and range for floating point numbers.
4862
4863 If this doesn't make any sense to you, just accept the default '$dflt'.
4864 EOM
4865 rp='Try to use long doubles if available?'
4866 . ./myread
4867 case "$ans" in
4868 y|Y)    val="$define"   ;;
4869 *)      val="$undef"    ;;
4870 esac
4871 set uselongdouble
4872 eval $setvar
4873
4874 case "$uselongdouble" in
4875 true|[yY]*) uselongdouble="$define" ;;
4876 esac
4877
4878 : Look for a hint-file generated 'call-back-unit'.  If the
4879 : user has specified that long doubles should be used,
4880 : we may need to set or change some other defaults.
4881 if $test -f uselongdouble.cbu; then
4882     echo "Your platform has some specific hints regarding long doubles, using them..."
4883     . ./uselongdouble.cbu
4884 else
4885     case "$uselongdouble" in
4886         $define)
4887                 $cat <<EOM
4888 (Your platform does not have any specific hints for long doubles.)
4889 EOM
4890         ;;
4891     esac
4892 fi
4893
4894 : Looking for optional libraries
4895 echo " "
4896 echo "Checking for optional libraries..." >&4
4897 case "$libs" in
4898 ' '|'') dflt='';;
4899 *) dflt="$libs";;
4900 esac
4901 case "$libswanted" in
4902 '') libswanted='c_s';;
4903 esac
4904 case "$usesocks" in
4905 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4906 esac
4907 libsfound=''
4908 libsfiles=''
4909 libsdirs=''
4910 libspath=''
4911 for thisdir in $libpth $xlibpth; do
4912   test -d $thisdir && libspath="$libspath $thisdir"
4913 done
4914 for thislib in $libswanted; do
4915         for thisdir in $libspath; do
4916             xxx=''
4917             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4918                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4919                 $test -f "$xxx" && eval $libscheck
4920                 $test -f "$xxx" && libstyle=shared
4921             fi
4922             if test ! -f "$xxx"; then
4923                 xxx=$thisdir/lib$thislib.$so
4924                 $test -f "$xxx" && eval $libscheck
4925                 $test -f "$xxx" && libstyle=shared
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/lib$thislib$_a
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=static
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/$thislib$_a
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=static
4936             fi
4937             if test ! -f "$xxx"; then
4938                 xxx=$thisdir/lib${thislib}_s$_a
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=static
4941                 $test -f "$xxx" && thislib=${thislib}_s
4942             fi
4943             if test ! -f "$xxx"; then
4944                 xxx=$thisdir/Slib$thislib$_a
4945                 $test -f "$xxx" && eval $libscheck
4946                 $test -f "$xxx" && libstyle=static
4947             fi
4948             if $test -f "$xxx"; then
4949                 case "$libstyle" in
4950                 shared) echo "Found -l$thislib (shared)." ;;
4951                 static) echo "Found -l$thislib." ;;
4952                 *)      echo "Found -l$thislib ($libstyle)." ;;
4953                 esac
4954                 case " $dflt " in
4955                 *"-l$thislib "*);;
4956                 *) dflt="$dflt -l$thislib"
4957                    libsfound="$libsfound $xxx"
4958                    yyy=`basename $xxx`
4959                    libsfiles="$libsfiles $yyy"
4960                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4961                    case " $libsdirs " in
4962                    *" $yyy "*) ;;
4963                    *) libsdirs="$libsdirs $yyy" ;;
4964                    esac
4965                    ;;
4966                 esac
4967                 break
4968             fi
4969         done
4970         if $test ! -f "$xxx"; then
4971             echo "No -l$thislib."
4972         fi
4973 done
4974 set X $dflt
4975 shift
4976 dflt="$*"
4977 case "$libs" in
4978 '') dflt="$dflt";;
4979 *) dflt="$libs";;
4980 esac
4981 case "$dflt" in
4982 ' '|'') dflt='none';;
4983 esac
4984
4985 $cat <<EOM
4986
4987 In order to compile $package on your machine, a number of libraries
4988 are usually needed.  Include any other special libraries here as well.
4989 Say "none" for none.  The default list is almost always right.
4990 EOM
4991
4992 echo " "
4993 rp="What libraries to use?"
4994 . ./myread
4995 case "$ans" in
4996 none) libs=' ';;
4997 *) libs="$ans";;
4998 esac
4999
5000 : determine optimization, if desired, or use for debug flag also
5001 case "$optimize" in
5002 ' '|$undef) dflt='none';;
5003 '') dflt='-O';;
5004 *) dflt="$optimize";;
5005 esac
5006 $cat <<EOH
5007
5008 By default, $package compiles with the -O flag to use the optimizer.
5009 Alternately, you might want to use the symbolic debugger, which uses
5010 the -g flag (on traditional Unix systems).  Either flag can be
5011 specified here.  To use neither flag, specify the word "none".
5012
5013 EOH
5014 rp="What optimizer/debugger flag should be used?"
5015 . ./myread
5016 optimize="$ans"
5017 case "$optimize" in
5018 'none') optimize=" ";;
5019 esac
5020
5021 : Check what DEBUGGING is required from the command line
5022 : -DEBUGGING      or -DDEBUGGING or
5023 : -DEBUGGING=both                       = -g + -DDEBUGGING
5024 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5025 : -DEBUGGING=none or -UDEBUGGING        =
5026 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5027 case "$EBUGGING" in
5028 '')     ;;
5029 *)      DEBUGGING=$EBUGGING ;;
5030 esac
5031
5032 case "$DEBUGGING" in
5033 -g|both|$define)
5034     case "$optimize" in
5035         *-g*) ;;
5036         *)    optimize="$optimize -g" ;;
5037     esac ;;
5038 none|$undef)
5039     case "$optimize" in
5040         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5041                 shift
5042                 optimize="$*"
5043                 ;;
5044     esac ;;
5045 esac
5046
5047 dflt=''
5048 case "$DEBUGGING" in
5049 both|$define) dflt='-DDEBUGGING'
5050 esac
5051
5052 : argument order is deliberate, as the flag will start with - which set could
5053 : think is an option
5054 checkccflag='check=$1; flag=$2; callback=$3;
5055 echo " ";
5056 echo "Checking if your compiler accepts $flag" 2>&1;
5057 echo "int main(void) { return 0; }" > gcctest.c;
5058 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5059     echo "Yes, it does." 2>&1;
5060     if $test -s gcctest.out ; then
5061         echo "But your platform does not like it:";
5062         cat gcctest.out;
5063     else
5064         case "$ccflags" in
5065         *$check*)
5066             echo "Leaving current flags $ccflags alone." 2>&1
5067             ;;
5068         *) dflt="$dflt $flag";
5069             eval $callback
5070             ;;
5071         esac
5072     fi
5073 else
5074     echo "Nope, it does not, but that is ok." 2>&1;
5075 fi
5076 '
5077
5078 : We will not override a previous value, but we might want to
5079 : augment a hint file
5080 case "$hint" in
5081 default|recommended)
5082         case "$gccversion" in
5083         1*) dflt="$dflt -fpcc-struct-return" ;;
5084         esac
5085         case "$optimize:$DEBUGGING" in
5086         *-g*:old) dflt="$dflt -DDEBUGGING";;
5087         esac
5088         case "$gccversion" in
5089         2*) if $test -d /etc/conf/kconfig.d &&
5090                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5091                 then
5092                         # Interactive Systems (ISC) POSIX mode.
5093                         dflt="$dflt -posix"
5094                 fi
5095                 ;;
5096         esac
5097         case "$gccversion" in
5098         1*) ;;
5099         2.[0-8]*) ;;
5100         ?*)     set strict-aliasing -fno-strict-aliasing
5101                 eval $checkccflag
5102                 ;;
5103         esac
5104         # For gcc, adding -pipe speeds up compilations for some, but apparently
5105         # some assemblers can't read from stdin.  (It also slows down compilations
5106         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5107         case "$gccversion" in
5108         ?*)     set pipe -pipe
5109                 eval $checkccflag
5110                 ;;
5111         esac
5112
5113         # on x86_64 (at least) we require an extra library (libssp) in the
5114         # link command line. This library is not named, so I infer that it is
5115         # an implementation detail that may change. Hence the safest approach
5116         # is to add the flag to the flags passed to the compiler at link time,
5117         # as that way the compiler can do the right implementation dependant
5118         # thing. (NWC)
5119         case "$gccversion" in
5120         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5121                 eval $checkccflag
5122                 ;;
5123         esac
5124         ;;
5125 esac
5126
5127 case "$mips_type" in
5128 *BSD*|'') inclwanted="$locincpth $usrinc";;
5129 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5130 esac
5131 for thisincl in $inclwanted; do
5132         if $test -d $thisincl; then
5133                 if $test x$thisincl != x$usrinc; then
5134                         case "$dflt" in
5135                         *" -I$thisincl "*);;
5136                         *) dflt="$dflt -I$thisincl ";;
5137                         esac
5138                 fi
5139         fi
5140 done
5141
5142 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5143         xxx=true;
5144 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5145         xxx=true;
5146 else
5147         xxx=false;
5148 fi;
5149 if $xxx; then
5150         case "$dflt" in
5151         *$2*);;
5152         *) dflt="$dflt -D$2";;
5153         esac;
5154 fi'
5155
5156 set signal.h LANGUAGE_C; eval $inctest
5157
5158 case "$usesocks" in
5159 $define)
5160         ccflags="$ccflags -DSOCKS"
5161         ;;
5162 esac
5163
5164 case "$hint" in
5165 default|recommended) dflt="$ccflags $dflt" ;;
5166 *) dflt="$ccflags";;
5167 esac
5168
5169 case "$dflt" in
5170 ''|' ') dflt=none;;
5171 esac
5172
5173 $cat <<EOH
5174
5175 Your C compiler may want other flags.  For this question you should include
5176 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5177 but you should NOT include libraries or ld flags like -lwhatever.  If you
5178 want $package to honor its debug switch, you should include -DDEBUGGING here.
5179 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5180
5181 To use no flags, specify the word "none".
5182
5183 EOH
5184 set X $dflt
5185 shift
5186 dflt=${1+"$@"}
5187 rp="Any additional cc flags?"
5188 . ./myread
5189 case "$ans" in
5190 none) ccflags='';;
5191 *) ccflags="$ans";;
5192 esac
5193
5194 : the following weeds options from ccflags that are of no interest to cpp
5195 case "$cppflags" in
5196 '') cppflags="$ccflags" ;;
5197 *)  cppflags="$cppflags $ccflags" ;;
5198 esac
5199 case "$gccversion" in
5200 1*) cppflags="$cppflags -D__GNUC__"
5201 esac
5202 case "$mips_type" in
5203 '');;
5204 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5205 esac
5206 case "$cppflags" in
5207 '');;
5208 *)
5209         echo " "
5210         echo "Let me guess what the preprocessor flags are..." >&4
5211         set X $cppflags
5212         shift
5213         cppflags=''
5214         $cat >cpp.c <<'EOM'
5215 #define BLURFL foo
5216
5217 BLURFL xx LFRULB
5218 EOM
5219         previous=''
5220         for flag in $*
5221         do
5222                 case "$flag" in
5223                 -*) ftry="$flag";;
5224                 *) ftry="$previous $flag";;
5225                 esac
5226                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5227                         >cpp1.out 2>/dev/null && \
5228                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5229                         >cpp2.out 2>/dev/null && \
5230                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5231                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5232                 then
5233                         cppflags="$cppflags $ftry"
5234                         previous=''
5235                 else
5236                         previous="$flag"
5237                 fi
5238         done
5239         set X $cppflags
5240         shift
5241         cppflags=${1+"$@"}
5242         case "$cppflags" in
5243         *-*)  echo "They appear to be: $cppflags";;
5244         esac
5245         $rm -f cpp.c cpp?.out
5246         ;;
5247 esac
5248
5249 : flags used in final linking phase
5250 case "$ldflags" in
5251 '') if ./venix; then
5252                 dflt='-i -z'
5253         else
5254                 dflt=''
5255         fi
5256         case "$ccflags" in
5257         *-posix*) dflt="$dflt -posix" ;;
5258         esac
5259         ;;
5260 *) dflt="$ldflags";;
5261 esac
5262
5263 : Try to guess additional flags to pick up local libraries.
5264 for thislibdir in $libpth; do
5265         case " $loclibpth " in
5266         *" $thislibdir "*)
5267                 case "$dflt " in
5268                 *"-L$thislibdir "*) ;;
5269                 *)  dflt="$dflt -L$thislibdir" ;;
5270                 esac
5271                 ;;
5272         esac
5273 done
5274
5275 case "$dflt" in
5276 '') dflt='none' ;;
5277 esac
5278
5279 $cat <<EOH
5280
5281 Your C linker may need flags.  For this question you should
5282 include -L/whatever and any other flags used by the C linker, but you
5283 should NOT include libraries like -lwhatever.
5284
5285 Make sure you include the appropriate -L/path flags if your C linker
5286 does not normally search all of the directories you specified above,
5287 namely
5288         $libpth
5289 To use no flags, specify the word "none".
5290
5291 EOH
5292
5293 rp="Any additional ld flags (NOT including libraries)?"
5294 . ./myread
5295 case "$ans" in
5296 none) ldflags='';;
5297 *) ldflags="$ans";;
5298 esac
5299 rmlist="$rmlist pdp11"
5300
5301 : coherency check
5302 echo " "
5303 echo "Checking your choice of C compiler and flags for coherency..." >&4
5304 $cat > try.c <<'EOF'
5305 #include <stdio.h>
5306 int main() { printf("Ok\n"); return(0); }
5307 EOF
5308 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5309 shift
5310 $cat >try.msg <<'EOM'
5311 I've tried to compile and run the following simple program:
5312
5313 EOM
5314 $cat try.c >> try.msg
5315
5316 $cat >> try.msg <<EOM
5317
5318 I used the command:
5319
5320         $*
5321         $run ./try
5322
5323 and I got the following output:
5324
5325 EOM
5326 dflt=y
5327 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5328         if $sh -c "$run ./try " >>try.msg 2>&1; then
5329                 xxx=`$run ./try`
5330                 case "$xxx" in
5331                 "Ok") dflt=n ;;
5332                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5333                         case " $libs " in
5334                         *" -lsfio "*)
5335                                 cat >> try.msg <<'EOQS'
5336 If $libs contains -lsfio, and sfio is mis-configured, then it
5337 sometimes (apparently) runs and exits with a 0 status, but with no
5338 output!  It may have to do with sfio's use of _exit vs. exit.
5339
5340 EOQS
5341                                 rp="You have a big problem.  Shall I abort Configure"
5342                                 dflt=y
5343                                 ;;
5344                         esac
5345                         ;;
5346                 esac
5347         else
5348                 echo "The program compiled OK, but exited with status $?." >>try.msg
5349                 rp="You have a problem.  Shall I abort Configure"
5350                 dflt=y
5351         fi
5352 else
5353         echo "I can't compile the test program." >>try.msg
5354         rp="You have a BIG problem.  Shall I abort Configure"
5355         dflt=y
5356 fi
5357 case "$dflt" in
5358 y)
5359         $cat try.msg >&4
5360         case "$knowitall" in
5361         '')
5362                 echo "(The supplied flags or libraries might be incorrect.)"
5363                 ;;
5364         *) dflt=n;;
5365         esac
5366         echo " "
5367         . ./myread
5368         case "$ans" in
5369         n*|N*) ;;
5370         *)      echo "Ok.  Stopping Configure." >&4
5371                 exit 1
5372                 ;;
5373         esac
5374         ;;
5375 n) echo "OK, that should do.";;
5376 esac
5377 $rm_try gcctest gcctest.out
5378
5379 : define a shorthand compile call
5380 compile='
5381 mc_file=$1;
5382 shift;
5383 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5384 : define a shorthand compile call for compilations that should be ok.
5385 compile_ok='
5386 mc_file=$1;
5387 shift;
5388 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5389
5390 : determine filename position in cpp output
5391 echo " "
5392 echo "Computing filename position in cpp output for #include directives..." >&4
5393 case "$osname" in
5394 vos) testaccess=-e ;;
5395 *)   testaccess=-r ;;
5396 esac
5397 echo '#include <stdio.h>' > foo.c
5398 $cat >fieldn <<EOF
5399 $startsh
5400 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5401 $grep '^[       ]*#.*stdio\.h' | \
5402 while read cline; do
5403         pos=1
5404         set \$cline
5405         while $test \$# -gt 0; do
5406                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5407                         echo "\$pos"
5408                         exit 0
5409                 fi
5410                 shift
5411                 pos=\`expr \$pos + 1\`
5412         done
5413 done
5414 EOF
5415 chmod +x fieldn
5416 fieldn=`./fieldn`
5417 $rm -f foo.c fieldn
5418 case $fieldn in
5419 '') pos='???';;
5420 1) pos=first;;
5421 2) pos=second;;
5422 3) pos=third;;
5423 *) pos="${fieldn}th";;
5424 esac
5425 echo "Your cpp writes the filename in the $pos field of the line."
5426
5427 case "$osname" in
5428 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5429 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5430 *)   cppfilter='' ;;
5431 esac
5432 : locate header file
5433 $cat >findhdr <<EOF
5434 $startsh
5435 wanted=\$1
5436 name=''
5437 for usrincdir in $usrinc
5438 do
5439         if test -f \$usrincdir/\$wanted; then
5440                 echo "\$usrincdir/\$wanted"
5441                 exit 0
5442         fi
5443 done
5444 awkprg='{ print \$$fieldn }'
5445 echo "#include <\$wanted>" > foo\$\$.c
5446 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5447 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5448 while read cline; do
5449         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5450         case "\$name" in
5451         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5452         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5453         *) exit 2;;
5454         esac;
5455 done;
5456 #
5457 # status = 0: grep returned 0 lines, case statement not executed
5458 # status = 1: headerfile found
5459 # status = 2: while loop executed, no headerfile found
5460 #
5461 status=\$?
5462 $rm -f foo\$\$.c;
5463 if test \$status -eq 1; then
5464         exit 0;
5465 fi
5466 exit 1
5467 EOF
5468 chmod +x findhdr
5469
5470 : define an alternate in-header-list? function
5471 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5472 cont=true; xxf="echo \"<\$1> found.\" >&4";
5473 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5474 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5475 esac;
5476 case $# in 4) instead=instead;; *) instead="at last";; esac;
5477 while $test "$cont"; do
5478         xxx=`./findhdr $1`
5479         var=$2; eval "was=\$$2";
5480         if $test "$xxx" && $test -r "$xxx";
5481         then eval $xxf;
5482         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5483                 cont="";
5484         else eval $xxnf;
5485         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5486         set $yyy; shift; shift; yyy=$@;
5487         case $# in 0) cont="";;
5488         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5489                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5490         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5491                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5492         esac;
5493 done;
5494 while $test "$yyy";
5495 do set $yyy; var=$2; eval "was=\$$2";
5496         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5497         set $yyy; shift; shift; yyy=$@;
5498 done'
5499
5500 : see if stdlib is available
5501 set stdlib.h i_stdlib
5502 eval $inhdr
5503
5504 : check for lengths of integral types
5505 echo " "
5506 case "$intsize" in
5507 '')
5508         echo "Checking to see how big your integers are..." >&4
5509         $cat >try.c <<EOCP
5510 #include <stdio.h>
5511 #$i_stdlib I_STDLIB
5512 #ifdef I_STDLIB
5513 #include <stdlib.h>
5514 #endif
5515 int main()
5516 {
5517         printf("intsize=%d;\n", (int)sizeof(int));
5518         printf("longsize=%d;\n", (int)sizeof(long));
5519         printf("shortsize=%d;\n", (int)sizeof(short));
5520         exit(0);
5521 }
5522 EOCP
5523         set try
5524         if eval $compile_ok && $run ./try > /dev/null; then
5525                 eval `$run ./try`
5526                 echo "Your integers are $intsize bytes long."
5527                 echo "Your long integers are $longsize bytes long."
5528                 echo "Your short integers are $shortsize bytes long."
5529         else
5530                 $cat >&4 <<EOM
5531 !
5532 Help! I can't compile and run the intsize test program: please enlighten me!
5533 (This is probably a misconfiguration in your system or libraries, and
5534 you really ought to fix it.  Still, I'll try anyway.)
5535 !
5536 EOM
5537                 dflt=4
5538                 rp="What is the size of an integer (in bytes)?"
5539                 . ./myread
5540                 intsize="$ans"
5541                 dflt=$intsize
5542                 rp="What is the size of a long integer (in bytes)?"
5543                 . ./myread
5544                 longsize="$ans"
5545                 dflt=2
5546                 rp="What is the size of a short integer (in bytes)?"
5547                 . ./myread
5548                 shortsize="$ans"
5549         fi
5550         ;;
5551 esac
5552 $rm_try
5553
5554 : check for long long
5555 echo " "
5556 echo "Checking to see if you have long long..." >&4
5557 echo 'int main() { long long x = 7; return 0; }' > try.c
5558 set try
5559 if eval $compile; then
5560         val="$define"
5561         echo "You have long long."
5562 else
5563         val="$undef"
5564         echo "You do not have long long."
5565 fi
5566 $rm_try
5567 set d_longlong
5568 eval $setvar
5569
5570 : check for length of long long
5571 case "${d_longlong}${longlongsize}" in
5572 $define)
5573         echo " "
5574         echo "Checking to see how big your long longs are..." >&4
5575         $cat >try.c <<'EOCP'
5576 #include <stdio.h>
5577 int main()
5578 {
5579     printf("%d\n", (int)sizeof(long long));
5580     return(0);
5581 }
5582 EOCP
5583         set try
5584         if eval $compile_ok; then
5585                 longlongsize=`$run ./try`
5586                 echo "Your long longs are $longlongsize bytes long."
5587         else
5588                 dflt='8'
5589                 echo " "
5590                 echo "(I can't seem to compile the test program.  Guessing...)"
5591                 rp="What is the size of a long long (in bytes)?"
5592                 . ./myread
5593                 longlongsize="$ans"
5594         fi
5595         if $test "X$longsize" = "X$longlongsize"; then
5596                 echo "(That isn't any different from an ordinary long.)"
5597         fi
5598         ;;
5599 esac
5600 $rm_try
5601
5602 : see if inttypes.h is available
5603 : we want a real compile instead of Inhdr because some systems
5604 : have an inttypes.h which includes non-existent headers
5605 echo " "
5606 $cat >try.c <<EOCP
5607 #include <inttypes.h>
5608 int main() {
5609         static int32_t foo32 = 0x12345678;
5610 }
5611 EOCP
5612 set try
5613 if eval $compile; then
5614         echo "<inttypes.h> found." >&4
5615         val="$define"
5616 else
5617         echo "<inttypes.h> NOT found." >&4
5618         val="$undef"
5619 fi
5620 $rm_try
5621 set i_inttypes
5622 eval $setvar
5623
5624 : check for int64_t
5625 echo " "
5626 echo "Checking to see if you have int64_t..." >&4
5627 $cat >try.c <<EOCP
5628 #include <sys/types.h>
5629 #$i_inttypes I_INTTYPES
5630 #ifdef I_INTTYPES
5631 #include <inttypes.h>
5632 #endif
5633 int main() { int64_t x = 7; }
5634 EOCP
5635 set try
5636 if eval $compile; then
5637         val="$define"
5638         echo "You have int64_t."
5639 else
5640         val="$undef"
5641         echo "You do not have int64_t."
5642 fi
5643 $rm_try
5644 set d_int64_t
5645 eval $setvar
5646
5647 : Check if 64bit ints have a quad type
5648 echo " "
5649 echo "Checking which 64-bit integer type we could use..." >&4
5650
5651 case "$intsize" in
5652 8) val=int
5653    set quadtype
5654    eval $setvar
5655    val='"unsigned int"'
5656    set uquadtype
5657    eval $setvar
5658    quadkind=1
5659    ;;
5660 *) case "$longsize" in
5661    8) val=long
5662       set quadtype
5663       eval $setvar
5664       val='"unsigned long"'
5665       set uquadtype
5666       eval $setvar
5667       quadkind=2
5668       ;;
5669    *) case "$d_longlong:$longlongsize" in
5670       define:8)
5671         val='"long long"'
5672         set quadtype
5673         eval $setvar
5674         val='"unsigned long long"'
5675         set uquadtype
5676         eval $setvar
5677         quadkind=3
5678         ;;
5679       *) case "$d_int64_t" in
5680          define)
5681            val=int64_t
5682            set quadtype
5683            eval $setvar
5684            val=uint64_t
5685            set uquadtype
5686            eval $setvar
5687            quadkind=4
5688            ;;
5689          esac
5690          ;;
5691       esac
5692       ;;
5693    esac
5694    ;;
5695 esac
5696
5697 case "$quadtype" in
5698 '')     echo "Alas, no 64-bit integer types in sight." >&4
5699         d_quad="$undef"
5700         ;;
5701 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5702         d_quad="$define"
5703         ;;
5704 esac
5705
5706 : Do we want 64bit support
5707 case "$uselonglong" in
5708 "$define"|true|[yY]*)
5709         cat <<EOM >&4
5710
5711 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5712 EOM
5713         use64bitint="$define"
5714         ;;
5715 esac
5716 case "$use64bits" in
5717 "$define"|true|[yY]*)
5718         cat <<EOM >&4
5719
5720 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5721 EOM
5722         use64bitint="$define"
5723         ;;
5724 esac
5725 case "$use64bitints" in
5726 "$define"|true|[yY]*)
5727         cat <<EOM >&4
5728
5729 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5730 EOM
5731         use64bitint="$define"
5732         ;;
5733 esac
5734 case "$use64bitsint" in
5735 "$define"|true|[yY]*)
5736         cat <<EOM >&4
5737
5738 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5739 EOM
5740         use64bitint="$define"
5741         ;;
5742 esac
5743 case "$uselonglongs" in
5744 "$define"|true|[yY]*)
5745         cat <<EOM >&4
5746
5747 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5748 EOM
5749         use64bitint="$define"
5750         ;;
5751 esac
5752 case "$use64bitsall" in
5753 "$define"|true|[yY]*)
5754         cat <<EOM >&4
5755
5756 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5757 EOM
5758         use64bitall="$define"
5759         ;;
5760 esac
5761
5762 case "$ccflags" in
5763 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5764 esac
5765 case "$use64bitall" in
5766 "$define"|true|[yY]*) use64bitint="$define" ;;
5767 esac
5768
5769 case "$longsize" in
5770 8) cat <<EOM
5771
5772 You have natively 64-bit long integers.
5773 EOM
5774    val="$define"
5775    ;;
5776 *) case "$use64bitint" in
5777    "$define"|true|[yY]*) dflt='y';;
5778    *) dflt='n';;
5779    esac
5780    case "$d_quad" in
5781    "$define") ;;
5782    *) dflt='n' ;;
5783    esac
5784    cat <<EOM
5785
5786 Perl can be built to take advantage of 64-bit integer types
5787 on some systems.  To do so, Configure can be run with -Duse64bitint.
5788 Choosing this option will most probably introduce binary incompatibilities.
5789
5790 If this doesn't make any sense to you, just accept the default '$dflt'.
5791 (The default has been chosen based on your configuration.)
5792 EOM
5793    rp='Try to use 64-bit integers, if available?'
5794    . ./myread
5795    case "$ans" in
5796    [yY]*) val="$define" ;;
5797    *)     val="$undef"  ;;
5798    esac
5799    ;;
5800 esac
5801 set use64bitint
5802 eval $setvar
5803
5804 case "$use64bitall" in
5805 "$define"|true|[yY]*) dflt='y' ;;
5806 *) case "$longsize" in
5807    8) dflt='y' ;;
5808    *) dflt='n' ;;
5809    esac
5810    ;;
5811 esac
5812 cat <<EOM
5813
5814 You may also choose to try maximal 64-bitness.  It means using as much
5815 64-bitness as possible on the platform.  This in turn means even more
5816 binary incompatibilities.  On the other hand, your platform may not
5817 have any more 64-bitness available than what you already have chosen.
5818
5819 If this doesn't make any sense to you, just accept the default '$dflt'.
5820 (The default has been chosen based on your configuration.)
5821 EOM
5822 rp='Try to use maximal 64-bit support, if available?'
5823 . ./myread
5824 case "$ans" in
5825 [yY]*) val="$define" ;;
5826 *)     val="$undef"  ;;
5827 esac
5828 set use64bitall
5829 eval $setvar
5830 case "$use64bitall" in
5831 "$define")
5832         case "$use64bitint" in
5833         "$undef")
5834                 cat <<EOM
5835
5836 Since you have chosen a maximally 64-bit build, I'm also turning on
5837 the use of 64-bit integers.
5838 EOM
5839                 use64bitint="$define" ;;
5840         esac
5841         ;;
5842 esac
5843
5844 : Look for a hint-file generated 'call-back-unit'.  If the
5845 : user has specified that a 64-bit perl is to be built,
5846 : we may need to set or change some other defaults.
5847 if $test -f use64bitint.cbu; then
5848         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5849         . ./use64bitint.cbu
5850 fi
5851 case "$use64bitint" in
5852 "$define"|true|[yY]*)
5853         case "$longsize" in
5854         4) case "$archname64" in
5855            '') archname64=64int ;;
5856            esac
5857            ;;
5858         esac
5859         ;;
5860 esac
5861
5862 : Look for a hint-file generated 'call-back-unit'.  If the
5863 : user has specified that a maximally 64-bit perl is to be built,
5864 : we may need to set or change some other defaults.
5865 if $test -f use64bitall.cbu; then
5866         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5867         . ./use64bitall.cbu
5868 fi
5869 case "$use64bitall" in
5870 "$define"|true|[yY]*)
5871         case "$longsize" in
5872         4) case "$archname64" in
5873            ''|64int) archname64=64all ;;
5874            esac
5875            ;;
5876         esac
5877         ;;
5878 esac
5879
5880 case "$d_quad:$use64bitint" in
5881 $undef:$define)
5882         cat >&4 <<EOF
5883
5884 *** You have chosen to use 64-bit integers,
5885 *** but none can be found.
5886 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5887 *** Cannot continue, aborting.
5888
5889 EOF
5890         exit 1
5891         ;;
5892 esac
5893
5894 : check for length of double
5895 echo " "
5896 case "$doublesize" in
5897 '')
5898         echo "Checking to see how big your double precision numbers are..." >&4
5899         $cat >try.c <<EOCP
5900 #include <stdio.h>
5901 #$i_stdlib I_STDLIB
5902 #ifdef I_STDLIB
5903 #include <stdlib.h>
5904 #endif
5905 int main()
5906 {
5907     printf("%d\n", (int)sizeof(double));
5908     exit(0);
5909 }
5910 EOCP
5911         set try
5912         if eval $compile_ok; then
5913                 doublesize=`$run ./try`
5914                 echo "Your double is $doublesize bytes long."
5915         else
5916                 dflt='8'
5917                 echo "(I can't seem to compile the test program.  Guessing...)"
5918                 rp="What is the size of a double precision number (in bytes)?"
5919                 . ./myread
5920                 doublesize="$ans"
5921         fi
5922         ;;
5923 esac
5924 $rm_try
5925
5926 : check for long doubles
5927 echo " "
5928 echo "Checking to see if you have long double..." >&4
5929 echo 'int main() { long double x = 7.0; }' > try.c
5930 set try
5931 if eval $compile; then
5932         val="$define"
5933         echo "You have long double."
5934 else
5935         val="$undef"
5936         echo "You do not have long double."
5937 fi
5938 $rm_try
5939 set d_longdbl
5940 eval $setvar
5941
5942 : check for length of long double
5943 case "${d_longdbl}${longdblsize}" in
5944 $define)
5945         echo " "
5946         echo "Checking to see how big your long doubles are..." >&4
5947         $cat >try.c <<'EOCP'
5948 #include <stdio.h>
5949 int main()
5950 {
5951         printf("%d\n", sizeof(long double));
5952 }
5953 EOCP
5954         set try
5955         set try
5956         if eval $compile; then
5957                 longdblsize=`$run ./try`
5958                 echo "Your long doubles are $longdblsize bytes long."
5959         else
5960                 dflt='8'
5961                 echo " "
5962                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5963                 rp="What is the size of a long double (in bytes)?"
5964                 . ./myread
5965                 longdblsize="$ans"
5966         fi
5967         if $test "X$doublesize" = "X$longdblsize"; then
5968                 echo "That isn't any different from an ordinary double."
5969                 echo "I'll keep your setting anyway, but you may see some"
5970                 echo "harmless compilation warnings."
5971         fi
5972         ;;
5973 esac
5974 $rm_try
5975
5976 : determine the architecture name
5977 echo " "
5978 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5979         tarch=`arch`"-$osname"
5980 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5981         if uname -m > tmparch 2>&1 ; then
5982                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5983                         -e 's/$/'"-$osname/" tmparch`
5984         else
5985                 tarch="$osname"
5986         fi
5987         $rm -f tmparch
5988 else
5989         tarch="$osname"
5990 fi
5991 case "$myarchname" in
5992 ''|"$tarch") ;;
5993 *)
5994         echo "(Your architecture name used to be $myarchname.)"
5995         archname=''
5996         ;;
5997 esac
5998 case "$targetarch" in
5999 '') ;;
6000 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6001 esac
6002 myarchname="$tarch"
6003 case "$archname" in
6004 '') dflt="$tarch";;
6005 *) dflt="$archname";;
6006 esac
6007 rp='What is your architecture name'
6008 . ./myread
6009 archname="$ans"
6010 case "$usethreads" in
6011 $define)
6012         echo "Threads selected." >&4
6013         case "$archname" in
6014         *-thread*) echo "...and architecture name already has -thread." >&4
6015                 ;;
6016         *)      archname="$archname-thread"
6017                 echo "...setting architecture name to $archname." >&4
6018                 ;;
6019         esac
6020         ;;
6021 esac
6022 case "$usemultiplicity" in
6023 $define)
6024         echo "Multiplicity selected." >&4
6025         case "$archname" in
6026         *-multi*) echo "...and architecture name already has -multi." >&4
6027                 ;;
6028         *)      archname="$archname-multi"
6029                 echo "...setting architecture name to $archname." >&4
6030                 ;;
6031         esac
6032         ;;
6033 esac
6034 case "$use64bitint$use64bitall" in
6035 *"$define"*)
6036         case "$archname64" in
6037         '')
6038                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6039                 ;;
6040         *)
6041                 case "$use64bitint" in
6042                 "$define") echo "64 bit integers selected." >&4 ;;
6043                 esac
6044                 case "$use64bitall" in
6045                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6046                 esac
6047                 case "$archname" in
6048                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6049                         ;;
6050                 *)      archname="$archname-$archname64"
6051                         echo "...setting architecture name to $archname." >&4
6052                         ;;
6053                 esac
6054                 ;;
6055         esac
6056 esac
6057 case "$uselongdouble" in
6058 $define)
6059         echo "Long doubles selected." >&4
6060         case "$longdblsize" in
6061         $doublesize)
6062                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6063                 ;;
6064         *)
6065                 case "$archname" in
6066                 *-ld*) echo "...and architecture name already has -ld." >&4
6067                         ;;
6068                 *)      archname="$archname-ld"
6069                         echo "...setting architecture name to $archname." >&4
6070                         ;;
6071                 esac
6072                 ;;
6073         esac
6074         ;;
6075 esac
6076 case "$useperlio" in
6077 $define)
6078         echo "Perlio selected." >&4
6079         ;;
6080 *)
6081         echo "Perlio not selected, using stdio." >&4
6082         case "$archname" in
6083         *-stdio*) echo "...and architecture name already has -stdio." >&4
6084                 ;;
6085         *)      archname="$archname-stdio"
6086                 echo "...setting architecture name to $archname." >&4
6087                 ;;
6088         esac
6089         ;;
6090 esac
6091 if $test -f archname.cbu; then
6092         echo "Your platform has some specific hints for architecture name, using them..."
6093         . ./archname.cbu
6094 fi
6095
6096 : set the prefixit variable, to compute a suitable default value
6097 prefixit='case "$3" in
6098 ""|none)
6099         case "$oldprefix" in
6100         "") eval "$1=\"\$$2\"";;
6101         *)
6102                 case "$3" in
6103                 "") eval "$1=";;
6104                 none)
6105                         eval "tp=\"\$$2\"";
6106                         case "$tp" in
6107                         ""|" ") eval "$1=\"\$$2\"";;
6108                         *) eval "$1=";;
6109                         esac;;
6110                 esac;;
6111         esac;;
6112 *)
6113         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6114         case "$tp" in
6115         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6116         /*-$oldprefix/*|\~*-$oldprefix/*)
6117                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6118         *) eval "$1=\"\$$2\"";;
6119         esac;;
6120 esac'
6121
6122 : determine installation style
6123 : For now, try to deduce it from prefix unless it is already set.
6124 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6125 case "$installstyle" in
6126 '')     case "$prefix" in
6127                 *perl*) dflt='lib';;
6128                 *) dflt='lib/perl5' ;;
6129         esac
6130         ;;
6131 *)      dflt="$installstyle" ;;
6132 esac
6133 : Probably not worth prompting for this since we prompt for all
6134 : the directories individually, and the prompt would be too long and
6135 : confusing anyway.
6136 installstyle=$dflt
6137
6138 : determine where public executables go
6139 echo " "
6140 set dflt bin bin
6141 eval $prefixit
6142 fn=d~
6143 rp='Pathname where the public executables will reside?'
6144 . ./getfile
6145 if $test "X$ansexp" != "X$binexp"; then
6146         installbin=''
6147 fi
6148 prefixvar=bin
6149 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6150 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6151 :     this via initialinstalllocation
6152 . ./setprefixvar
6153
6154 case "$userelocatableinc" in
6155 $define|true|[yY]*)     dflt='y' ;;
6156 *)                      dflt='n' ;;
6157 esac
6158 cat <<EOM
6159
6160 Would you like to build Perl so that the installation is relocatable, so that
6161 library paths in @INC are determined relative to the path of the perl binary?
6162 This is not advised for system Perl installs, or if you need to run setid
6163 scripts or scripts under taint mode.
6164
6165 If this doesn't make any sense to you, just accept the default '$dflt'.
6166 EOM
6167 rp='Use relocatable @INC?'
6168 . ./myread
6169 case "$ans" in
6170 y|Y)    val="$define" ;;
6171 *)      val="$undef"  ;;
6172 esac
6173 set userelocatableinc
6174 eval $setvar
6175
6176 initialinstalllocation="$binexp"
6177 : Default prefix is now "up one level from where the binaries are"
6178 case "$userelocatableinc" in
6179 $define|true|[yY]*)
6180     bin=".../"
6181     binexp=".../"
6182     prefix=".../.."
6183     prefixexp=".../.."
6184     installprefixexp=".../.."
6185     ;;
6186 esac
6187
6188 : determine where private library files go
6189 : Usual default is /usr/local/lib/perl5/$version.
6190 : Also allow things like /opt/perl/lib/$version, since
6191 : /opt/perl/lib/perl5... would be redundant.
6192 : The default "style" setting is made in installstyle.U
6193 case "$installstyle" in
6194 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6195 *)       set dflt privlib lib/$version ;;
6196 esac
6197 eval $prefixit
6198 $cat <<EOM
6199
6200 There are some auxiliary files for $package that need to be put into a
6201 private library directory that is accessible by everyone.
6202
6203 EOM
6204 fn=$binexp
6205 fn=d~+
6206 rp='Pathname where the private library files will reside?'
6207 . ./getfile
6208 prefixvar=privlib
6209 . ./setprefixvar
6210
6211 : set the prefixup variable, to restore leading tilda escape
6212 prefixup='case "$prefixexp" in
6213 "$prefix") ;;
6214 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6215 esac'
6216
6217 : determine where public architecture dependent libraries go
6218 set archlib archlib
6219 eval $prefixit
6220 : privlib default is /usr/local/lib/$package/$version
6221 : archlib default is /usr/local/lib/$package/$version/$archname
6222 : privlib may have an optional trailing /share.
6223 tdflt=`echo $privlib | $sed 's,/share$,,'`
6224 tdflt=$tdflt/$archname
6225 case "$archlib" in
6226 '')     dflt=$tdflt
6227         ;;
6228 *)      dflt="$archlib"
6229     ;;
6230 esac
6231 $cat <<EOM
6232
6233 $spackage contains architecture-dependent library files.  If you are
6234 sharing libraries in a heterogeneous environment, you might store
6235 these files in a separate location.  Otherwise, you can just include
6236 them with the rest of the public library files.
6237
6238 EOM
6239 fn=$binexp
6240 fn=d+~
6241 rp='Where do you want to put the public architecture-dependent libraries?'
6242 . ./getfile
6243 prefixvar=archlib
6244 . ./setprefixvar
6245 if $test X"$archlib" = X"$privlib"; then
6246         d_archlib="$undef"
6247 else
6248         d_archlib="$define"
6249 fi
6250
6251 : see if setuid scripts can be secure
6252 $cat <<EOM
6253
6254 Some kernels have a bug that prevents setuid #! scripts from being
6255 secure.  Some sites have disabled setuid #! scripts because of this.
6256
6257 First let's decide if your kernel supports secure setuid #! scripts.
6258 (If setuid #! scripts would be secure but have been disabled anyway,
6259 don't say that they are secure if asked.)
6260
6261 EOM
6262
6263 val="$undef"
6264 if $test -d /dev/fd; then
6265         echo "#!$ls" >reflect
6266         chmod +x,u+s reflect
6267         ./reflect >flect 2>&1
6268         if $contains "/dev/fd" flect >/dev/null; then
6269                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6270                 val="$define"
6271         else
6272                 $cat <<EOM
6273 If you are not sure if they are secure, I can check but I'll need a
6274 username and password different from the one you are using right now.
6275 If you don't have such a username or don't want me to test, simply
6276 enter 'none'.
6277
6278 EOM
6279                 rp='Other username to test security of setuid scripts with?'
6280                 dflt='none'
6281                 . ./myread
6282                 case "$ans" in
6283                 n|none)
6284                         case "$d_suidsafe" in
6285                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6286                                 dflt=n;;
6287                         "$undef")
6288                                 echo "Well, the $hint value is *not* secure." >&4
6289                                 dflt=n;;
6290                         *)      echo "Well, the $hint value *is* secure." >&4
6291                                 dflt=y;;
6292                         esac
6293                         ;;
6294                 *)
6295                         $rm -f reflect flect
6296                         echo "#!$ls" >reflect
6297                         chmod +x,u+s reflect
6298                         echo >flect
6299                         chmod a+w flect
6300                         echo '"su" will (probably) prompt you for '"$ans's password."
6301                         su $ans -c './reflect >flect'
6302                         if $contains "/dev/fd" flect >/dev/null; then
6303                                 echo "Okay, it looks like setuid scripts are secure." >&4
6304                                 dflt=y
6305                         else
6306                                 echo "I don't think setuid scripts are secure." >&4
6307                                 dflt=n
6308                         fi
6309                         ;;
6310                 esac
6311                 rp='Does your kernel have *secure* setuid scripts?'
6312                 . ./myread
6313                 case "$ans" in
6314                 [yY]*)  val="$define";;
6315                 *)      val="$undef";;
6316                 esac
6317         fi
6318 else
6319         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6320         echo "(That's for file descriptors, not floppy disks.)"
6321         val="$undef"
6322 fi
6323 set d_suidsafe
6324 eval $setvar
6325
6326 $rm -f reflect flect
6327
6328 : now see if they want to do setuid emulation
6329 echo " "
6330 val="$undef"
6331 case "$d_suidsafe" in
6332 "$define")
6333         val="$undef"
6334         echo "No need to emulate SUID scripts since they are secure here." >&4
6335         ;;
6336 *)
6337         $cat <<EOM
6338 Some systems have disabled setuid scripts, especially systems where
6339 setuid scripts cannot be secure.  On systems where setuid scripts have
6340 been disabled, the setuid/setgid bits on scripts are currently
6341 useless.  It is possible for $package to detect those bits and emulate
6342 setuid/setgid in a secure fashion.  This emulation will only work if
6343 setuid scripts have been disabled in your kernel.
6344
6345 EOM
6346         case "$d_dosuid" in
6347         "$define") dflt=y ;;
6348         *) dflt=n ;;
6349         esac
6350         rp="Do you want to do setuid/setgid emulation?"
6351         . ./myread
6352         case "$ans" in
6353         [yY]*)  val="$define";;
6354         *)      val="$undef";;
6355         esac
6356         ;;
6357 esac
6358 set d_dosuid
6359 eval $setvar
6360
6361 : Find perl5.005 or later.
6362 echo "Looking for a previously installed perl5.005 or later... "
6363 case "$perl5" in
6364 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6365                 : Check if this perl is recent and can load a simple module
6366                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6367                         perl5=$tdir/perl
6368                         break;
6369                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6370                         perl5=$tdir/perl5
6371                         break;
6372                 fi
6373         done
6374         ;;
6375 *)      perl5="$perl5"
6376         ;;
6377 esac
6378 case "$perl5" in
6379 '')     echo "None found.  That's ok.";;
6380 *)      echo "Using $perl5." ;;
6381 esac
6382
6383 : Set the siteprefix variables
6384 $cat <<EOM
6385
6386 After $package is installed, you may wish to install various
6387 add-on modules and utilities.  Typically, these add-ons will
6388 be installed under $prefix with the rest
6389 of this package.  However, you may wish to install such add-ons
6390 elsewhere under a different prefix.
6391
6392 If you do not wish to put everything under a single prefix, that's
6393 ok.  You will be prompted for the individual locations; this siteprefix
6394 is only used to suggest the defaults.
6395
6396 The default should be fine for most people.
6397
6398 EOM
6399 fn=d~+
6400 rp='Installation prefix to use for add-on modules and utilities?'
6401 : XXX Here might be another good place for an installstyle setting.
6402 case "$siteprefix" in
6403 '') dflt=$prefix ;;
6404 *)  dflt=$siteprefix ;;
6405 esac
6406 . ./getfile
6407 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6408 oldsiteprefix=''
6409 case "$siteprefix" in
6410 '') ;;
6411 *)      case "$ans" in
6412         "$prefix") ;;
6413         *) oldsiteprefix="$prefix";;
6414         esac
6415         ;;
6416 esac
6417 siteprefix="$ans"
6418 siteprefixexp="$ansexp"
6419
6420 : determine where site specific libraries go.
6421 : Usual default is /usr/local/lib/perl5/site_perl/$version
6422 : The default "style" setting is made in installstyle.U
6423 : XXX No longer works with Prefixit stuff.
6424 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6425 case "$sitelib" in
6426 '') case "$installstyle" in
6427         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6428         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6429         esac
6430         ;;
6431 *)      dflt="$sitelib"
6432         ;;
6433 esac
6434 $cat <<EOM
6435
6436 The installation process will create a directory for
6437 site-specific extensions and modules.  Most users find it convenient
6438 to place all site-specific files in this directory rather than in the
6439 main distribution directory.
6440
6441 EOM
6442 fn=d~+
6443 rp='Pathname for the site-specific library files?'
6444 . ./getfile
6445 prefixvar=sitelib
6446 . ./setprefixvar
6447 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6448
6449 : Determine list of previous versions to include in @INC
6450 $cat > getverlist <<EOPL
6451 #!$perl5 -w
6452 use File::Basename;
6453 \$api_versionstring = "$api_versionstring";
6454 \$version = "$version";
6455 \$stem = "$sitelib_stem";
6456 \$archname = "$archname";
6457 EOPL
6458         $cat >> getverlist <<'EOPL'
6459 # The list found is store twice for each entry: the original name, and
6460 # the binary broken down version as pack "sss", so sorting is easy and
6461 # unambiguous. This will work for all versions that have a maximum of
6462 # three digit groups, separate by '.'s or '_'s. Names are extended with
6463 # ".0.0" to ensure at least three elements for the pack.
6464 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6465
6466 # Can't have leading @ because metaconfig interprets it as a command!
6467 ;@inc_version_list=();
6468 # XXX Redo to do opendir/readdir?
6469 if (-d $stem) {
6470     chdir($stem);
6471     ;@candidates = map {
6472         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6473 }
6474 else {
6475     ;@candidates = ();
6476 }
6477
6478 ($pversion, $aversion, $vsn5005) = map {
6479     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6480 foreach $d (@candidates) {
6481     if ($d->[1] lt $pversion) {
6482         if ($d->[1] ge $aversion) {
6483             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6484         }
6485         elsif ($d->[1] ge $vsn5005) {
6486             unshift(@inc_version_list, grep { -d } $d->[0]);
6487         }
6488     }
6489     else {
6490         # Skip newer version.  I.e. don't look in
6491         # 5.7.0 if we're installing 5.6.1.
6492     }
6493 }
6494
6495 if (@inc_version_list) {
6496     print join(' ', @inc_version_list);
6497 }
6498 else {
6499     # Blank space to preserve value for next Configure run.
6500     print " ";
6501 }
6502 EOPL
6503 chmod +x getverlist
6504 case "$inc_version_list" in
6505 '')     if test -x "$perl5$exe_ext"; then
6506                 dflt=`$perl5 getverlist`
6507         else
6508                 dflt='none'
6509         fi
6510         ;;
6511 $undef) dflt='none' ;;
6512 *)  eval dflt=\"$inc_version_list\" ;;
6513 esac
6514 case "$dflt" in
6515 ''|' ') dflt=none ;;
6516 esac
6517 case "$dflt" in
6518 5.005) dflt=none ;;
6519 esac
6520 $cat <<EOM
6521
6522 In order to ease the process of upgrading, this version of perl
6523 can be configured to use modules built and installed with earlier
6524 versions of perl that were installed under $prefix.  Specify here
6525 the list of earlier versions that this version of perl should check.
6526 If Configure detected no earlier versions of perl installed under
6527 $prefix, then the list will be empty.  Answer 'none' to tell perl
6528 to not search earlier versions.
6529
6530 The default should almost always be sensible, so if you're not sure,
6531 just accept the default.
6532 EOM
6533
6534 rp='List of earlier versions to include in @INC?'
6535 . ./myread
6536 case "$ans" in
6537 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6538 *) inc_version_list="$ans" ;;
6539 esac
6540 case "$inc_version_list" in
6541 ''|' ')
6542         inc_version_list_init='0'
6543         d_inc_version_list="$undef"
6544         ;;
6545 *)      inc_version_list_init=`echo $inc_version_list |
6546                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6547         d_inc_version_list="$define"
6548         ;;
6549 esac
6550 $rm -f getverlist
6551
6552 : see if this is a malloc.h system
6553 : we want a real compile instead of Inhdr because some systems have a
6554 : malloc.h that just gives a compile error saying to use stdlib.h instead
6555 echo " "
6556 $cat >try.c <<EOCP
6557 #include <stdlib.h>
6558 #include <malloc.h>
6559 int main () { return 0; }
6560 EOCP
6561 set try
6562 if eval $compile; then
6563     echo "<malloc.h> found." >&4
6564     val="$define"
6565 else
6566     echo "<malloc.h> NOT found." >&4
6567     val="$undef"
6568 fi
6569 $rm_try
6570 set i_malloc
6571 eval $setvar
6572
6573 : check for void type
6574 echo " "
6575 echo "Checking to see how well your C compiler groks the void type..." >&4
6576 case "$voidflags" in
6577 '')
6578         $cat >try.c <<EOCP
6579 #$i_stdlib I_STDLIB
6580 #ifdef I_STDLIB
6581 #include <stdlib.h>
6582 #endif
6583 #if TRY & 1
6584 void sub() {
6585 #else
6586 sub() {
6587 #endif
6588         extern void moo();      /* function returning void */
6589         void (*goo)();          /* ptr to func returning void */
6590 #if TRY & 8
6591         void *hue;              /* generic ptr */
6592 #endif
6593 #if TRY & 2
6594         void (*foo[10])();
6595 #endif
6596
6597 #if TRY & 4
6598         if(goo == moo) {
6599                 exit(0);
6600         }
6601 #endif
6602         exit(0);
6603 }
6604 int main() { sub(); }
6605 EOCP
6606         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6607                 voidflags=$defvoidused
6608         echo "Good.  It appears to support void to the level $package wants.">&4
6609                 if $contains warning .out >/dev/null 2>&1; then
6610                         echo "However, you might get some warnings that look like this:"
6611                         $cat .out
6612                 fi
6613         else
6614 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6615                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6616                         echo "It supports 1..."
6617                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6618                                 echo "It also supports 2..."
6619                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6620                                         voidflags=7
6621                                         echo "And it supports 4 but not 8 definitely."
6622                                 else
6623                                         echo "It doesn't support 4..."
6624                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6625                                                 voidflags=11
6626                                                 echo "But it supports 8."
6627                                         else
6628                                                 voidflags=3
6629                                                 echo "Neither does it support 8."
6630                                         fi
6631                                 fi
6632                         else
6633                                 echo "It does not support 2..."
6634                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6635                                         voidflags=13
6636                                         echo "But it supports 4 and 8."
6637                                 else
6638                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6639                                                 voidflags=5
6640                                                 echo "And it supports 4 but has not heard about 8."
6641                                         else
6642                                                 echo "However it supports 8 but not 4."
6643                                         fi
6644                                 fi
6645                         fi
6646                 else
6647                         echo "There is no support at all for void."
6648                         voidflags=0
6649                 fi
6650         fi
6651 esac
6652 case "$voidflags" in
6653 "$defvoidused") ;;
6654 *)      $cat >&4 <<'EOM'
6655   Support flag bits are:
6656     1: basic void declarations.
6657     2: arrays of pointers to functions returning void.
6658     4: operations between pointers to and addresses of void functions.
6659     8: generic void pointers.
6660 EOM
6661         dflt="$voidflags";
6662         rp="Your void support flags add up to what?"
6663         . ./myread
6664         voidflags="$ans"
6665         ;;
6666 esac
6667 $rm_try
6668
6669 : check for length of pointer
6670 echo " "
6671 case "$ptrsize" in
6672 '')
6673         echo "Checking to see how big your pointers are..." >&4
6674         if test "$voidflags" -gt 7; then
6675                 echo '#define VOID_PTR char *' > try.c
6676         else
6677                 echo '#define VOID_PTR void *' > try.c
6678         fi
6679         $cat >>try.c <<EOCP
6680 #include <stdio.h>
6681 #$i_stdlib I_STDLIB
6682 #ifdef I_STDLIB
6683 #include <stdlib.h>
6684 #endif
6685 int main()
6686 {
6687     printf("%d\n", (int)sizeof(VOID_PTR));
6688     exit(0);
6689 }
6690 EOCP
6691         set try
6692         if eval $compile_ok; then
6693                 ptrsize=`$run ./try`
6694                 echo "Your pointers are $ptrsize bytes long."
6695         else
6696                 dflt='4'
6697                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6698                 rp="What is the size of a pointer (in bytes)?"
6699                 . ./myread
6700                 ptrsize="$ans"
6701         fi
6702         ;;
6703 esac
6704 $rm_try
6705 case "$use64bitall" in
6706 "$define"|true|[yY]*)
6707         case "$ptrsize" in
6708         4)      cat <<EOM >&4
6709
6710 *** You have chosen a maximally 64-bit build,
6711 *** but your pointers are only 4 bytes wide.
6712 *** Please rerun Configure without -Duse64bitall.
6713 EOM
6714                 case "$d_quad" in
6715                 define)
6716                         cat <<EOM >&4
6717 *** Since you have quads, you could possibly try with -Duse64bitint.
6718 EOM
6719                         ;;
6720                 esac
6721                 cat <<EOM >&4
6722 *** Cannot continue, aborting.
6723
6724 EOM
6725
6726                 exit 1
6727                 ;;
6728         esac
6729         ;;
6730 esac
6731
6732
6733 : determine whether to use malloc wrapping
6734 echo " "
6735 case "$usemallocwrap" in
6736 [yY]*|true|$define)     dflt='y' ;;
6737 [nN]*|false|$undef)     dflt='n' ;;
6738 *)      case "$usedevel" in
6739         [yY]*|true|$define)     dflt='y' ;;
6740         *) dflt='n' ;;
6741         esac
6742         ;;
6743 esac
6744 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6745 . ./myread
6746 usemallocwrap="$ans"
6747 case "$ans" in
6748 y*|true)
6749         usemallocwrap="$define" ;;
6750 *)
6751         usemallocwrap="$undef" ;;
6752 esac
6753
6754 : determine which malloc to compile in
6755 echo " "
6756 case "$usemymalloc" in
6757 [yY]*|true|$define)     dflt='y' ;;
6758 [nN]*|false|$undef)     dflt='n' ;;
6759 *)      case "$ptrsize" in
6760         4) dflt='y' ;;
6761         *) dflt='n' ;;
6762         esac
6763         ;;
6764 esac
6765 rp="Do you wish to attempt to use the malloc that comes with $package?"
6766 . ./myread
6767 usemymalloc="$ans"
6768 case "$ans" in
6769 y*|true)
6770         usemymalloc='y'
6771         mallocsrc='malloc.c'
6772         mallocobj="malloc$_o"
6773         d_mymalloc="$define"
6774         case "$libs" in
6775         *-lmalloc*)
6776                 : Remove malloc from list of libraries to use
6777                 echo "Removing unneeded -lmalloc from library list" >&4
6778                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6779                 shift
6780                 libs="$*"
6781                 echo "libs = $libs" >&4
6782                 ;;
6783         esac
6784         ;;
6785 *)
6786         usemymalloc='n'
6787         mallocsrc=''
6788         mallocobj=''
6789         d_mymalloc="$undef"
6790         ;;
6791 esac
6792
6793 : compute the return types of malloc and free
6794 echo " "
6795 $cat >malloc.c <<END
6796 #$i_malloc I_MALLOC
6797 #$i_stdlib I_STDLIB
6798 #include <stdio.h>
6799 #include <sys/types.h>
6800 #ifdef I_MALLOC
6801 #include <malloc.h>
6802 #endif
6803 #ifdef I_STDLIB
6804 #include <stdlib.h>
6805 #endif
6806 #ifdef TRY_MALLOC
6807 void *malloc();
6808 #endif
6809 #ifdef TRY_FREE
6810 void free();
6811 #endif
6812 END
6813 case "$malloctype" in
6814 '')
6815         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6816                 malloctype='void *'
6817         else
6818                 malloctype='char *'
6819         fi
6820         ;;
6821 esac
6822 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6823
6824 case "$freetype" in
6825 '')
6826         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6827                 freetype='void'
6828         else
6829                 freetype='int'
6830         fi
6831         ;;
6832 esac
6833 echo "Your system uses $freetype free(), it would seem." >&4
6834 $rm -f malloc.[co]
6835 : determine where site specific architecture-dependent libraries go.
6836 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6837 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6838 : sitelib may have an optional trailing /share.
6839 case "$sitearch" in
6840 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6841         dflt="$dflt/$archname"
6842         ;;
6843 *)      dflt="$sitearch"
6844         ;;
6845 esac
6846 set sitearch sitearch none
6847 eval $prefixit
6848 $cat <<EOM
6849
6850 The installation process will also create a directory for
6851 architecture-dependent site-specific extensions and modules.
6852
6853 EOM
6854 fn=d~+
6855 rp='Pathname for the site-specific architecture-dependent library files?'
6856 . ./getfile
6857 prefixvar=sitearch
6858 . ./setprefixvar
6859 if $test X"$sitearch" = X"$sitelib"; then
6860         d_sitearch="$undef"
6861 else
6862         d_sitearch="$define"
6863 fi
6864
6865 : Set the vendorprefix variables
6866 $cat <<EOM
6867
6868 The installation process will also create a directory for
6869 vendor-supplied add-ons.  Vendors who supply perl with their system
6870 may find it convenient to place all vendor-supplied files in this
6871 directory rather than in the main distribution directory.  This will
6872 ease upgrades between binary-compatible maintenance versions of perl.
6873
6874 Of course you may also use these directories in whatever way you see
6875 fit.  For example, you might use them to access modules shared over a
6876 company-wide network.
6877
6878 The default answer should be fine for most people.
6879 This causes further questions about vendor add-ons to be skipped
6880 and no vendor-specific directories will be configured for perl.
6881
6882 EOM
6883 rp='Do you want to configure vendor-specific add-on directories?'
6884 case "$usevendorprefix" in
6885 define|true|[yY]*) dflt=y ;;
6886 *)      : User may have set vendorprefix directly on Configure command line.
6887         case "$vendorprefix" in
6888         ''|' ') dflt=n ;;
6889         *)      dflt=y ;;
6890         esac
6891         ;;
6892 esac
6893 . ./myread
6894 case "$ans" in
6895 [yY]*)  fn=d~+
6896         rp='Installation prefix to use for vendor-supplied add-ons?'
6897         case "$vendorprefix" in
6898         '') dflt='' ;;
6899         *)  dflt=$vendorprefix ;;
6900         esac
6901         . ./getfile
6902         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6903         oldvendorprefix=''
6904         case "$vendorprefix" in
6905         '') ;;
6906         *)      case "$ans" in
6907                 "$prefix") ;;
6908                 *) oldvendorprefix="$prefix";;
6909                 esac
6910                 ;;
6911         esac
6912         usevendorprefix="$define"
6913         vendorprefix="$ans"
6914         vendorprefixexp="$ansexp"
6915         ;;
6916 *)      usevendorprefix="$undef"
6917         vendorprefix=''
6918         vendorprefixexp=''
6919         ;;
6920 esac
6921
6922 : Set the vendorlib variables
6923 case "$vendorprefix" in
6924 '')     d_vendorlib="$undef"
6925         vendorlib=''
6926         vendorlibexp=''
6927         ;;
6928 *)      d_vendorlib="$define"
6929         : determine where vendor-supplied modules go.
6930         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6931         case "$vendorlib" in
6932         '')
6933                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6934                 case "$installstyle" in
6935                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6936                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6937                 esac
6938                 ;;
6939         *)      dflt="$vendorlib"
6940                 ;;
6941         esac
6942         fn=d~+
6943         rp='Pathname for the vendor-supplied library files?'
6944         . ./getfile
6945         vendorlib="$ans"
6946         vendorlibexp="$ansexp"
6947         ;;
6948 esac
6949 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6950 prefixvar=vendorlib
6951 . ./installprefix
6952
6953 : Set the vendorarch variables
6954 case "$vendorprefix" in
6955 '')     d_vendorarch="$undef"
6956         vendorarch=''
6957         vendorarchexp=''
6958         ;;
6959 *)      d_vendorarch="$define"
6960         : determine where vendor-supplied architecture-dependent libraries go.
6961         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6962         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6963         : vendorlib may have an optional trailing /share.
6964         case "$vendorarch" in
6965         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6966                 dflt="$dflt/$archname"
6967                 ;;
6968         *)      dflt="$vendorarch" ;;
6969         esac
6970         fn=d~+
6971         rp='Pathname for vendor-supplied architecture-dependent files?'
6972         . ./getfile
6973         vendorarch="$ans"
6974         vendorarchexp="$ansexp"
6975         ;;
6976 esac
6977 prefixvar=vendorarch
6978 . ./installprefix
6979
6980 : Final catch-all directories to search
6981 $cat <<EOM
6982
6983 Lastly, you can have perl look in other directories for extensions and
6984 modules in addition to those already specified.
6985 These directories will be searched after 
6986         $sitearch 
6987         $sitelib 
6988 EOM
6989 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6990 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6991 echo ' '
6992 case "$otherlibdirs" in
6993 ''|' ') dflt='none' ;;
6994 *)      dflt="$otherlibdirs" ;;
6995 esac
6996 $cat <<EOM
6997 Enter a colon-separated set of extra paths to include in perl's @INC
6998 search path, or enter 'none' for no extra paths.
6999
7000 EOM
7001
7002 rp='Colon-separated list of additional directories for perl to search?'
7003 . ./myread
7004 case "$ans" in
7005 ' '|''|none)    otherlibdirs=' ' ;;     
7006 *)      otherlibdirs="$ans" ;;
7007 esac
7008 case "$otherlibdirs" in
7009 ' ') val=$undef ;;
7010 *)      val=$define ;;
7011 esac
7012 set d_perl_otherlibdirs
7013 eval $setvar
7014
7015 : Cruising for prototypes
7016 echo " "
7017 echo "Checking out function prototypes..." >&4
7018 $cat >prototype.c <<EOCP
7019 #$i_stdlib I_STDLIB
7020 #ifdef I_STDLIB
7021 #include <stdlib.h>
7022 #endif
7023 int main(int argc, char *argv[]) {
7024         exit(0);}
7025 EOCP
7026 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7027         echo "Your C compiler appears to support function prototypes."
7028         val="$define"
7029 else
7030         echo "Your C compiler doesn't seem to understand function prototypes."
7031         val="$undef"
7032 fi
7033 set prototype
7034 eval $setvar
7035 $rm -f prototype*
7036
7037 : Check if ansi2knr is required
7038 case "$prototype" in
7039 "$define") ;;
7040 *)      ansi2knr='ansi2knr'
7041         echo " "
7042         cat <<EOM >&4
7043
7044 $me:  FATAL ERROR:
7045 This version of $package can only be compiled by a compiler that 
7046 understands function prototypes.  Unfortunately, your C compiler 
7047         $cc $ccflags
7048 doesn't seem to understand them.  Sorry about that.
7049
7050 If GNU cc is available for your system, perhaps you could try that instead.  
7051
7052 Eventually, we hope to support building Perl with pre-ANSI compilers.
7053 If you would like to help in that effort, please contact <perlbug@perl.org>.
7054
7055 Aborting Configure now.
7056 EOM
7057         exit 2
7058         ;;
7059 esac
7060
7061 : DTrace support
7062 dflt_dtrace='/usr/sbin/dtrace'
7063 cat <<EOM
7064
7065 Perl can be built to support DTrace on platforms that support it.
7066 DTrace is a diagnosis and performance analysis tool from Sun.
7067
7068 If this doesn't make any sense to you, just accept the default '$dflt'.
7069 EOM
7070
7071 while $test 1 ; do
7072         case "$usedtrace" in
7073         $define|true|[yY]*)
7074                 dflt='y'
7075                 ;;
7076         ?*)
7077                 dflt='y'
7078                 dflt_dtrace=$usedtrace
7079                 ;;
7080         *)
7081                 dflt='n'
7082                 ;;
7083         esac
7084
7085         rp='Support DTrace if available?'
7086         . ./myread
7087         case "$ans" in
7088         y|Y)    val="$define" ;;
7089         *)      val="$undef" ;;
7090         esac
7091         set usedtrace
7092         eval $setvar
7093
7094         test "X$usedtrace" != "X$define" && break
7095
7096         echo " "
7097         rp='Where is the dtrace executable?'
7098         dflt=$dflt_dtrace
7099         . ./getfile
7100         val="$ans"
7101         set dtrace
7102         eval $setvar
7103
7104         if $test -f $dtrace
7105         then
7106                 if $dtrace -h -s ../perldtrace.d \
7107                         -o perldtrace.tmp >/dev/null 2>&1 \
7108                         && rm -f perldtrace.tmp
7109                 then
7110                         echo " "
7111                         echo "Good: your $dtrace knows about the -h flag."
7112                 else
7113                         cat >&2 <<EOM
7114
7115 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7116 ***
7117 *** Your installed dtrace doesn't support the -h switch to compile a D
7118 *** program into a C header. Can't continue.
7119
7120 EOM
7121                         exit 1
7122                 fi
7123                 break;
7124         fi
7125
7126         case "$fastread" in
7127         yes)
7128                 cat >&2 <<EOM
7129
7130 *** $me:  Fatal Error:  $dtrace not found.
7131 *** Can't continue.
7132
7133 EOM
7134                 exit 1
7135                 ;;
7136         *)
7137                 echo "*** $dtrace was not found."
7138                 echo " "
7139                 ;;
7140         esac
7141 done
7142
7143 : See if we want extra modules installed
7144 echo " "
7145 case "$extras" in
7146 '') dflt='n';;
7147 *) dflt='y';;
7148 esac
7149 cat <<EOM
7150 Perl can be built with extra modules or bundles of modules which
7151 will be fetched from the CPAN and installed alongside Perl.
7152
7153 Notice that you will need access to the CPAN; either via the Internet,
7154 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7155 be asked later to configure the CPAN.pm module which will in turn do
7156 the installation of the rest of the extra modules or bundles.)
7157
7158 Notice also that if the modules require any external software such as
7159 libraries and headers (the libz library and the zlib.h header for the
7160 Compress::Zlib module, for example) you MUST have any such software
7161 already installed, this configuration process will NOT install such
7162 things for you.
7163
7164 If this doesn't make any sense to you, just accept the default '$dflt'.
7165 EOM
7166 rp='Install any extra modules (y or n)?'
7167 . ./myread
7168 case "$ans" in
7169 y|Y)
7170         cat <<EOM
7171
7172 Please list any extra modules or bundles to be installed from CPAN,
7173 with spaces between the names.  The names can be in any format the
7174 'install' command of CPAN.pm will understand.  (Answer 'none',
7175 without the quotes, to install no extra modules or bundles.)
7176 EOM
7177         rp='Extras?'
7178         dflt="$extras"
7179         . ./myread
7180         extras="$ans"
7181 esac
7182 case "$extras" in
7183 ''|'none')
7184         val=''
7185         $rm -f ../extras.lst
7186         ;;
7187 *)      echo "(Saving the list of extras for later...)"
7188         echo "$extras" > ../extras.lst
7189         val="'$extras'"
7190         ;;
7191 esac
7192 set extras
7193 eval $setvar
7194 echo " "
7195
7196 : determine where html pages for programs go
7197 set html1dir html1dir none
7198 eval $prefixit
7199 $cat <<EOM
7200
7201 If you wish to install html files for programs in $spackage, indicate
7202 the appropriate directory here.  To skip installing html files,
7203 answer "none".
7204 EOM
7205 case "$html1dir" in
7206 ''|none|$undef|' ') dflt=none ;;
7207 *) dflt=$html1dir ;;
7208 esac
7209 fn=dn+~
7210 rp="Directory for the main $spackage html pages?"
7211 . ./getfile
7212 prefixvar=html1dir
7213 . ./setprefixvar
7214 : Use ' ' for none so value is preserved next time through Configure
7215 $test X"$html1dir" = "X" && html1dir=' '
7216
7217 : determine where html pages for libraries and modules go
7218 set html3dir html3dir none
7219 eval $prefixit
7220 $cat <<EOM
7221
7222 If you wish to install html files for modules associated with $spackage,
7223 indicate the appropriate directory here.  To skip installing html files,
7224 answer "none".
7225 EOM
7226 : There is no obvious default.  If they have specified html1dir, then
7227 : try to key off that, possibly changing .../html1 into .../html3.
7228 case "$html3dir" in
7229 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7230 *) dflt=$html3dir ;;
7231 esac
7232 fn=dn+~
7233 rp="Directory for the $spackage module html pages?"
7234 . ./getfile
7235 prefixvar=html3dir
7236 . ./setprefixvar
7237 : Use ' ' for none so value is preserved next time through Configure
7238 $test X"$html3dir" = "X" && html3dir=' '
7239
7240 : determine whether to install perl also as /usr/bin/perl
7241
7242 echo " "
7243 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7244         $cat <<EOM
7245 Many scripts expect perl to be installed as /usr/bin/perl.
7246
7247 If you want to, I can install the perl you are about to compile
7248 as /usr/bin/perl (in addition to $bin/perl).
7249 EOM
7250         if test -f /usr/bin/perl; then
7251             $cat <<EOM
7252
7253 However, please note that because you already have a /usr/bin/perl,
7254 overwriting that with a new Perl would very probably cause problems.
7255 Therefore I'm assuming you don't want to do that (unless you insist).
7256
7257 EOM
7258             case "$installusrbinperl" in
7259             "$define"|[yY]*)    dflt='y';;
7260             *)                  dflt='n';;
7261             esac
7262         else
7263             $cat <<EOM
7264
7265 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7266
7267 EOM
7268             case "$installusrbinperl" in
7269             "$undef"|[nN]*)     dflt='n';;
7270             *)                  dflt='y';;
7271             esac
7272         fi
7273         rp="Do you want to install perl as /usr/bin/perl?"
7274         . ./myread
7275         case "$ans" in
7276         [yY]*)  val="$define";;
7277         *)      val="$undef" ;;
7278         esac
7279 else
7280         val="$undef"
7281 fi
7282 set installusrbinperl
7283 eval $setvar
7284
7285 : Check if we are using the GNU C library
7286 echo " "
7287 echo "Checking for GNU C Library..." >&4
7288 cat >try.c <<'EOCP'
7289 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7290    alone are insufficient to distinguish different versions, such as
7291    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7292    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7293 */
7294 #include <stdio.h>
7295 int main(void)
7296 {
7297 #ifdef __GLIBC__
7298 #   ifdef __GLIBC_MINOR__
7299 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7300 #           include <gnu/libc-version.h>
7301             printf("%s\n",  gnu_get_libc_version());
7302 #       else
7303             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7304 #       endif
7305 #   else
7306         printf("%d\n",  __GLIBC__);
7307 #   endif
7308     return 0;
7309 #else
7310     return 1;
7311 #endif
7312 }
7313 EOCP
7314 set try
7315 if eval $compile_ok && $run ./try > glibc.ver; then
7316         val="$define"
7317         gnulibc_version=`$cat glibc.ver`
7318         echo "You are using the GNU C Library version $gnulibc_version"
7319 else
7320         val="$undef"
7321         gnulibc_version=''
7322         echo "You are not using the GNU C Library"
7323 fi
7324 $rm_try glibc.ver
7325 set d_gnulibc
7326 eval $setvar
7327
7328 : see if nm is to be used to determine whether a symbol is defined or not
7329 case "$usenm" in
7330 '')
7331         dflt=''
7332         case "$d_gnulibc" in
7333         "$define")
7334                 echo " "
7335                 echo "nm probably won't work on the GNU C Library." >&4
7336                 dflt=n
7337                 ;;
7338         esac
7339         case "$dflt" in
7340         '') 
7341                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7342                         echo " "
7343                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7344                         echo "'nm' won't be sufficient on this sytem." >&4
7345                         dflt=n
7346                 fi
7347                 ;;
7348         esac
7349         case "$dflt" in
7350         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7351                 if $test $dflt -gt 20; then
7352                         dflt=y
7353                 else
7354                         dflt=n
7355                 fi
7356                 ;;
7357         esac
7358         ;;
7359 *)
7360         case "$usenm" in
7361         true|$define) dflt=y;;
7362         *) dflt=n;;
7363         esac
7364         ;;
7365 esac
7366 $cat <<EOM
7367
7368 I can use $nm to extract the symbols from your C libraries. This
7369 is a time consuming task which may generate huge output on the disk (up
7370 to 3 megabytes) but that should make the symbols extraction faster. The
7371 alternative is to skip the 'nm' extraction part and to compile a small
7372 test program instead to determine whether each symbol is present. If
7373 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7374 this may be the best solution.
7375
7376 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7377
7378 EOM
7379 rp="Shall I use $nm to extract C symbols from the libraries?"
7380 . ./myread
7381 case "$ans" in
7382 [Nn]*) usenm=false;;
7383 *) usenm=true;;
7384 esac
7385
7386 runnm=$usenm
7387 case "$reuseval" in
7388 true) runnm=false;;
7389 esac
7390
7391 : nm options which may be necessary
7392 case "$nm_opt" in
7393 '') if $test -f /mach_boot; then
7394                 nm_opt=''       # Mach
7395         elif $test -d /usr/ccs/lib; then
7396                 nm_opt='-p'     # Solaris (and SunOS?)
7397         elif $test -f /dgux; then
7398                 nm_opt='-p'     # DG-UX
7399         elif $test -f /lib64/rld; then
7400                 nm_opt='-p'     # 64-bit Irix
7401         else
7402                 nm_opt=''
7403         fi;;
7404 esac
7405
7406 : nm options which may be necessary for shared libraries but illegal
7407 : for archive libraries.  Thank you, Linux.
7408 case "$nm_so_opt" in
7409 '')     case "$myuname" in
7410         *linux*|gnu*)
7411                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7412                         nm_so_opt='--dynamic'
7413                 fi
7414                 ;;
7415         esac
7416         ;;
7417 esac
7418
7419 : get list of predefined functions in a handy place
7420 case "$runnm" in
7421 true)
7422 echo " "
7423 case "$libc" in
7424 '') libc=unknown
7425         case "$libs" in
7426         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7427         esac
7428         ;;
7429 esac
7430 case "$libs" in
7431 '') ;;
7432 *)  for thislib in $libs; do
7433         case "$thislib" in
7434         -lc|-lc_s)
7435                 : Handle C library specially below.
7436                 ;;
7437         -l*)
7438                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7439                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7440                         :
7441                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7442                         :
7443                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7444                         :
7445                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7446                         :
7447                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7448                         :
7449                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7450                         :
7451                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7452                         :
7453                 else
7454                         try=''
7455                 fi
7456                 libnames="$libnames $try"
7457                 ;;
7458         *) libnames="$libnames $thislib" ;;
7459         esac
7460         done
7461         ;;
7462 esac
7463 xxx=normal
7464 case "$libc" in
7465 unknown)
7466         set /lib/libc.$so
7467         for xxx in $libpth; do
7468                 $test -r $1 || set $xxx/libc.$so
7469                 : The messy sed command sorts on library version numbers.
7470                 $test -r $1 || \
7471                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7472                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7473                                 h
7474                                 s/[0-9][0-9]*/0000&/g
7475                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7476                                 G
7477                                 s/\n/ /' | \
7478                          $sort | $sed -e 's/^.* //'`
7479                 eval set \$$#
7480         done
7481         $test -r $1 || set /usr/ccs/lib/libc.$so
7482         $test -r $1 || set /lib/libsys_s$_a
7483         ;;
7484 *)
7485         set blurfl
7486         ;;
7487 esac
7488 if $test -r "$1"; then
7489         echo "Your (shared) C library seems to be in $1."
7490         libc="$1"
7491 elif $test -r /lib/libc && $test -r /lib/clib; then
7492         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7493         xxx=apollo
7494         libc='/lib/clib /lib/libc'
7495         if $test -r /lib/syslib; then
7496                 echo "(Your math library is in /lib/syslib.)"
7497                 libc="$libc /lib/syslib"
7498         fi
7499 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7500         echo "Your C library seems to be in $libc, as you said before."
7501 elif $test -r $incpath/usr/lib/libc$_a; then
7502         libc=$incpath/usr/lib/libc$_a;
7503         echo "Your C library seems to be in $libc.  That's fine."
7504 elif $test -r /lib/libc$_a; then
7505         libc=/lib/libc$_a;
7506         echo "Your C library seems to be in $libc.  You're normal."
7507 else
7508         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7509                 :
7510         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7511                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7512         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7513                 :
7514         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7515                 :
7516         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7517                 :
7518         else
7519                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7520         fi
7521         if $test -r "$tans"; then
7522                 echo "Your C library seems to be in $tans, of all places."
7523                 libc=$tans
7524         else
7525                 libc='blurfl'
7526         fi
7527 fi
7528 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7529         dflt="$libc"
7530         cat <<EOM
7531
7532 If the guess above is wrong (which it might be if you're using a strange
7533 compiler, or your machine supports multiple models), you can override it here.
7534
7535 EOM
7536 else
7537         dflt=''
7538         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7539         cat >&4 <<EOM
7540 I can't seem to find your C library.  I've looked in the following places:
7541
7542 EOM
7543         $sed 's/^/      /' libpath
7544         cat <<EOM
7545
7546 None of these seems to contain your C library. I need to get its name...
7547
7548 EOM
7549 fi
7550 fn=f
7551 rp='Where is your C library?'
7552 . ./getfile
7553 libc="$ans"
7554
7555 echo " "
7556 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7557 set X `cat libnames`
7558 shift
7559 xxx=files
7560 case $# in 1) xxx=file; esac
7561 echo "Extracting names from the following $xxx for later perusal:" >&4
7562 echo " "
7563 $sed 's/^/      /' libnames >&4
7564 echo " "
7565 $echo $n "This may take a while...$c" >&4
7566
7567 for file in $*; do
7568         case $file in
7569         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7570         *) $nm $nm_opt $file 2>/dev/null;;
7571         esac
7572 done >libc.tmp
7573
7574 $echo $n ".$c"
7575 $grep fprintf libc.tmp > libc.ptf
7576 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7577 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7578 xxx='[ADTSIW]'
7579 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7580         eval $xscan;\
7581         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7582                 eval $xrun
7583 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7584         eval $xscan;\
7585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7586                 eval $xrun
7587 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7588         eval $xscan;\
7589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7590                 eval $xrun
7591 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7592         eval $xscan;\
7593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7594                 eval $xrun
7595 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7596         eval $xscan;\
7597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7598                 eval $xrun
7599 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7604                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7605         eval $xscan;\
7606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7607                 eval $xrun
7608 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e '/Def. Text/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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 else
7637         $nm -p $* 2>/dev/null >libc.tmp
7638         $grep fprintf libc.tmp > libc.ptf
7639         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7640                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7641         then
7642                 nm_opt='-p'
7643                 eval $xrun
7644         else
7645                 echo " "
7646                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7647                 com=''
7648                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7649                         for thisname in $libnames $libc; do
7650                                 $ar t $thisname >>libc.tmp
7651                         done
7652                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7653                         echo "Ok." >&4
7654                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7655                         # Repeat libc to extract forwarders to DLL entries too
7656                         for thisname in $libnames $libc; do
7657                                 $ar tv $thisname >>libc.tmp
7658                                 # Revision 50 of EMX has bug in $ar.
7659                                 # it will not extract forwarders to DLL entries
7660                                 # Use emximp which will extract exactly them.
7661                                 emximp -o tmp.imp $thisname \
7662                                     2>/dev/null && \
7663                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7664                                     < tmp.imp >>libc.tmp
7665                                 $rm tmp.imp
7666                         done
7667                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7668                         echo "Ok." >&4
7669                 else
7670                         echo "$ar didn't seem to work right." >&4
7671                         echo "Maybe this is a Cray...trying bld instead..." >&4
7672                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7673                         then
7674                                 for thisname in $libnames; do
7675                                         bld t $libnames | \
7676                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7677                                         $ar t $thisname >>libc.tmp
7678                                 done
7679                                 echo "Ok." >&4
7680                         else
7681                                 echo "That didn't work either.  Giving up." >&4
7682                                 exit 1
7683                         fi
7684                 fi
7685         fi
7686 fi
7687 nm_extract="$com"
7688 case "$PASE" in
7689 define)
7690     echo " "
7691     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7692     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7693     ;;
7694 *)  if $test -f /lib/syscalls.exp; then
7695         echo " "
7696         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7697         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7698     fi
7699     ;;
7700 esac
7701 ;;
7702 esac
7703 $rm -f libnames libpath
7704
7705 : see if dld is available
7706 set dld.h i_dld
7707 eval $inhdr
7708
7709 : Check if we are using C++
7710 echo " "
7711 echo "Checking for C++..." >&4
7712 $cat >try.c <<'EOCP'
7713 #include <stdio.h>
7714 int main(void)
7715 {
7716 #ifdef __cplusplus
7717     return 0;
7718 #else
7719     return 1;
7720 #endif
7721 }
7722 EOCP
7723 set try
7724 if eval $compile_ok && $run ./try; then
7725         val="$define"
7726         echo "You are using a C++ compiler."
7727 else
7728         val="$undef"
7729         echo "You are not using a C++ compiler."
7730 fi
7731 $rm_try cplusplus$$
7732 set d_cplusplus
7733 eval $setvar
7734
7735 : is a C symbol defined?
7736 csym='tlook=$1;
7737 case "$3" in
7738 -v) tf=libc.tmp; tdc="";;
7739 -a) tf=libc.tmp; tdc="[]";;
7740 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7741 esac;
7742 tx=yes;
7743 case "$reuseval-$4" in
7744 true-) ;;
7745 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7746 esac;
7747 case "$tx" in
7748 yes)
7749         tval=false;
7750         case "$d_cplusplus" in
7751                 $define) extern_C=\"C\";;
7752         esac;
7753         if $test "$runnm" = true; then
7754                 if $contains $tlook $tf >/dev/null 2>&1; then
7755                         tval=true;
7756                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7757                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7758                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7759                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7760                         $rm_try;
7761                 fi;
7762         else
7763                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7764                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7765                 $rm_try;
7766         fi;
7767         ;;
7768 *)
7769         case "$tval" in
7770         $define) tval=true;;
7771         *) tval=false;;
7772         esac;
7773         ;;
7774 esac;
7775 eval "$2=$tval"'
7776
7777 : define an is-in-libc? function
7778 inlibc='echo " "; td=$define; tu=$undef;
7779 sym=$1; var=$2; eval "was=\$$2";
7780 tx=yes;
7781 case "$reuseval$was" in
7782 true) ;;
7783 true*) tx=no;;
7784 esac;
7785 case "$tx" in
7786 yes)
7787         set $sym tres -f;
7788         eval $csym;
7789         case "$tres" in
7790         true)
7791                 echo "$sym() found." >&4;
7792                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7793         *)
7794                 echo "$sym() NOT found." >&4;
7795                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7796         esac;;
7797 *)
7798         case "$was" in
7799         $define) echo "$sym() found." >&4;;
7800         *) echo "$sym() NOT found." >&4;;
7801         esac;;
7802 esac'
7803
7804 : see if dlopen exists
7805 xxx_runnm="$runnm"
7806 xxx_ccflags="$ccflags"
7807 runnm=false
7808 : with g++ one needs -shared to get is-in-libc to work for dlopen
7809 case "$gccversion" in
7810 '')     ;;
7811 *)      case "$d_cplusplus" in
7812         "$define") ccflags="$ccflags -shared" ;;
7813         esac
7814         ;;
7815 esac
7816 set dlopen d_dlopen
7817 eval $inlibc
7818 runnm="$xxx_runnm"
7819 ccflags="$xxx_ccflags"
7820
7821 : see if this is a unistd.h system
7822 set unistd.h i_unistd
7823 eval $inhdr
7824
7825 : determine which dynamic loading, if any, to compile in
7826 echo " "
7827 dldir="ext/DynaLoader"
7828 case "$usedl" in
7829 $define|y|true)
7830         dflt='y'
7831         usedl="$define"
7832         ;;
7833 $undef|n|false)
7834         dflt='n'
7835         usedl="$undef"
7836         ;;
7837 *)
7838         dflt='n'
7839         case "$d_dlopen" in
7840             $define) dflt='y' ;;
7841         esac
7842         case "$i_dld" in
7843             $define) dflt='y' ;;
7844         esac
7845         : Does a dl_xxx.xs file exist for this operating system
7846         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7847         ;;
7848 esac
7849 rp="Do you wish to use dynamic loading?"
7850 . ./myread
7851 usedl="$ans"
7852 case "$ans" in
7853 y*) usedl="$define"
7854         case "$dlsrc" in
7855         '')
7856                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7857                         dflt="$dldir/dl_${osname}.xs"
7858                 elif $test "$d_dlopen" = "$define" ; then
7859                         dflt="$dldir/dl_dlopen.xs"
7860                 elif $test "$i_dld" = "$define" ; then
7861                         dflt="$dldir/dl_dld.xs"
7862                 else
7863                         dflt=''
7864                 fi
7865                 ;;
7866         *)      dflt="$dldir/$dlsrc"
7867                 ;;
7868         esac
7869     echo "The following dynamic loading files are available:"
7870         : Can not go over to $dldir because getfile has path hard-coded in.
7871         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7872         rp="Source file to use for dynamic loading"
7873         fn="fne"
7874         gfpth="$src"
7875         . ./getfile
7876         usedl="$define"
7877         : emulate basename
7878         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7879
7880         $cat << EOM
7881
7882 Some systems may require passing special flags to $cc -c to
7883 compile modules that will be used to create a shared library.
7884 To use no flags, say "none".
7885
7886 EOM
7887     case "$cccdlflags" in
7888     '') case "$gccversion" in
7889                 '') case "$osname" in
7890                         hpux)   dflt='+z' ;;
7891                         next)   dflt='none' ;;
7892                         irix*)  dflt='-KPIC' ;;
7893                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7894                         sunos)  dflt='-pic' ;;
7895                         *)      dflt='none' ;;
7896                     esac
7897                         ;;
7898                 *)  case "$osname" in
7899                         darwin) dflt='none' ;;
7900                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7901                         *)      dflt='-fpic' ;;
7902                     esac ;;
7903             esac ;;
7904         ' ') dflt='none' ;;
7905     *)  dflt="$cccdlflags" ;;
7906     esac
7907     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7908     . ./myread
7909     case "$ans" in
7910     none) cccdlflags=' ' ;;
7911     *) cccdlflags="$ans" ;;
7912     esac
7913
7914     cat << EOM
7915
7916 Some systems use ld to create libraries that can be dynamically loaded,
7917 while other systems (such as those using ELF) use $cc.
7918
7919 EOM
7920         case "$ld" in
7921         '')     $cat >try.c <<EOM
7922 /* Test for whether ELF binaries are produced */
7923 #include <fcntl.h>
7924 #$i_stdlib I_STDLIB
7925 #ifdef I_STDLIB
7926 #include <stdlib.h>
7927 #endif
7928 #$i_unistd I_UNISTD
7929 #ifdef I_UNISTD
7930 #include <unistd.h>
7931 #endif
7932 int main() {
7933         char b[4];
7934         int i = open("a.out",O_RDONLY);
7935         if(i == -1)
7936                 exit(1); /* fail */
7937         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7938                 exit(0); /* succeed (yes, it's ELF) */
7939         else
7940                 exit(1); /* fail */
7941 }
7942 EOM
7943                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7944                         cat <<EOM
7945 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7946 EOM
7947                         dflt="$cc"
7948                 else
7949                         echo "I'll use ld to build dynamic libraries."
7950                         dflt='ld'
7951                 fi
7952                 $rm_try
7953                 ;;
7954         *)      dflt="$ld"
7955                 ;;
7956         esac
7957
7958     rp="What command should be used to create dynamic libraries?"
7959     . ./myread
7960         ld="$ans"
7961
7962     cat << EOM
7963
7964 Some systems may require passing special flags to $ld to create a
7965 library that can be dynamically loaded.  If your ld flags include
7966 -L/other/path options to locate libraries outside your loader's normal
7967 search path, you may need to specify those -L options here as well.  To
7968 use no flags, say "none".
7969
7970 EOM
7971     case "$lddlflags" in
7972     '') case "$osname" in
7973                         beos) dflt='-nostart' ;;
7974                         hpux) dflt='-b';
7975                               case "$gccversion" in
7976                               '') dflt="$dflt +vnocompatwarnings" ;;
7977                               esac
7978                               ;;
7979                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7980                         next)  dflt='none' ;;
7981                         solaris) dflt='-G' ;;
7982                         sunos) dflt='-assert nodefinitions' ;;
7983                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7984                 *)     dflt='none' ;;
7985                         esac
7986                         ;;
7987     *) dflt="$lddlflags" ;;
7988     esac
7989
7990         : Try to guess additional flags to pick up local libraries.
7991         : Be careful not to append to a plain 'none'
7992         case "$dflt" in
7993         none) dflt='' ;;
7994         esac
7995         for thisflag in $ldflags; do
7996                 case "$thisflag" in
7997                 -L*|-R*|-Wl,-R*)
7998                         case " $dflt " in
7999                         *" $thisflag "*) ;;
8000                         *) dflt="$dflt $thisflag" ;;
8001                         esac
8002                         ;;
8003                 esac
8004         done
8005
8006         case "$dflt" in
8007         ''|' ') dflt='none' ;;
8008         esac
8009
8010     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8011     . ./myread
8012     case "$ans" in
8013     none) lddlflags=' ' ;;
8014     *) lddlflags="$ans" ;;
8015     esac
8016
8017         cat <<EOM
8018
8019 Some systems may require passing special flags to $cc to indicate that
8020 the resulting executable will use dynamic linking.  To use no flags,
8021 say "none".
8022
8023 EOM
8024     case "$ccdlflags" in
8025     '') case "$osname" in
8026             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8027             next|sunos) dflt='none' ;;
8028             *)          dflt='none' ;;
8029             esac ;;
8030     ' ')  dflt='none' ;;
8031     *)  dflt="$ccdlflags" ;;
8032     esac
8033     rp="Any special flags to pass to $cc to use dynamic linking?"
8034     . ./myread
8035     case "$ans" in
8036     none) ccdlflags=' ' ;;
8037     *) ccdlflags="$ans" ;;
8038     esac
8039     ;;
8040 *)  usedl="$undef"
8041         ld='ld'
8042     dlsrc='dl_none.xs'
8043     lddlflags=''
8044     ccdlflags=''
8045     ;;
8046 esac
8047
8048 : Do we want a shared libperl?
8049 also=''
8050 case "$usedl" in
8051 $undef)
8052         # No dynamic loading being used, so don't bother even to prompt.
8053         useshrplib='false'
8054         ;;
8055 *)      case "$useshrplib" in
8056         '')     case "$osname" in
8057                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8058                         dflt=y
8059                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8060                         ;;
8061                 next*)
8062                         case "$osvers" in
8063                         4*)     dflt=y
8064                                 also='Building a shared libperl is needed for MAB support.'
8065                                 ;;
8066                         *)      dflt=n
8067                                 ;;
8068                         esac
8069                         ;;
8070                 *)      dflt=n
8071                         ;;
8072                 esac
8073                 ;;
8074         $define|true|[Yy]*)
8075                 dflt=y
8076                 ;;
8077         *)      dflt=n
8078                 ;;
8079         esac
8080         $cat << EOM
8081
8082 The perl executable is normally obtained by linking perlmain.c with
8083 libperl${_a}, any static extensions (usually just DynaLoader), and
8084 any other libraries needed on this system (such as -lm, etc.).  Since
8085 your system supports dynamic loading, it is probably possible to build
8086 a shared libperl.$so.  If you will have more than one executable linked
8087 to libperl.$so, this will significantly reduce the size of each
8088 executable, but it may have a noticeable effect on performance.  The
8089 default is probably sensible for your system.
8090 $also
8091
8092 EOM
8093         rp="Build a shared libperl.$so (y/n)"
8094         . ./myread
8095         case "$ans" in
8096         true|$define|[Yy]*)
8097                 useshrplib='true'  ;;
8098         *)      useshrplib='false' ;;
8099         esac
8100         ;;
8101 esac
8102
8103 case "$useshrplib" in
8104 true)
8105         case "$libperl" in
8106         '')
8107                 # Figure out a good name for libperl.so.  Since it gets stored in
8108                 # a version-specific architecture-dependent library, the version
8109                 # number isn't really that important, except for making cc/ld happy.
8110                 #
8111                 # A name such as libperl.so.3.1
8112                 majmin="libperl.$so.$patchlevel.$subversion"
8113                 # A name such as libperl.so.301
8114                 majonly=`echo $patchlevel $subversion |
8115                         $awk '{printf "%d%02d", $1, $2}'`
8116                 majonly=libperl.$so.$majonly
8117                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8118                 # rely on figuring it out from the naming of libc.
8119                 case "${osname}${osvers}" in
8120                 next4*)
8121                         dflt=libperl.5.$so
8122                         # XXX How handle the --version stuff for MAB?
8123                         ;;
8124                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8125                         dflt=libperl.$so
8126                         ;;
8127                 cygwin*) # ld links against an importlib
8128                         dflt=libperl$lib_ext
8129                         ;;
8130                 *)      # Try to guess based on whether libc has major.minor.
8131                         case "$libc" in
8132                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8133                         *libc.$so.[0-9]*) dflt=$majonly ;;
8134                         *)      dflt=libperl.$so ;;
8135                         esac
8136                         ;;
8137                 esac
8138                 ;;
8139         *)      dflt=$libperl
8140                 ;;
8141         esac
8142         cat << EOM
8143
8144 I need to select a good name for the shared libperl.  If your system uses
8145 library names with major and minor numbers, then you might want something
8146 like $majmin.  Alternatively, if your system uses a single version
8147 number for shared libraries, then you might want to use $majonly.
8148 Or, your system might be quite happy with a simple libperl.$so.
8149
8150 Since the shared libperl will get installed into a version-specific
8151 architecture-dependent directory, the version number of the shared perl
8152 library probably isn't important, so the default should be o.k.
8153
8154 EOM
8155         rp='What name do you want to give to the shared libperl?'
8156         . ./myread
8157         libperl=$ans
8158         echo "Ok, I'll use $libperl"
8159         ;;
8160 *)
8161         libperl="libperl${_a}"
8162         ;;
8163 esac
8164
8165 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8166 case "$shrpdir" in
8167 '') ;;
8168 *)      $cat >&4 <<EOM
8169 WARNING:  Use of the shrpdir variable for the installation location of
8170 the shared $libperl is not supported.  It was never documented and
8171 will not work in this version.  Let me (perlbug@perl.org)
8172 know of any problems this may cause.
8173
8174 EOM
8175         case "$shrpdir" in
8176         "$archlibexp/CORE")
8177                 $cat >&4 <<EOM
8178 But your current setting of $shrpdir is
8179 the default anyway, so it's harmless.
8180 EOM
8181                 ;;
8182         *)
8183                 $cat >&4 <<EOM
8184 Further, your current attempted setting of $shrpdir
8185 conflicts with the value of $archlibexp/CORE
8186 that installperl will use.
8187 EOM
8188                 ;;
8189         esac
8190         ;;
8191 esac
8192
8193 # How will the perl executable find the installed shared $libperl?
8194 # Add $xxx to ccdlflags.
8195 # If we can't figure out a command-line option, use $shrpenv to
8196 # set env LD_RUN_PATH.  The main perl makefile uses this.
8197 shrpdir=$archlibexp/CORE
8198 xxx=''
8199 tmp_shrpenv=''
8200 if "$useshrplib"; then
8201     case "$osname" in
8202         aix)
8203                 # We'll set it in Makefile.SH...
8204                 ;;
8205         solaris)
8206                 xxx="-R $shrpdir"
8207                 ;;
8208         freebsd|netbsd|openbsd|interix|dragonfly)
8209                 xxx="-Wl,-R$shrpdir"
8210                 ;;
8211         bsdos|linux|irix*|dec_osf|gnu*)
8212                 xxx="-Wl,-rpath,$shrpdir"
8213                 ;;
8214         next)
8215                 # next doesn't like the default...
8216                 ;;
8217         beos)
8218                 # beos doesn't like the default, either.
8219                 ;;
8220         hpux*)
8221                 # hpux doesn't like the default, either.
8222                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8223                 ;;
8224         *)
8225                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8226                 ;;
8227         esac
8228         case "$xxx" in
8229         '') ;;
8230         *)
8231                 # Only add $xxx if it isn't already in ccdlflags.
8232                 case " $ccdlflags " in
8233                 *" $xxx "*)     ;;
8234                 *)      ccdlflags="$ccdlflags $xxx"
8235                         cat <<EOM >&4
8236
8237 Adding $xxx to the flags
8238 passed to $ld so that the perl executable will find the
8239 installed shared $libperl.
8240
8241 EOM
8242                         ;;
8243                 esac
8244                 ;;
8245         esac
8246 fi
8247 # Fix ccdlflags in AIX for building external extensions.
8248 # (For building Perl itself bare -bE:perl.exp is needed,
8249 #  Makefile.SH takes care of this.)
8250 case "$osname" in
8251 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8252 esac
8253 # Respect a hint or command-line value.
8254 case "$shrpenv" in
8255 '') shrpenv="$tmp_shrpenv" ;;
8256 esac
8257 case "$ldlibpthname" in
8258 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8259 none)   ldlibpthname='' ;;
8260 esac
8261
8262 : determine where manual pages are on this system
8263 echo " "
8264 case "$sysman" in
8265 '') 
8266         syspath='/usr/share/man/man1 /usr/man/man1'
8267         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8268         syspath="$syspath /usr/man/u_man/man1"
8269         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8270         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8271         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8272         sysman=`./loc . /usr/man/man1 $syspath`
8273         ;;
8274 esac
8275 if $test -d "$sysman"; then
8276         echo "System manual is in $sysman." >&4
8277 else
8278         echo "Could not find manual pages in source form." >&4
8279 fi
8280
8281 : determine where manual pages go
8282 set man1dir man1dir none
8283 eval $prefixit
8284 $cat <<EOM
8285
8286 $spackage has manual pages available in source form.
8287 EOM
8288 case "$nroff" in
8289 nroff)
8290         echo "However, you don't have nroff, so they're probably useless to you."
8291         case "$man1dir" in
8292         '') man1dir="none";;
8293         esac;;
8294 esac
8295 echo "If you don't want the manual sources installed, answer 'none'."
8296 case "$man1dir" in
8297 ' ') dflt=none
8298         ;;
8299 '')
8300         lookpath="$prefixexp/share/man/man1"
8301         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8302         lookpath="$lookpath $prefixexp/man/p_man/man1"
8303         lookpath="$lookpath $prefixexp/man/u_man/man1"
8304         lookpath="$lookpath $prefixexp/man/man.1"
8305         case "$sysman" in
8306         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8307         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8308         esac
8309         set dflt
8310         eval $prefixup
8311         ;;
8312 *)  dflt="$man1dir"
8313         ;;
8314 esac
8315 echo " "
8316 fn=dn+~
8317 rp="Where do the main $spackage manual pages (source) go?"
8318 . ./getfile
8319 if $test "X$man1direxp" != "X$ansexp"; then
8320         installman1dir=''
8321 fi
8322 prefixvar=man1dir
8323 . ./setprefixvar
8324
8325 case "$man1dir" in
8326 '')     man1dir=' '
8327         installman1dir='';;
8328 esac
8329
8330 : What suffix to use on installed man pages
8331
8332 case "$man1dir" in
8333 ' ')
8334         man1ext='0'
8335         ;;
8336 *)
8337         rp="What suffix should be used for the main $spackage man pages?"
8338         case "$man1ext" in
8339         '')     case "$man1dir" in
8340                 *1)  dflt=1 ;;
8341                 *1p) dflt=1p ;;
8342                 *1pm) dflt=1pm ;;
8343                 *l) dflt=l;;
8344                 *n) dflt=n;;
8345                 *o) dflt=o;;
8346                 *p) dflt=p;;
8347                 *C) dflt=C;;
8348                 *L) dflt=L;;
8349                 *L1) dflt=L1;;
8350                 *) dflt=1;;
8351                 esac
8352                 ;;
8353         *)      dflt="$man1ext";;
8354         esac
8355         . ./myread
8356         man1ext="$ans"
8357         ;;
8358 esac
8359
8360 : see if we can have long filenames
8361 echo " "
8362 first=123456789abcdef
8363 $rm -f $first
8364 if (echo hi >$first) 2>/dev/null; then
8365         if $test -f 123456789abcde; then
8366                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8367                 val="$undef"
8368         else
8369                 echo 'You can have filenames longer than 14 characters.'>&4
8370                 val="$define"
8371         fi
8372 else
8373         $cat <<'EOM'
8374 You can't have filenames longer than 14 chars.
8375 You can't even think about them!
8376 EOM
8377         val="$undef"
8378 fi
8379 set d_flexfnam
8380 eval $setvar
8381 $rm -rf 123456789abcde*
8382
8383 : determine where library module manual pages go
8384 set man3dir man3dir none
8385 eval $prefixit
8386 $cat <<EOM
8387
8388 $spackage has manual pages for many of the library modules.
8389 EOM
8390
8391 case "$nroff" in
8392 nroff)
8393         $cat <<'EOM'
8394 However, you don't have nroff, so they're probably useless to you.
8395 EOM
8396         case "$man3dir" in
8397         '') man3dir="none";;
8398         esac;;
8399 esac
8400
8401 case "$d_flexfnam" in
8402 undef)
8403         $cat <<'EOM'
8404 However, your system can't handle the long file names like File::Basename.3.
8405 EOM
8406         case "$man3dir" in
8407         '') man3dir="none";;
8408         esac;;
8409 esac
8410
8411 echo "If you don't want the manual sources installed, answer 'none'."
8412 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8413 case "$man3dir" in
8414 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8415         if $test -d "$privlib/man/man3"; then
8416                 cat <<EOM >&4
8417
8418 WARNING:  Previous versions of perl installed man3 pages into
8419 $privlib/man/man3.  This version will suggest a
8420 new default of $dflt.
8421 EOM
8422                 tdflt=$dflt
8423                 dflt='n'
8424                 rp='Do you wish to preserve the old behavior?(y/n)'
8425                 . ./myread
8426                 case "$ans" in
8427                 y*) dflt="$privlib/man/man3" ;;
8428                 *)  dflt=$tdflt ;;
8429                 esac
8430     fi
8431         ;;
8432 *)      dflt="$man3dir" ;;
8433 esac
8434 case "$dflt" in
8435 ' ') dflt=none ;;
8436 esac
8437 echo " "
8438 fn=dn+~
8439 rp="Where do the $package library man pages (source) go?"
8440 . ./getfile
8441 prefixvar=man3dir
8442 . ./setprefixvar
8443
8444 case "$man3dir" in
8445 '')     man3dir=' '
8446         installman3dir='';;
8447 esac
8448
8449 : What suffix to use on installed man pages
8450 case "$man3dir" in
8451 ' ')
8452         man3ext='0'
8453         ;;
8454 *)
8455         rp="What suffix should be used for the $package library man pages?"
8456         case "$man3ext" in
8457         '')     case "$man3dir" in
8458                 *3)  dflt=3 ;;
8459                 *3p) dflt=3p ;;
8460                 *3pm) dflt=3pm ;;
8461                 *l) dflt=l;;
8462                 *n) dflt=n;;
8463                 *o) dflt=o;;
8464                 *p) dflt=p;;
8465                 *C) dflt=C;;
8466                 *L) dflt=L;;
8467                 *L3) dflt=L3;;
8468                 *) dflt=3;;
8469                 esac
8470                 ;;
8471         *)      dflt="$man3ext";;
8472         esac
8473         . ./myread
8474         man3ext="$ans"
8475         ;;
8476 esac
8477
8478 : see if we have to deal with yellow pages, now NIS.
8479 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8480         if $test -f /usr/etc/nibindd; then
8481                 echo " "
8482                 echo "I'm fairly confident you're on a NeXT."
8483                 echo " "
8484                 rp='Do you get the hosts file via NetInfo?'
8485                 dflt=y
8486                 case "$hostcat" in
8487                 nidump*) ;;
8488                 '') ;;
8489                 *) dflt=n;;
8490                 esac
8491                 . ./myread
8492                 case "$ans" in
8493                 y*) hostcat='nidump hosts .';;
8494                 *)      case "$hostcat" in
8495                         nidump*) hostcat='';;
8496                         esac
8497                         ;;
8498                 esac
8499         fi
8500         case "$hostcat" in
8501         nidump*) ;;
8502         *)
8503                 case "$hostcat" in
8504                 *ypcat*) dflt=y;;
8505                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8506                                 dflt=y
8507                         else
8508                                 dflt=n
8509                         fi;;
8510                 *) dflt=n;;
8511                 esac
8512                 echo " "
8513                 rp='Are you getting the hosts file via yellow pages?'
8514                 . ./myread
8515                 case "$ans" in
8516                 y*) hostcat='ypcat hosts';;
8517                 *) hostcat='cat /etc/hosts';;
8518                 esac
8519                 ;;
8520         esac
8521 fi
8522 case "$hostcat" in
8523 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8524 esac
8525 case "$groupcat" in
8526 '') test -f /etc/group && groupcat='cat /etc/group';;
8527 esac
8528 case "$passcat" in
8529 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8530 esac
8531
8532 : now get the host name
8533 echo " "
8534 echo "Figuring out host name..." >&4
8535 case "$myhostname" in
8536 '') cont=true
8537         echo 'Maybe "hostname" will work...'
8538         if tans=`sh -c hostname 2>&1` ; then
8539                 myhostname=$tans
8540                 phostname=hostname
8541                 cont=''
8542         fi
8543         ;;
8544 *) cont='';;
8545 esac
8546 if $test "$cont"; then
8547         if ./xenix; then
8548                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8549                 if tans=`cat /etc/systemid 2>&1` ; then
8550                         myhostname=$tans
8551                         phostname='cat /etc/systemid'
8552                         echo "Whadyaknow.  Xenix always was a bit strange..."
8553                         cont=''
8554                 fi
8555         elif $test -r /etc/systemid; then
8556                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8557         fi
8558 fi
8559 if $test "$cont"; then
8560         echo 'No, maybe "uuname -l" will work...'
8561         if tans=`sh -c 'uuname -l' 2>&1` ; then
8562                 myhostname=$tans
8563                 phostname='uuname -l'
8564         else
8565                 echo 'Strange.  Maybe "uname -n" will work...'
8566                 if tans=`sh -c 'uname -n' 2>&1` ; then
8567                         myhostname=$tans
8568                         phostname='uname -n'
8569                 else
8570                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8571                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8572                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8573                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8574                         else
8575                                 case "$myhostname" in
8576                                 '') echo "Does this machine have an identity crisis or something?"
8577                                         phostname='';;
8578                                 *)
8579                                         echo "Well, you said $myhostname before..."
8580                                         phostname='echo $myhostname';;
8581                                 esac
8582                         fi
8583                 fi
8584         fi
8585 fi
8586 case "$myhostname" in
8587 '') myhostname=noname ;;
8588 esac
8589 : you do not want to know about this
8590 set $myhostname
8591 myhostname=$1
8592
8593 : verify guess
8594 if $test "$myhostname" ; then
8595         dflt=y
8596         rp='Your host name appears to be "'$myhostname'".'" Right?"
8597         . ./myread
8598         case "$ans" in
8599         y*) ;;
8600         *) myhostname='';;
8601         esac
8602 fi
8603
8604 : bad guess or no guess
8605 while $test "X$myhostname" = X ; do
8606         dflt=''
8607         rp="Please type the (one word) name of your host:"
8608         . ./myread
8609         myhostname="$ans"
8610 done
8611
8612 : translate upper to lower if necessary
8613 case "$myhostname" in
8614 *[A-Z]*)
8615         echo "(Normalizing case in your host name)"
8616         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8617         ;;
8618 esac
8619
8620 case "$myhostname" in
8621 *.*)
8622         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8623         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8624         echo "(Trimming domain name from host name--host name is now $myhostname)"
8625         ;;
8626 *) case "$mydomain" in
8627         '')
8628                 {
8629                         test "X$hostcat" = "Xypcat hosts" &&
8630                         ypmatch "$myhostname" hosts 2>/dev/null |\
8631                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8632                         $test -s hosts
8633                 } || {
8634                         test "X$hostcat" != "X" &&
8635                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8636                                         /[       ]$myhostname[  . ]/p" > hosts
8637                 }
8638                 tmp_re="[       . ]"
8639                 if $test -f hosts; then
8640                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8641                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8642                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8643                                 hosts | $sort | $uniq | \
8644                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8645                         case `$echo X$dflt` in
8646                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8647                                 dflt=.
8648                                 ;;
8649                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8650                                 ;;
8651                         esac
8652                 else
8653                         echo "(I cannot locate a hosts database anywhere)"
8654                         dflt=.
8655                 fi
8656                 case "$dflt" in
8657                 .)
8658                         tans=`./loc resolv.conf X /etc /usr/etc`
8659                         if $test -f "$tans"; then
8660                                 echo "(Attempting domain name extraction from $tans)"
8661                                 dflt=.`$sed -n -e 's/   / /g' \
8662                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8663                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8664                                 case "$dflt" in
8665                                 .) dflt=.`$sed -n -e 's/        / /g' \
8666                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8667                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8668                                         ;;
8669                                 esac
8670                         fi
8671                         ;;
8672                 esac
8673                 case "$dflt" in
8674                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8675                         dflt=.`sh -c domainname 2>/dev/null`
8676                         case "$dflt" in
8677                         '') dflt='.';;
8678                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8679                         esac
8680                         ;;
8681                 esac
8682                 case "$dflt$osname" in
8683                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8684                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8685                         ;;
8686                 esac
8687                 case "$dflt" in
8688                 .) echo "(Lost all hope -- silly guess then)"
8689                         dflt='.nonet'
8690                         ;;
8691                 esac
8692                 $rm -f hosts
8693                 ;;
8694         *) dflt="$mydomain";;
8695         esac;;
8696 esac
8697 echo " "
8698 rp="What is your domain name?"
8699 . ./myread
8700 tans="$ans"
8701 case "$ans" in
8702 '') ;;
8703 .*) ;;
8704 *) tans=".$tans";;
8705 esac
8706 mydomain="$tans"
8707
8708 : translate upper to lower if necessary
8709 case "$mydomain" in
8710 *[A-Z]*)
8711         echo "(Normalizing case in your domain name)"
8712         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8713         ;;
8714 esac
8715
8716 : a little sanity check here
8717 case "$phostname" in
8718 '') ;;
8719 *)
8720         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8721         $myhostname$mydomain|$myhostname) ;;
8722         *)
8723                 case "$phostname" in
8724                 sed*)
8725                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8726                         ;;
8727                 *)
8728                         echo "(That doesn't agree with your $phostname command, by the way.)"
8729                         ;;
8730                 esac
8731         ;;
8732         esac
8733         ;;
8734 esac
8735
8736 : determine the e-mail address of the user who is running us
8737 $cat <<EOM
8738
8739 I need to get your e-mail address in Internet format if possible, i.e.
8740 something like user@host.domain. Please answer accurately since I have
8741 no easy means to double check it. The default value provided below
8742 is most probably close to reality but may not be valid from outside
8743 your organization...
8744
8745 EOM
8746 cont=x
8747 while test "$cont"; do
8748         case "$cf_email" in
8749         '') dflt="$cf_by@$myhostname$mydomain";;
8750         *) dflt="$cf_email";;
8751         esac
8752         rp='What is your e-mail address?'
8753         . ./myread
8754         cf_email="$ans"
8755         case "$cf_email" in
8756         *@*.*) cont='' ;;
8757         *)
8758                 rp='Address does not look like an Internet one.  Use it anyway?'
8759                 case "$fastread" in
8760                 yes) dflt=y ;;
8761                 *) dflt=n ;;
8762                 esac
8763                 . ./myread
8764                 case "$ans" in
8765                 y*) cont='' ;;
8766                 *) echo " " ;;
8767                 esac
8768                 ;;
8769         esac
8770 done
8771
8772 : Ask e-mail of administrator
8773 $cat <<EOM
8774
8775 If you or somebody else will be maintaining perl at your site, please
8776 fill in the correct e-mail address here so that they may be contacted
8777 if necessary. Currently, the "perlbug" program included with perl
8778 will send mail to this address in addition to perlbug@perl.org. You may
8779 enter "none" for no administrator.
8780
8781 EOM
8782 case "$perladmin" in
8783 '') dflt="$cf_email";;
8784 *) dflt="$perladmin";;
8785 esac
8786 rp='Perl administrator e-mail address'
8787 . ./myread
8788 perladmin="$ans"
8789
8790 : determine whether to only install version-specific parts.
8791 echo " "
8792 $cat <<EOM
8793 Do you want to install only the version-specific parts of the perl
8794 distribution?  Usually you do *not* want to do this.
8795 EOM
8796 case "$versiononly" in
8797 "$define"|[Yy]*|true) dflt='y' ;;
8798 *) dflt='n';
8799 esac
8800 rp="Do you want to install only the version-specific parts of perl?"
8801 . ./myread
8802 case "$ans" in
8803 [yY]*)  val="$define";;
8804 *)      val="$undef" ;;
8805 esac
8806 set versiononly
8807 eval $setvar
8808
8809 case "$versiononly" in
8810 "$define") inc_version_list=''
8811            inc_version_list_init=0
8812            ;;
8813 esac
8814
8815 : figure out how to guarantee perl startup
8816 : XXX Note that this currently takes advantage of the bug that binexp ignores
8817 :     the Configure -Dinstallprefix setting, which in turn means that under
8818 :     relocatable @INC, initialinstalllocation is what binexp started as.
8819 case "$startperl" in
8820 '')
8821         case "$sharpbang" in
8822         *!)
8823                 $cat <<EOH
8824
8825 I can use the #! construct to start perl on your system. This will
8826 make startup of perl scripts faster, but may cause problems if you
8827 want to share those scripts and perl is not in a standard place
8828 ($initialinstalllocation/perl) on all your platforms. The alternative
8829 is to force a shell by starting the script with a single ':' character.
8830
8831 EOH
8832                 case "$versiononly" in
8833                 "$define")      dflt="$initialinstalllocation/perl$version";;
8834                 *)              dflt="$initialinstalllocation/perl";;
8835                 esac
8836                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8837                 . ./myread
8838                 case "$ans" in
8839                 none)   startperl=": # use perl";;
8840                 *)      startperl="#!$ans"
8841                         if $test 30 -lt `echo "$ans" | wc -c`; then
8842                                 $cat >&4 <<EOM
8843
8844 WARNING:  Some systems limit the #! command to 32 characters.
8845 If you experience difficulty running Perl scripts with #!, try
8846 installing Perl in a directory with a shorter pathname.
8847
8848 EOM
8849                         fi ;;
8850                 esac
8851                 ;;
8852         *) startperl=": # use perl"
8853                 ;;
8854         esac
8855         ;;
8856 esac
8857 echo "I'll use $startperl to start perl scripts."
8858
8859 : figure best path for perl in scripts
8860 case "$perlpath" in
8861 '')
8862         case "$versiononly" in
8863         "$define")      perlpath="$initialinstalllocation/perl$version";;
8864         *)              perlpath="$initialinstalllocation/perl";;
8865         esac
8866         case "$startperl" in
8867         *!*) ;;
8868         *)
8869                 $cat <<EOH
8870
8871 I will use the "eval 'exec'" idiom to start Perl on your system.
8872 I can use the full path of your Perl binary for this purpose, but
8873 doing so may cause problems if you want to share those scripts and
8874 Perl is not always in a standard place ($initialinstalllocation/perl).
8875
8876 EOH
8877                 dflt="$initialinstalllocation/perl"
8878                 rp="What path shall I use in \"eval 'exec'\"?"
8879                 . ./myread
8880                 perlpath="$ans"
8881                 ;;
8882         esac
8883         ;;
8884 esac
8885 case "$startperl" in
8886 *!*)    ;;
8887 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8888 esac
8889
8890 : determine where public executable scripts go
8891 set scriptdir scriptdir
8892 eval $prefixit
8893 case "$scriptdir" in
8894 '')
8895         dflt="$bin"
8896         : guess some guesses
8897         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8898         $test -d /usr/share/bin     && dflt=/usr/share/bin
8899         $test -d /usr/local/script  && dflt=/usr/local/script
8900         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8901         $test -d $prefixexp/script  && dflt=$prefixexp/script
8902         set dflt
8903         eval $prefixup
8904         ;;
8905 *)  dflt="$scriptdir"
8906         ;;
8907 esac
8908 $cat <<EOM
8909
8910 Some installations have a separate directory just for executable scripts so
8911 that they can mount it across multiple architectures but keep the scripts in
8912 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8913 Or you might just lump your scripts in with all your other executables.
8914
8915 EOM
8916 fn=d~
8917 rp='Where do you keep publicly executable scripts?'
8918 . ./getfile
8919 if $test "X$ansexp" != "X$scriptdirexp"; then
8920         installscript=''
8921 fi
8922 installscriptdir=''
8923 prefixvar=scriptdir
8924 . ./setprefixvar
8925 : A little fix up for an irregularly named variable.
8926 installscript="$installscriptdir"
8927
8928 : determine where add-on public executables go
8929 case "$sitebin" in
8930 '')     dflt=$siteprefix/bin ;;
8931 *)      dflt=$sitebin ;;
8932 esac
8933 fn=d~
8934 rp='Pathname where the add-on public executables should be installed?'
8935 . ./getfile
8936 prefixvar=sitebin
8937 . ./setprefixvar
8938
8939 : determine where add-on html pages go
8940 : There is no standard location, so try to copy the previously-selected
8941 : directory structure for the core html pages.
8942 case "$sitehtml1dir" in
8943 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8944 *)     dflt=$sitehtml1dir ;;
8945 esac
8946 case "$dflt" in
8947 ''|' ') dflt=none ;;
8948 esac
8949 fn=dn+~
8950 rp='Pathname where the site-specific html pages should be installed?'
8951 . ./getfile
8952 prefixvar=sitehtml1dir
8953 . ./setprefixvar
8954
8955 : determine where add-on library 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 "$sitehtml3dir" in
8959 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8960 *)     dflt=$sitehtml3dir ;;
8961 esac
8962 case "$dflt" in
8963 ''|' ') dflt=none ;;
8964 esac
8965 fn=dn+~
8966 rp='Pathname where the site-specific library html pages should be installed?'
8967 . ./getfile
8968 prefixvar=sitehtml3dir
8969 . ./setprefixvar
8970
8971 : determine where add-on manual pages go
8972 case "$siteman1dir" in
8973 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8974 *)      dflt=$siteman1dir ;;
8975 esac
8976 case "$dflt" in
8977 ''|' ') dflt=none ;;
8978 esac
8979 fn=dn+~
8980 rp='Pathname where the site-specific manual pages should be installed?'
8981 . ./getfile
8982 prefixvar=siteman1dir
8983 . ./setprefixvar
8984
8985 : determine where add-on library man pages go
8986 case "$siteman3dir" in
8987 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8988 *)      dflt=$siteman3dir ;;
8989 esac
8990 case "$dflt" in
8991 ''|' ') dflt=none ;;
8992 esac
8993 fn=dn+~
8994 rp='Pathname where the site-specific library manual pages should be installed?'
8995 . ./getfile
8996 prefixvar=siteman3dir
8997 . ./setprefixvar
8998
8999 : determine where add-on public executable scripts go
9000 case "$sitescript" in
9001 '')     dflt=$siteprefix/script
9002         $test -d $dflt || dflt=$sitebin ;;
9003 *)  dflt="$sitescript" ;;
9004 esac
9005 fn=d~+
9006 rp='Pathname where add-on public executable scripts should be installed?'
9007 . ./getfile
9008 prefixvar=sitescript
9009 . ./setprefixvar
9010
9011 : Check if faststdio is requested and available
9012 case "$usefaststdio" in
9013 $define|true|[yY]*|'')
9014         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9015         case "$xversion" in
9016         [68])   dflt='y' ;;
9017         *)      dflt='n' ;;
9018         esac
9019         ;;
9020 *) dflt='n';;
9021 esac
9022 cat <<EOM
9023
9024 Perl can be built to use 'fast stdio', which means using the stdio
9025 library but also directly manipulating the stdio buffers to enable
9026 faster I/O.  Using stdio is better for backward compatibility (especially
9027 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9028 interface has been preferred instead of stdio.
9029
9030 If this doesn't make any sense to you, just accept the default '$dflt'.
9031 EOM
9032 rp='Use the "fast stdio" if available?'
9033 . ./myread
9034 case "$ans" in
9035 y|Y)    val="$define" ;;
9036 *)      val="$undef" ;;
9037 esac
9038 set usefaststdio
9039 eval $setvar
9040
9041
9042 : define an is-a-typedef? function
9043 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9044 case "$inclist" in
9045 "") inclist="sys/types.h";;
9046 esac;
9047 eval "varval=\$$var";
9048 case "$varval" in
9049 "")
9050         $rm -f temp.c;
9051         for inc in $inclist; do
9052                 echo "#include <$inc>" >>temp.c;
9053         done;
9054         echo "#ifdef $type" >> temp.c;
9055         echo "printf(\"We have $type\");" >> temp.c;
9056         echo "#endif" >> temp.c;
9057         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9058         if $contains $type temp.E >/dev/null 2>&1; then
9059                 eval "$var=\$type";
9060         else
9061                 eval "$var=\$def";
9062         fi;
9063         $rm -f temp.?;;
9064 *) eval "$var=\$varval";;
9065 esac'
9066
9067 : define an is-a-typedef? function that prompts if the type is not available.
9068 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9069 case "$inclist" in
9070 "") inclist="sys/types.h";;
9071 esac;
9072 eval "varval=\$$var";
9073 case "$varval" in
9074 "")
9075         $rm -f temp.c;
9076         for inc in $inclist; do
9077                 echo "#include <$inc>" >>temp.c;
9078         done;
9079         echo "#ifdef $type" >> temp.c;
9080         echo "printf(\"We have $type\");" >> temp.c;
9081         echo "#endif" >> temp.c;
9082         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9083         echo " " ;
9084         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9085         if $contains $type temp.E >/dev/null 2>&1; then
9086                 echo "$type found." >&4;
9087                 eval "$var=\$type";
9088         else
9089                 echo "$type NOT found." >&4;
9090                 dflt="$def";
9091                 . ./myread ;
9092                 eval "$var=\$ans";
9093         fi;
9094         $rm -f temp.?;;
9095 *) eval "$var=\$varval";;
9096 esac'
9097
9098 : see what type lseek is declared as in the kernel
9099 rp="What is the type used for lseek's offset on this system?"
9100 set off_t lseektype long stdio.h sys/types.h
9101 eval $typedef_ask
9102
9103 echo " "
9104 echo "Checking to see how big your file offsets are..." >&4
9105 $cat >try.c <<EOCP
9106 #include <sys/types.h>
9107 #include <stdio.h>
9108 int main()
9109 {
9110     printf("%d\n", (int)sizeof($lseektype));
9111     return(0);
9112 }
9113 EOCP
9114 set try
9115 if eval $compile_ok; then
9116         lseeksize=`$run ./try`
9117         echo "Your file offsets are $lseeksize bytes long."
9118 else
9119         dflt=$longsize
9120         echo " "
9121         echo "(I can't seem to compile the test program.  Guessing...)"
9122         rp="What is the size of your file offsets (in bytes)?"
9123         . ./myread
9124         lseeksize="$ans"
9125 fi
9126 $rm_try
9127
9128 : see what type file positions are declared as in the library
9129 rp="What is the type for file position used by fsetpos()?"
9130 set fpos_t fpostype long stdio.h sys/types.h
9131 eval $typedef_ask
9132
9133 : Check size for Fpos_t
9134 echo " "
9135 case "$fpostype" in
9136 *_t) zzz="$fpostype"    ;;
9137 *)   zzz="fpos_t"       ;;
9138 esac
9139 echo "Checking the size of $zzz..." >&4
9140 cat > try.c <<EOCP
9141 #include <sys/types.h>
9142 #include <stdio.h>
9143 #$i_stdlib I_STDLIB
9144 #ifdef I_STDLIB
9145 #include <stdlib.h>
9146 #endif
9147 int main() {
9148     printf("%d\n", (int)sizeof($fpostype));
9149     exit(0);
9150 }
9151 EOCP
9152 set try
9153 if eval $compile_ok; then
9154         yyy=`$run ./try`
9155         case "$yyy" in
9156         '')     fpossize=4
9157                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9158                 ;;
9159         *)      fpossize=$yyy
9160                 echo "Your $zzz is $fpossize bytes long."
9161                 ;;
9162         esac
9163 else
9164         dflt="$longsize"
9165         echo " " >&4
9166         echo "(I can't compile the test program.  Guessing...)" >&4
9167         rp="What is the size of your file positions (in bytes)?"
9168         . ./myread
9169         fpossize="$ans"
9170 fi
9171
9172 : Check for large file support
9173 # Backward compatibility (uselfs is deprecated).
9174 case "$uselfs" in
9175 "$define"|true|[yY]*)
9176         cat <<EOM >&4
9177
9178 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9179 EOM
9180         uselargefiles="$define"
9181         ;;
9182 esac
9183
9184 case "$lseeksize:$fpossize" in
9185 8:8) cat <<EOM
9186
9187 You can have files larger than 2 gigabytes.
9188 EOM
9189    val="$define" ;;
9190 *)    case "$uselargefiles" in
9191    "$undef"|false|[nN]*) dflt='n' ;;
9192    *)   dflt='y' ;;
9193    esac
9194    cat <<EOM
9195
9196 Perl can be built to understand large files (files larger than 2 gigabytes)
9197 on some systems.  To do so, Configure can be run with -Duselargefiles.
9198
9199 If this doesn't make any sense to you, just accept the default '$dflt'.
9200 EOM
9201    rp='Try to understand large files, if available?'
9202    . ./myread
9203    case "$ans" in
9204    y|Y)         val="$define" ;;
9205    *)           val="$undef"  ;;
9206    esac
9207    ;;
9208 esac
9209 set uselargefiles
9210 eval $setvar
9211 : Look for a hint-file generated 'call-back-unit'.  If the
9212 : user has specified that a large files perl is to be built,
9213 : we may need to set or change some other defaults.
9214 if $test -f uselargefiles.cbu; then
9215         echo "Your platform has some specific hints regarding large file builds, using them..."
9216         . ./uselargefiles.cbu
9217 fi
9218 case "$uselargefiles" in
9219 "$define")
9220         if $test -f uselargefiles.cbu; then
9221                 echo " "
9222                 echo "Rechecking to see how big your file offsets are..." >&4
9223                 $cat >try.c <<EOCP
9224 #include <sys/types.h>
9225 #include <stdio.h>
9226 int main()
9227 {
9228     printf("%d\n", (int)sizeof($lseektype));
9229     return(0);
9230 }
9231 EOCP
9232                 set try
9233                 if eval $compile_ok; then
9234                         lseeksize=`$run ./try`
9235                         $echo "Your file offsets are now $lseeksize bytes long."
9236                 else
9237                         dflt="$lseeksize"
9238                         echo " "
9239                         echo "(I can't seem to compile the test program.  Guessing...)"
9240                         rp="What is the size of your file offsets (in bytes)?"
9241                         . ./myread
9242                         lseeksize="$ans"
9243                 fi
9244                 case "$fpostype" in
9245                 *_t) zzz="$fpostype"    ;;
9246                 *)   zzz="fpos_t"       ;;
9247                 esac
9248                 $echo $n "Rechecking the size of $zzz...$c" >&4
9249                 $cat > try.c <<EOCP
9250 #include <sys/types.h>
9251 #include <stdio.h>
9252 #$i_stdlib I_STDLIB
9253 #ifdef I_STDLIB
9254 #include <stdlib.h>
9255 #endif
9256 int main() {
9257     printf("%d\n", (int)sizeof($fpostype));
9258     return(0);
9259 }
9260 EOCP
9261                 set try
9262                 if eval $compile_ok; then
9263                         yyy=`$run ./try`
9264                         dflt="$lseeksize"
9265                         case "$yyy" in
9266                         '')     echo " "
9267                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9268                                 ;;
9269                         *)      fpossize=$yyy
9270                                 echo " $fpossize bytes." >&4
9271                                 ;;
9272                         esac
9273                 else
9274                         dflt="$fpossize"
9275                         echo " "
9276                         echo "(I can't compile the test program.  Guessing...)" >&4
9277                         rp="What is the size of your file positions (in bytes)?"
9278                         . ./myread
9279                         fpossize="$ans"
9280                 fi
9281                 $rm_try
9282         fi
9283         ;;
9284 esac
9285
9286 : Set the vendorbin variables
9287 case "$vendorprefix" in
9288 '')     d_vendorbin="$undef"
9289         vendorbin=''
9290         vendorbinexp=''
9291         ;;
9292 *)      d_vendorbin="$define"
9293         : determine where vendor-supplied executables go.
9294         case "$vendorbin" in
9295         '') dflt=$vendorprefix/bin ;;
9296         *)      dflt="$vendorbin" ;;
9297         esac
9298         fn=d~+
9299         rp='Pathname for the vendor-supplied executables directory?'
9300         . ./getfile
9301         vendorbin="$ans"
9302         vendorbinexp="$ansexp"
9303         ;;
9304 esac
9305 prefixvar=vendorbin
9306 . ./installprefix
9307
9308 : Set the vendorhtml1dir variables
9309 case "$vendorprefix" in
9310 '')     vendorhtml1dir=''
9311         vendorhtml1direxp=''
9312         ;;
9313 *)      : determine where vendor-supplied html pages go.
9314         : There is no standard location, so try to copy the previously-selected
9315         : directory structure for the core html pages.
9316         : XXX Better default suggestions would be welcome.
9317         case "$vendorhtml1dir" in
9318         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9319         *)      dflt=$vendorhtml1dir ;;
9320         esac
9321         case "$dflt" in
9322         ''|' ') dflt=none ;;
9323         esac
9324         fn=dn+~
9325         rp='Pathname for the vendor-supplied html pages?'
9326         . ./getfile
9327         vendorhtml1dir="$ans"
9328         vendorhtml1direxp="$ansexp"
9329         ;;
9330 esac
9331 : Use ' ' for none so value is preserved next time through Configure
9332 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9333 prefixvar=vendorhtml1dir
9334 . ./installprefix
9335
9336 : Set the vendorhtml3dir variables
9337 case "$vendorprefix" in
9338 '')     vendorhtml3dir=''
9339         vendorhtml3direxp=''
9340         ;;
9341 *)      : determine where vendor-supplied module html pages go.
9342         : There is no standard location, so try to copy the previously-selected
9343         : directory structure for the core html pages.
9344         : XXX Better default suggestions would be welcome.
9345         case "$vendorhtml3dir" in
9346         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9347         *)      dflt=$vendorhtml3dir ;;
9348         esac
9349         case "$dflt" in
9350         ''|' ') dflt=none ;;
9351         esac
9352         fn=dn+~
9353         rp='Pathname for the vendor-supplied html pages?'
9354         . ./getfile
9355         vendorhtml3dir="$ans"
9356         vendorhtml3direxp="$ansexp"
9357         ;;
9358 esac
9359 : Use ' ' for none so value is preserved next time through Configure
9360 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9361 prefixvar=vendorhtml3dir
9362 . ./installprefix
9363
9364 : Set the vendorman1dir variables
9365 case "$vendorprefix" in
9366 '')     vendorman1dir=''
9367         vendorman1direxp=''
9368         ;;
9369 *)      : determine where vendor-supplied manual pages go.
9370         case "$vendorman1dir" in
9371         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9372         *)      dflt=$vendorman1dir ;;
9373         esac
9374         case "$dflt" in
9375         ''|' ') dflt=none ;;
9376         esac
9377         fn=nd~+
9378         rp='Pathname for the vendor-supplied manual section 1 pages?'
9379         . ./getfile
9380         vendorman1dir="$ans"
9381         vendorman1direxp="$ansexp"
9382         ;;
9383 esac
9384 : Use ' ' for none so value is preserved next time through Configure
9385 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9386 prefixvar=vendorman1dir
9387 . ./installprefix
9388
9389 : Set the vendorman3dir variables
9390 case "$vendorprefix" in
9391 '')     vendorman3dir=''
9392         vendorman3direxp=''
9393         ;;
9394 *)      : determine where vendor-supplied module manual pages go.
9395         case "$vendorman3dir" in
9396         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9397         *)      dflt=$vendorman3dir ;;
9398         esac
9399         case "$dflt" in
9400         ''|' ') dflt=none ;;
9401         esac
9402         fn=nd~+
9403         rp='Pathname for the vendor-supplied manual section 3 pages?'
9404         . ./getfile
9405         vendorman3dir="$ans"
9406         vendorman3direxp="$ansexp"
9407         ;;
9408 esac
9409 : Use ' ' for none so value is preserved next time through Configure
9410 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9411 prefixvar=vendorman3dir
9412 . ./installprefix
9413
9414 : Set the vendorscript variables
9415 case "$vendorprefix" in
9416 '')     d_vendorscript="$undef"
9417         vendorscript=''
9418         vendorscriptexp=''
9419         ;;
9420 *)      d_vendorscript="$define"
9421         : determine where vendor-supplied scripts go.
9422         case "$vendorscript" in
9423         '')     dflt=$vendorprefix/script
9424                 $test -d $dflt || dflt=$vendorbin ;;
9425         *)  dflt="$vendorscript" ;;
9426         esac
9427         $cat <<EOM
9428
9429 The installation process will create a directory for
9430 vendor-supplied scripts.
9431
9432 EOM
9433         fn=d~+
9434         rp='Pathname for the vendor-supplied scripts directory?'
9435         . ./getfile
9436         vendorscript="$ans"
9437         vendorscriptexp="$ansexp"
9438         ;;
9439 esac
9440 prefixvar=vendorscript
9441 . ./installprefix
9442
9443 : see if qgcvt exists
9444 set qgcvt d_qgcvt
9445 eval $inlibc
9446
9447 : Check print/scan long double stuff
9448 echo " "
9449
9450 if $test X"$d_longdbl" = X"$define"; then
9451
9452 echo "Checking how to print long doubles..." >&4
9453
9454 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9455         $cat >try.c <<'EOCP'
9456 #include <sys/types.h>
9457 #include <stdio.h>
9458 int main() {
9459   double d = 123.456;
9460   printf("%.3f\n", d);
9461 }
9462 EOCP
9463         set try
9464         if eval $compile; then
9465                 yyy=`$run ./try`
9466                 case "$yyy" in
9467                 123.456)
9468                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9469                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9470                         echo "We will use %f."
9471                         ;;
9472                 esac
9473         fi
9474 fi
9475
9476 if $test X"$sPRIfldbl" = X; then
9477         $cat >try.c <<'EOCP'
9478 #include <sys/types.h>
9479 #include <stdio.h>
9480 int main() {
9481   long double d = 123.456;
9482   printf("%.3Lf\n", d);
9483 }
9484 EOCP
9485         set try
9486         if eval $compile; then
9487                 yyy=`$run ./try`
9488                 case "$yyy" in
9489                 123.456)
9490                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9491                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9492                         echo "We will use %Lf."
9493                         ;;
9494                 esac
9495         fi
9496 fi
9497
9498 if $test X"$sPRIfldbl" = X; then
9499         $cat >try.c <<'EOCP'
9500 #include <sys/types.h>
9501 #include <stdio.h>
9502 int main() {
9503   long double d = 123.456;
9504   printf("%.3llf\n", d);
9505 }
9506 EOCP
9507         set try
9508         if eval $compile; then
9509                 yyy=`$run ./try`
9510                 case "$yyy" in
9511                 123.456)
9512                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9513                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9514                         echo "We will use %llf."
9515                         ;;
9516                 esac
9517         fi
9518 fi
9519
9520 if $test X"$sPRIfldbl" = X; then
9521         $cat >try.c <<'EOCP'
9522 #include <sys/types.h>
9523 #include <stdio.h>
9524 int main() {
9525   long double d = 123.456;
9526   printf("%.3lf\n", d);
9527 }
9528 EOCP
9529         set try
9530         if eval $compile; then
9531                 yyy=`$run ./try`
9532                 case "$yyy" in
9533                 123.456)
9534                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9535                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9536                         echo "We will use %lf."
9537                         ;;
9538                 esac
9539         fi
9540 fi
9541
9542 if $test X"$sPRIfldbl" = X; then
9543         echo "Cannot figure out how to print long doubles." >&4
9544 else
9545         sSCNfldbl=$sPRIfldbl    # expect consistency
9546 fi
9547
9548 $rm_try
9549
9550 fi # d_longdbl
9551
9552 case "$sPRIfldbl" in
9553 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9554         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9555         d_SCNfldbl="$undef";
9556         ;;
9557 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9558         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9559         d_SCNfldbl="$define";
9560         ;;
9561 esac
9562
9563 : Check how to convert floats to strings.
9564
9565 if test "X$d_Gconvert" = X; then
9566
9567 echo " "
9568 echo "Checking for an efficient way to convert floats to strings."
9569 echo " " > try.c
9570 case "$uselongdouble" in
9571 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9572 esac
9573 case "$d_longdbl" in
9574 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9575 esac
9576 case "$d_PRIgldbl" in
9577 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9578 esac
9579 $cat >>try.c <<EOP
9580 #ifdef TRY_gconvert
9581 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9582 char *myname = "gconvert";
9583 #endif
9584 #ifdef TRY_gcvt
9585 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9586 char *myname = "gcvt";
9587 #endif
9588 #ifdef TRY_qgcvt
9589 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9590 char *myname = "qgcvt";
9591 #define DOUBLETYPE long double
9592 #endif
9593 #ifdef TRY_sprintf
9594 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9595 #ifdef HAS_PRIgldbl
9596 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9597 #else
9598 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9599 #endif
9600 #else
9601 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9602 #endif
9603 char *myname = "sprintf";
9604 #endif
9605
9606 #ifndef DOUBLETYPE
9607 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9608 #define DOUBLETYPE long double
9609 #else
9610 #define DOUBLETYPE double
9611 #endif
9612 #endif
9613
9614 #include <stdio.h>
9615
9616 #define I_STDLIB $i_stdlib
9617 #ifdef I_STDLIB
9618 #include <stdlib.h>
9619 #endif
9620
9621 int
9622 checkit(expect, got)
9623 char *expect;
9624 char *got;
9625 {
9626     if (strcmp(expect, got)) {
9627                 printf("%s oddity:  Expected %s, got %s\n",
9628                         myname, expect, got);
9629                 exit(1);
9630         }
9631 }
9632
9633 int main()
9634 {
9635         char buf[64];
9636         buf[63] = '\0';
9637
9638         /* This must be 1st test on (which?) platform */
9639         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9640         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9641         checkit("0.1", buf);
9642
9643         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9644         checkit("0.01", buf);
9645
9646         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9647         checkit("0.001", buf);
9648
9649         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9650         checkit("0.0001", buf);
9651
9652         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9653         if (strlen(buf) > 5)
9654             checkit("9e-005", buf); /* for Microsoft ?? */
9655         else
9656             checkit("9e-05", buf);
9657
9658         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9659         checkit("1", buf);
9660
9661         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9662         checkit("1.1", buf);
9663
9664         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9665         checkit("1.01", buf);
9666
9667         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9668         checkit("1.001", buf);
9669
9670         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9671         checkit("1.0001", buf);
9672
9673         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9674         checkit("1.00001", buf);
9675
9676         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9677         checkit("1.000001", buf);
9678
9679         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9680         checkit("0", buf);
9681
9682         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9683         checkit("-1", buf);
9684
9685         /* Some Linux gcvt's give 1.e+5 here. */
9686         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9687         checkit("100000", buf);
9688
9689         /* Some Linux gcvt's give -1.e+5 here. */
9690         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9691         checkit("-100000", buf);
9692
9693         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9694         checkit("123.456", buf);
9695
9696         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9697         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9698         /* 34 should be enough to scare even long double
9699          * places into using the e notation. */
9700         if (strlen(buf) > 5)
9701             checkit("1e+034", buf); /* for Microsoft */
9702         else
9703             checkit("1e+34", buf);
9704
9705         /* For Perl, if you add additional tests here, also add them to
9706          * t/base/num.t for benefit of platforms not using Configure or
9707          * overriding d_Gconvert */
9708
9709         exit(0);
9710 }
9711 EOP
9712 : first add preferred functions to our list
9713 xxx_list=""
9714 for xxx_convert in $gconvert_preference; do
9715     case $xxx_convert in
9716     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9717     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9718     esac
9719 done
9720 : then add any others
9721 for xxx_convert in gconvert gcvt sprintf; do
9722     case "$xxx_list" in
9723     *$xxx_convert*) ;;
9724     *) xxx_list="$xxx_list $xxx_convert" ;;
9725     esac
9726 done
9727
9728 case "$d_longdbl$uselongdouble" in
9729 "$define$define")
9730     : again, add prefered functions to our list first
9731     xxx_ld_list=""
9732     for xxx_convert in $gconvert_ld_preference; do
9733         case $xxx_convert in
9734         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9735         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9736         esac
9737     done
9738     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9739     for xxx_convert in qgcvt sprintf $xxx_list; do
9740         case "$xxx_ld_list" in
9741         $xxx_convert*|*" $xxx_convert"*) ;;
9742         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9743         esac
9744     done
9745     : if sprintf cannot do long doubles, move it to the end
9746     if test "$d_PRIgldbl" != "$define"; then
9747         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9748     fi
9749     : if no qgcvt, remove it
9750     if test "$d_qgcvt" != "$define"; then
9751         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9752     fi
9753     : use the ld_list
9754     xxx_list="$xxx_ld_list"
9755     ;;
9756 esac
9757
9758 for xxx_convert in $xxx_list; do
9759         echo "Trying $xxx_convert..."
9760         $rm -f try try$_o core
9761         set try -DTRY_$xxx_convert
9762         if eval $compile; then
9763                 echo "$xxx_convert() found." >&4
9764                 if $run ./try; then
9765                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9766                         break;
9767                 else
9768                         echo "...But $xxx_convert didn't work as I expected."
9769                         xxx_convert=''
9770                 fi
9771         else
9772                 echo "$xxx_convert NOT found." >&4
9773         fi
9774 done
9775
9776 if test X$xxx_convert = X; then
9777     echo "*** WHOA THERE!!! ***" >&4
9778     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9779     xxx_convert=sprintf
9780 fi
9781
9782 case "$xxx_convert" in
9783 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9784 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9785 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9786 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9787    "$define$define$define")
9788       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9789    "$define$define$undef")
9790       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9791    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9792    esac
9793    ;;
9794 esac
9795
9796 fi
9797 $rm_try
9798
9799 : see if _fwalk exists
9800 set fwalk d__fwalk
9801 eval $inlibc
9802
9803 : Initialize h_fcntl
9804 h_fcntl=false
9805
9806 : Initialize h_sysfile
9807 h_sysfile=false
9808
9809 : access call always available on UNIX
9810 set access d_access
9811 eval $inlibc
9812
9813 : locate the flags for 'access()'
9814 case "$d_access" in
9815 "$define")
9816         echo " "
9817         $cat >access.c <<EOCP
9818 #include <sys/types.h>
9819 #ifdef I_FCNTL
9820 #include <fcntl.h>
9821 #endif
9822 #ifdef I_SYS_FILE
9823 #include <sys/file.h>
9824 #endif
9825 #ifdef I_UNISTD
9826 #include <unistd.h>
9827 #endif
9828 #$i_stdlib I_STDLIB
9829 #ifdef I_STDLIB
9830 #include <stdlib.h>
9831 #endif
9832 int main() {
9833         exit(R_OK);
9834 }
9835 EOCP
9836         : check sys/file.h first, no particular reason here
9837         if $test `./findhdr sys/file.h` && \
9838                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9839                 h_sysfile=true;
9840                 echo "<sys/file.h> defines the *_OK access constants." >&4
9841         elif $test `./findhdr fcntl.h` && \
9842                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9843                 h_fcntl=true;
9844                 echo "<fcntl.h> defines the *_OK access constants." >&4
9845         elif $test `./findhdr unistd.h` && \
9846                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9847                 echo "<unistd.h> defines the *_OK access constants." >&4
9848         else
9849                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9850         fi
9851         ;;
9852 esac
9853 $rm -f access*
9854
9855 : see if accessx exists
9856 set accessx d_accessx
9857 eval $inlibc
9858
9859 : see if aintl exists
9860 set aintl d_aintl
9861 eval $inlibc
9862
9863 : see if alarm exists
9864 set alarm d_alarm
9865 eval $inlibc
9866
9867 : see if POSIX threads are available
9868 set pthread.h i_pthread
9869 eval $inhdr
9870
9871 : define a fucntion to check prototypes
9872 $cat > protochk <<EOSH
9873 $startsh
9874 cc="$cc"
9875 optimize="$optimize"
9876 ccflags="$ccflags"
9877 prototype="$prototype"
9878 define="$define"
9879 rm_try="$rm_try"
9880 usethreads=$usethreads
9881 i_pthread=$i_pthread
9882 pthread_h_first=$pthread_h_first
9883 EOSH
9884
9885 $cat >> protochk <<'EOSH'
9886
9887 $rm_try
9888 foo="$1"
9889 shift
9890 while test $# -ge 2; do
9891         case "$1" in
9892                 $define) echo "#include <$2>" >> try.c ;;
9893                 literal) echo "$2" >> try.c ;;
9894         esac
9895     # Extra magic for the benefit of systems that need pthread.h
9896     # to be included early to correctly detect threadsafe functions.
9897     # Such functions must guarantee themselves, though, that the usethreads
9898     # and i_pthread have been defined, before calling protochk.
9899     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9900         echo "#include <pthread.h>" >> try.c
9901         pthread_h_done=yes
9902     fi
9903     shift 2
9904 done
9905 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9906 cat >> try.c <<'EOCP'
9907 #ifdef CAN_PROTOTYPE
9908 #define _(args) args
9909 #else
9910 #define _(args) ()
9911 #endif
9912 EOCP
9913 echo "$foo" >> try.c
9914 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9915 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9916 status=$?
9917 $rm_try
9918 exit $status
9919 EOSH
9920 chmod +x protochk
9921 $eunicefix protochk
9922
9923 : Define hasproto macro for Configure internal use
9924 hasproto='varname=$1; func=$2; shift; shift;
9925 while $test $# -ge 2; do
9926         case "$1" in
9927         $define) echo "#include <$2>";;
9928         esac ;
9929     shift 2;
9930 done > try.c;
9931 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9932 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9933         echo "$func() prototype found.";
9934         val="$define";
9935 else
9936         echo "$func() prototype NOT found.";
9937         val="$undef";
9938 fi;
9939 set $varname;
9940 eval $setvar;
9941 $rm_try tryout.c'
9942
9943 : see if sys/types.h has to be included
9944 set sys/types.h i_systypes
9945 eval $inhdr
9946
9947 : see if sys/select.h has to be included
9948 set sys/select.h i_sysselct
9949 eval $inhdr
9950
9951 : Define hasfield macro for Configure internal use
9952 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9953 while $test $# -ge 2; do
9954         case "$1" in
9955         $define) echo "#include <$2>";;
9956         esac ;
9957     shift 2;
9958 done > try.c;
9959 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9960 set try;
9961 if eval $compile; then
9962         val="$define";
9963 else
9964         val="$undef";
9965 fi;
9966 set $varname;
9967 eval $setvar;
9968 $rm_try'
9969
9970 : see if we should include time.h, sys/time.h, or both
9971 echo " "
9972 if test "X$timeincl" = X; then
9973         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9974         $echo $n "I'm now running the test program...$c"
9975         $cat >try.c <<EOCP
9976 #include <sys/types.h>
9977 #ifdef I_TIME
9978 #include <time.h>
9979 #endif
9980 #ifdef I_SYSTIME
9981 #ifdef SYSTIMEKERNEL
9982 #define KERNEL
9983 #endif
9984 #include <sys/time.h>
9985 #endif
9986 #ifdef I_SYSSELECT
9987 #include <sys/select.h>
9988 #endif
9989 #$i_stdlib I_STDLIB
9990 #ifdef I_STDLIB
9991 #include <stdlib.h>
9992 #endif
9993 int main()
9994 {
9995         struct tm foo;
9996 #ifdef S_TIMEVAL
9997         struct timeval bar;
9998 #endif
9999 #ifdef S_TIMEZONE
10000         struct timezone tzp;
10001 #endif
10002         if (foo.tm_sec == foo.tm_sec)
10003                 exit(0);
10004 #ifdef S_TIMEVAL
10005         if (bar.tv_sec == bar.tv_sec)
10006                 exit(0);
10007 #endif
10008         exit(1);
10009 }
10010 EOCP
10011         flags=''
10012         for s_timezone in '-DS_TIMEZONE' ''; do
10013         sysselect=''
10014         for s_timeval in '-DS_TIMEVAL' ''; do
10015         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10016         for i_time in '' '-DI_TIME'; do
10017         for i_systime in '-DI_SYSTIME' ''; do
10018                 case "$flags" in
10019                 '') $echo $n ".$c"
10020                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10021                         if eval $compile; then
10022                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10023                                 shift
10024                                 flags="$*"
10025                                 echo " "
10026                                 $echo $n "Succeeded with $flags$c"
10027                         fi
10028                         ;;
10029                 esac
10030         done
10031         done
10032         done
10033         done
10034         done
10035         timeincl=''
10036         echo " "
10037         case "$flags" in
10038         *SYSTIMEKERNEL*) i_systimek="$define"
10039                 timeincl=`./findhdr sys/time.h`
10040                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10041         *) i_systimek="$undef";;
10042         esac
10043         case "$flags" in
10044         *I_TIME*) i_time="$define"
10045                 timeincl=`./findhdr time.h`" $timeincl"
10046                 echo "We'll include <time.h>." >&4;;
10047         *) i_time="$undef";;
10048         esac
10049         case "$flags" in
10050         *I_SYSTIME*) i_systime="$define"
10051                 timeincl=`./findhdr sys/time.h`" $timeincl"
10052                 echo "We'll include <sys/time.h>." >&4;;
10053         *) i_systime="$undef";;
10054         esac
10055         $rm_try
10056 fi
10057 : see if struct tm knows about tm_zone
10058 case "$i_systime$i_time" in
10059 *$define*)
10060         echo " "
10061         echo "Checking to see if your struct tm has tm_zone field..." >&4
10062         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10063         eval $hasfield
10064         ;;
10065 *)      val="$undef"
10066         set d_tm_tm_zone
10067         eval $setvar
10068         ;;
10069 esac
10070 case "$d_tm_tm_zone" in
10071 "$define")      echo "Yes, it does."   ;;
10072 *)              echo "No, it doesn't." ;;
10073 esac
10074 : see if struct tm knows about tm_gmtoff
10075 case "$i_systime$i_time" in
10076 *$define*)
10077         echo " "
10078         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10079         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10080         eval $hasfield
10081         ;;
10082 *)      val="$undef"
10083         set d_tm_tm_gmtoff
10084         eval $setvar
10085         ;;
10086 esac
10087 case "$d_tm_tm_gmtoff" in
10088 "$define")      echo "Yes, it does."   ;;
10089 *)              echo "No, it doesn't." ;;
10090 esac
10091
10092 : see if asctime_r exists
10093 set asctime_r d_asctime_r
10094 eval $inlibc
10095 case "$d_asctime_r" in
10096 "$define")
10097         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10098         case "$d_asctime_r_proto:$usethreads" in
10099         ":define")      d_asctime_r_proto=define
10100                 set d_asctime_r_proto asctime_r $hdrs
10101                 eval $hasproto ;;
10102         *)      ;;
10103         esac
10104         case "$d_asctime_r_proto" in
10105         define)
10106         case "$asctime_r_proto" in
10107         ''|0) try='char* asctime_r(const struct tm*, char*);'
10108         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10109         esac
10110         case "$asctime_r_proto" in
10111         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10112         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10113         esac
10114         case "$asctime_r_proto" in
10115         ''|0) try='int asctime_r(const struct tm*, char*);'
10116         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10117         esac
10118         case "$asctime_r_proto" in
10119         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10120         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10121         esac
10122         case "$asctime_r_proto" in
10123         ''|0)   d_asctime_r=undef
10124                 asctime_r_proto=0
10125                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10126         * )     case "$asctime_r_proto" in
10127                 REENTRANT_PROTO*) ;;
10128                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10129                 esac
10130                 echo "Prototype: $try" ;;
10131         esac
10132         ;;
10133         *)      case "$usethreads" in
10134                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10135                 esac
10136                 d_asctime_r=undef
10137                 asctime_r_proto=0
10138                 ;;
10139         esac
10140         ;;
10141 *)      asctime_r_proto=0
10142         ;;
10143 esac
10144
10145 : see if atolf exists
10146 set atolf d_atolf
10147 eval $inlibc
10148
10149 : see if atoll exists
10150 set atoll d_atoll
10151 eval $inlibc
10152
10153 : Look for GCC-style attribute format
10154 case "$d_attribute_format" in
10155 '')
10156 echo " "
10157 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10158 $cat >attrib.c <<'EOCP'
10159 #include <stdio.h>
10160 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10161 EOCP
10162 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10163         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10164                 echo "Your C compiler doesn't support __attribute__((format))."
10165                 val="$undef"
10166         else
10167                 echo "Your C compiler supports __attribute__((format))."
10168                 val="$define"
10169         fi
10170 else
10171         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10172         val="$undef"
10173 fi
10174 ;;
10175 *) val="$d_attribute_format" ;;
10176 esac
10177 set d_attribute_format
10178 eval $setvar
10179 $rm -f attrib*
10180
10181 : Look for GCC-style attribute format with null format allowed
10182 case "$d_printf_format_null" in
10183 '') case "$d_attribute_format" in
10184     $define)
10185         echo " "
10186         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10187 $cat >attrib.c <<EOCP
10188 #include <stdio.h>
10189 #$i_stdlib I_STDLIB
10190 #ifdef I_STDLIB
10191 #include <stdlib.h>
10192 #endif
10193 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10194 int null_printf (char* pat,...) { return (int)pat; }
10195 int main () { exit(null_printf(NULL)); }
10196 EOCP
10197         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10198             : run the executable in case it produces a run-time warning
10199             if $run ./attrib >>attrib.out 2>&1; then
10200                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10201                     echo "Your C compiler doesn't allow __printf__ format to be null."
10202                     val="$undef"
10203                 else
10204                     echo "Your C compiler allows __printf__ format to be null."
10205                     val="$define"
10206                 fi
10207             else
10208             echo "Your C compiler executable failed with __printf__ format null."
10209             val="$undef"
10210         fi
10211     else
10212         echo "Your C compiler fails with __printf__ format null."
10213         val="$undef"
10214     fi
10215     ;;
10216     *)  val="$undef" ;;
10217     esac
10218 ;;
10219 *)  val="$d_printf_format_null" ;;
10220 esac
10221 set d_printf_format_null
10222 eval $setvar
10223 $rm -f attrib*
10224
10225 : Look for GCC-style attribute malloc
10226 case "$d_attribute_malloc" in
10227 '')
10228 echo " "
10229 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10230 $cat >attrib.c <<'EOCP'
10231 #include <stdio.h>
10232 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10233 EOCP
10234 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10235         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10236                 echo "Your C compiler doesn't support __attribute__((malloc))."
10237                 val="$undef"
10238         else
10239                 echo "Your C compiler supports __attribute__((malloc))."
10240                 val="$define"
10241         fi
10242 else
10243         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10244         val="$undef"
10245 fi
10246 ;;
10247 *) val="$d_attribute_malloc" ;;
10248 esac
10249 set d_attribute_malloc
10250 eval $setvar
10251 $rm -f attrib*
10252
10253 : Look for GCC-style attribute nonnull
10254 case "$d_attribute_nonnull" in
10255 '')
10256 echo " "
10257 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10258 $cat >attrib.c <<'EOCP'
10259 #include <stdio.h>
10260 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10261 EOCP
10262 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10263         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10264                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10265                 val="$undef"
10266         else
10267                 echo "Your C compiler supports __attribute__((nonnull))."
10268                 val="$define"
10269         fi
10270 else
10271         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10272         val="$undef"
10273 fi
10274 ;;
10275 *) val="$d_attribute_nonnull" ;;
10276 esac
10277 set d_attribute_nonnull
10278 eval $setvar
10279 $rm -f attrib*
10280
10281 : Look for GCC-style attribute noreturn
10282 case "$d_attribute_noreturn" in
10283 '')
10284 echo " "
10285 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10286 $cat >attrib.c <<'EOCP'
10287 #include <stdio.h>
10288 void fall_over_dead( void ) __attribute__((noreturn));
10289 EOCP
10290 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10291         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10292                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10293                 val="$undef"
10294         else
10295                 echo "Your C compiler supports __attribute__((noreturn))."
10296                 val="$define"
10297         fi
10298 else
10299         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10300         val="$undef"
10301 fi
10302 ;;
10303 *) val="$d_attribute_noreturn" ;;
10304 esac
10305 set d_attribute_noreturn
10306 eval $setvar
10307 $rm -f attrib*
10308
10309 : Look for GCC-style attribute pure
10310 case "$d_attribute_pure" in
10311 '')
10312 echo " "
10313 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10314 $cat >attrib.c <<'EOCP'
10315 #include <stdio.h>
10316 int square( int n ) __attribute__((pure));
10317 EOCP
10318 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10319         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10320                 echo "Your C compiler doesn't support __attribute__((pure))."
10321                 val="$undef"
10322         else
10323                 echo "Your C compiler supports __attribute__((pure))."
10324                 val="$define"
10325         fi
10326 else
10327         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10328         val="$undef"
10329 fi
10330 ;;
10331 *) val="$d_attribute_pure" ;;
10332 esac
10333 set d_attribute_pure
10334 eval $setvar
10335 $rm -f attrib*
10336
10337 : Look for GCC-style attribute unused
10338 case "$d_attribute_unused" in
10339 '')
10340 echo " "
10341 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10342 $cat >attrib.c <<'EOCP'
10343 #include <stdio.h>
10344 int do_something( int dummy __attribute__((unused)), int n );
10345 EOCP
10346 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10347         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10348                 echo "Your C compiler doesn't support __attribute__((unused))."
10349                 val="$undef"
10350         else
10351                 echo "Your C compiler supports __attribute__((unused))."
10352                 val="$define"
10353         fi
10354 else
10355         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10356         val="$undef"
10357 fi
10358 ;;
10359 *) val="$d_attribute_unused" ;;
10360 esac
10361 set d_attribute_unused
10362 eval $setvar
10363 $rm -f attrib*
10364
10365 : Look for GCC-style attribute warn_unused_result
10366 case "$d_attribute_warn_unused_result" in
10367 '')
10368 echo " "
10369 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10370 $cat >attrib.c <<'EOCP'
10371 #include <stdio.h>
10372 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10373 EOCP
10374 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10375         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10376                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10377                 val="$undef"
10378         else
10379                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10380                 val="$define"
10381         fi
10382 else
10383         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10384         val="$undef"
10385 fi
10386 ;;
10387 *) val="$d_attribute_warn_unused_result" ;;
10388 esac
10389 set d_attribute_warn_unused_result
10390 eval $setvar
10391 $rm -f attrib*
10392
10393 : see if bcmp exists
10394 set bcmp d_bcmp
10395 eval $inlibc
10396
10397 : see if bcopy exists
10398 set bcopy d_bcopy
10399 eval $inlibc
10400
10401 : see if getpgrp exists
10402 set getpgrp d_getpgrp
10403 eval $inlibc
10404
10405 case "$d_getpgrp" in
10406 "$define")
10407         echo " "
10408         echo "Checking to see which flavor of getpgrp is in use..."
10409         $cat >try.c <<EOP
10410 #$i_unistd I_UNISTD
10411 #include <sys/types.h>
10412 #ifdef I_UNISTD
10413 #  include <unistd.h>
10414 #endif
10415 #$i_stdlib I_STDLIB
10416 #ifdef I_STDLIB
10417 #include <stdlib.h>
10418 #endif
10419 int main()
10420 {
10421         if (getuid() == 0) {
10422                 printf("(I see you are running Configure as super-user...)\n");
10423                 setuid(1);
10424         }
10425 #ifdef TRY_BSD_PGRP
10426         if (getpgrp(1) == 0)
10427                 exit(0);
10428 #else
10429         if (getpgrp() > 0)
10430                 exit(0);
10431 #endif
10432         exit(1);
10433 }
10434 EOP
10435         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10436                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10437                 val="$define"
10438         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10439                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10440                 val="$undef"
10441         else
10442                 echo "I can't seem to compile and run the test program."
10443                 if ./usg; then
10444                         xxx="a USG one, i.e. you use getpgrp()."
10445                 else
10446                         # SVR4 systems can appear rather BSD-ish.
10447                         case "$i_unistd" in
10448                         $undef)
10449                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10450                                 val="$define"
10451                                 ;;
10452                         $define)
10453                                 xxx="probably a USG one, i.e. you use getpgrp()."
10454                                 val="$undef"
10455                                 ;;
10456                         esac
10457                 fi
10458                 echo "Assuming your getpgrp is $xxx" >&4
10459         fi
10460         ;;
10461 *) val="$undef";;
10462 esac
10463 set d_bsdgetpgrp
10464 eval $setvar
10465 $rm_try
10466
10467 : see if setpgrp exists
10468 set setpgrp d_setpgrp
10469 eval $inlibc
10470
10471 case "$d_setpgrp" in
10472 "$define")
10473         echo " "
10474         echo "Checking to see which flavor of setpgrp is in use..."
10475         $cat >try.c <<EOP
10476 #$i_unistd I_UNISTD
10477 #include <sys/types.h>
10478 #ifdef I_UNISTD
10479 #  include <unistd.h>
10480 #endif
10481 #$i_stdlib I_STDLIB
10482 #ifdef I_STDLIB
10483 #include <stdlib.h>
10484 #endif
10485 int main()
10486 {
10487         if (getuid() == 0) {
10488                 printf("(I see you are running Configure as super-user...)\n");
10489                 setuid(1);
10490         }
10491 #ifdef TRY_BSD_PGRP
10492         if (-1 == setpgrp(1, 1))
10493                 exit(0);
10494 #else
10495         if (setpgrp() != -1)
10496                 exit(0);
10497 #endif
10498         exit(1);
10499 }
10500 EOP
10501         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10502                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10503                 val="$define"
10504         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10505                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10506                 val="$undef"
10507         else
10508                 echo "(I can't seem to compile and run the test program.)"
10509                 if ./usg; then
10510                         xxx="a USG one, i.e. you use setpgrp()."
10511                 else
10512                         # SVR4 systems can appear rather BSD-ish.
10513                         case "$i_unistd" in
10514                         $undef)
10515                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10516                                 val="$define"
10517                                 ;;
10518                         $define)
10519                                 xxx="probably a USG one, i.e. you use setpgrp()."
10520                                 val="$undef"
10521                                 ;;
10522                         esac
10523                 fi
10524                 echo "Assuming your setpgrp is $xxx" >&4
10525         fi
10526         ;;
10527 *) val="$undef";;
10528 esac
10529 set d_bsdsetpgrp
10530 eval $setvar
10531 $rm_try
10532
10533 : Look for GCC-style __builtin_choose_expr
10534 case "$d_builtin_choose_expr" in
10535 '')
10536     echo " "
10537     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10538     $cat >try.c <<'EOCP'
10539 #include <assert.h>
10540 #include <stdlib.h>
10541 #include <stdio.h>
10542
10543 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10544
10545 int main(void) {
10546     assert( SYRINX(1) == 2112 );
10547     assert( SYRINX(1) != 5150 );
10548     assert( SYRINX(0) == 5150 );
10549     assert( SYRINX(0) != 2112 );
10550     puts( "All good!" );
10551     exit(0);
10552 }
10553
10554 EOCP
10555     set try
10556     if eval $compile; then
10557         echo "Your C compiler supports __builtin_choose_expr."
10558         val="$define"
10559     else
10560         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10561         val="$undef"
10562     fi
10563 ;;
10564 *) val="$d_builtin_choose_expr" ;;
10565 esac
10566
10567 set d_builtin_choose_expr
10568 eval $setvar
10569 $rm_try
10570
10571 : Look for GCC-style __builtin_expect
10572 case "$d_builtin_expect" in
10573 '')
10574     echo " "
10575     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10576     $cat >builtin.c <<'EOCP'
10577 int main(void) {
10578     int n = 50;
10579     if ( __builtin_expect(n, 0) ) n = 1;
10580 }
10581 EOCP
10582     set try
10583     if eval $compile; then
10584         echo "Your C compiler supports __builtin_choose_expr."
10585         val="$define"
10586     else
10587         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10588         val="$undef"
10589     fi
10590     ;;
10591 *) val="$d_builtin_expect" ;;
10592 esac
10593
10594 set d_builtin_expect
10595 eval $setvar
10596 $rm_try
10597
10598 : see if bzero exists
10599 set bzero d_bzero
10600 eval $inlibc
10601
10602 : see if stdarg is available
10603 echo " "
10604 if $test `./findhdr stdarg.h`; then
10605         echo "<stdarg.h> found." >&4
10606         valstd="$define"
10607 else
10608         echo "<stdarg.h> NOT found." >&4
10609         valstd="$undef"
10610 fi
10611
10612 : see if varags is available
10613 echo " "
10614 if $test `./findhdr varargs.h`; then
10615         echo "<varargs.h> found." >&4
10616 else
10617         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10618 fi
10619
10620 : set up the varargs testing programs
10621 $cat > varargs.c <<EOP
10622 #ifdef I_STDARG
10623 #include <stdarg.h>
10624 #endif
10625 #ifdef I_VARARGS
10626 #include <varargs.h>
10627 #endif
10628
10629 #ifdef I_STDARG
10630 int f(char *p, ...)
10631 #else
10632 int f(va_alist)
10633 va_dcl
10634 #endif
10635 {
10636         va_list ap;
10637 #ifndef I_STDARG
10638         char *p;
10639 #endif
10640 #ifdef I_STDARG
10641         va_start(ap,p);
10642 #else
10643         va_start(ap);
10644         p = va_arg(ap, char *);
10645 #endif
10646         va_end(ap);
10647         return 0;
10648 }
10649 EOP
10650 $cat > varargs <<EOP
10651 $startsh
10652 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10653         echo "true"
10654 else
10655         echo "false"
10656 fi
10657 $rm -f varargs$_o
10658 EOP
10659 chmod +x varargs
10660
10661 : now check which varargs header should be included
10662 echo " "
10663 i_varhdr=''
10664 case "$valstd" in
10665 "$define")
10666         if `./varargs I_STDARG`; then
10667                 val='stdarg.h'
10668         elif `./varargs I_VARARGS`; then
10669                 val='varargs.h'
10670         fi
10671         ;;
10672 *)
10673         if `./varargs I_VARARGS`; then
10674                 val='varargs.h'
10675         fi
10676         ;;
10677 esac
10678 case "$val" in
10679 '')
10680 echo "I could not find the definition for va_dcl... You have problems..." >&4
10681         val="$undef"; set i_stdarg; eval $setvar
10682         val="$undef"; set i_varargs; eval $setvar
10683         ;;
10684 *)
10685         set i_varhdr
10686         eval $setvar
10687         case "$i_varhdr" in
10688         stdarg.h)
10689                 val="$define"; set i_stdarg; eval $setvar
10690                 val="$undef"; set i_varargs; eval $setvar
10691                 ;;
10692         varargs.h)
10693                 val="$undef"; set i_stdarg; eval $setvar
10694                 val="$define"; set i_varargs; eval $setvar
10695                 ;;
10696         esac
10697         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10698 esac
10699 $rm -f varargs*
10700
10701 : see if the Compiler supports C99 variadic macros
10702 case "$i_stdarg$i_stdlib" in
10703     "$define$define")
10704     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10705     $cat >try.c <<EOCP
10706 #include <stdio.h>
10707 #include <stdarg.h>
10708
10709 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10710
10711 int main() {
10712   char buf[20];
10713   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10714   puts(buf);
10715   return 0;
10716 }
10717 EOCP
10718     set try
10719     if eval $compile && $run ./try 2>&1 >/dev/null; then
10720         case "`$run ./try`" in
10721             "123 456 789")
10722             echo "You have C99 variadic macros." >&4
10723             d_c99_variadic_macros="$define"
10724             ;;
10725             *)
10726             echo "You don't have functional C99 variadic macros." >&4
10727             d_c99_variadic_macros="$undef"
10728             ;;
10729         esac
10730     else
10731         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10732         d_c99_variadic_macros="$undef"
10733     fi
10734     $rm_try
10735     ;;
10736     *)
10737     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10738     d_c99_variadic_macros="$undef"
10739     ;;
10740 esac
10741
10742 : see if signal is declared as pointer to function returning int or void
10743 echo " "
10744 xxx=`./findhdr signal.h`
10745 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10746 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10747         echo "You have int (*signal())() instead of void." >&4
10748         val="$undef"
10749 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10750         echo "You have void (*signal())()." >&4
10751         val="$define"
10752 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10753         echo "You have int (*signal())() instead of void." >&4
10754         val="$undef"
10755 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10756         echo "You have void (*signal())()." >&4
10757         val="$define"
10758 else
10759         case "$d_voidsig" in
10760         '')
10761         echo "I can't determine whether signal handler returns void or int..." >&4
10762                 dflt=void
10763                 rp="What type does your signal handler return?"
10764                 . ./myread
10765                 case "$ans" in
10766                 v*) val="$define";;
10767                 *) val="$undef";;
10768                 esac;;
10769         "$define")
10770                 echo "As you already told me, signal handler returns void." >&4
10771                 val="$define"
10772                 ;;
10773         *)      echo "As you already told me, signal handler returns int." >&4
10774                 val="$undef"
10775                 ;;
10776         esac
10777 fi
10778 set d_voidsig
10779 eval $setvar
10780 case "$d_voidsig" in
10781 "$define") signal_t="void";;
10782 *) signal_t="int";;
10783 esac
10784 $rm -f $$.tmp
10785
10786 : check for ability to cast large floats to 32-bit ints.
10787 echo " "
10788 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10789 if $test "$intsize" -ge 4; then
10790         xxx=int
10791 else
10792         xxx=long
10793 fi
10794 $cat >try.c <<EOCP
10795 #include <stdio.h>
10796 #$i_stdlib I_STDLIB
10797 #ifdef I_STDLIB
10798 #include <stdlib.h>
10799 #endif
10800 #include <sys/types.h>
10801 #include <signal.h>
10802 $signal_t blech(int s) { exit(3); }
10803 int main()
10804 {
10805         $xxx i32;
10806         double f, g;
10807         int result = 0;
10808         char str[16];
10809         signal(SIGFPE, blech);
10810
10811         /* Don't let compiler optimize the test away.  Store the number
10812            in a writable string for gcc to pass to sscanf under HP/UX.
10813         */
10814         sprintf(str, "2147483647");
10815         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10816         g = 10 * f;
10817         i32  = ($xxx) g;
10818
10819         /* x86 processors will probably give 0x8000 0000, which is a
10820            sign change.  We don't want that.  We want to mimic SPARC
10821            behavior here, which is to preserve the sign and give
10822            back 0x7fff ffff.
10823         */
10824         if (i32 != ($xxx) f)
10825                 result |= 1;
10826         exit(result);
10827 }
10828 EOCP
10829 set try
10830 if eval $compile_ok; then
10831         $run ./try
10832         yyy=$?
10833 else
10834         echo "(I can't seem to compile the test program--assuming it can't)"
10835         yyy=1
10836 fi
10837 case "$yyy" in
10838 0)      val="$define"
10839         echo "Yup, it can."
10840         ;;
10841 *)      val="$undef"
10842         echo "Nope, it can't."
10843         ;;
10844 esac
10845 set d_casti32
10846 eval $setvar
10847 $rm_try
10848
10849 : check for ability to cast negative floats to unsigned
10850 echo " "
10851 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10852 $cat >try.c <<EOCP
10853 #include <stdio.h>
10854 #$i_stdlib I_STDLIB
10855 #ifdef I_STDLIB
10856 #include <stdlib.h>
10857 #endif
10858 #include <sys/types.h>
10859 #include <signal.h>
10860 $signal_t blech(int s) { exit(7); }
10861 $signal_t blech_in_list(int s) { exit(4); }
10862 unsigned long dummy_long(unsigned long p) { return p; }
10863 unsigned int dummy_int(unsigned int p) { return p; }
10864 unsigned short dummy_short(unsigned short p) { return p; }
10865 int main()
10866 {
10867         double f;
10868         unsigned long along;
10869         unsigned int aint;
10870         unsigned short ashort;
10871         int result = 0;
10872         char str[16];
10873
10874         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10875            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10876            optimized the whole file away
10877         */
10878         /* Store the number in a writable string for gcc to pass to
10879            sscanf under HP/UX.
10880         */
10881         sprintf(str, "-123");
10882         sscanf(str, "%lf", &f);  /* f = -123.; */
10883
10884         signal(SIGFPE, blech);
10885         along = (unsigned long)f;
10886         aint = (unsigned int)f;
10887         ashort = (unsigned short)f;
10888         if (along != (unsigned long)-123)
10889                 result |= 1;
10890         if (aint != (unsigned int)-123)
10891                 result |= 1;
10892         if (ashort != (unsigned short)-123)
10893                 result |= 1;
10894         sprintf(str, "1073741824.");
10895         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10896         f = f + f;
10897         along = 0;
10898         along = (unsigned long)f;
10899         if (along != 0x80000000)
10900                 result |= 2;
10901         f -= 1.;
10902         along = 0;
10903         along = (unsigned long)f;
10904         if (along != 0x7fffffff)
10905                 result |= 1;
10906         f += 2.;
10907         along = 0;
10908         along = (unsigned long)f;
10909         if (along != 0x80000001)
10910                 result |= 2;
10911         if (result)
10912                 exit(result);
10913         signal(SIGFPE, blech_in_list);
10914         sprintf(str, "123.");
10915         sscanf(str, "%lf", &f);  /* f = 123.; */
10916         along = dummy_long((unsigned long)f);
10917         aint = dummy_int((unsigned int)f);
10918         ashort = dummy_short((unsigned short)f);
10919         if (along != (unsigned long)123)
10920                 result |= 4;
10921         if (aint != (unsigned int)123)
10922                 result |= 4;
10923         if (ashort != (unsigned short)123)
10924                 result |= 4;
10925         exit(result);
10926
10927 }
10928 EOCP
10929 set try
10930 if eval $compile_ok; then
10931         $run ./try
10932         castflags=$?
10933 else
10934         echo "(I can't seem to compile the test program--assuming it can't)"
10935         castflags=7
10936 fi
10937 case "$castflags" in
10938 0)      val="$define"
10939         echo "Yup, it can."
10940         ;;
10941 *)      val="$undef"
10942         echo "Nope, it can't."
10943         ;;
10944 esac
10945 set d_castneg
10946 eval $setvar
10947 $rm_try
10948
10949 : see if vprintf exists
10950 echo " "
10951 if set vprintf val -f d_vprintf; eval $csym; $val; then
10952         echo 'vprintf() found.' >&4
10953         val="$define"
10954         $cat >try.c <<EOF
10955 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10956 #$i_varargs I_VARARGS
10957
10958 #$i_stdlib I_STDLIB
10959 #$i_unistd I_UNISTD
10960
10961 #ifdef I_STDARG
10962 #  include <stdarg.h>
10963 #else /* I_VARARGS */
10964 #  include <varargs.h>
10965 #endif
10966
10967 #ifdef I_UNISTD
10968 #  include <unistd.h>
10969 #endif
10970
10971 #ifdef I_STDLIB
10972 #  include <stdlib.h>
10973 #endif
10974
10975 #include <stdio.h> /* vsprintf prototype */
10976
10977 #ifdef I_STDARG
10978 void xxx(int n, ...)
10979 {
10980     va_list args;
10981     char buf[10];
10982     va_start(args, n);
10983     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10984 }
10985 int main() { xxx(1, "foo"); }
10986
10987 #else /* I_VARARGS */
10988
10989 xxx(va_alist)
10990 va_dcl
10991 {
10992     va_list args;
10993     char buf[10];
10994     va_start(args);
10995     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10996 }
10997 int main() { xxx("foo"); }
10998
10999 #endif
11000
11001 EOF
11002         set try
11003         if eval $compile_ok; then
11004                 if $run ./try; then
11005                         echo "Your vsprintf() returns (int)." >&4
11006                         val2="$undef"
11007                 else
11008                         echo "Your vsprintf() returns (char*)." >&4
11009                         val2="$define"
11010                 fi
11011         else
11012                 echo 'I am unable to compile the vsprintf() test program.' >&4
11013                 # We shouldn't get here.  If we do, assume the standard signature,
11014                 # not the old BSD one.
11015                 echo 'Guessing that vsprintf() returns (int).' >&4
11016                 val2="$undef"
11017         fi
11018 else
11019         echo 'vprintf() NOT found.' >&4
11020         val="$undef"
11021         val2="$undef"
11022 fi
11023 $rm_try
11024 set d_vprintf
11025 eval $setvar
11026 val=$val2
11027 set d_charvspr
11028 eval $setvar
11029
11030 : see if chown exists
11031 set chown d_chown
11032 eval $inlibc
11033
11034 : see if chroot exists
11035 set chroot d_chroot
11036 eval $inlibc
11037
11038 : see if chsize exists
11039 set chsize d_chsize
11040 eval $inlibc
11041
11042 : see if class exists
11043 set class d_class
11044 eval $inlibc
11045
11046 : see if clearenv exists
11047 set clearenv d_clearenv
11048 eval $inlibc
11049
11050 : Define hasstruct macro for Configure internal use
11051 hasstruct='varname=$1; struct=$2; shift; shift;
11052 while $test $# -ge 2; do
11053         case "$1" in
11054         $define) echo "#include <$2>";;
11055         esac ;
11056     shift 2;
11057 done > try.c;
11058 echo "int main () { struct $struct foo; }" >> try.c;
11059 set try;
11060 if eval $compile; then
11061         val="$define";
11062 else
11063         val="$undef";
11064 fi;
11065 set $varname;
11066 eval $setvar;
11067 $rm_try'
11068
11069 : see whether socket exists
11070 socketlib=''
11071 sockethdr=''
11072 echo " "
11073 $echo $n "Hmm... $c" >&4
11074 if set socket val -f d_socket; eval $csym; $val; then
11075         echo "Looks like you have Berkeley networking support." >&4
11076         d_socket="$define"
11077         if set setsockopt val -f; eval $csym; $val; then
11078                 d_oldsock="$undef"
11079         else
11080                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11081                 d_oldsock="$define"
11082         fi
11083 else
11084         if $contains socklib libc.list >/dev/null 2>&1; then
11085                 echo "Looks like you have Berkeley networking support." >&4
11086                 d_socket="$define"
11087                 : we will have to assume that it supports the 4.2 BSD interface
11088                 d_oldsock="$undef"
11089         else
11090                 echo "You don't have Berkeley networking in libc$_a..." >&4
11091                 if test "X$d_socket" = "X$define"; then
11092                    echo "...but you seem to believe that you have sockets." >&4
11093                 else
11094                         for net in net socket
11095                         do
11096                                 if test -f /usr/lib/lib$net$_a; then
11097                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11098                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11099                                         if $contains socket libc.list >/dev/null 2>&1; then
11100                                                 d_socket="$define"
11101                                                 socketlib="-l$net"
11102                                                 case "$net" in
11103                                                 net)
11104                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11105                                                         sockethdr="-I/usr/netinclude"
11106                                                         ;;
11107                                                 esac
11108                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11109                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11110                                                         d_oldsock="$undef"
11111                                                 else
11112                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11113                                                         d_oldsock="$define"
11114                                                 fi
11115                                                 break
11116                                         fi
11117                                 fi
11118                         done
11119                         if test "X$d_socket" != "X$define"; then
11120                            echo "or anywhere else I see." >&4
11121                            d_socket="$undef"
11122                            d_oldsock="$undef"
11123                         fi
11124                 fi
11125         fi
11126 fi
11127
11128 : see if socketpair exists
11129 set socketpair d_sockpair
11130 eval $inlibc
11131
11132
11133 echo " "
11134 echo "Checking the availability of certain socket constants..." >&4
11135 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11136         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11137         $cat >try.c <<EOF
11138 #include <sys/types.h>
11139 #include <sys/socket.h>
11140 int main() {
11141     int i = $ENUM;
11142 }
11143 EOF
11144         val="$undef"
11145         set try; if eval $compile; then
11146                 val="$define"
11147         fi
11148         set d_${enum}; eval $setvar
11149         $rm_try
11150 done
11151
11152 : see if this is a sys/uio.h system
11153 set sys/uio.h i_sysuio
11154 eval $inhdr
11155
11156 : Check for cmsghdr support
11157 echo " "
11158 echo "Checking to see if your system supports struct cmsghdr..." >&4
11159 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11160 eval $hasstruct
11161 case "$d_cmsghdr_s" in
11162 "$define")      echo "Yes, it does."   ;;
11163 *)              echo "No, it doesn't." ;;
11164 esac
11165
11166
11167 : check for const keyword
11168 echo " "
11169 echo 'Checking to see if your C compiler knows about "const"...' >&4
11170 $cat >const.c <<'EOCP'
11171 typedef struct spug { int drokk; } spug;
11172 int main()
11173 {
11174         const char *foo;
11175         const spug y = { 0 };
11176 }
11177 EOCP
11178 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11179         val="$define"
11180         echo "Yup, it does."
11181 else
11182         val="$undef"
11183         echo "Nope, it doesn't."
11184 fi
11185 set d_const
11186 eval $setvar
11187
11188 : see if copysignl exists
11189 set copysignl d_copysignl
11190 eval $inlibc
11191
11192 : see if crypt exists
11193 echo " "
11194 set crypt d_crypt
11195 eval $inlibc
11196 case "$d_crypt" in
11197 $define) cryptlib='' ;;
11198 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11199                 echo 'crypt() found.' >&4
11200                 val="$define"
11201                 cryptlib=''
11202         else
11203                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11204                 if $test -z "$cryptlib"; then
11205                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11206                 else
11207                         cryptlib=-lcrypt
11208                 fi
11209                 if $test -z "$cryptlib"; then
11210                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11211                 else
11212                         cryptlib=-lcrypt
11213                 fi
11214                 if $test -z "$cryptlib"; then
11215                         cryptlib=`./loc libcrypt$_a "" $libpth`
11216                 else
11217                         cryptlib=-lcrypt
11218                 fi
11219                 if $test -z "$cryptlib"; then
11220                         echo 'crypt() NOT found.' >&4
11221                         val="$undef"
11222                 else
11223                         val="$define"
11224                 fi
11225         fi
11226         set d_crypt
11227         eval $setvar
11228         ;;
11229 esac
11230
11231 : see if this is a crypt.h system
11232 set crypt.h i_crypt
11233 eval $inhdr
11234
11235 : see if crypt_r exists
11236 set crypt_r d_crypt_r
11237 eval $inlibc
11238 case "$d_crypt_r" in
11239 "$define")
11240         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11241         case "$d_crypt_r_proto:$usethreads" in
11242         ":define")      d_crypt_r_proto=define
11243                 set d_crypt_r_proto crypt_r $hdrs
11244                 eval $hasproto ;;
11245         *)      ;;
11246         esac
11247         case "$d_crypt_r_proto" in
11248         define)
11249         case "$crypt_r_proto" in
11250         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11251         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11252         esac
11253         case "$crypt_r_proto" in
11254         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11255         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11256         esac
11257         case "$crypt_r_proto" in
11258         ''|0)   d_crypt_r=undef
11259                 crypt_r_proto=0
11260                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11261         * )     case "$crypt_r_proto" in
11262                 REENTRANT_PROTO*) ;;
11263                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11264                 esac
11265                 echo "Prototype: $try" ;;
11266         esac
11267         ;;
11268         *)      case "$usethreads" in
11269                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11270                 esac
11271                 d_crypt_r=undef
11272                 crypt_r_proto=0
11273                 ;;
11274         esac
11275         ;;
11276 *)      crypt_r_proto=0
11277         ;;
11278 esac
11279
11280 : get csh whereabouts
11281 case "$csh" in
11282 'csh') val="$undef" ;;
11283 *) val="$define" ;;
11284 esac
11285 set d_csh
11286 eval $setvar
11287 : Respect a hint or command line value for full_csh.
11288 case "$full_csh" in
11289 '') full_csh=$csh ;;
11290 esac
11291
11292 : see if ctermid exists
11293 set ctermid d_ctermid
11294 eval $inlibc
11295
11296 : see if ctermid_r exists
11297 set ctermid_r d_ctermid_r
11298 eval $inlibc
11299 case "$d_ctermid_r" in
11300 "$define")
11301         hdrs="$i_systypes sys/types.h define stdio.h "
11302         case "$d_ctermid_r_proto:$usethreads" in
11303         ":define")      d_ctermid_r_proto=define
11304                 set d_ctermid_r_proto ctermid_r $hdrs
11305                 eval $hasproto ;;
11306         *)      ;;
11307         esac
11308         case "$d_ctermid_r_proto" in
11309         define)
11310         case "$ctermid_r_proto" in
11311         ''|0) try='char* ctermid_r(char*);'
11312         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11313         esac
11314         case "$ctermid_r_proto" in
11315         ''|0)   d_ctermid_r=undef
11316                 ctermid_r_proto=0
11317                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11318         * )     case "$ctermid_r_proto" in
11319                 REENTRANT_PROTO*) ;;
11320                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11321                 esac
11322                 echo "Prototype: $try" ;;
11323         esac
11324         ;;
11325         *)      case "$usethreads" in
11326                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11327                 esac
11328                 d_ctermid_r=undef
11329                 ctermid_r_proto=0
11330                 ;;
11331         esac
11332         ;;
11333 *)      ctermid_r_proto=0
11334         ;;
11335 esac
11336
11337 : see if ctime_r exists
11338 set ctime_r d_ctime_r
11339 eval $inlibc
11340 case "$d_ctime_r" in
11341 "$define")
11342         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11343         case "$d_ctime_r_proto:$usethreads" in
11344         ":define")      d_ctime_r_proto=define
11345                 set d_ctime_r_proto ctime_r $hdrs
11346                 eval $hasproto ;;
11347         *)      ;;
11348         esac
11349         case "$d_ctime_r_proto" in
11350         define)
11351         case "$ctime_r_proto" in
11352         ''|0) try='char* ctime_r(const time_t*, char*);'
11353         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11354         esac
11355         case "$ctime_r_proto" in
11356         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11357         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11358         esac
11359         case "$ctime_r_proto" in
11360         ''|0) try='int ctime_r(const time_t*, char*);'
11361         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11362         esac
11363         case "$ctime_r_proto" in
11364         ''|0) try='int ctime_r(const time_t*, char*, int);'
11365         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11366         esac
11367         case "$ctime_r_proto" in
11368         ''|0)   d_ctime_r=undef
11369                 ctime_r_proto=0
11370                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11371         * )     case "$ctime_r_proto" in
11372                 REENTRANT_PROTO*) ;;
11373                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11374                 esac
11375                 echo "Prototype: $try" ;;
11376         esac
11377         ;;
11378         *)      case "$usethreads" in
11379                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11380                 esac
11381                 d_ctime_r=undef
11382                 ctime_r_proto=0
11383                 ;;
11384         esac
11385         ;;
11386 *)      ctime_r_proto=0
11387         ;;
11388 esac
11389
11390 : see if cuserid exists
11391 set cuserid d_cuserid
11392 eval $inlibc
11393
11394 : see if this is a limits.h system
11395 set limits.h i_limits
11396 eval $inhdr
11397
11398 : see if this is a float.h system
11399 set float.h i_float
11400 eval $inhdr
11401
11402 : See if number of significant digits in a double precision number is known
11403 echo " "
11404 $cat >dbl_dig.c <<EOM
11405 #$i_limits I_LIMITS
11406 #$i_float I_FLOAT
11407 #ifdef I_LIMITS
11408 #include <limits.h>
11409 #endif
11410 #ifdef I_FLOAT
11411 #include <float.h>
11412 #endif
11413 #ifdef DBL_DIG
11414 printf("Contains DBL_DIG");
11415 #endif
11416 EOM
11417 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11418 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11419         echo "DBL_DIG found." >&4
11420         val="$define"
11421 else
11422         echo "DBL_DIG NOT found." >&4
11423         val="$undef"
11424 fi
11425 $rm -f dbl_dig.?
11426 set d_dbl_dig
11427 eval $setvar
11428
11429 : see if dbm.h is available
11430 : see if dbmclose exists
11431 set dbmclose d_dbmclose
11432 eval $inlibc
11433
11434 case "$d_dbmclose" in
11435 $define)
11436         set dbm.h i_dbm
11437         eval $inhdr
11438         case "$i_dbm" in
11439         $define)
11440                 val="$undef"
11441                 set i_rpcsvcdbm
11442                 eval $setvar
11443                 ;;
11444         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11445                 eval $inhdr
11446                 ;;
11447         esac
11448         ;;
11449 *)      echo "We won't be including <dbm.h>"
11450         val="$undef"
11451         set i_dbm
11452         eval $setvar
11453         val="$undef"
11454         set i_rpcsvcdbm
11455         eval $setvar
11456         ;;
11457 esac
11458
11459 : see if prototype for dbminit is available
11460 echo " "
11461 set d_dbminitproto dbminit $i_dbm dbm.h
11462 eval $hasproto
11463
11464 : see if difftime exists
11465 set difftime d_difftime
11466 eval $inlibc
11467
11468 : see if this is a dirent system
11469 echo " "
11470 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11471         val="$define"
11472         echo "<dirent.h> found." >&4
11473 else
11474         val="$undef"
11475         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11476                 echo "<sys/dir.h> found." >&4
11477                 echo " "
11478         else
11479                 xinc=`./findhdr sys/ndir.h`
11480         fi
11481         echo "<dirent.h> NOT found." >&4
11482 fi
11483 set i_dirent
11484 eval $setvar
11485
11486 : Look for type of directory structure.
11487 echo " "
11488 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11489
11490 case "$direntrytype" in
11491 ''|' ')
11492         case "$i_dirent" in
11493         $define) guess1='struct dirent' ;;
11494         *) guess1='struct direct'  ;;
11495         esac
11496         ;;
11497 *)      guess1="$direntrytype"
11498         ;;
11499 esac
11500
11501 case "$guess1" in
11502 'struct dirent') guess2='struct direct' ;;
11503 *) guess2='struct dirent' ;;
11504 esac
11505
11506 if $contains "$guess1" try.c >/dev/null 2>&1; then
11507         direntrytype="$guess1"
11508         echo "Your directory entries are $direntrytype." >&4
11509 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11510         direntrytype="$guess2"
11511         echo "Your directory entries seem to be $direntrytype." >&4
11512 else
11513         echo "I don't recognize your system's directory entries." >&4
11514         rp="What type is used for directory entries on this system?"
11515         dflt="$guess1"
11516         . ./myread
11517         direntrytype="$ans"
11518 fi
11519 $rm_try
11520
11521 : see if the directory entry stores field length
11522 echo " "
11523 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11524 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11525         echo "Good, your directory entry keeps length information in d_namlen." >&4
11526         val="$define"
11527 else
11528         echo "Your directory entry does not know about the d_namlen field." >&4
11529         val="$undef"
11530 fi
11531 set d_dirnamlen
11532 eval $setvar
11533 $rm_try
11534
11535 : Look for DIR.dd_fd
11536 case "$i_dirent" in
11537 "$define")
11538     echo "Checking to see if DIR has a dd_fd member variable" >&4
11539     $cat >try.c <<EOCP
11540 #$i_stdlib I_STDLIB
11541 #ifdef I_STDLIB
11542 #include <stdlib.h>
11543 #endif
11544 #include <dirent.h>
11545
11546 int main() {
11547     DIR dir;
11548     dir.dd_fd = 1;
11549     return 0;
11550 }
11551 EOCP
11552     val=$undef
11553     set try
11554     if eval $compile; then
11555         echo "Yes, it does."
11556         val="$define"
11557     else
11558         echo "No, it does not."
11559         val="$undef"
11560     fi
11561     ;;
11562 *)
11563     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11564     val="$undef"
11565     ;;
11566 esac
11567 set d_dir_dd_fd
11568 eval $setvar
11569 $rm_try
11570
11571 : see if this is an sysdir system
11572 set sys/dir.h i_sysdir
11573 eval $inhdr
11574
11575 : see if this is an sysndir system
11576 set sys/ndir.h i_sysndir
11577 eval $inhdr
11578
11579 : Look for dirfd
11580 echo " "
11581 $cat >dirfd.c <<EOM
11582 #include <stdio.h>
11583 #$i_stdlib I_STDLIB
11584 #ifdef I_STDLIB
11585 #include <stdlib.h>
11586 #endif
11587 #$i_dirent I_DIRENT             /**/
11588 #$i_sysdir I_SYS_DIR            /**/
11589 #$i_sysndir I_SYS_NDIR          /**/
11590 #$i_systypes I_SYS_TYPES        /**/
11591 #if defined(I_SYS_TYPES)
11592 #include <sys/types.h>
11593 #endif
11594 #if defined(I_DIRENT)
11595 #include <dirent.h>
11596 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11597 #include <sys/dir.h>
11598 #endif
11599 #else
11600 #ifdef I_SYS_NDIR
11601 #include <sys/ndir.h>
11602 #else
11603 #ifdef I_SYS_DIR
11604 #ifdef hp9000s500
11605 #include <ndir.h>       /* may be wrong in the future */
11606 #else
11607 #include <sys/dir.h>
11608 #endif
11609 #endif
11610 #endif
11611 #endif 
11612 int main() {
11613         DIR *dirp = opendir(".");
11614         if (dirfd(dirp) >= 0)
11615                 exit(0);
11616         else
11617                 exit(1);
11618 }
11619 EOM
11620 val=$undef
11621 set dirfd
11622 if eval $compile; then
11623         val="$define"
11624 fi
11625 case "$val" in
11626 $define)        echo "dirfd() found." >&4       ;;
11627 *)              echo "dirfd() NOT found." >&4   ;;
11628 esac
11629 set d_dirfd
11630 eval $setvar
11631 $rm -f dirfd*
11632
11633 : see if dlerror exists
11634 xxx_runnm="$runnm"
11635 runnm=false
11636 set dlerror d_dlerror
11637 eval $inlibc
11638 runnm="$xxx_runnm"
11639
11640 : see if dlfcn is available
11641 set dlfcn.h i_dlfcn
11642 eval $inhdr
11643
11644 : Check what extension to use for shared libs
11645 case "$usedl" in
11646 $define|y|true)
11647         $cat << EOM
11648
11649 On a few systems, the dynamically loaded modules that perl generates and uses
11650 will need a different extension than shared libs. The default will probably
11651 be appropriate.
11652
11653 EOM
11654         case "$dlext" in
11655         '')     dflt="$so" ;;
11656         *)      dflt="$dlext" ;;
11657         esac
11658         rp='What is the extension of dynamically loaded modules'
11659         . ./myread
11660         dlext="$ans"
11661         ;;
11662 *)
11663         dlext="none"
11664         ;;
11665 esac
11666
11667 : Check if dlsym need a leading underscore
11668 echo " "
11669 val="$undef"
11670
11671 case "$dlsrc" in
11672 dl_dlopen.xs)
11673         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11674         $cat >dyna.c <<'EOM'
11675 fred () { }
11676 EOM
11677
11678 $cat >fred.c<<EOM
11679
11680 #include <stdio.h>
11681 #$i_stdlib I_STDLIB
11682 #ifdef I_STDLIB
11683 #include <stdlib.h>
11684 #endif
11685 #$i_dlfcn I_DLFCN
11686 #ifdef I_DLFCN
11687 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11688 #else
11689 #include <sys/types.h>
11690 #include <nlist.h>
11691 #include <link.h>
11692 #endif
11693
11694 extern int fred() ;
11695
11696 int main()
11697 {
11698     void * handle ;
11699     void * symbol ;
11700 #ifndef RTLD_LAZY
11701     int mode = 1 ;
11702 #else
11703     int mode = RTLD_LAZY ;
11704 #endif
11705     handle = dlopen("./dyna.$dlext", mode) ;
11706     if (handle == NULL) {
11707         printf ("1\n") ;
11708         fflush (stdout) ;
11709         exit(0);
11710     }
11711     symbol = dlsym(handle, "fred") ;
11712     if (symbol == NULL) {
11713         /* try putting a leading underscore */
11714         symbol = dlsym(handle, "_fred") ;
11715         if (symbol == NULL) {
11716             printf ("2\n") ;
11717             fflush (stdout) ;
11718             exit(0);
11719         }
11720         printf ("3\n") ;
11721     }
11722     else
11723         printf ("4\n") ;
11724     fflush (stdout) ;
11725     exit(0);
11726 }
11727 EOM
11728         : Call the object file tmp-dyna.o in case dlext=o.
11729         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11730                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11731                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11732                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11733                 xxx=`$run ./fred`
11734                 case $xxx in
11735                 1)      echo "Test program failed using dlopen." >&4
11736                         echo "Perhaps you should not use dynamic loading." >&4;;
11737                 2)      echo "Test program failed using dlsym." >&4
11738                         echo "Perhaps you should not use dynamic loading." >&4;;
11739                 3)      echo "dlsym needs a leading underscore" >&4
11740                         val="$define" ;;
11741                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11742                 esac
11743         else
11744                 echo "I can't compile and run the test program." >&4
11745                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11746         fi
11747         ;;
11748 esac
11749
11750 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11751
11752 set d_dlsymun
11753 eval $setvar
11754
11755 : see if drand48_r exists
11756 set drand48_r d_drand48_r
11757 eval $inlibc
11758 case "$d_drand48_r" in
11759 "$define")
11760         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11761         case "$d_drand48_r_proto:$usethreads" in
11762         ":define")      d_drand48_r_proto=define
11763                 set d_drand48_r_proto drand48_r $hdrs
11764                 eval $hasproto ;;
11765         *)      ;;
11766         esac
11767         case "$d_drand48_r_proto" in
11768         define)
11769         case "$drand48_r_proto" in
11770         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11771         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11772         esac
11773         case "$drand48_r_proto" in
11774         ''|0)   d_drand48_r=undef
11775                 drand48_r_proto=0
11776                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11777         * )     case "$drand48_r_proto" in
11778                 REENTRANT_PROTO*) ;;
11779                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11780                 esac
11781                 echo "Prototype: $try" ;;
11782         esac
11783         ;;
11784         *)      case "$usethreads" in
11785                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11786                 esac
11787                 d_drand48_r=undef
11788                 drand48_r_proto=0
11789                 ;;
11790         esac
11791         ;;
11792 *)      drand48_r_proto=0
11793         ;;
11794 esac
11795
11796 : see if prototype for drand48 is available
11797 echo " "
11798 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11799 eval $hasproto
11800
11801 : see if dup2 exists
11802 set dup2 d_dup2
11803 eval $inlibc
11804
11805 : see if eaccess exists
11806 set eaccess d_eaccess
11807 eval $inlibc
11808
11809 : see if endgrent exists
11810 set endgrent d_endgrent
11811 eval $inlibc
11812
11813 : see if this is an grp system
11814 set grp.h i_grp
11815 eval $inhdr
11816
11817 case "$i_grp" in
11818 $define)
11819         xxx=`./findhdr grp.h`
11820         $cppstdin $cppflags $cppminus < $xxx >$$.h
11821
11822         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11823                 val="$define"
11824         else
11825                 val="$undef"
11826         fi
11827         set d_grpasswd
11828         eval $setvar
11829
11830         $rm -f $$.h
11831         ;;
11832 *)
11833         val="$undef";
11834         set d_grpasswd; eval $setvar
11835         ;;
11836 esac
11837
11838 : see if endgrent_r exists
11839 set endgrent_r d_endgrent_r
11840 eval $inlibc
11841 case "$d_endgrent_r" in
11842 "$define")
11843         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11844         case "$d_endgrent_r_proto:$usethreads" in
11845         ":define")      d_endgrent_r_proto=define
11846                 set d_endgrent_r_proto endgrent_r $hdrs
11847                 eval $hasproto ;;
11848         *)      ;;
11849         esac
11850         case "$d_endgrent_r_proto" in
11851         define)
11852         case "$endgrent_r_proto" in
11853         ''|0) try='int endgrent_r(FILE**);'
11854         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11855         esac
11856         case "$endgrent_r_proto" in
11857         ''|0) try='void endgrent_r(FILE**);'
11858         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11859         esac
11860         case "$endgrent_r_proto" in
11861         ''|0)   d_endgrent_r=undef
11862                 endgrent_r_proto=0
11863                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11864         * )     case "$endgrent_r_proto" in
11865                 REENTRANT_PROTO*) ;;
11866                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11867                 esac
11868                 echo "Prototype: $try" ;;
11869         esac
11870         ;;
11871         *)      case "$usethreads" in
11872                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11873                 esac
11874                 d_endgrent_r=undef
11875                 endgrent_r_proto=0
11876                 ;;
11877         esac
11878         ;;
11879 *)      endgrent_r_proto=0
11880         ;;
11881 esac
11882
11883 : see if endhostent exists
11884 set endhostent d_endhent
11885 eval $inlibc
11886
11887 : see if this is a netdb.h system
11888 set netdb.h i_netdb
11889 eval $inhdr
11890
11891 : see if endhostent_r exists
11892 set endhostent_r d_endhostent_r
11893 eval $inlibc
11894 case "$d_endhostent_r" in
11895 "$define")
11896         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11897         case "$d_endhostent_r_proto:$usethreads" in
11898         ":define")      d_endhostent_r_proto=define
11899                 set d_endhostent_r_proto endhostent_r $hdrs
11900                 eval $hasproto ;;
11901         *)      ;;
11902         esac
11903         case "$d_endhostent_r_proto" in
11904         define)
11905         case "$endhostent_r_proto" in
11906         ''|0) try='int endhostent_r(struct hostent_data*);'
11907         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11908         esac
11909         case "$endhostent_r_proto" in
11910         ''|0) try='void endhostent_r(struct hostent_data*);'
11911         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11912         esac
11913         case "$endhostent_r_proto" in
11914         ''|0)   d_endhostent_r=undef
11915                 endhostent_r_proto=0
11916                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11917         * )     case "$endhostent_r_proto" in
11918                 REENTRANT_PROTO*) ;;
11919                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11920                 esac
11921                 echo "Prototype: $try" ;;
11922         esac
11923         ;;
11924         *)      case "$usethreads" in
11925                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11926                 esac
11927                 d_endhostent_r=undef
11928                 endhostent_r_proto=0
11929                 ;;
11930         esac
11931         ;;
11932 *)      endhostent_r_proto=0
11933         ;;
11934 esac
11935
11936 : see if endnetent exists
11937 set endnetent d_endnent
11938 eval $inlibc
11939
11940 : see if endnetent_r exists
11941 set endnetent_r d_endnetent_r
11942 eval $inlibc
11943 case "$d_endnetent_r" in
11944 "$define")
11945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11946         case "$d_endnetent_r_proto:$usethreads" in
11947         ":define")      d_endnetent_r_proto=define
11948                 set d_endnetent_r_proto endnetent_r $hdrs
11949                 eval $hasproto ;;
11950         *)      ;;
11951         esac
11952         case "$d_endnetent_r_proto" in
11953         define)
11954         case "$endnetent_r_proto" in
11955         ''|0) try='int endnetent_r(struct netent_data*);'
11956         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11957         esac
11958         case "$endnetent_r_proto" in
11959         ''|0) try='void endnetent_r(struct netent_data*);'
11960         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11961         esac
11962         case "$endnetent_r_proto" in
11963         ''|0)   d_endnetent_r=undef
11964                 endnetent_r_proto=0
11965                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11966         * )     case "$endnetent_r_proto" in
11967                 REENTRANT_PROTO*) ;;
11968                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11969                 esac
11970                 echo "Prototype: $try" ;;
11971         esac
11972         ;;
11973         *)      case "$usethreads" in
11974                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11975                 esac
11976                 d_endnetent_r=undef
11977                 endnetent_r_proto=0
11978                 ;;
11979         esac
11980         ;;
11981 *)      endnetent_r_proto=0
11982         ;;
11983 esac
11984
11985 : see if endprotoent exists
11986 set endprotoent d_endpent
11987 eval $inlibc
11988
11989 : see if endprotoent_r exists
11990 set endprotoent_r d_endprotoent_r
11991 eval $inlibc
11992 case "$d_endprotoent_r" in
11993 "$define")
11994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11995         case "$d_endprotoent_r_proto:$usethreads" in
11996         ":define")      d_endprotoent_r_proto=define
11997                 set d_endprotoent_r_proto endprotoent_r $hdrs
11998                 eval $hasproto ;;
11999         *)      ;;
12000         esac
12001         case "$d_endprotoent_r_proto" in
12002         define)
12003         case "$endprotoent_r_proto" in
12004         ''|0) try='int endprotoent_r(struct protoent_data*);'
12005         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12006         esac
12007         case "$endprotoent_r_proto" in
12008         ''|0) try='void endprotoent_r(struct protoent_data*);'
12009         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12010         esac
12011         case "$endprotoent_r_proto" in
12012         ''|0)   d_endprotoent_r=undef
12013                 endprotoent_r_proto=0
12014                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12015         * )     case "$endprotoent_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_endprotoent_r=undef
12026                 endprotoent_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      endprotoent_r_proto=0
12031         ;;
12032 esac
12033
12034 : see if endpwent exists
12035 set endpwent d_endpwent
12036 eval $inlibc
12037
12038 : see if this is a pwd.h system
12039 set pwd.h i_pwd
12040 eval $inhdr
12041
12042 case "$i_pwd" in
12043 $define)
12044         xxx=`./findhdr pwd.h`
12045         $cppstdin $cppflags $cppminus < $xxx >$$.h
12046
12047         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12048                 val="$define"
12049         else
12050                 val="$undef"
12051         fi
12052         set d_pwquota
12053         eval $setvar
12054
12055         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12056                 val="$define"
12057         else
12058                 val="$undef"
12059         fi
12060         set d_pwage
12061         eval $setvar
12062
12063         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12064                 val="$define"
12065         else
12066                 val="$undef"
12067         fi
12068         set d_pwchange
12069         eval $setvar
12070
12071         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12072                 val="$define"
12073         else
12074                 val="$undef"
12075         fi
12076         set d_pwclass
12077         eval $setvar
12078
12079         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12080                 val="$define"
12081         else
12082                 val="$undef"
12083         fi
12084         set d_pwexpire
12085         eval $setvar
12086
12087         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12088                 val="$define"
12089         else
12090                 val="$undef"
12091         fi
12092         set d_pwcomment
12093         eval $setvar
12094
12095         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12096                 val="$define"
12097         else
12098                 val="$undef"
12099         fi
12100         set d_pwgecos
12101         eval $setvar
12102
12103         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12104                 val="$define"
12105         else
12106                 val="$undef"
12107         fi
12108         set d_pwpasswd
12109         eval $setvar
12110
12111         $rm -f $$.h
12112         ;;
12113 *)
12114         val="$undef"; 
12115         set d_pwquota; eval $setvar
12116         set d_pwage; eval $setvar
12117         set d_pwchange; eval $setvar
12118         set d_pwclass; eval $setvar
12119         set d_pwexpire; eval $setvar
12120         set d_pwcomment; eval $setvar
12121         set d_pwgecos; eval $setvar
12122         set d_pwpasswd; eval $setvar
12123         ;;
12124 esac
12125
12126 : see if endpwent_r exists
12127 set endpwent_r d_endpwent_r
12128 eval $inlibc
12129 case "$d_endpwent_r" in
12130 "$define")
12131         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12132         case "$d_endpwent_r_proto:$usethreads" in
12133         ":define")      d_endpwent_r_proto=define
12134                 set d_endpwent_r_proto endpwent_r $hdrs
12135                 eval $hasproto ;;
12136         *)      ;;
12137         esac
12138         case "$d_endpwent_r_proto" in
12139         define)
12140         case "$endpwent_r_proto" in
12141         ''|0) try='int endpwent_r(FILE**);'
12142         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12143         esac
12144         case "$endpwent_r_proto" in
12145         ''|0) try='void endpwent_r(FILE**);'
12146         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12147         esac
12148         case "$endpwent_r_proto" in
12149         ''|0)   d_endpwent_r=undef
12150                 endpwent_r_proto=0
12151                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12152         * )     case "$endpwent_r_proto" in
12153                 REENTRANT_PROTO*) ;;
12154                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12155                 esac
12156                 echo "Prototype: $try" ;;
12157         esac
12158         ;;
12159         *)      case "$usethreads" in
12160                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12161                 esac
12162                 d_endpwent_r=undef
12163                 endpwent_r_proto=0
12164                 ;;
12165         esac
12166         ;;
12167 *)      endpwent_r_proto=0
12168         ;;
12169 esac
12170
12171 : see if endservent exists
12172 set endservent d_endsent
12173 eval $inlibc
12174
12175 : see if endservent_r exists
12176 set endservent_r d_endservent_r
12177 eval $inlibc
12178 case "$d_endservent_r" in
12179 "$define")
12180         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12181         case "$d_endservent_r_proto:$usethreads" in
12182         ":define")      d_endservent_r_proto=define
12183                 set d_endservent_r_proto endservent_r $hdrs
12184                 eval $hasproto ;;
12185         *)      ;;
12186         esac
12187         case "$d_endservent_r_proto" in
12188         define)
12189         case "$endservent_r_proto" in
12190         ''|0) try='int endservent_r(struct servent_data*);'
12191         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12192         esac
12193         case "$endservent_r_proto" in
12194         ''|0) try='void endservent_r(struct servent_data*);'
12195         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12196         esac
12197         case "$endservent_r_proto" in
12198         ''|0)   d_endservent_r=undef
12199                 endservent_r_proto=0
12200                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12201         * )     case "$endservent_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_endservent_r=undef
12212                 endservent_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      endservent_r_proto=0
12217         ;;
12218 esac
12219
12220 : Locate the flags for 'open()'
12221 echo " "
12222 $cat >try.c <<EOCP
12223 #include <sys/types.h>
12224 #ifdef I_FCNTL
12225 #include <fcntl.h>
12226 #endif
12227 #ifdef I_SYS_FILE
12228 #include <sys/file.h>
12229 #endif
12230 #$i_stdlib I_STDLIB
12231 #ifdef I_STDLIB
12232 #include <stdlib.h>
12233 #endif
12234 int main() {
12235         if(O_RDONLY);
12236 #ifdef O_TRUNC
12237         exit(0);
12238 #else
12239         exit(1);
12240 #endif
12241 }
12242 EOCP
12243 : check sys/file.h first to get FREAD on Sun
12244 if $test `./findhdr sys/file.h` && \
12245                 set try -DI_SYS_FILE && eval $compile; then
12246         h_sysfile=true;
12247         echo "<sys/file.h> defines the O_* constants..." >&4
12248         if $run ./try; then
12249                 echo "and you have the 3 argument form of open()." >&4
12250                 val="$define"
12251         else
12252                 echo "but not the 3 argument form of open().  Oh, well." >&4
12253                 val="$undef"
12254         fi
12255 elif $test `./findhdr fcntl.h` && \
12256                 set try -DI_FCNTL && eval $compile; then
12257         h_fcntl=true;
12258         echo "<fcntl.h> defines the O_* constants..." >&4
12259         if $run ./try; then
12260                 echo "and you have the 3 argument form of open()." >&4
12261                 val="$define"
12262         else
12263                 echo "but not the 3 argument form of open().  Oh, well." >&4
12264                 val="$undef"
12265         fi
12266 else
12267         val="$undef"
12268         echo "I can't find the O_* constant definitions!  You got problems." >&4
12269 fi
12270 set d_open3
12271 eval $setvar
12272 $rm_try
12273
12274 : see which of string.h or strings.h is needed
12275 echo " "
12276 strings=`./findhdr string.h`
12277 if $test "$strings" && $test -r "$strings"; then
12278         echo "Using <string.h> instead of <strings.h>." >&4
12279         val="$define"
12280 else
12281         val="$undef"
12282         strings=`./findhdr strings.h`
12283         if $test "$strings" && $test -r "$strings"; then
12284                 echo "Using <strings.h> instead of <string.h>." >&4
12285         else
12286                 echo "No string header found -- You'll surely have problems." >&4
12287         fi
12288 fi
12289 set i_string
12290 eval $setvar
12291 case "$i_string" in
12292 "$undef") strings=`./findhdr strings.h`;;
12293 *)        strings=`./findhdr string.h`;;
12294 esac
12295
12296 : see if this is a sys/file.h system
12297 val=''
12298 set sys/file.h val
12299 eval $inhdr
12300
12301 : do we need to include sys/file.h ?
12302 case "$val" in
12303 "$define")
12304         echo " "
12305         if $h_sysfile; then
12306                 val="$define"
12307                 echo "We'll be including <sys/file.h>." >&4
12308         else
12309                 val="$undef"
12310                 echo "We won't be including <sys/file.h>." >&4
12311         fi
12312         ;;
12313 *)
12314         h_sysfile=false
12315         ;;
12316 esac
12317 set i_sysfile
12318 eval $setvar
12319
12320 : see if fcntl.h is there
12321 val=''
12322 set fcntl.h val
12323 eval $inhdr
12324
12325 : see if we can include fcntl.h
12326 case "$val" in
12327 "$define")
12328         echo " "
12329         if $h_fcntl; then
12330                 val="$define"
12331                 echo "We'll be including <fcntl.h>." >&4
12332         else
12333                 val="$undef"
12334                 if $h_sysfile; then
12335         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12336                 else
12337                         echo "We won't be including <fcntl.h>." >&4
12338                 fi
12339         fi
12340         ;;
12341 *)
12342         h_fcntl=false
12343         val="$undef"
12344         ;;
12345 esac
12346 set i_fcntl
12347 eval $setvar
12348
12349 : see if fork exists
12350 set fork d_fork
12351 eval $inlibc
12352
12353 : see if pipe exists
12354 set pipe d_pipe
12355 eval $inlibc
12356
12357 : check for non-blocking I/O stuff
12358 case "$h_sysfile" in
12359 true) echo "#include <sys/file.h>" > head.c;;
12360 *)
12361        case "$h_fcntl" in
12362        true) echo "#include <fcntl.h>" > head.c;;
12363        *) echo "#include <sys/fcntl.h>" > head.c;;
12364        esac
12365        ;;
12366 esac
12367 echo " "
12368 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12369 case "$o_nonblock" in
12370 '')
12371         $cat head.c > try.c
12372         $cat >>try.c <<EOCP
12373 #include <stdio.h>
12374 #$i_stdlib I_STDLIB
12375 #ifdef I_STDLIB
12376 #include <stdlib.h>
12377 #endif
12378 #$i_fcntl I_FCNTL
12379 #ifdef I_FCNTL
12380 #include <fcntl.h>
12381 #endif
12382 int main() {
12383 #ifdef O_NONBLOCK
12384         printf("O_NONBLOCK\n");
12385         exit(0);
12386 #endif
12387 #ifdef O_NDELAY
12388         printf("O_NDELAY\n");
12389         exit(0);
12390 #endif
12391 #ifdef FNDELAY
12392         printf("FNDELAY\n");
12393         exit(0);
12394 #endif
12395         exit(0);
12396 }
12397 EOCP
12398         set try
12399         if eval $compile_ok; then
12400                 o_nonblock=`$run ./try`
12401                 case "$o_nonblock" in
12402                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12403                 *) echo "Seems like we can use $o_nonblock.";;
12404                 esac
12405         else
12406                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12407         fi
12408         ;;
12409 *) echo "Using $hint value $o_nonblock.";;
12410 esac
12411 $rm_try
12412
12413 echo " "
12414 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12415 case "$eagain" in
12416 '')
12417         case "$d_fork:$d_pipe" in
12418         define:define)
12419         $cat head.c > try.c
12420         $cat >>try.c <<EOCP
12421 #include <errno.h>
12422 #include <sys/types.h>
12423 #include <signal.h>
12424 #include <stdio.h>
12425 #$i_stdlib I_STDLIB
12426 #ifdef I_STDLIB
12427 #include <stdlib.h>
12428 #endif
12429 #$i_fcntl I_FCNTL
12430 #ifdef I_FCNTL
12431 #include <fcntl.h>
12432 #endif
12433 #define MY_O_NONBLOCK $o_nonblock
12434 #ifndef errno  /* XXX need better Configure test */
12435 extern int errno;
12436 #endif
12437 #$i_unistd I_UNISTD
12438 #ifdef I_UNISTD
12439 #include <unistd.h>
12440 #endif
12441 #$i_string I_STRING
12442 #ifdef I_STRING
12443 #include <string.h>
12444 #else
12445 #include <strings.h>
12446 #endif
12447 $signal_t blech(int x) { exit(3); }
12448 EOCP
12449         $cat >> try.c <<'EOCP'
12450 int main()
12451 {
12452         int pd[2];
12453         int pu[2];
12454         char buf[1];
12455         char string[100];
12456
12457         pipe(pd);       /* Down: child -> parent */
12458         pipe(pu);       /* Up: parent -> child */
12459         if (0 != fork()) {
12460                 int ret;
12461                 close(pd[1]);   /* Parent reads from pd[0] */
12462                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12463 #ifdef F_SETFL
12464                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12465                         exit(1);
12466 #else
12467                 exit(4);
12468 #endif
12469                 signal(SIGALRM, blech);
12470                 alarm(5);
12471                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12472                         exit(2);
12473                 sprintf(string, "%d\n", ret);
12474                 write(2, string, strlen(string));
12475                 alarm(0);
12476 #ifdef EAGAIN
12477                 if (errno == EAGAIN) {
12478                         printf("EAGAIN\n");
12479                         goto ok;
12480                 }
12481 #endif
12482 #ifdef EWOULDBLOCK
12483                 if (errno == EWOULDBLOCK)
12484                         printf("EWOULDBLOCK\n");
12485 #endif
12486         ok:
12487                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12488                 sleep(2);                               /* Give it time to close our pipe */
12489                 alarm(5);
12490                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12491                 alarm(0);
12492                 sprintf(string, "%d\n", ret);
12493                 write(4, string, strlen(string));
12494                 exit(0);
12495         }
12496
12497         close(pd[0]);                   /* We write to pd[1] */
12498         close(pu[1]);                   /* We read from pu[0] */
12499         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12500         close(pd[1]);                   /* Pipe pd is now fully closed! */
12501         exit(0);                                /* Bye bye, thank you for playing! */
12502 }
12503 EOCP
12504         set try
12505         if eval $compile_ok; then
12506                 echo "$startsh" >mtry
12507                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12508                 chmod +x mtry
12509                 ./mtry >/dev/null 2>&1
12510                 case $? in
12511                 0) eagain=`$cat try.out`;;
12512                 1) echo "Could not perform non-blocking setting!";;
12513                 2) echo "I did a successful read() for something that was not there!";;
12514                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12515                 4) echo "Could not find F_SETFL!";;
12516                 *) echo "Something terribly wrong happened during testing.";;
12517                 esac
12518                 rd_nodata=`$cat try.ret`
12519                 echo "A read() system call with no data present returns $rd_nodata."
12520                 case "$rd_nodata" in
12521                 0|-1) ;;
12522                 *)
12523                         echo "(That's peculiar, fixing that to be -1.)"
12524                         rd_nodata=-1
12525                         ;;
12526                 esac
12527                 case "$eagain" in
12528                 '')
12529                         echo "Forcing errno EAGAIN on read() with no data available."
12530                         eagain=EAGAIN
12531                         ;;
12532                 *)
12533                         echo "Your read() sets errno to $eagain when no data is available."
12534                         ;;
12535                 esac
12536                 status=`$cat try.err`
12537                 case "$status" in
12538                 0) echo "And it correctly returns 0 to signal EOF.";;
12539                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12540                 *) echo "However, your read() returns '$status' on EOF??";;
12541                 esac
12542                 val="$define"
12543                 if test "$status" = "$rd_nodata"; then
12544                         echo "WARNING: you can't distinguish between EOF and no data!"
12545                         val="$undef"
12546                 fi
12547         else
12548                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12549                 eagain=EAGAIN
12550         fi
12551         ;;
12552         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12553                 eagain=EAGAIN
12554                 val="$define"
12555                 ;;
12556         esac
12557         set d_eofnblk
12558         eval $setvar
12559         ;;
12560 *)
12561         echo "Using $hint value $eagain."
12562         echo "Your read() returns $rd_nodata when no data is present."
12563         case "$d_eofnblk" in
12564         "$define") echo "And you can see EOF because read() returns 0.";;
12565         "$undef") echo "But you can't see EOF status from read() returned value.";;
12566         *)
12567                 echo "(Assuming you can't see EOF status from read anyway.)"
12568                 d_eofnblk=$undef
12569                 ;;
12570         esac
12571         ;;
12572 esac
12573 $rm_try head.c mtry
12574
12575 : see if _ptr and _cnt from stdio act std
12576 echo " "
12577
12578 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12579         echo "(Looks like you have stdio.h from BSD.)"
12580         case "$stdio_ptr" in
12581         '') stdio_ptr='((fp)->_p)'
12582                 ptr_lval=$define
12583                 ;;
12584         *)      ptr_lval=$d_stdio_ptr_lval;;
12585         esac
12586         case "$stdio_cnt" in
12587         '') stdio_cnt='((fp)->_r)'
12588                 cnt_lval=$define
12589                 ;;
12590         *)      cnt_lval=$d_stdio_cnt_lval;;
12591         esac
12592         case "$stdio_base" in
12593         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12594         esac
12595         case "$stdio_bufsiz" in
12596         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12597         esac
12598 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12599         echo "(Looks like you have stdio.h from Linux.)"
12600         case "$stdio_ptr" in
12601         '') stdio_ptr='((fp)->_IO_read_ptr)'
12602                 ptr_lval=$define
12603                 ;;
12604         *)      ptr_lval=$d_stdio_ptr_lval;;
12605         esac
12606         case "$stdio_cnt" in
12607         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12608                 cnt_lval=$undef
12609                 ;;
12610         *)      cnt_lval=$d_stdio_cnt_lval;;
12611         esac
12612         case "$stdio_base" in
12613         '') stdio_base='((fp)->_IO_read_base)';;
12614         esac
12615         case "$stdio_bufsiz" in
12616         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12617         esac
12618 else
12619         case "$stdio_ptr" in
12620         '') stdio_ptr='((fp)->_ptr)'
12621                 ptr_lval=$define
12622                 ;;
12623         *)      ptr_lval=$d_stdio_ptr_lval;;
12624         esac
12625         case "$stdio_cnt" in
12626         '') stdio_cnt='((fp)->_cnt)'
12627                 cnt_lval=$define
12628                 ;;
12629         *)      cnt_lval=$d_stdio_cnt_lval;;
12630         esac
12631         case "$stdio_base" in
12632         '') stdio_base='((fp)->_base)';;
12633         esac
12634         case "$stdio_bufsiz" in
12635         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12636         esac
12637 fi
12638
12639 : test whether _ptr and _cnt really work
12640 echo "Checking how std your stdio is..." >&4
12641 $cat >try.c <<EOP
12642 #include <stdio.h>
12643 #$i_stdlib I_STDLIB
12644 #ifdef I_STDLIB
12645 #include <stdlib.h>
12646 #endif
12647 #define FILE_ptr(fp)    $stdio_ptr
12648 #define FILE_cnt(fp)    $stdio_cnt
12649 int main() {
12650         FILE *fp = fopen("try.c", "r");
12651         char c = getc(fp);
12652         if (
12653                 18 <= FILE_cnt(fp) &&
12654                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12655         )
12656                 exit(0);
12657         exit(1);
12658 }
12659 EOP
12660 val="$undef"
12661 set try
12662 if eval $compile && $to try.c; then
12663         if $run ./try; then
12664                 echo "Your stdio acts pretty std."
12665                 val="$define"
12666         else
12667                 echo "Your stdio isn't very std."
12668         fi
12669 else
12670         echo "Your stdio doesn't appear very std."
12671 fi
12672 $rm_try
12673
12674 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12675 # direct buffer manipulation no longer works.  The Configure tests
12676 # should be changed to correctly detect this, but until then,
12677 # the following check should at least let perl compile and run.
12678 # (This quick fix should be updated before 5.8.1.)
12679 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12680 # A. Dougherty, June 3, 2002.
12681 case "$d_gnulibc" in
12682 $define)
12683         case "$gnulibc_version" in
12684         2.[01]*)  ;;
12685         2.2) ;;
12686         2.2.[0-9]) ;;
12687         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12688                 val="$undef"
12689                 ;;
12690         esac
12691         ;;
12692 esac
12693 set d_stdstdio
12694 eval $setvar
12695
12696 : Can _ptr be used as an lvalue?
12697 case "$d_stdstdio$ptr_lval" in
12698 $define$define) val=$define ;;
12699 *) val=$undef ;;
12700 esac
12701 set d_stdio_ptr_lval
12702 eval $setvar
12703
12704 : Can _cnt be used as an lvalue?
12705 case "$d_stdstdio$cnt_lval" in
12706 $define$define) val=$define ;;
12707 *) val=$undef ;;
12708 esac
12709 set d_stdio_cnt_lval
12710 eval $setvar
12711
12712
12713 : test whether setting _ptr sets _cnt as a side effect
12714 d_stdio_ptr_lval_sets_cnt="$undef"
12715 d_stdio_ptr_lval_nochange_cnt="$undef"
12716 case "$d_stdio_ptr_lval$d_stdstdio" in
12717 $define$define)
12718         echo "Checking to see what happens if we set the stdio ptr..." >&4
12719 $cat >try.c <<EOP
12720 #include <stdio.h>
12721 /* Can we scream? */
12722 /* Eat dust sed :-) */
12723 /* In the buffer space, no one can hear you scream. */
12724 #$i_stdlib I_STDLIB
12725 #ifdef I_STDLIB
12726 #include <stdlib.h>
12727 #endif
12728 #define FILE_ptr(fp)    $stdio_ptr
12729 #define FILE_cnt(fp)    $stdio_cnt
12730 #include <sys/types.h>
12731 int main() {
12732         FILE *fp = fopen("try.c", "r");
12733         int c;
12734         char *ptr;
12735         size_t cnt;
12736         if (!fp) {
12737             puts("Fail even to read");
12738             exit(1);
12739         }
12740         c = getc(fp); /* Read away the first # */
12741         if (c == EOF) {
12742             puts("Fail even to read");
12743             exit(1);
12744         }
12745         if (!(
12746                 18 <= FILE_cnt(fp) &&
12747                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12748         )) {
12749                 puts("Fail even to read");
12750                 exit (1);
12751         }
12752         ptr = (char*) FILE_ptr(fp);
12753         cnt = (size_t)FILE_cnt(fp);
12754
12755         FILE_ptr(fp) += 42;
12756
12757         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12758                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12759                 exit (1);
12760         }
12761         if (FILE_cnt(fp) <= 20) {
12762                 printf ("Fail (<20 chars to test)");
12763                 exit (1);
12764         }
12765         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12766                 puts("Fail compare");
12767                 exit (1);
12768         }
12769         if (cnt == FILE_cnt(fp)) {
12770                 puts("Pass_unchanged");
12771                 exit (0);
12772         }
12773         if (FILE_cnt(fp) == (cnt - 42)) {
12774                 puts("Pass_changed");
12775                 exit (0);
12776         }
12777         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12778         return 1;
12779
12780 }
12781 EOP
12782         set try
12783         if eval $compile && $to try.c; then
12784                 case `$run ./try` in
12785                 Pass_changed)
12786                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12787                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12788                 Pass_unchanged)
12789                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12790                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12791                 Fail*)
12792                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12793                 *)
12794                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12795         esac
12796         else
12797                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12798         fi
12799         $rm_try
12800         ;;
12801 esac
12802
12803 : see if _base is also standard
12804 val="$undef"
12805 case "$d_stdstdio" in
12806 $define)
12807         $cat >try.c <<EOP
12808 #include <stdio.h>
12809 #$i_stdlib I_STDLIB
12810 #ifdef I_STDLIB
12811 #include <stdlib.h>
12812 #endif
12813 #define FILE_base(fp)   $stdio_base
12814 #define FILE_bufsiz(fp) $stdio_bufsiz
12815 int main() {
12816         FILE *fp = fopen("try.c", "r");
12817         char c = getc(fp);
12818         if (
12819                 19 <= FILE_bufsiz(fp) &&
12820                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12821         )
12822                 exit(0);
12823         exit(1);
12824 }
12825 EOP
12826         set try
12827         if eval $compile && $to try.c; then
12828                 if $run ./try; then
12829                         echo "And its _base field acts std."
12830                         val="$define"
12831                 else
12832                         echo "But its _base field isn't std."
12833                 fi
12834         else
12835                 echo "However, it seems to be lacking the _base field."
12836         fi
12837         $rm_try
12838         ;;
12839 esac
12840 set d_stdiobase
12841 eval $setvar
12842
12843 : see if fast_stdio exists
12844 val="$undef"
12845 case "$d_stdstdio:$d_stdio_ptr_lval" in
12846 "$define:$define")
12847         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12848         *$define*)
12849                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12850                 val="$define"
12851                 ;;
12852         esac
12853         ;;
12854 esac
12855 set d_faststdio
12856 eval $setvar
12857
12858
12859
12860 : see if fchdir exists
12861 set fchdir d_fchdir
12862 eval $inlibc
12863
12864 : see if fchmod exists
12865 set fchmod d_fchmod
12866 eval $inlibc
12867
12868 : see if fchown exists
12869 set fchown d_fchown
12870 eval $inlibc
12871
12872 : see if this is an fcntl system
12873 set fcntl d_fcntl
12874 eval $inlibc
12875
12876 : See if fcntl-based locking works.
12877 echo " "
12878 $cat >try.c <<EOCP
12879 #$i_stdlib I_STDLIB
12880 #ifdef I_STDLIB
12881 #include <stdlib.h>
12882 #endif
12883 #include <unistd.h>
12884 #include <fcntl.h>
12885 #include <signal.h>
12886 $signal_t blech(int x) { exit(3); }
12887 int main() {
12888 #if defined(F_SETLK) && defined(F_SETLKW)
12889      struct flock flock;
12890      int retval, fd;
12891      fd = open("try.c", O_RDONLY);
12892      flock.l_type = F_RDLCK;
12893      flock.l_whence = SEEK_SET;
12894      flock.l_start = flock.l_len = 0;
12895      signal(SIGALRM, blech);
12896      alarm(10);
12897      retval = fcntl(fd, F_SETLK, &flock);
12898      close(fd);
12899      (retval < 0 ? exit(2) : exit(0));
12900 #else
12901      exit(2);
12902 #endif
12903 }
12904 EOCP
12905 echo "Checking if fcntl-based file locking works... "
12906 case "$d_fcntl" in
12907 "$define")
12908         set try
12909         if eval $compile_ok; then
12910                 if $run ./try; then
12911                         echo "Yes, it seems to work."
12912                         val="$define"
12913                 else
12914                         echo "Nope, it didn't work."
12915                         val="$undef"
12916                         case "$?" in
12917                         3) $cat >&4 <<EOM
12918 ***
12919 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12920 *** This is (almost) impossible.
12921 *** If your NFS lock daemons are not feeling well, something like
12922 *** this may happen, please investigate.  Cannot continue, aborting.
12923 ***
12924 EOM
12925                                 exit 1
12926                                 ;;
12927                         esac
12928                 fi
12929         else
12930                 echo "I'm unable to compile the test program, so I'll assume not."
12931                 val="$undef"
12932         fi
12933         ;;
12934 *) val="$undef";
12935         echo "Nope, since you don't even have fcntl()."
12936         ;;
12937 esac
12938 set d_fcntl_can_lock
12939 eval $setvar
12940 $rm_try
12941
12942 : check for fd_set items
12943 $cat <<EOM
12944
12945 Checking to see how well your C compiler handles fd_set and friends ...
12946 EOM
12947 $cat >try.c <<EOCP
12948 #$i_stdlib I_STDLIB
12949 #ifdef I_STDLIB
12950 #include <stdlib.h>
12951 #endif
12952 #$i_systime I_SYS_TIME
12953 #$i_sysselct I_SYS_SELECT
12954 #$d_socket HAS_SOCKET
12955 #include <sys/types.h>
12956 #ifdef HAS_SOCKET
12957 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12958 #endif
12959 #ifdef I_SYS_TIME
12960 #include <sys/time.h>
12961 #endif
12962 #ifdef I_SYS_SELECT
12963 #include <sys/select.h>
12964 #endif
12965 int main() {
12966         fd_set fds;
12967
12968 #ifdef TRYBITS
12969         if(fds.fds_bits);
12970 #endif
12971
12972 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12973         exit(0);
12974 #else
12975         exit(1);
12976 #endif
12977 }
12978 EOCP
12979 set try -DTRYBITS
12980 if eval $compile; then
12981         d_fds_bits="$define"
12982         d_fd_set="$define"
12983         echo "Well, your system knows about the normal fd_set typedef..." >&4
12984         if $run ./try; then
12985                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12986                 d_fd_macros="$define"
12987         else
12988                 $cat >&4 <<'EOM'
12989 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12990 EOM
12991                 d_fd_macros="$undef"
12992         fi
12993 else
12994         $cat <<'EOM'
12995 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12996 EOM
12997         set try
12998         if eval $compile; then
12999                 d_fds_bits="$undef"
13000                 d_fd_set="$define"
13001                 echo "Well, your system has some sort of fd_set available..." >&4
13002                 if $run ./try; then
13003                         echo "and you have the normal fd_set macros." >&4
13004                         d_fd_macros="$define"
13005                 else
13006                         $cat <<'EOM'
13007 but not the normal fd_set macros!  Gross!  More work for me...
13008 EOM
13009                         d_fd_macros="$undef"
13010                 fi
13011         else
13012         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13013                 d_fd_set="$undef"
13014                 d_fds_bits="$undef"
13015                 d_fd_macros="$undef"
13016         fi
13017 fi
13018 $rm_try
13019
13020 : see if fgetpos exists
13021 set fgetpos d_fgetpos
13022 eval $inlibc
13023
13024 : see if finite exists
13025 set finite d_finite
13026 eval $inlibc
13027
13028 : see if finitel exists
13029 set finitel d_finitel
13030 eval $inlibc
13031
13032 : see if flock exists
13033 set flock d_flock
13034 eval $inlibc
13035
13036 : see if prototype for flock is available
13037 echo " "
13038 set d_flockproto flock $i_sysfile sys/file.h
13039 eval $hasproto
13040
13041 : see if fp_class exists
13042 set fp_class d_fp_class
13043 eval $inlibc
13044
13045 : see if pathconf exists
13046 set pathconf d_pathconf
13047 eval $inlibc
13048
13049 : see if fpathconf exists
13050 set fpathconf d_fpathconf
13051 eval $inlibc
13052
13053 : see if fpclass exists
13054 set fpclass d_fpclass
13055 eval $inlibc
13056
13057 : see if fpclassify exists
13058 set fpclassify d_fpclassify
13059 eval $inlibc
13060
13061 : see if fpclassl exists
13062 set fpclassl d_fpclassl
13063 eval $inlibc
13064
13065 : check for fpos64_t
13066 echo " "
13067 echo "Checking to see if you have fpos64_t..." >&4
13068 $cat >try.c <<EOCP
13069 #include <stdio.h>
13070 int main() { fpos64_t x = 7; }
13071 EOCP
13072 set try
13073 if eval $compile; then
13074         val="$define"
13075         echo "You have fpos64_t."
13076 else
13077         val="$undef"
13078         echo "You do not have fpos64_t."
13079         case "$fpossize" in
13080         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13081         esac
13082 fi
13083 $rm_try
13084 set d_fpos64_t
13085 eval $setvar
13086
13087 : see if frexpl exists
13088 set frexpl d_frexpl
13089 eval $inlibc
13090
13091 : see if this is a sys/param system
13092 set sys/param.h i_sysparam
13093 eval $inhdr
13094
13095 : see if this is a sys/mount.h system
13096 set sys/mount.h i_sysmount
13097 eval $inhdr
13098
13099 : Check for fs_data_s
13100 echo " "
13101 echo "Checking to see if your system supports struct fs_data..." >&4
13102 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13103 eval $hasstruct
13104 case "$d_fs_data_s" in
13105 "$define")      echo "Yes, it does."   ;;
13106 *)              echo "No, it doesn't." ;;
13107 esac
13108
13109 : see if fseeko exists
13110 set fseeko d_fseeko
13111 eval $inlibc
13112 case "$longsize" in
13113 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13114 esac
13115
13116 : see if fsetpos exists
13117 set fsetpos d_fsetpos
13118 eval $inlibc
13119
13120 : see if fstatfs exists
13121 set fstatfs d_fstatfs
13122 eval $inlibc
13123
13124 : see if statvfs exists
13125 set statvfs d_statvfs
13126 eval $inlibc
13127
13128 : see if fstatvfs exists
13129 set fstatvfs d_fstatvfs
13130 eval $inlibc
13131
13132
13133 : see if fsync exists
13134 set fsync d_fsync
13135 eval $inlibc
13136
13137 : see if ftello exists
13138 set ftello d_ftello
13139 eval $inlibc
13140 case "$longsize" in
13141 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13142 esac
13143
13144 : check for a working futimes
13145 d_futimes="$undef"
13146 echo " "
13147 echo "Checking if you have a working futimes()" >&4
13148 $cat >try.c <<EOCP
13149 #include <stdio.h>
13150 #include <sys/time.h>
13151 #include <errno.h>
13152 #include <fcntl.h>
13153
13154 int main ()
13155 {
13156     int fd, rv;
13157     fd = open ("try.c", O_RDWR);
13158     if (-1 == fd) exit (1);
13159     rv = futimes (fd, NULL);
13160     exit (rv == -1 ? errno : 0);
13161 }
13162 EOCP
13163 set try
13164 if eval $compile; then
13165     `$run ./try`
13166     rc=$?
13167     case "$rc" in
13168         0)  echo "Yes, you have" >&4
13169             d_futimes="$define"
13170             ;;
13171         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13172             ;;
13173     esac
13174 else
13175     echo "No, it does not (probably harmless)" >&4
13176 fi
13177 $rm_try
13178
13179 : see if getcwd exists
13180 set getcwd d_getcwd
13181 eval $inlibc
13182
13183 : see if getespwnam exists
13184 set getespwnam d_getespwnam
13185 eval $inlibc
13186
13187 : see if getfsstat exists
13188 set getfsstat d_getfsstat
13189 eval $inlibc
13190
13191 : see if getgrent exists
13192 set getgrent d_getgrent
13193 eval $inlibc
13194
13195 : see if getgrent_r exists
13196 set getgrent_r d_getgrent_r
13197 eval $inlibc
13198 case "$d_getgrent_r" in
13199 "$define")
13200         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13201         case "$d_getgrent_r_proto:$usethreads" in
13202         ":define")      d_getgrent_r_proto=define
13203                 set d_getgrent_r_proto getgrent_r $hdrs
13204                 eval $hasproto ;;
13205         *)      ;;
13206         esac
13207         case "$d_getgrent_r_proto" in
13208         define)
13209         case "$getgrent_r_proto" in
13210         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13211         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13212         esac
13213         case "$getgrent_r_proto" in
13214         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13215         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13216         esac
13217         case "$getgrent_r_proto" in
13218         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13219         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13220         esac
13221         case "$getgrent_r_proto" in
13222         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13223         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13224         esac
13225         case "$getgrent_r_proto" in
13226         ''|0) try='int getgrent_r(struct group*, char*, int);'
13227         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13228         esac
13229         case "$getgrent_r_proto" in
13230         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13231         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13232         esac
13233         case "$getgrent_r_proto" in
13234         ''|0)   d_getgrent_r=undef
13235                 getgrent_r_proto=0
13236                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13237         * )     case "$getgrent_r_proto" in
13238                 REENTRANT_PROTO*) ;;
13239                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13240                 esac
13241                 echo "Prototype: $try" ;;
13242         esac
13243         ;;
13244         *)      case "$usethreads" in
13245                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13246                 esac
13247                 d_getgrent_r=undef
13248                 getgrent_r_proto=0
13249                 ;;
13250         esac
13251         ;;
13252 *)      getgrent_r_proto=0
13253         ;;
13254 esac
13255
13256 : see if getgrgid_r exists
13257 set getgrgid_r d_getgrgid_r
13258 eval $inlibc
13259 case "$d_getgrgid_r" in
13260 "$define")
13261         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13262         case "$d_getgrgid_r_proto:$usethreads" in
13263         ":define")      d_getgrgid_r_proto=define
13264                 set d_getgrgid_r_proto getgrgid_r $hdrs
13265                 eval $hasproto ;;
13266         *)      ;;
13267         esac
13268         case "$d_getgrgid_r_proto" in
13269         define)
13270         case "$getgrgid_r_proto" in
13271         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13272         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13273         esac
13274         case "$getgrgid_r_proto" in
13275         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13276         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13277         esac
13278         case "$getgrgid_r_proto" in
13279         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13280         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13281         esac
13282         case "$getgrgid_r_proto" in
13283         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13284         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13285         esac
13286         case "$getgrgid_r_proto" in
13287         ''|0)   d_getgrgid_r=undef
13288                 getgrgid_r_proto=0
13289                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13290         * )     case "$getgrgid_r_proto" in
13291                 REENTRANT_PROTO*) ;;
13292                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13293                 esac
13294                 echo "Prototype: $try" ;;
13295         esac
13296         ;;
13297         *)      case "$usethreads" in
13298                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13299                 esac
13300                 d_getgrgid_r=undef
13301                 getgrgid_r_proto=0
13302                 ;;
13303         esac
13304         ;;
13305 *)      getgrgid_r_proto=0
13306         ;;
13307 esac
13308
13309 : see if getgrnam_r exists
13310 set getgrnam_r d_getgrnam_r
13311 eval $inlibc
13312 case "$d_getgrnam_r" in
13313 "$define")
13314         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13315         case "$d_getgrnam_r_proto:$usethreads" in
13316         ":define")      d_getgrnam_r_proto=define
13317                 set d_getgrnam_r_proto getgrnam_r $hdrs
13318                 eval $hasproto ;;
13319         *)      ;;
13320         esac
13321         case "$d_getgrnam_r_proto" in
13322         define)
13323         case "$getgrnam_r_proto" in
13324         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13325         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13326         esac
13327         case "$getgrnam_r_proto" in
13328         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13329         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13330         esac
13331         case "$getgrnam_r_proto" in
13332         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13333         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13334         esac
13335         case "$getgrnam_r_proto" in
13336         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13337         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13338         esac
13339         case "$getgrnam_r_proto" in
13340         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13341         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13342         esac
13343         case "$getgrnam_r_proto" in
13344         ''|0)   d_getgrnam_r=undef
13345                 getgrnam_r_proto=0
13346                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13347         * )     case "$getgrnam_r_proto" in
13348                 REENTRANT_PROTO*) ;;
13349                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13350                 esac
13351                 echo "Prototype: $try" ;;
13352         esac
13353         ;;
13354         *)      case "$usethreads" in
13355                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13356                 esac
13357                 d_getgrnam_r=undef
13358                 getgrnam_r_proto=0
13359                 ;;
13360         esac
13361         ;;
13362 *)      getgrnam_r_proto=0
13363         ;;
13364 esac
13365
13366 : see if gethostbyaddr exists
13367 set gethostbyaddr d_gethbyaddr
13368 eval $inlibc
13369
13370 : see if gethostbyname exists
13371 set gethostbyname d_gethbyname
13372 eval $inlibc
13373
13374 : see if gethostent exists
13375 set gethostent d_gethent
13376 eval $inlibc
13377
13378 : see how we will look up host name
13379 echo " "
13380 call=''
13381 if set gethostname val -f d_gethname; eval $csym; $val; then
13382         echo 'gethostname() found.' >&4
13383         d_gethname="$define"
13384         call=gethostname
13385 fi
13386 if set uname val -f d_uname; eval $csym; $val; then
13387         if ./xenix; then
13388                 $cat <<'EOM'
13389 uname() was found, but you're running xenix, and older versions of xenix
13390 have a broken uname(). If you don't really know whether your xenix is old
13391 enough to have a broken system call, use the default answer.
13392
13393 EOM
13394                 dflt=y
13395                 case "$d_uname" in
13396                 "$define") dflt=n;;
13397                 esac
13398                 rp='Is your uname() broken?'
13399                 . ./myread
13400                 case "$ans" in
13401                 n*) d_uname="$define"; call=uname;;
13402                 esac
13403         else
13404                 echo 'uname() found.' >&4
13405                 d_uname="$define"
13406                 case "$call" in
13407                 '') call=uname ;;
13408                 esac
13409         fi
13410 fi
13411 case "$d_gethname" in
13412 '') d_gethname="$undef";;
13413 esac
13414 case "$d_uname" in
13415 '') d_uname="$undef";;
13416 esac
13417 case "$d_uname$d_gethname" in
13418 *define*)
13419         dflt=n
13420         cat <<EOM
13421
13422 Every now and then someone has a $call() that lies about the hostname
13423 but can't be fixed for political or economic reasons.  If you wish, I can
13424 pretend $call() isn't there and maybe compute hostname at run-time
13425 thanks to the '$phostname' command.
13426
13427 EOM
13428         rp="Shall I ignore $call() from now on?"
13429         . ./myread
13430         case "$ans" in
13431         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13432         esac;;
13433 esac
13434 case "$phostname" in
13435 '') aphostname='';;
13436 *) case "$aphostname" in
13437         /*) ;;
13438         *) set X $phostname
13439                 shift
13440                 file=$1
13441                 shift
13442                 file=`./loc $file $file $pth`
13443                 aphostname=`echo $file $*`
13444                 ;;
13445         esac
13446         ;;
13447 esac
13448 case "$d_uname$d_gethname" in
13449 *define*) ;;
13450 *)
13451         case "$phostname" in
13452         '')
13453                 echo "There will be no way for $package to get your hostname." >&4;;
13454         *)
13455         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13456                 ;;
13457         esac;;
13458 esac
13459 case "$d_phostname" in
13460 '') d_phostname="$undef";;
13461 esac
13462
13463 : see if gethostbyaddr_r exists
13464 set gethostbyaddr_r d_gethostbyaddr_r
13465 eval $inlibc
13466 case "$d_gethostbyaddr_r" in
13467 "$define")
13468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13469         case "$d_gethostbyaddr_r_proto:$usethreads" in
13470         ":define")      d_gethostbyaddr_r_proto=define
13471                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13472                 eval $hasproto ;;
13473         *)      ;;
13474         esac
13475         case "$d_gethostbyaddr_r_proto" in
13476         define)
13477         case "$gethostbyaddr_r_proto" in
13478         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13479         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13480         esac
13481         case "$gethostbyaddr_r_proto" in
13482         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13483         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13484         esac
13485         case "$gethostbyaddr_r_proto" in
13486         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13487         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13488         esac
13489         case "$gethostbyaddr_r_proto" in
13490         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13491         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13492         esac
13493         case "$gethostbyaddr_r_proto" in
13494         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13495         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13496         esac
13497         case "$gethostbyaddr_r_proto" in
13498         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13499         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13500         esac
13501         case "$gethostbyaddr_r_proto" in
13502         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13503         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13504         esac
13505         case "$gethostbyaddr_r_proto" in
13506         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13507         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13508         esac
13509         case "$gethostbyaddr_r_proto" in
13510         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13511         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13512         esac
13513         case "$gethostbyaddr_r_proto" in
13514         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13515         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13516         esac
13517         case "$gethostbyaddr_r_proto" in
13518         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13519         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13520         esac
13521         case "$gethostbyaddr_r_proto" in
13522         ''|0)   d_gethostbyaddr_r=undef
13523                 gethostbyaddr_r_proto=0
13524                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13525         * )     case "$gethostbyaddr_r_proto" in
13526                 REENTRANT_PROTO*) ;;
13527                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13528                 esac
13529                 echo "Prototype: $try" ;;
13530         esac
13531         ;;
13532         *)      case "$usethreads" in
13533                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13534                 esac
13535                 d_gethostbyaddr_r=undef
13536                 gethostbyaddr_r_proto=0
13537                 ;;
13538         esac
13539         ;;
13540 *)      gethostbyaddr_r_proto=0
13541         ;;
13542 esac
13543
13544 : see if gethostbyname_r exists
13545 set gethostbyname_r d_gethostbyname_r
13546 eval $inlibc
13547 case "$d_gethostbyname_r" in
13548 "$define")
13549         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13550         case "$d_gethostbyname_r_proto:$usethreads" in
13551         ":define")      d_gethostbyname_r_proto=define
13552                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13553                 eval $hasproto ;;
13554         *)      ;;
13555         esac
13556         case "$d_gethostbyname_r_proto" in
13557         define)
13558         case "$gethostbyname_r_proto" in
13559         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13560         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13561         esac
13562         case "$gethostbyname_r_proto" in
13563         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13564         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13565         esac
13566         case "$gethostbyname_r_proto" in
13567         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13568         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13569         esac
13570         case "$gethostbyname_r_proto" in
13571         ''|0)   d_gethostbyname_r=undef
13572                 gethostbyname_r_proto=0
13573                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13574         * )     case "$gethostbyname_r_proto" in
13575                 REENTRANT_PROTO*) ;;
13576                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13577                 esac
13578                 echo "Prototype: $try" ;;
13579         esac
13580         ;;
13581         *)      case "$usethreads" in
13582                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13583                 esac
13584                 d_gethostbyname_r=undef
13585                 gethostbyname_r_proto=0
13586                 ;;
13587         esac
13588         ;;
13589 *)      gethostbyname_r_proto=0
13590         ;;
13591 esac
13592
13593 : see if gethostent_r exists
13594 set gethostent_r d_gethostent_r
13595 eval $inlibc
13596 case "$d_gethostent_r" in
13597 "$define")
13598         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13599         case "$d_gethostent_r_proto:$usethreads" in
13600         ":define")      d_gethostent_r_proto=define
13601                 set d_gethostent_r_proto gethostent_r $hdrs
13602                 eval $hasproto ;;
13603         *)      ;;
13604         esac
13605         case "$d_gethostent_r_proto" in
13606         define)
13607         case "$gethostent_r_proto" in
13608         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13609         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13610         esac
13611         case "$gethostent_r_proto" in
13612         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13613         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13614         esac
13615         case "$gethostent_r_proto" in
13616         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13617         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13618         esac
13619         case "$gethostent_r_proto" in
13620         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13621         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13622         esac
13623         case "$gethostent_r_proto" in
13624         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13625         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13626         esac
13627         case "$gethostent_r_proto" in
13628         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13629         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13630         esac
13631         case "$gethostent_r_proto" in
13632         ''|0)   d_gethostent_r=undef
13633                 gethostent_r_proto=0
13634                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13635         * )     case "$gethostent_r_proto" in
13636                 REENTRANT_PROTO*) ;;
13637                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13638                 esac
13639                 echo "Prototype: $try" ;;
13640         esac
13641         ;;
13642         *)      case "$usethreads" in
13643                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13644                 esac
13645                 d_gethostent_r=undef
13646                 gethostent_r_proto=0
13647                 ;;
13648         esac
13649         ;;
13650 *)      gethostent_r_proto=0
13651         ;;
13652 esac
13653
13654 : see if prototypes for various gethostxxx netdb.h functions are available
13655 echo " "
13656 set d_gethostprotos gethostent $i_netdb netdb.h
13657 eval $hasproto
13658
13659 : see if getitimer exists
13660 set getitimer d_getitimer
13661 eval $inlibc
13662
13663 : see if getlogin exists
13664 set getlogin d_getlogin
13665 eval $inlibc
13666
13667 : see if getlogin_r exists
13668 set getlogin_r d_getlogin_r
13669 eval $inlibc
13670 case "$d_getlogin_r" in
13671 "$define")
13672         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13673         case "$d_getlogin_r_proto:$usethreads" in
13674         ":define")      d_getlogin_r_proto=define
13675                 set d_getlogin_r_proto getlogin_r $hdrs
13676                 eval $hasproto ;;
13677         *)      ;;
13678         esac
13679         case "$d_getlogin_r_proto" in
13680         define)
13681         case "$getlogin_r_proto" in
13682         ''|0) try='int getlogin_r(char*, size_t);'
13683         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13684         esac
13685         case "$getlogin_r_proto" in
13686         ''|0) try='int getlogin_r(char*, int);'
13687         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13688         esac
13689         case "$getlogin_r_proto" in
13690         ''|0) try='char* getlogin_r(char*, size_t);'
13691         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13692         esac
13693         case "$getlogin_r_proto" in
13694         ''|0) try='char* getlogin_r(char*, int);'
13695         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13696         esac
13697         case "$getlogin_r_proto" in
13698         ''|0)   d_getlogin_r=undef
13699                 getlogin_r_proto=0
13700                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13701         * )     case "$getlogin_r_proto" in
13702                 REENTRANT_PROTO*) ;;
13703                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13704                 esac
13705                 echo "Prototype: $try" ;;
13706         esac
13707         ;;
13708         *)      case "$usethreads" in
13709                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13710                 esac
13711                 d_getlogin_r=undef
13712                 getlogin_r_proto=0
13713                 ;;
13714         esac
13715         ;;
13716 *)      getlogin_r_proto=0
13717         ;;
13718 esac
13719
13720 : see if getmnt exists
13721 set getmnt d_getmnt
13722 eval $inlibc
13723
13724 : see if getmntent exists
13725 set getmntent d_getmntent
13726 eval $inlibc
13727
13728 : see if getnetbyaddr exists
13729 set getnetbyaddr d_getnbyaddr
13730 eval $inlibc
13731
13732 : see if getnetbyname exists
13733 set getnetbyname d_getnbyname
13734 eval $inlibc
13735
13736 : see if getnetent exists
13737 set getnetent d_getnent
13738 eval $inlibc
13739
13740 : see if getnetbyaddr_r exists
13741 set getnetbyaddr_r d_getnetbyaddr_r
13742 eval $inlibc
13743 case "$d_getnetbyaddr_r" in
13744 "$define")
13745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13746         case "$d_getnetbyaddr_r_proto:$usethreads" in
13747         ":define")      d_getnetbyaddr_r_proto=define
13748                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13749                 eval $hasproto ;;
13750         *)      ;;
13751         esac
13752         case "$d_getnetbyaddr_r_proto" in
13753         define)
13754         case "$getnetbyaddr_r_proto" in
13755         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13756         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13757         esac
13758         case "$getnetbyaddr_r_proto" in
13759         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13760         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13761         esac
13762         case "$getnetbyaddr_r_proto" in
13763         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13764         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13765         esac
13766         case "$getnetbyaddr_r_proto" in
13767         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13768         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13769         esac
13770         case "$getnetbyaddr_r_proto" in
13771         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13772         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13773         esac
13774         case "$getnetbyaddr_r_proto" in
13775         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13776         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13777         esac
13778         case "$getnetbyaddr_r_proto" in
13779         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13780         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13781         esac
13782         case "$getnetbyaddr_r_proto" in
13783         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13784         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13785         esac
13786         case "$getnetbyaddr_r_proto" in
13787         ''|0)   d_getnetbyaddr_r=undef
13788                 getnetbyaddr_r_proto=0
13789                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13790         * )     case "$getnetbyaddr_r_proto" in
13791                 REENTRANT_PROTO*) ;;
13792                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13793                 esac
13794                 echo "Prototype: $try" ;;
13795         esac
13796         ;;
13797         *)      case "$usethreads" in
13798                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13799                 esac
13800                 d_getnetbyaddr_r=undef
13801                 getnetbyaddr_r_proto=0
13802                 ;;
13803         esac
13804         ;;
13805 *)      getnetbyaddr_r_proto=0
13806         ;;
13807 esac
13808
13809 : see if getnetbyname_r exists
13810 set getnetbyname_r d_getnetbyname_r
13811 eval $inlibc
13812 case "$d_getnetbyname_r" in
13813 "$define")
13814         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13815         case "$d_getnetbyname_r_proto:$usethreads" in
13816         ":define")      d_getnetbyname_r_proto=define
13817                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13818                 eval $hasproto ;;
13819         *)      ;;
13820         esac
13821         case "$d_getnetbyname_r_proto" in
13822         define)
13823         case "$getnetbyname_r_proto" in
13824         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13825         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13826         esac
13827         case "$getnetbyname_r_proto" in
13828         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13829         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13830         esac
13831         case "$getnetbyname_r_proto" in
13832         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13833         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13834         esac
13835         case "$getnetbyname_r_proto" in
13836         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13837         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13838         esac
13839         case "$getnetbyname_r_proto" in
13840         ''|0)   d_getnetbyname_r=undef
13841                 getnetbyname_r_proto=0
13842                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13843         * )     case "$getnetbyname_r_proto" in
13844                 REENTRANT_PROTO*) ;;
13845                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13846                 esac
13847                 echo "Prototype: $try" ;;
13848         esac
13849         ;;
13850         *)      case "$usethreads" in
13851                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13852                 esac
13853                 d_getnetbyname_r=undef
13854                 getnetbyname_r_proto=0
13855                 ;;
13856         esac
13857         ;;
13858 *)      getnetbyname_r_proto=0
13859         ;;
13860 esac
13861
13862 : see if getnetent_r exists
13863 set getnetent_r d_getnetent_r
13864 eval $inlibc
13865 case "$d_getnetent_r" in
13866 "$define")
13867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13868         case "$d_getnetent_r_proto:$usethreads" in
13869         ":define")      d_getnetent_r_proto=define
13870                 set d_getnetent_r_proto getnetent_r $hdrs
13871                 eval $hasproto ;;
13872         *)      ;;
13873         esac
13874         case "$d_getnetent_r_proto" in
13875         define)
13876         case "$getnetent_r_proto" in
13877         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13878         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13879         esac
13880         case "$getnetent_r_proto" in
13881         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13882         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13883         esac
13884         case "$getnetent_r_proto" in
13885         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13886         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13887         esac
13888         case "$getnetent_r_proto" in
13889         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13890         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13891         esac
13892         case "$getnetent_r_proto" in
13893         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13894         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13895         esac
13896         case "$getnetent_r_proto" in
13897         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13898         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13899         esac
13900         case "$getnetent_r_proto" in
13901         ''|0)   d_getnetent_r=undef
13902                 getnetent_r_proto=0
13903                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13904         * )     case "$getnetent_r_proto" in
13905                 REENTRANT_PROTO*) ;;
13906                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13907                 esac
13908                 echo "Prototype: $try" ;;
13909         esac
13910         ;;
13911         *)      case "$usethreads" in
13912                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13913                 esac
13914                 d_getnetent_r=undef
13915                 getnetent_r_proto=0
13916                 ;;
13917         esac
13918         ;;
13919 *)      getnetent_r_proto=0
13920         ;;
13921 esac
13922
13923 : see if prototypes for various getnetxxx netdb.h functions are available
13924 echo " "
13925 set d_getnetprotos getnetent $i_netdb netdb.h
13926 eval $hasproto
13927
13928 : see if getpagesize exists
13929 set getpagesize d_getpagsz
13930 eval $inlibc
13931
13932 : Optional checks for getprotobyname and getprotobynumber
13933
13934 : see if getprotobyname exists
13935 set getprotobyname d_getpbyname
13936 eval $inlibc
13937
13938 : see if getprotobynumber exists
13939 set getprotobynumber d_getpbynumber
13940 eval $inlibc
13941
13942 : see if getprotoent exists
13943 set getprotoent d_getpent
13944 eval $inlibc
13945
13946 : see if getpgid exists
13947 set getpgid d_getpgid
13948 eval $inlibc
13949
13950 : see if getpgrp2 exists
13951 set getpgrp2 d_getpgrp2
13952 eval $inlibc
13953
13954 : see if getppid exists
13955 set getppid d_getppid
13956 eval $inlibc
13957
13958 : see if getpriority exists
13959 set getpriority d_getprior
13960 eval $inlibc
13961
13962 : see if getprotobyname_r exists
13963 set getprotobyname_r d_getprotobyname_r
13964 eval $inlibc
13965 case "$d_getprotobyname_r" in
13966 "$define")
13967         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13968         case "$d_getprotobyname_r_proto:$usethreads" in
13969         ":define")      d_getprotobyname_r_proto=define
13970                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13971                 eval $hasproto ;;
13972         *)      ;;
13973         esac
13974         case "$d_getprotobyname_r_proto" in
13975         define)
13976         case "$getprotobyname_r_proto" in
13977         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13978         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13979         esac
13980         case "$getprotobyname_r_proto" in
13981         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13982         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13983         esac
13984         case "$getprotobyname_r_proto" in
13985         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13986         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13987         esac
13988         case "$getprotobyname_r_proto" in
13989         ''|0)   d_getprotobyname_r=undef
13990                 getprotobyname_r_proto=0
13991                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13992         * )     case "$getprotobyname_r_proto" in
13993                 REENTRANT_PROTO*) ;;
13994                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13995                 esac
13996                 echo "Prototype: $try" ;;
13997         esac
13998         ;;
13999         *)      case "$usethreads" in
14000                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14001                 esac
14002                 d_getprotobyname_r=undef
14003                 getprotobyname_r_proto=0
14004                 ;;
14005         esac
14006         ;;
14007 *)      getprotobyname_r_proto=0
14008         ;;
14009 esac
14010
14011 : see if getprotobynumber_r exists
14012 set getprotobynumber_r d_getprotobynumber_r
14013 eval $inlibc
14014 case "$d_getprotobynumber_r" in
14015 "$define")
14016         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14017         case "$d_getprotobynumber_r_proto:$usethreads" in
14018         ":define")      d_getprotobynumber_r_proto=define
14019                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14020                 eval $hasproto ;;
14021         *)      ;;
14022         esac
14023         case "$d_getprotobynumber_r_proto" in
14024         define)
14025         case "$getprotobynumber_r_proto" in
14026         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14027         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14028         esac
14029         case "$getprotobynumber_r_proto" in
14030         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14031         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14032         esac
14033         case "$getprotobynumber_r_proto" in
14034         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14035         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14036         esac
14037         case "$getprotobynumber_r_proto" in
14038         ''|0)   d_getprotobynumber_r=undef
14039                 getprotobynumber_r_proto=0
14040                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14041         * )     case "$getprotobynumber_r_proto" in
14042                 REENTRANT_PROTO*) ;;
14043                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14044                 esac
14045                 echo "Prototype: $try" ;;
14046         esac
14047         ;;
14048         *)      case "$usethreads" in
14049                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14050                 esac
14051                 d_getprotobynumber_r=undef
14052                 getprotobynumber_r_proto=0
14053                 ;;
14054         esac
14055         ;;
14056 *)      getprotobynumber_r_proto=0
14057         ;;
14058 esac
14059
14060 : see if getprotoent_r exists
14061 set getprotoent_r d_getprotoent_r
14062 eval $inlibc
14063 case "$d_getprotoent_r" in
14064 "$define")
14065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14066         case "$d_getprotoent_r_proto:$usethreads" in
14067         ":define")      d_getprotoent_r_proto=define
14068                 set d_getprotoent_r_proto getprotoent_r $hdrs
14069                 eval $hasproto ;;
14070         *)      ;;
14071         esac
14072         case "$d_getprotoent_r_proto" in
14073         define)
14074         case "$getprotoent_r_proto" in
14075         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14076         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14077         esac
14078         case "$getprotoent_r_proto" in
14079         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14080         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14081         esac
14082         case "$getprotoent_r_proto" in
14083         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14084         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14085         esac
14086         case "$getprotoent_r_proto" in
14087         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14088         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14089         esac
14090         case "$getprotoent_r_proto" in
14091         ''|0)   d_getprotoent_r=undef
14092                 getprotoent_r_proto=0
14093                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14094         * )     case "$getprotoent_r_proto" in
14095                 REENTRANT_PROTO*) ;;
14096                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14097                 esac
14098                 echo "Prototype: $try" ;;
14099         esac
14100         ;;
14101         *)      case "$usethreads" in
14102                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14103                 esac
14104                 d_getprotoent_r=undef
14105                 getprotoent_r_proto=0
14106                 ;;
14107         esac
14108         ;;
14109 *)      getprotoent_r_proto=0
14110         ;;
14111 esac
14112
14113 : see if prototypes for various getprotoxxx netdb.h functions are available
14114 echo " "
14115 set d_getprotoprotos getprotoent $i_netdb netdb.h
14116 eval $hasproto
14117
14118 : see if getprpwnam exists
14119 set getprpwnam d_getprpwnam
14120 eval $inlibc
14121
14122 : see if getpwent exists
14123 set getpwent d_getpwent
14124 eval $inlibc
14125
14126 : see if getpwent_r exists
14127 set getpwent_r d_getpwent_r
14128 eval $inlibc
14129 case "$d_getpwent_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14132         case "$d_getpwent_r_proto:$usethreads" in
14133         ":define")      d_getpwent_r_proto=define
14134                 set d_getpwent_r_proto getpwent_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getpwent_r_proto" in
14139         define)
14140         case "$getpwent_r_proto" in
14141         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14142         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14143         esac
14144         case "$getpwent_r_proto" in
14145         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14146         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14147         esac
14148         case "$getpwent_r_proto" in
14149         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14150         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14151         esac
14152         case "$getpwent_r_proto" in
14153         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14154         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14155         esac
14156         case "$getpwent_r_proto" in
14157         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14158         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14159         esac
14160         case "$getpwent_r_proto" in
14161         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14162         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14163         esac
14164         case "$getpwent_r_proto" in
14165         ''|0)   d_getpwent_r=undef
14166                 getpwent_r_proto=0
14167                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14168         * )     case "$getpwent_r_proto" in
14169                 REENTRANT_PROTO*) ;;
14170                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14171                 esac
14172                 echo "Prototype: $try" ;;
14173         esac
14174         ;;
14175         *)      case "$usethreads" in
14176                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14177                 esac
14178                 d_getpwent_r=undef
14179                 getpwent_r_proto=0
14180                 ;;
14181         esac
14182         ;;
14183 *)      getpwent_r_proto=0
14184         ;;
14185 esac
14186
14187 : see if getpwnam_r exists
14188 set getpwnam_r d_getpwnam_r
14189 eval $inlibc
14190 case "$d_getpwnam_r" in
14191 "$define")
14192         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14193         case "$d_getpwnam_r_proto:$usethreads" in
14194         ":define")      d_getpwnam_r_proto=define
14195                 set d_getpwnam_r_proto getpwnam_r $hdrs
14196                 eval $hasproto ;;
14197         *)      ;;
14198         esac
14199         case "$d_getpwnam_r_proto" in
14200         define)
14201         case "$getpwnam_r_proto" in
14202         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14203         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14204         esac
14205         case "$getpwnam_r_proto" in
14206         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14207         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14208         esac
14209         case "$getpwnam_r_proto" in
14210         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14211         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14212         esac
14213         case "$getpwnam_r_proto" in
14214         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14215         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14216         esac
14217         case "$getpwnam_r_proto" in
14218         ''|0)   d_getpwnam_r=undef
14219                 getpwnam_r_proto=0
14220                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14221         * )     case "$getpwnam_r_proto" in
14222                 REENTRANT_PROTO*) ;;
14223                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14224                 esac
14225                 echo "Prototype: $try" ;;
14226         esac
14227         ;;
14228         *)      case "$usethreads" in
14229                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14230                 esac
14231                 d_getpwnam_r=undef
14232                 getpwnam_r_proto=0
14233                 ;;
14234         esac
14235         ;;
14236 *)      getpwnam_r_proto=0
14237         ;;
14238 esac
14239
14240 : see if getpwuid_r exists
14241 set getpwuid_r d_getpwuid_r
14242 eval $inlibc
14243 case "$d_getpwuid_r" in
14244 "$define")
14245         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14246         case "$d_getpwuid_r_proto:$usethreads" in
14247         ":define")      d_getpwuid_r_proto=define
14248                 set d_getpwuid_r_proto getpwuid_r $hdrs
14249                 eval $hasproto ;;
14250         *)      ;;
14251         esac
14252         case "$d_getpwuid_r_proto" in
14253         define)
14254         case "$getpwuid_r_proto" in
14255         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14256         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14257         esac
14258         case "$getpwuid_r_proto" in
14259         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14260         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14261         esac
14262         case "$getpwuid_r_proto" in
14263         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14264         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14265         esac
14266         case "$getpwuid_r_proto" in
14267         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14268         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14269         esac
14270         case "$getpwuid_r_proto" in
14271         ''|0)   d_getpwuid_r=undef
14272                 getpwuid_r_proto=0
14273                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14274         * )     case "$getpwuid_r_proto" in
14275                 REENTRANT_PROTO*) ;;
14276                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14277                 esac
14278                 echo "Prototype: $try" ;;
14279         esac
14280         ;;
14281         *)      case "$usethreads" in
14282                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14283                 esac
14284                 d_getpwuid_r=undef
14285                 getpwuid_r_proto=0
14286                 ;;
14287         esac
14288         ;;
14289 *)      getpwuid_r_proto=0
14290         ;;
14291 esac
14292
14293 : Optional checks for getsbyname and getsbyport
14294
14295 : see if getservbyname exists
14296 set getservbyname d_getsbyname
14297 eval $inlibc
14298
14299 : see if getservbyport exists
14300 set getservbyport d_getsbyport
14301 eval $inlibc
14302
14303 : see if getservent exists
14304 set getservent d_getsent
14305 eval $inlibc
14306
14307 : see if getservbyname_r exists
14308 set getservbyname_r d_getservbyname_r
14309 eval $inlibc
14310 case "$d_getservbyname_r" in
14311 "$define")
14312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14313         case "$d_getservbyname_r_proto:$usethreads" in
14314         ":define")      d_getservbyname_r_proto=define
14315                 set d_getservbyname_r_proto getservbyname_r $hdrs
14316                 eval $hasproto ;;
14317         *)      ;;
14318         esac
14319         case "$d_getservbyname_r_proto" in
14320         define)
14321         case "$getservbyname_r_proto" in
14322         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14323         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14324         esac
14325         case "$getservbyname_r_proto" in
14326         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14327         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14328         esac
14329         case "$getservbyname_r_proto" in
14330         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14331         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14332         esac
14333         case "$getservbyname_r_proto" in
14334         ''|0)   d_getservbyname_r=undef
14335                 getservbyname_r_proto=0
14336                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14337         * )     case "$getservbyname_r_proto" in
14338                 REENTRANT_PROTO*) ;;
14339                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14340                 esac
14341                 echo "Prototype: $try" ;;
14342         esac
14343         ;;
14344         *)      case "$usethreads" in
14345                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14346                 esac
14347                 d_getservbyname_r=undef
14348                 getservbyname_r_proto=0
14349                 ;;
14350         esac
14351         ;;
14352 *)      getservbyname_r_proto=0
14353         ;;
14354 esac
14355
14356 : see if getservbyport_r exists
14357 set getservbyport_r d_getservbyport_r
14358 eval $inlibc
14359 case "$d_getservbyport_r" in
14360 "$define")
14361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14362         case "$d_getservbyport_r_proto:$usethreads" in
14363         ":define")      d_getservbyport_r_proto=define
14364                 set d_getservbyport_r_proto getservbyport_r $hdrs
14365                 eval $hasproto ;;
14366         *)      ;;
14367         esac
14368         case "$d_getservbyport_r_proto" in
14369         define)
14370         case "$getservbyport_r_proto" in
14371         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14372         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14373         esac
14374         case "$getservbyport_r_proto" in
14375         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14376         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14377         esac
14378         case "$getservbyport_r_proto" in
14379         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14380         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14381         esac
14382         case "$getservbyport_r_proto" in
14383         ''|0)   d_getservbyport_r=undef
14384                 getservbyport_r_proto=0
14385                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14386         * )     case "$getservbyport_r_proto" in
14387                 REENTRANT_PROTO*) ;;
14388                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14389                 esac
14390                 echo "Prototype: $try" ;;
14391         esac
14392         ;;
14393         *)      case "$usethreads" in
14394                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14395                 esac
14396                 d_getservbyport_r=undef
14397                 getservbyport_r_proto=0
14398                 ;;
14399         esac
14400         ;;
14401 *)      getservbyport_r_proto=0
14402         ;;
14403 esac
14404
14405 : see if getservent_r exists
14406 set getservent_r d_getservent_r
14407 eval $inlibc
14408 case "$d_getservent_r" in
14409 "$define")
14410         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14411         case "$d_getservent_r_proto:$usethreads" in
14412         ":define")      d_getservent_r_proto=define
14413                 set d_getservent_r_proto getservent_r $hdrs
14414                 eval $hasproto ;;
14415         *)      ;;
14416         esac
14417         case "$d_getservent_r_proto" in
14418         define)
14419         case "$getservent_r_proto" in
14420         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14421         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14422         esac
14423         case "$getservent_r_proto" in
14424         ''|0) try='int getservent_r(struct servent*, char*, int);'
14425         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14426         esac
14427         case "$getservent_r_proto" in
14428         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14429         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14430         esac
14431         case "$getservent_r_proto" in
14432         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14433         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14434         esac
14435         case "$getservent_r_proto" in
14436         ''|0)   d_getservent_r=undef
14437                 getservent_r_proto=0
14438                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14439         * )     case "$getservent_r_proto" in
14440                 REENTRANT_PROTO*) ;;
14441                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14442                 esac
14443                 echo "Prototype: $try" ;;
14444         esac
14445         ;;
14446         *)      case "$usethreads" in
14447                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14448                 esac
14449                 d_getservent_r=undef
14450                 getservent_r_proto=0
14451                 ;;
14452         esac
14453         ;;
14454 *)      getservent_r_proto=0
14455         ;;
14456 esac
14457
14458 : see if prototypes for various getservxxx netdb.h functions are available
14459 echo " "
14460 set d_getservprotos getservent $i_netdb netdb.h
14461 eval $hasproto
14462
14463 : see if getspnam exists
14464 set getspnam d_getspnam
14465 eval $inlibc
14466
14467 : see if this is a shadow.h system
14468 set shadow.h i_shadow
14469 eval $inhdr
14470
14471 : see if getspnam_r exists
14472 set getspnam_r d_getspnam_r
14473 eval $inlibc
14474 case "$d_getspnam_r" in
14475 "$define")
14476         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14477         case "$d_getspnam_r_proto:$usethreads" in
14478         ":define")      d_getspnam_r_proto=define
14479                 set d_getspnam_r_proto getspnam_r $hdrs
14480                 eval $hasproto ;;
14481         *)      ;;
14482         esac
14483         case "$d_getspnam_r_proto" in
14484         define)
14485         case "$getspnam_r_proto" in
14486         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14487         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14488         esac
14489         case "$getspnam_r_proto" in
14490         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14491         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14492         esac
14493         case "$getspnam_r_proto" in
14494         ''|0)   d_getspnam_r=undef
14495                 getspnam_r_proto=0
14496                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14497         * )     case "$getspnam_r_proto" in
14498                 REENTRANT_PROTO*) ;;
14499                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14500                 esac
14501                 echo "Prototype: $try" ;;
14502         esac
14503         ;;
14504         *)      case "$usethreads" in
14505                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14506                 esac
14507                 d_getspnam_r=undef
14508                 getspnam_r_proto=0
14509                 ;;
14510         esac
14511         ;;
14512 *)      getspnam_r_proto=0
14513         ;;
14514 esac
14515
14516 : see if gettimeofday or ftime exists
14517 set gettimeofday d_gettimeod
14518 eval $inlibc
14519 case "$d_gettimeod" in
14520 "$undef")
14521         set ftime d_ftime 
14522         eval $inlibc
14523         ;;
14524 *)
14525         val="$undef"; set d_ftime; eval $setvar
14526         ;;
14527 esac
14528 case "$d_gettimeod$d_ftime" in
14529 "$undef$undef")
14530         echo " "
14531         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14532         ;;
14533 esac
14534
14535 : see if gmtime_r exists
14536 set gmtime_r d_gmtime_r
14537 eval $inlibc
14538 case "$d_gmtime_r" in
14539 "$define")
14540         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14541         case "$d_gmtime_r_proto:$usethreads" in
14542         ":define")      d_gmtime_r_proto=define
14543                 set d_gmtime_r_proto gmtime_r $hdrs
14544                 eval $hasproto ;;
14545         *)      ;;
14546         esac
14547         case "$d_gmtime_r_proto" in
14548         define)
14549         case "$gmtime_r_proto" in
14550         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14551         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14552         esac
14553         case "$gmtime_r_proto" in
14554         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14555         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14556         esac
14557         case "$gmtime_r_proto" in
14558         ''|0)   d_gmtime_r=undef
14559                 gmtime_r_proto=0
14560                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14561         * )     case "$gmtime_r_proto" in
14562                 REENTRANT_PROTO*) ;;
14563                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14564                 esac
14565                 echo "Prototype: $try" ;;
14566         esac
14567         ;;
14568         *)      case "$usethreads" in
14569                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14570                 esac
14571                 d_gmtime_r=undef
14572                 gmtime_r_proto=0
14573                 ;;
14574         esac
14575         ;;
14576 *)      gmtime_r_proto=0
14577         ;;
14578 esac
14579
14580 : see if hasmntopt exists
14581 set hasmntopt d_hasmntopt
14582 eval $inlibc
14583
14584 : see if this is a netinet/in.h or sys/in.h system
14585 set netinet/in.h i_niin sys/in.h i_sysin
14586 eval $inhdr
14587
14588 : see if arpa/inet.h has to be included
14589 set arpa/inet.h i_arpainet
14590 eval $inhdr
14591
14592 : see if htonl --and friends-- exists
14593 val=''
14594 set htonl val
14595 eval $inlibc
14596
14597 : Maybe they are macros.
14598 case "$val" in
14599 $undef)
14600         $cat >htonl.c <<EOM
14601 #include <stdio.h>
14602 #include <sys/types.h>
14603 #$i_niin I_NETINET_IN
14604 #$i_sysin I_SYS_IN
14605 #$i_arpainet I_ARPA_INET
14606 #ifdef I_NETINET_IN
14607 #include <netinet/in.h>
14608 #endif
14609 #ifdef I_SYS_IN
14610 #include <sys/in.h>
14611 #endif
14612 #ifdef I_ARPA_INET
14613 #include <arpa/inet.h>
14614 #endif
14615 #ifdef htonl
14616 printf("Defined as a macro.");
14617 #endif
14618 EOM
14619         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14620         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14621                 val="$define"
14622                 echo "But it seems to be defined as a macro." >&4
14623         fi
14624         $rm -f htonl.?
14625         ;;
14626 esac
14627 set d_htonl
14628 eval $setvar
14629
14630 : see if ilogbl exists
14631 set ilogbl d_ilogbl
14632 eval $inlibc
14633
14634 : index or strchr
14635 echo " "
14636 if set index val -f; eval $csym; $val; then
14637         if set strchr val -f d_strchr; eval $csym; $val; then
14638                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14639                         val="$define"
14640                         vali="$undef"
14641                         echo "strchr() found." >&4
14642                 else
14643                         val="$undef"
14644                         vali="$define"
14645                         echo "index() found." >&4
14646                 fi
14647         else
14648                 val="$undef"
14649                 vali="$define"
14650                 echo "index() found." >&4
14651         fi
14652 else
14653         if set strchr val -f d_strchr; eval $csym; $val; then
14654                 val="$define"
14655                 vali="$undef"
14656                 echo "strchr() found." >&4
14657         else
14658                 echo "No index() or strchr() found!" >&4
14659                 val="$undef"
14660                 vali="$undef"
14661         fi
14662 fi
14663 set d_strchr; eval $setvar
14664 val="$vali"
14665 set d_index; eval $setvar
14666
14667 : check whether inet_aton exists
14668 set inet_aton d_inetaton
14669 eval $inlibc
14670
14671 : Look for isascii
14672 echo " "
14673 $cat >isascii.c <<EOCP
14674 #include <stdio.h>
14675 #include <ctype.h>
14676 #$i_stdlib I_STDLIB
14677 #ifdef I_STDLIB
14678 #include <stdlib.h>
14679 #endif
14680 int main() {
14681         int c = 'A';
14682         if (isascii(c))
14683                 exit(0);
14684         else
14685                 exit(1);
14686 }
14687 EOCP
14688 set isascii
14689 if eval $compile; then
14690         echo "isascii() found." >&4
14691         val="$define"
14692 else
14693         echo "isascii() NOT found." >&4
14694         val="$undef"
14695 fi
14696 set d_isascii
14697 eval $setvar
14698 $rm -f isascii*
14699
14700 : see if isfinite exists
14701 set isfinite d_isfinite
14702 eval $inlibc
14703
14704 : see if isinf exists
14705 set isinf d_isinf
14706 eval $inlibc
14707
14708 : see if isnan exists
14709 set isnan d_isnan
14710 eval $inlibc
14711
14712 : see if isnanl exists
14713 set isnanl d_isnanl
14714 eval $inlibc
14715
14716 : see if killpg exists
14717 set killpg d_killpg
14718 eval $inlibc
14719
14720 : see if lchown exists
14721 echo " "
14722 $cat > try.c <<'EOCP'
14723 /* System header to define __stub macros and hopefully few prototypes,
14724     which can conflict with char lchown(); below.  */
14725 #include <assert.h>
14726 /* Override any gcc2 internal prototype to avoid an error.  */
14727 /* We use char because int might match the return type of a gcc2
14728    builtin and then its argument prototype would still apply.  */
14729 char lchown();
14730 int main() {
14731     /*  The GNU C library defines this for functions which it implements
14732         to always fail with ENOSYS.  Some functions are actually named
14733         something starting with __ and the normal name is an alias.  */
14734 #if defined (__stub_lchown) || defined (__stub___lchown)
14735 choke me
14736 #else
14737 lchown();
14738 #endif
14739 ; return 0; }
14740 EOCP
14741 set try
14742 if eval $compile; then
14743     $echo "lchown() found." >&4
14744     val="$define"
14745 else
14746     $echo "lchown() NOT found." >&4
14747     val="$undef"
14748 fi
14749 set d_lchown
14750 eval $setvar
14751
14752 : See if number of significant digits in a double precision number is known
14753 echo " "
14754 $cat >ldbl_dig.c <<EOM
14755 #$i_limits I_LIMITS
14756 #$i_float I_FLOAT
14757 #ifdef I_LIMITS
14758 #include <limits.h>
14759 #endif
14760 #ifdef I_FLOAT
14761 #include <float.h>
14762 #endif
14763 #ifdef LDBL_DIG
14764 printf("Contains LDBL_DIG");
14765 #endif
14766 EOM
14767 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14768 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14769         echo "LDBL_DIG found." >&4
14770         val="$define"
14771 else
14772         echo "LDBL_DIG NOT found." >&4
14773         val="$undef"
14774 fi
14775 $rm -f ldbl_dig.?
14776 set d_ldbl_dig
14777 eval $setvar
14778
14779 : see if this is a math.h system
14780 set math.h i_math
14781 eval $inhdr
14782
14783 : check to see if math.h defines _LIB_VERSION
14784 d_libm_lib_version="$undef"
14785 case $i_math in
14786     $define)
14787         echo " "
14788         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14789         $cat >try.c <<EOCP
14790 #include <unistd.h>
14791 #include <math.h>
14792 int main (int argc, char *argv[])
14793 {
14794     printf ("%d\n", _LIB_VERSION);
14795     return (0);
14796     } /* main */
14797 EOCP
14798         set try
14799         if eval $compile; then
14800             foo=`$run ./try`
14801             echo "Yes, it does ($foo)" >&4
14802             d_libm_lib_version="$define"
14803         else
14804             echo "No, it does not (probably harmless)" >&4
14805             fi
14806         $rm_try
14807         ;;
14808
14809     esac
14810
14811 : see if link exists
14812 set link d_link
14813 eval $inlibc
14814
14815 : see if localtime_r exists
14816 set localtime_r d_localtime_r
14817 eval $inlibc
14818 case "$d_localtime_r" in
14819 "$define")
14820         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14821         case "$d_localtime_r_proto:$usethreads" in
14822         ":define")      d_localtime_r_proto=define
14823                 set d_localtime_r_proto localtime_r $hdrs
14824                 eval $hasproto ;;
14825         *)      ;;
14826         esac
14827         case "$d_localtime_r_proto" in
14828         define)
14829         case "$localtime_r_proto" in
14830         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14831         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14832         esac
14833         case "$localtime_r_proto" in
14834         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14835         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14836         esac
14837         case "$localtime_r_proto" in
14838         ''|0)   d_localtime_r=undef
14839                 localtime_r_proto=0
14840                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14841         * )     case "$localtime_r_proto" in
14842                 REENTRANT_PROTO*) ;;
14843                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14844                 esac
14845                 echo "Prototype: $try" ;;
14846         esac
14847         ;;
14848         *)      case "$usethreads" in
14849                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14850                 esac
14851                 d_localtime_r=undef
14852                 localtime_r_proto=0
14853                 ;;
14854         esac
14855         ;;
14856 *)      localtime_r_proto=0
14857         ;;
14858 esac
14859
14860 : see if localtime_r calls tzset
14861 case "$localtime_r_proto" in
14862 REENTRANT_PROTO*)
14863         $cat >try.c <<EOCP
14864 /*  Does our libc's localtime_r call tzset ?
14865  *  return 0 if so, 1 otherwise.
14866  */
14867 #include <sys/types.h>
14868 #include <unistd.h>
14869 #include <time.h>
14870 #include <string.h>
14871 #include <malloc.h>
14872 int main()
14873 {
14874     time_t t = time(0L);
14875     char w_tz[]="TZ" "=GMT+5",
14876          e_tz[]="TZ" "=GMT-5",
14877         *tz_e = (char*)malloc(16),
14878         *tz_w = (char*)malloc(16);
14879     struct tm tm_e, tm_w;
14880     memset(&tm_e,'\0',sizeof(struct tm));
14881     memset(&tm_w,'\0',sizeof(struct tm));
14882     strcpy(tz_e,e_tz);
14883     strcpy(tz_w,w_tz);
14884
14885     putenv(tz_e);
14886     localtime_r(&t, &tm_e);
14887
14888     putenv(tz_w);
14889     localtime_r(&t, &tm_w);
14890
14891     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14892         return 1;
14893     return 0;
14894 }
14895 EOCP
14896         set try
14897         if eval $compile; then
14898             if $run ./try; then
14899                 d_localtime_r_needs_tzset=undef;
14900             else
14901                 d_localtime_r_needs_tzset=define;
14902             fi;
14903         else
14904             d_localtime_r_needs_tzset=undef;
14905         fi;
14906      ;;
14907   *)
14908      d_localtime_r_needs_tzset=undef;
14909      ;;
14910 esac
14911 $rm_try
14912
14913 : see if localeconv exists
14914 set localeconv d_locconv
14915 eval $inlibc
14916
14917 : see if lockf exists
14918 set lockf d_lockf
14919 eval $inlibc
14920
14921 : see if prototype for lseek is available
14922 echo " "
14923 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14924 eval $hasproto
14925
14926 : see if lstat exists
14927 set lstat d_lstat
14928 eval $inlibc
14929
14930 : see if madvise exists
14931 set madvise d_madvise
14932 eval $inlibc
14933
14934 : see if malloc_size exists
14935 set malloc_size d_malloc_size
14936 eval $inlibc
14937
14938 : see if malloc_size_good exists
14939 set malloc_good_size d_malloc_good_size
14940 eval $inlibc
14941
14942 : see if mblen exists
14943 set mblen d_mblen
14944 eval $inlibc
14945
14946 : see if mbstowcs exists
14947 set mbstowcs d_mbstowcs
14948 eval $inlibc
14949
14950 : see if mbtowc exists
14951 set mbtowc d_mbtowc
14952 eval $inlibc
14953
14954 : see if memchr exists
14955 set memchr d_memchr
14956 eval $inlibc
14957
14958 : see if memcmp exists
14959 set memcmp d_memcmp
14960 eval $inlibc
14961
14962 : see if memcpy exists
14963 set memcpy d_memcpy
14964 eval $inlibc
14965
14966 : see if memmove exists
14967 set memmove d_memmove
14968 eval $inlibc
14969
14970 : see if memset exists
14971 set memset d_memset
14972 eval $inlibc
14973
14974 : see if mkdir exists
14975 set mkdir d_mkdir
14976 eval $inlibc
14977
14978 : see if mkdtemp exists
14979 set mkdtemp d_mkdtemp
14980 eval $inlibc
14981
14982 : see if mkfifo exists
14983 set mkfifo d_mkfifo
14984 eval $inlibc
14985
14986 : see if mkstemp exists
14987 set mkstemp d_mkstemp
14988 eval $inlibc
14989
14990 : see if mkstemps exists
14991 set mkstemps d_mkstemps
14992 eval $inlibc
14993
14994 : see if mktime exists
14995 set mktime d_mktime
14996 eval $inlibc
14997
14998 : see if this is a sys/mman.h system
14999 set sys/mman.h i_sysmman
15000 eval $inhdr
15001
15002 : see if mmap exists
15003 set mmap d_mmap
15004 eval $inlibc
15005 : see what shmat returns
15006 : default to something harmless
15007 mmaptype='void *'
15008 case "$i_sysmman$d_mmap" in
15009 "$define$define")
15010         $cat >mmap.c <<'END'
15011 #include <sys/mman.h>
15012 void *mmap();
15013 END
15014         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15015                 mmaptype='void *'
15016         else
15017                 mmaptype='caddr_t'
15018         fi
15019         echo "and it returns ($mmaptype)." >&4
15020         ;;
15021 esac
15022
15023
15024
15025 : see if sqrtl exists
15026 set sqrtl d_sqrtl
15027 eval $inlibc
15028
15029 : see if scalbnl exists
15030 set scalbnl d_scalbnl
15031 eval $inlibc
15032
15033 : see if modfl exists
15034 set modfl d_modfl
15035 eval $inlibc
15036
15037 : see if prototype for modfl is available
15038 echo " "
15039 set d_modflproto modfl $i_math math.h
15040 eval $hasproto
15041
15042 d_modfl_pow32_bug="$undef"
15043
15044 case "$d_longdbl$d_modfl" in
15045 $define$define)
15046         $cat <<EOM
15047 Checking to see whether your modfl() is okay for large values...
15048 EOM
15049 $cat >try.c <<EOCP
15050 #include <math.h>
15051 #include <stdio.h>
15052 EOCP
15053 if $test "X$d_modflproto" != "X$define"; then
15054         $cat >>try.c <<EOCP
15055 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15056 long double modfl (long double, long double *);
15057 EOCP
15058 fi
15059 $cat >>try.c <<EOCP
15060 int main() {
15061     long double nv = 4294967303.15;
15062     long double v, w;
15063     v = modfl(nv, &w);
15064 #ifdef __GLIBC__
15065     printf("glibc");
15066 #endif
15067     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15068     return 0;
15069 }
15070 EOCP
15071         case "$osname:$gccversion" in
15072         aix:)   saveccflags="$ccflags"
15073                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15074         esac
15075         set try
15076         if eval $compile; then
15077                 foo=`$run ./try`
15078                 case "$foo" in
15079                 *" 4294967303.150000 1.150000 4294967302.000000")
15080                         echo >&4 "Your modfl() is broken for large values."
15081                         d_modfl_pow32_bug="$define"
15082                         case "$foo" in
15083                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15084                         ;;
15085                         esac
15086                         ;;
15087                 *" 4294967303.150000 0.150000 4294967303.000000")
15088                         echo >&4 "Your modfl() seems okay for large values."
15089                         ;;
15090                 *)      echo >&4 "I don't understand your modfl() at all."
15091                         d_modfl="$undef"
15092                         ;;
15093                 esac
15094                 $rm_try
15095         else
15096                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15097                 d_modfl="$undef"
15098         fi
15099         case "$osname:$gccversion" in
15100         aix:)   ccflags="$saveccflags" ;; # restore
15101         esac
15102         ;;
15103 esac
15104
15105 if $test "$uselongdouble" = "$define"; then
15106     message=""
15107     if $test "$d_sqrtl" != "$define"; then
15108         message="$message sqrtl"
15109     fi
15110     if $test "$d_modfl" != "$define"; then
15111         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15112             echo "You have both aintl and copysignl, so I can emulate modfl."
15113         else
15114             message="$message modfl"
15115         fi
15116     fi
15117     if $test "$d_frexpl" != "$define"; then
15118         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15119             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15120         else
15121             message="$message frexpl"
15122         fi
15123     fi
15124
15125     if $test "$message" != ""; then
15126         $cat <<EOM >&4
15127
15128 *** You requested the use of long doubles but you do not seem to have
15129 *** the following mathematical functions needed for long double support:
15130 ***    $message
15131 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15132 *** Cannot continue, aborting.
15133
15134 EOM
15135
15136         exit 1
15137     fi
15138 fi
15139
15140 : see if mprotect exists
15141 set mprotect d_mprotect
15142 eval $inlibc
15143
15144 : see if msgctl exists
15145 set msgctl d_msgctl
15146 eval $inlibc
15147
15148 : see if msgget exists
15149 set msgget d_msgget
15150 eval $inlibc
15151
15152 : see if msgsnd exists
15153 set msgsnd d_msgsnd
15154 eval $inlibc
15155
15156 : see if msgrcv exists
15157 set msgrcv d_msgrcv
15158 eval $inlibc
15159
15160 : see how much of the 'msg*(2)' library is present.
15161 h_msg=true
15162 echo " "
15163 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15164 *"$undef"*) h_msg=false;;
15165 esac
15166 case "$osname" in
15167 freebsd)
15168     case "`ipcs 2>&1`" in
15169     "SVID messages"*"not configured"*)
15170         echo "Your $osname does not have the msg*(2) configured." >&4
15171         h_msg=false
15172         val="$undef"
15173         set msgctl d_msgctl
15174         eval $setvar
15175         set msgget d_msgget
15176         eval $setvar
15177         set msgsnd d_msgsnd
15178         eval $setvar
15179         set msgrcv d_msgrcv
15180         eval $setvar
15181         ;;
15182     esac
15183     ;;
15184 esac
15185 : we could also check for sys/ipc.h ...
15186 if $h_msg && $test `./findhdr sys/msg.h`; then
15187         echo "You have the full msg*(2) library." >&4
15188         val="$define"
15189 else
15190         echo "You don't have the full msg*(2) library." >&4
15191         val="$undef"
15192 fi
15193 set d_msg
15194 eval $setvar
15195
15196 : Check for msghdr_s
15197 echo " "
15198 echo "Checking to see if your system supports struct msghdr..." >&4
15199 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15200 eval $hasstruct
15201 case "$d_msghdr_s" in
15202 "$define")      echo "Yes, it does."   ;;
15203 *)              echo "No, it doesn't." ;;
15204 esac
15205
15206
15207 : see if msync exists
15208 set msync d_msync
15209 eval $inlibc
15210
15211 : see if munmap exists
15212 set munmap d_munmap
15213 eval $inlibc
15214
15215 : see if nice exists
15216 set nice d_nice
15217 eval $inlibc
15218
15219 : see if this is a langinfo.h system
15220 set langinfo.h i_langinfo
15221 eval $inhdr
15222
15223 : see if nl_langinfo exists
15224 set nl_langinfo d_nl_langinfo
15225 eval $inlibc
15226
15227 : check for volatile keyword
15228 echo " "
15229 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15230 $cat >try.c <<'EOCP'
15231 int main()
15232 {
15233         typedef struct _goo_struct goo_struct;
15234         goo_struct * volatile goo = ((goo_struct *)0);
15235         struct _goo_struct {
15236                 long long_int;
15237                 int reg_int;
15238                 char char_var;
15239         };
15240         typedef unsigned short foo_t;
15241         char *volatile foo;
15242         volatile int bar;
15243         volatile foo_t blech;
15244         foo = foo;
15245 }
15246 EOCP
15247 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15248         val="$define"
15249         echo "Yup, it does."
15250 else
15251         val="$undef"
15252         echo "Nope, it doesn't."
15253 fi
15254 set d_volatile
15255 eval $setvar
15256 $rm_try
15257
15258 : Check basic sizes
15259 echo " "
15260 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15261
15262 case "$use64bitint:$d_quad:$quadtype" in
15263 define:define:?*)
15264         ivtype="$quadtype"
15265         uvtype="$uquadtype"
15266         ivsize=8
15267         uvsize=8
15268         ;;
15269 *)      ivtype="long"
15270         uvtype="unsigned long"
15271         ivsize=$longsize
15272         uvsize=$longsize
15273         ;;
15274 esac
15275
15276 case "$uselongdouble:$d_longdbl" in
15277 define:define)
15278         nvtype="long double"
15279         nvsize=$longdblsize
15280         ;;
15281 *)      nvtype=double
15282         nvsize=$doublesize
15283         ;;
15284 esac
15285
15286 $echo "(IV will be "$ivtype", $ivsize bytes)"
15287 $echo "(UV will be "$uvtype", $uvsize bytes)"
15288 $echo "(NV will be "$nvtype", $nvsize bytes)"
15289
15290 $cat >try.c <<EOCP
15291 #$i_inttypes I_INTTYPES
15292 #ifdef I_INTTYPES
15293 #include <inttypes.h>
15294 #endif
15295 #include <stdio.h>
15296 int main() {
15297 #ifdef INT8
15298    int8_t i =  INT8_MAX;
15299   uint8_t u = UINT8_MAX;
15300   printf("int8_t\n");
15301 #endif
15302 #ifdef INT16
15303    int16_t i =  INT16_MAX;
15304   uint16_t i = UINT16_MAX;
15305   printf("int16_t\n");
15306 #endif
15307 #ifdef INT32
15308    int32_t i =  INT32_MAX;
15309   uint32_t u = UINT32_MAX;
15310   printf("int32_t\n");
15311 #endif
15312 }
15313 EOCP
15314
15315 i8type="signed char"
15316 u8type="unsigned char"
15317 i8size=1
15318 u8size=1
15319
15320 case "$i16type" in
15321 '')     case "$shortsize" in
15322         2)      i16type=short
15323                 u16type="unsigned short"
15324                 i16size=$shortsize
15325                 u16size=$shortsize
15326                 ;;
15327         esac
15328         ;;
15329 esac
15330 case "$i16type" in
15331 '')     set try -DINT16
15332         if eval $compile; then
15333                 case "`$run ./try`" in
15334                 int16_t)
15335                         i16type=int16_t
15336                         u16type=uint16_t
15337                         i16size=2
15338                         u16size=2
15339                         ;;
15340                 esac
15341         fi
15342         ;;
15343 esac
15344 case "$i16type" in
15345 '')     if $test $shortsize -ge 2; then
15346                 i16type=short
15347                 u16type="unsigned short"
15348                 i16size=$shortsize
15349                 u16size=$shortsize
15350         fi
15351         ;;
15352 esac
15353
15354 case "$i32type" in
15355 '')     case "$longsize" in
15356         4)      i32type=long
15357                 u32type="unsigned long"
15358                 i32size=$longsize
15359                 u32size=$longsize
15360                 ;;
15361         *)      case "$intsize" in
15362                 4)      i32type=int
15363                         u32type="unsigned int"
15364                         i32size=$intsize
15365                         u32size=$intsize
15366                         ;;
15367                 esac
15368                 ;;
15369         esac
15370         ;;
15371 esac
15372 case "$i32type" in
15373 '')     set try -DINT32
15374         if eval $compile; then
15375                 case "`$run ./try`" in
15376                 int32_t)
15377                         i32type=int32_t
15378                         u32type=uint32_t
15379                         i32size=4
15380                         u32size=4
15381                         ;;
15382                 esac
15383         fi
15384         ;;
15385 esac
15386 case "$i32type" in
15387 '')     if $test $intsize -ge 4; then
15388                 i32type=int
15389                 u32type="unsigned int"
15390                 i32size=$intsize
15391                 u32size=$intsize
15392         fi
15393         ;;
15394 esac
15395
15396 case "$i64type" in
15397 '')     case "$d_quad:$quadtype" in
15398         define:?*)
15399                 i64type="$quadtype"
15400                 u64type="$uquadtype"
15401                 i64size=8
15402                 u64size=8
15403                 ;;
15404         esac
15405         ;;
15406 esac
15407
15408 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15409 : volatile so that the compiler has to store it out to memory.
15410 if test X"$d_volatile" = X"$define"; then
15411         volatile=volatile
15412 fi
15413 $cat <<EOP >try.c
15414 #include <stdio.h>
15415 #$i_stdlib I_STDLIB
15416 #ifdef I_STDLIB
15417 #include <stdlib.h>
15418 #endif
15419 #include <sys/types.h>
15420 #include <signal.h>
15421 #ifdef SIGFPE
15422 $volatile int bletched = 0;
15423 $signal_t blech(int s) { bletched = 1; }
15424 #endif
15425 int main() {
15426     $uvtype u = 0;
15427     $nvtype d;
15428     int     n = 8 * $uvsize;
15429     int     i;
15430 #ifdef SIGFPE
15431     signal(SIGFPE, blech);
15432 #endif
15433
15434     for (i = 0; i < n; i++) {
15435       u = u << 1 | ($uvtype)1;
15436       d = ($nvtype)u;
15437       if (($uvtype)d != u)
15438         break;
15439       if (d <= 0)
15440         break;
15441       d = ($nvtype)(u - 1);
15442       if (($uvtype)d != (u - 1))
15443         break;
15444 #ifdef SIGFPE
15445       if (bletched)
15446         break;
15447 #endif
15448     }
15449     printf("%d\n", ((i == n) ? -n : i));
15450     exit(0);
15451 }
15452 EOP
15453 set try
15454
15455 d_nv_preserves_uv="$undef"
15456 if eval $compile; then
15457         nv_preserves_uv_bits="`$run ./try`"
15458 fi
15459 case "$nv_preserves_uv_bits" in
15460 \-[1-9]*)
15461         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15462         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15463         d_nv_preserves_uv="$define"
15464         ;;
15465 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15466         d_nv_preserves_uv="$undef" ;;
15467 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15468         nv_preserves_uv_bits="0" ;;
15469 esac
15470 $rm_try
15471
15472 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15473 : volatile so that the compiler has to store it out to memory.
15474 if test X"$d_volatile" = X"$define"; then
15475         volatile=volatile
15476 fi
15477 $cat <<EOP >try.c
15478 #include <stdio.h>
15479
15480 typedef $nvtype NV;
15481
15482 int
15483 main() {
15484   NV value = 2;
15485   int count = 1;
15486
15487   while(count < 256) {
15488     $volatile NV up = value + 1.0;
15489     $volatile NV negated = -value;
15490     $volatile NV down = negated - 1.0;
15491     $volatile NV got_up = up - value;
15492     int up_good = got_up == 1.0;
15493     int got_down = down - negated;
15494     int down_good = got_down == -1.0;
15495
15496     if (down_good != up_good) {
15497       fprintf(stderr,
15498               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15499               up_good, (double) got_up, down_good, (double) got_down,
15500               count, (double) value);
15501       return 1;
15502     }
15503     if (!up_good) {
15504       while (1) {
15505         if (count > 8) {
15506           count -= 8;
15507           fputs("256.0", stdout);
15508         } else {
15509           count--;
15510           fputs("2.0", stdout);
15511         }
15512         if (!count) {
15513           puts("");
15514           return 0;
15515         }
15516         fputs("*", stdout);
15517       }
15518     }
15519     value *= 2;
15520     ++count;
15521   }
15522   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15523           count, (double) value);
15524   return 1;
15525 }
15526 EOP
15527 set try
15528
15529 nv_overflows_integers_at='0'
15530 if eval $compile; then
15531     xxx="`$run ./try`"
15532     case "$?" in
15533         0)
15534             case "$xxx" in
15535                 2*)  cat >&4 <<EOM
15536 The largest integer your NVs can preserve is equal to $xxx
15537 EOM
15538                     nv_overflows_integers_at="$xxx"
15539                     ;;
15540                 *)  cat >&4 <<EOM
15541 Cannot determine the largest integer value your NVs can hold, unexpected output
15542 '$xxx'
15543 EOM
15544                     ;;
15545             esac
15546             ;;
15547         *)  cat >&4 <<EOM
15548 Cannot determine the largest integer value your NVs can hold
15549 EOM
15550             ;;
15551     esac
15552 fi
15553 $rm_try
15554
15555 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15556 : volatile so that the compiler has to store it out to memory.
15557 if test X"$d_volatile" = X"$define"; then
15558         volatile=volatile
15559 fi
15560 $cat <<EOP >try.c
15561 #include <stdio.h>
15562 #$i_stdlib I_STDLIB
15563 #ifdef I_STDLIB
15564 #include <stdlib.h>
15565 #endif
15566 #$i_string I_STRING
15567 #ifdef I_STRING
15568 #  include <string.h>
15569 #else
15570 #  include <strings.h>
15571 #endif
15572 #include <sys/types.h>
15573 #include <signal.h>
15574 #ifdef SIGFPE
15575 $volatile int bletched = 0;
15576 $signal_t blech(int s) { bletched = 1; }
15577 #endif
15578
15579 int checkit($nvtype d, char *where) {
15580     unsigned char *p = (char *)&d;
15581     unsigned char *end = p + sizeof(d);
15582     int fail = 0;
15583
15584     while (p < end)
15585         fail += *p++;
15586
15587     if (!fail)
15588         return 0;
15589
15590     p = (char *)&d;
15591     printf("No - %s: 0x", where);
15592     while (p < end)
15593         printf ("%02X", *p++);
15594     printf("\n");
15595     return 1;
15596 }
15597
15598 int main(int argc, char **argv) {
15599     $nvtype d = 0.0;
15600     int fail = 0;
15601     fail += checkit(d, "0.0");
15602
15603     /* The compiler shouldn't be assuming that bletched is 0  */
15604     d = bletched;
15605
15606     fail += checkit(d, "bleched");
15607
15608 #ifdef SIGFPE
15609     signal(SIGFPE, blech);
15610 #endif
15611
15612     /* Paranoia - the compiler should have no way of knowing that ANSI says
15613        that argv[argc] will always be NULL.  Actually, if it did assume this it
15614        would be buggy, as this is C and main() can be called from elsewhere in
15615        the program.  */
15616     d = argv[argc] ? 1 : 0;
15617
15618     if (d) {
15619         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15620     }
15621
15622     fail += checkit(d, "ternary");
15623
15624     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15625
15626     if (d != 0.0) {
15627         printf("No - memset doesn't give 0.0\n");
15628         /* This might just blow up:  */
15629         printf("(gives %g)\n", d);
15630         return 1;
15631     }
15632
15633 #ifdef SIGFPE
15634     if (bletched) {
15635         printf("No - something bleched\n");
15636         return 1;
15637     }
15638 #endif
15639     if (fail) {
15640       printf("No - %d fail(s)\n", fail);
15641       return 1;
15642     }
15643     printf("Yes\n");
15644     return 0;
15645 }
15646 EOP
15647 set try
15648
15649 d_nv_zero_is_allbits_zero="$undef"
15650 if eval $compile; then
15651     xxx="`$run ./try`"
15652     case "$?" in
15653         0)
15654             case "$xxx" in
15655                 Yes)  cat >&4 <<EOM
15656 0.0 is represented as all bits zero in memory
15657 EOM
15658                     d_nv_zero_is_allbits_zero="$define"
15659                     ;;
15660                 *)  cat >&4 <<EOM
15661 0.0 is not represented as all bits zero in memory
15662 EOM
15663                     d_nv_zero_is_allbits_zero="$undef"
15664                     ;;
15665             esac
15666             ;;
15667         *)  cat >&4 <<EOM
15668 0.0 is not represented as all bits zero in memory
15669 EOM
15670             d_nv_zero_is_allbits_zero="$undef"
15671             ;;
15672     esac
15673 fi
15674 $rm_try
15675
15676 : check for off64_t
15677 echo " "
15678 echo "Checking to see if you have off64_t..." >&4
15679 $cat >try.c <<EOCP
15680 #include <sys/types.h>
15681 #include <unistd.h>
15682 int main() { off64_t x = 7; }
15683 EOCP
15684 set try
15685 if eval $compile; then
15686         val="$define"
15687         echo "You have off64_t."
15688 else
15689         val="$undef"
15690         echo "You do not have off64_t."
15691         case "$lseeksize" in
15692         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15693         esac
15694 fi
15695 $rm_try
15696 set d_off64_t
15697 eval $setvar
15698
15699 : how to create joinable pthreads
15700 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15701         echo " "
15702         echo "Checking what constant to use for creating joinable pthreads..." >&4
15703         $cat >try.c <<'EOCP'
15704 #include <pthread.h>
15705 int main() {
15706     int detachstate = JOINABLE;
15707 }
15708 EOCP
15709         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15710         if eval $compile; then
15711                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15712                 val="$undef" # Yes, undef.
15713                 set d_old_pthread_create_joinable
15714                 eval $setvar
15715                 val=""
15716                 set old_pthread_create_joinable
15717                 eval $setvar
15718         else
15719                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15720                 if eval $compile; then
15721                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15722                         val="$define"
15723                         set d_old_pthread_create_joinable
15724                         eval $setvar
15725                         val=PTHREAD_CREATE_UNDETACHED
15726                         set old_pthread_create_joinable
15727                         eval $setvar
15728                 else
15729                         set try -DJOINABLE=__UNDETACHED
15730                         if eval $compile; then
15731                                 echo "You seem to use __UNDETACHED." >&4
15732                                 val="$define"
15733                                 set d_old_pthread_create_joinable
15734                                 eval $setvar
15735                                 val=__UNDETACHED
15736                                 set old_pthread_create_joinable
15737                                 eval $setvar
15738                         else
15739                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15740                                 val="$define"
15741                                 set d_old_pthread_create_joinable
15742                                 eval $setvar
15743                                 val=0
15744                                 set old_pthread_create_joinable
15745                                 eval $setvar
15746                         fi
15747                 fi
15748         fi
15749         $rm_try
15750 else
15751     d_old_pthread_create_joinable="$undef"
15752     old_pthread_create_joinable=""
15753 fi
15754
15755 : see if pause exists
15756 set pause d_pause
15757 eval $inlibc
15758
15759 : see if poll exists
15760 set poll d_poll
15761 eval $inlibc
15762
15763 : see if readlink exists
15764 set readlink d_readlink
15765 eval $inlibc
15766
15767 : Check if exe is symlink to abs path of executing program
15768 echo " "
15769 procselfexe=''
15770 val="$undef"
15771 case "$d_readlink" in
15772 "$define")
15773         if $issymlink /proc/self/exe ; then
15774                 $ls -l /proc/self/exe > reflect
15775                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15776                         echo "You have Linux-like /proc/self/exe."
15777                         procselfexe='"/proc/self/exe"'
15778                         val="$define"
15779                 fi
15780         fi
15781         if $issymlink /proc/curproc/file ; then
15782                 $ls -l /proc/curproc/file > reflect
15783                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15784                         echo "You have BSD-like /proc/curproc/file."
15785                         procselfexe='"/proc/curproc/file"'
15786                         val="$define"
15787                 fi
15788         fi
15789         ;;
15790 esac
15791 $rm -f reflect
15792 set d_procselfexe
15793 eval $setvar
15794
15795 : backward compatibility for d_hvfork
15796 if test X$d_hvfork != X; then
15797         d_vfork="$d_hvfork"
15798         d_hvfork=''
15799 fi
15800 : see if there is a vfork
15801 val=''
15802 set vfork val
15803 eval $inlibc
15804
15805 d_pseudofork=$undef
15806
15807 : Ok, but do we want to use it. vfork is reportedly unreliable in
15808 : perl on Solaris 2.x, and probably elsewhere.
15809 case "$val" in
15810 $define)
15811         echo " "
15812         case "$usevfork" in
15813         false) dflt='n';;
15814         *) dflt='y';;
15815         esac
15816         cat <<'EOM'
15817
15818 Perl can only use a vfork() that doesn't suffer from strict
15819 restrictions on calling functions or modifying global data in
15820 the child.  For example, glibc-2.1 contains such a vfork()
15821 that is unsuitable.  If your system provides a proper fork()
15822 call, chances are that you do NOT want perl to use vfork().
15823
15824 EOM
15825         rp="Do you still want to use vfork()?"
15826         . ./myread
15827         case "$ans" in
15828         y|Y) ;;
15829         *)
15830                 echo "Ok, we won't use vfork()."
15831                 val="$undef"
15832                 ;;
15833         esac
15834         ;;
15835 esac
15836 set d_vfork
15837 eval $setvar
15838 case "$d_vfork" in
15839 $define) usevfork='true';;
15840 *) usevfork='false';;
15841 esac
15842
15843 : see whether the pthread_atfork exists
15844 $cat >try.c <<EOP
15845 #include <pthread.h>
15846 #include <stdio.h>
15847 int main() {
15848 #ifdef  PTHREAD_ATFORK
15849         pthread_atfork(NULL,NULL,NULL);
15850 #endif
15851 }
15852 EOP
15853
15854 : see if pthread_atfork exists
15855 set try -DPTHREAD_ATFORK
15856 if eval $compile; then
15857     val="$define"
15858 else
15859     val="$undef"
15860 fi
15861 case "$usethreads" in
15862 $define)
15863         case "$val" in
15864         $define) echo 'pthread_atfork found.' >&4        ;;
15865         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15866         esac
15867 esac
15868 set d_pthread_atfork
15869 eval $setvar
15870
15871 : see if pthread_attr_setscope exists
15872 set pthread_attr_setscope d_pthread_attr_setscope
15873 eval $inlibc
15874
15875 : see whether the various POSIXish _yields exist
15876 $cat >try.c <<EOP
15877 #include <pthread.h>
15878 #include <stdio.h>
15879 int main() {
15880 #ifdef SCHED_YIELD
15881         sched_yield();
15882 #else
15883 #ifdef PTHREAD_YIELD
15884         pthread_yield();
15885 #else
15886 #ifdef PTHREAD_YIELD_NULL
15887         pthread_yield(NULL);
15888 #endif
15889 #endif
15890 #endif
15891 }
15892 EOP
15893 : see if sched_yield exists
15894 set try -DSCHED_YIELD
15895 if eval $compile; then
15896     val="$define"
15897     sched_yield='sched_yield()'
15898 else
15899     val="$undef"
15900 fi
15901 case "$usethreads" in
15902 $define)
15903         case "$val" in
15904         $define) echo 'sched_yield() found.' >&4        ;;
15905         *)       echo 'sched_yield() NOT found.' >&4    ;;
15906         esac
15907 esac
15908 set d_sched_yield
15909 eval $setvar
15910
15911 : see if pthread_yield exists
15912 set try -DPTHREAD_YIELD
15913 if eval $compile; then
15914     val="$define"
15915     case "$sched_yield" in
15916     '') sched_yield='pthread_yield()' ;;
15917     esac
15918 else
15919     set try -DPTHREAD_YIELD_NULL
15920     if eval $compile; then
15921         val="$define"
15922         case "$sched_yield" in
15923         '') sched_yield='pthread_yield(NULL)' ;;
15924         esac
15925     else
15926         val="$undef"
15927     fi
15928 fi
15929 case "$usethreads" in
15930 $define)
15931         case "$val" in
15932         $define) echo 'pthread_yield() found.' >&4      ;;
15933         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15934         esac
15935         ;;
15936 esac
15937 set d_pthread_yield
15938 eval $setvar
15939 case "$sched_yield" in
15940 '') sched_yield=undef ;;
15941 esac
15942 $rm_try
15943
15944 : see if random_r exists
15945 set random_r d_random_r
15946 eval $inlibc
15947 case "$d_random_r" in
15948 "$define")
15949         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15950         case "$d_random_r_proto:$usethreads" in
15951         ":define")      d_random_r_proto=define
15952                 set d_random_r_proto random_r $hdrs
15953                 eval $hasproto ;;
15954         *)      ;;
15955         esac
15956         case "$d_random_r_proto" in
15957         define)
15958         case "$random_r_proto" in
15959         ''|0) try='int random_r(int*, struct random_data*);'
15960         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15961         esac
15962         case "$random_r_proto" in
15963         ''|0) try='int random_r(long*, struct random_data*);'
15964         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15965         esac
15966         case "$random_r_proto" in
15967         ''|0) try='int random_r(struct random_data*, int32_t*);'
15968         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15969         esac
15970         case "$random_r_proto" in
15971         ''|0)   d_random_r=undef
15972                 random_r_proto=0
15973                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15974         * )     case "$random_r_proto" in
15975                 REENTRANT_PROTO*) ;;
15976                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15977                 esac
15978                 echo "Prototype: $try" ;;
15979         esac
15980         ;;
15981         *)      case "$usethreads" in
15982                 define) echo "random_r has no prototype, not using it." >&4 ;;
15983                 esac
15984                 d_random_r=undef
15985                 random_r_proto=0
15986                 ;;
15987         esac
15988         ;;
15989 *)      random_r_proto=0
15990         ;;
15991 esac
15992
15993 : see if readdir and friends exist
15994 set readdir d_readdir
15995 eval $inlibc
15996 set seekdir d_seekdir
15997 eval $inlibc
15998 set telldir d_telldir
15999 eval $inlibc
16000 set rewinddir d_rewinddir
16001 eval $inlibc
16002
16003 : see if readdir64_r exists
16004 set readdir64_r d_readdir64_r
16005 eval $inlibc
16006 case "$d_readdir64_r" in
16007 "$define")
16008         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16009         case "$d_readdir64_r_proto:$usethreads" in
16010         ":define")      d_readdir64_r_proto=define
16011                 set d_readdir64_r_proto readdir64_r $hdrs
16012                 eval $hasproto ;;
16013         *)      ;;
16014         esac
16015         case "$d_readdir64_r_proto" in
16016         define)
16017         case "$readdir64_r_proto" in
16018         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16019         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16020         esac
16021         case "$readdir64_r_proto" in
16022         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16023         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16024         esac
16025         case "$readdir64_r_proto" in
16026         ''|0)   d_readdir64_r=undef
16027                 readdir64_r_proto=0
16028                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16029         * )     case "$readdir64_r_proto" in
16030                 REENTRANT_PROTO*) ;;
16031                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16032                 esac
16033                 echo "Prototype: $try" ;;
16034         esac
16035         ;;
16036         *)      case "$usethreads" in
16037                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16038                 esac
16039                 d_readdir64_r=undef
16040                 readdir64_r_proto=0
16041                 ;;
16042         esac
16043         ;;
16044 *)      readdir64_r_proto=0
16045         ;;
16046 esac
16047
16048 : see if readdir_r exists
16049 set readdir_r d_readdir_r
16050 eval $inlibc
16051 case "$d_readdir_r" in
16052 "$define")
16053         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16054         case "$d_readdir_r_proto:$usethreads" in
16055         ":define")      d_readdir_r_proto=define
16056                 set d_readdir_r_proto readdir_r $hdrs
16057                 eval $hasproto ;;
16058         *)      ;;
16059         esac
16060         case "$d_readdir_r_proto" in
16061         define)
16062         case "$readdir_r_proto" in
16063         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16064         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16065         esac
16066         case "$readdir_r_proto" in
16067         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16068         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16069         esac
16070         case "$readdir_r_proto" in
16071         ''|0)   d_readdir_r=undef
16072                 readdir_r_proto=0
16073                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16074         * )     case "$readdir_r_proto" in
16075                 REENTRANT_PROTO*) ;;
16076                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16077                 esac
16078                 echo "Prototype: $try" ;;
16079         esac
16080         ;;
16081         *)      case "$usethreads" in
16082                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16083                 esac
16084                 d_readdir_r=undef
16085                 readdir_r_proto=0
16086                 ;;
16087         esac
16088         ;;
16089 *)      readdir_r_proto=0
16090         ;;
16091 esac
16092
16093 : see if readv exists
16094 set readv d_readv
16095 eval $inlibc
16096
16097 : see if recvmsg exists
16098 set recvmsg d_recvmsg
16099 eval $inlibc
16100
16101 : see if rename exists
16102 set rename d_rename
16103 eval $inlibc
16104
16105 : see if rmdir exists
16106 set rmdir d_rmdir
16107 eval $inlibc
16108
16109 : see if memory.h is available.
16110 val=''
16111 set memory.h val
16112 eval $inhdr
16113
16114 : See if it conflicts with string.h
16115 case "$val" in
16116 $define)
16117         case "$strings" in
16118         '') ;;
16119         *)
16120                 $cppstdin $cppflags $cppminus < $strings > mem.h
16121                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16122                         echo " "
16123                         echo "We won't be including <memory.h>."
16124                         val="$undef"
16125                 fi
16126                 $rm -f mem.h
16127                 ;;
16128         esac
16129 esac
16130 set i_memory
16131 eval $setvar
16132
16133 : can bcopy handle overlapping blocks?
16134 echo " "
16135 val="$undef"
16136 case "$d_memmove" in
16137 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16138 *)      case "$d_bcopy" in
16139         "$define")
16140                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16141                 $cat >try.c <<EOCP
16142 #$i_memory I_MEMORY
16143 #$i_stdlib I_STDLIB
16144 #$i_string I_STRING
16145 #$i_unistd I_UNISTD
16146 EOCP
16147         $cat >>try.c <<'EOCP'
16148 #include <stdio.h>
16149 #ifdef I_MEMORY
16150 #  include <memory.h>
16151 #endif
16152 #ifdef I_STDLIB
16153 #  include <stdlib.h>
16154 #endif
16155 #ifdef I_STRING
16156 #  include <string.h>
16157 #else
16158 #  include <strings.h>
16159 #endif
16160 #ifdef I_UNISTD
16161 #  include <unistd.h>  /* Needed for NetBSD */
16162 #endif
16163 int main()
16164 {
16165 char buf[128], abc[128];
16166 char *b;
16167 int len;
16168 int off;
16169 int align;
16170
16171 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16172    try to store the string in read-only memory. */
16173 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16174
16175 for (align = 7; align >= 0; align--) {
16176         for (len = 36; len; len--) {
16177                 b = buf+align;
16178                 bcopy(abc, b, len);
16179                 for (off = 1; off <= len; off++) {
16180                         bcopy(b, b+off, len);
16181                         bcopy(b+off, b, len);
16182                         if (bcmp(b, abc, len))
16183                                 exit(1);
16184                 }
16185         }
16186 }
16187 exit(0);
16188 }
16189 EOCP
16190                 set try
16191                 if eval $compile_ok; then
16192                         if $run ./try 2>/dev/null; then
16193                                 echo "Yes, it can."
16194                                 val="$define"
16195                         else
16196                                 echo "It can't, sorry."
16197                         fi
16198                 else
16199                         echo "(I can't compile the test program, so we'll assume not...)"
16200                 fi
16201                 ;;
16202         esac
16203         $rm_try
16204         ;;
16205 esac
16206 set d_safebcpy
16207 eval $setvar
16208
16209 : can memcpy handle overlapping blocks?
16210 echo " "
16211 val="$undef"
16212 case "$d_memmove" in
16213 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16214 *)      case "$d_memcpy" in
16215         "$define")
16216                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16217                 $cat >try.c <<EOCP
16218 #$i_memory I_MEMORY
16219 #$i_stdlib I_STDLIB
16220 #$i_string I_STRING
16221 #$i_unistd I_UNISTD
16222 EOCP
16223         $cat >>try.c <<'EOCP'
16224 #include <stdio.h>
16225 #ifdef I_MEMORY
16226 #  include <memory.h>
16227 #endif
16228 #ifdef I_STDLIB
16229 #  include <stdlib.h>
16230 #endif
16231 #ifdef I_STRING
16232 #  include <string.h>
16233 #else
16234 #  include <strings.h>
16235 #endif
16236 #ifdef I_UNISTD
16237 #  include <unistd.h>  /* Needed for NetBSD */
16238 #endif
16239 int main()
16240 {
16241 char buf[128], abc[128];
16242 char *b;
16243 int len;
16244 int off;
16245 int align;
16246
16247 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16248    try to store the string in read-only memory. */
16249 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16250
16251 for (align = 7; align >= 0; align--) {
16252         for (len = 36; len; len--) {
16253                 b = buf+align;
16254                 memcpy(b, abc, len);
16255                 for (off = 1; off <= len; off++) {
16256                         memcpy(b+off, b, len);
16257                         memcpy(b, b+off, len);
16258                         if (memcmp(b, abc, len))
16259                                 exit(1);
16260                 }
16261         }
16262 }
16263 exit(0);
16264 }
16265 EOCP
16266                 set try
16267                 if eval $compile_ok; then
16268                         if $run ./try 2>/dev/null; then
16269                                 echo "Yes, it can."
16270                                 val="$define"
16271                         else
16272                                 echo "It can't, sorry."
16273                         fi
16274                 else
16275                         echo "(I can't compile the test program, so we'll assume not...)"
16276                 fi
16277                 ;;
16278         esac
16279         $rm_try
16280         ;;
16281 esac
16282 set d_safemcpy
16283 eval $setvar
16284
16285 : can memcmp be trusted to compare relative magnitude?
16286 val="$undef"
16287 case "$d_memcmp" in
16288 "$define")
16289         echo " "
16290         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16291         $cat >try.c <<EOCP
16292 #$i_memory I_MEMORY
16293 #$i_stdlib I_STDLIB
16294 #$i_string I_STRING
16295 #$i_unistd I_UNISTD
16296 EOCP
16297         $cat >>try.c <<'EOCP'
16298 #include <stdio.h>
16299 #ifdef I_MEMORY
16300 #  include <memory.h>
16301 #endif
16302 #ifdef I_STDLIB
16303 #  include <stdlib.h>
16304 #endif
16305 #ifdef I_STRING
16306 #  include <string.h>
16307 #else
16308 #  include <strings.h>
16309 #endif
16310 #ifdef I_UNISTD
16311 #  include <unistd.h>  /* Needed for NetBSD */
16312 #endif
16313 int main()
16314 {
16315 char a = -1;
16316 char b = 0;
16317 if ((a < b) && memcmp(&a, &b, 1) < 0)
16318         exit(1);
16319 exit(0);
16320 }
16321 EOCP
16322         set try
16323         if eval $compile_ok; then
16324                 if $run ./try 2>/dev/null; then
16325                         echo "Yes, it can."
16326                         val="$define"
16327                 else
16328                         echo "No, it can't (it uses signed chars)."
16329                 fi
16330         else
16331                 echo "(I can't compile the test program, so we'll assume not...)"
16332         fi
16333         ;;
16334 esac
16335 $rm_try
16336 set d_sanemcmp
16337 eval $setvar
16338
16339 : see if prototype for sbrk is available
16340 echo " "
16341 set d_sbrkproto sbrk $i_unistd unistd.h
16342 eval $hasproto
16343
16344 : see if select exists
16345 set select d_select
16346 eval $inlibc
16347
16348 : see if semctl exists
16349 set semctl d_semctl
16350 eval $inlibc
16351
16352 : see if semget exists
16353 set semget d_semget
16354 eval $inlibc
16355
16356 : see if semop exists
16357 set semop d_semop
16358 eval $inlibc
16359
16360 : see how much of the 'sem*(2)' library is present.
16361 h_sem=true
16362 echo " "
16363 case "$d_semctl$d_semget$d_semop" in
16364 *"$undef"*) h_sem=false;;
16365 esac
16366 case "$osname" in
16367 freebsd)
16368     case "`ipcs 2>&1`" in
16369     "SVID messages"*"not configured"*)
16370         echo "Your $osname does not have the sem*(2) configured." >&4
16371         h_sem=false
16372         val="$undef"
16373         set semctl d_semctl
16374         eval $setvar
16375         set semget d_semget
16376         eval $setvar
16377         set semop d_semop
16378         eval $setvar
16379         ;;
16380     esac
16381     ;;
16382 esac
16383 : we could also check for sys/ipc.h ...
16384 if $h_sem && $test `./findhdr sys/sem.h`; then
16385         echo "You have the full sem*(2) library." >&4
16386         val="$define"
16387 else
16388         echo "You don't have the full sem*(2) library." >&4
16389         val="$undef"
16390 fi
16391 set d_sem
16392 eval $setvar
16393
16394 : see whether sys/sem.h defines union semun
16395 echo " "
16396 $cat > try.c <<'END'
16397 #include <sys/types.h>
16398 #include <sys/ipc.h>
16399 #include <sys/sem.h>
16400 int main () { union semun semun; semun.buf = 0; }
16401 END
16402 set try
16403 if eval $compile; then
16404     echo "You have union semun in <sys/sem.h>." >&4
16405     val="$define"
16406 else
16407     echo "You do not have union semun in <sys/sem.h>." >&4
16408     val="$undef"
16409 fi
16410 $rm_try
16411 set d_union_semun
16412 eval $setvar
16413
16414 : see how to do semctl IPC_STAT
16415 case "$d_sem" in
16416 $define)
16417     echo " "
16418     $cat > tryh.h <<END
16419 #ifndef S_IRUSR
16420 #   ifdef S_IREAD
16421 #       define S_IRUSR S_IREAD
16422 #       define S_IWUSR S_IWRITE
16423 #       define S_IXUSR S_IEXEC
16424 #   else
16425 #       define S_IRUSR 0400
16426 #       define S_IWUSR 0200
16427 #       define S_IXUSR 0100
16428 #   endif
16429 #   define S_IRGRP (S_IRUSR>>3)
16430 #   define S_IWGRP (S_IWUSR>>3)
16431 #   define S_IXGRP (S_IXUSR>>3)
16432 #   define S_IROTH (S_IRUSR>>6)
16433 #   define S_IWOTH (S_IWUSR>>6)
16434 #   define S_IXOTH (S_IXUSR>>6)
16435 #endif
16436 #ifndef S_IRWXU
16437 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16438 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16439 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16440 #endif
16441 END
16442     : see whether semctl IPC_STAT can use union semun
16443     case "$d_semctl_semun" in
16444     '')
16445       val="$undef"
16446       $cat > try.c <<END
16447 #include <sys/types.h>
16448 #include <sys/ipc.h>
16449 #include <sys/sem.h>
16450 #include <sys/stat.h>
16451 #include <stdio.h>
16452 #include <errno.h>
16453 #include "tryh.h"
16454 #ifndef errno
16455 extern int errno;
16456 #endif
16457 #$d_union_semun HAS_UNION_SEMUN
16458 int main() {
16459     union semun
16460 #ifndef HAS_UNION_SEMUN
16461     {
16462         int val;
16463         struct semid_ds *buf;
16464         unsigned short *array;
16465     }
16466 #endif
16467     arg;
16468     int sem, st;
16469
16470 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16471     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16472     if (sem > -1) {
16473         struct semid_ds argbuf;
16474         arg.buf = &argbuf;
16475 #       ifdef IPC_STAT
16476         st = semctl(sem, 0, IPC_STAT, arg);
16477         if (st == 0)
16478             printf("semun\n");
16479         else
16480 #       endif /* IPC_STAT */
16481             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16482 #       ifdef IPC_RMID
16483         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16484 #       endif /* IPC_RMID */
16485             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16486     } else
16487 #endif /* IPC_PRIVATE && ... */
16488         printf("semget failed: errno = %d\n", errno);
16489   return 0;
16490 }
16491 END
16492       set try
16493       if eval $compile; then
16494           xxx=`$run ./try`
16495           case "$xxx" in
16496           semun) val="$define" ;;
16497           esac
16498       fi
16499       $rm_try
16500       set d_semctl_semun
16501       eval $setvar
16502       ;;
16503     esac
16504     case "$d_semctl_semun" in
16505     $define)
16506         echo "You can use union semun for semctl IPC_STAT." >&4
16507         also='also'
16508         ;;
16509     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16510         also=''
16511         ;;
16512     esac
16513
16514     : see whether semctl IPC_STAT can use struct semid_ds pointer
16515     case "$d_semctl_semid_ds" in
16516     '')
16517       val="$undef"
16518       $cat > try.c <<'END'
16519 #include <sys/types.h>
16520 #include <sys/ipc.h>
16521 #include <sys/sem.h>
16522 #include <sys/stat.h>
16523 #include "tryh.h"
16524 #include <stdio.h>
16525 #include <errno.h>
16526 #ifndef errno
16527 extern int errno;
16528 #endif
16529 int main() {
16530     struct semid_ds arg;
16531     int sem, st;
16532
16533 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16534     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16535     if (sem > -1) {
16536 #       ifdef IPC_STAT
16537         st = semctl(sem, 0, IPC_STAT, &arg);
16538         if (st == 0)
16539             printf("semid_ds\n");
16540         else
16541 #       endif /* IPC_STAT */
16542             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16543 #       ifdef IPC_RMID
16544         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16545 #       endif /* IPC_RMID */
16546             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16547     } else
16548 #endif /* IPC_PRIVATE && ... */
16549         printf("semget failed: errno = %d\n", errno);
16550
16551     return 0;
16552 }
16553 END
16554       set try
16555       if eval $compile; then
16556           xxx=`$run ./try`
16557           case "$xxx" in
16558           semid_ds) val="$define" ;;
16559           esac
16560       fi
16561       $rm_try
16562       set d_semctl_semid_ds
16563       eval $setvar
16564       ;;
16565     esac
16566     case "$d_semctl_semid_ds" in
16567     $define)
16568         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16569         ;;
16570     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16571         ;;
16572     esac
16573     ;;
16574 *)  val="$undef"
16575
16576     # We do not have the full sem*(2) library, so assume we can not
16577     # use either.
16578
16579     set d_semctl_semun
16580     eval $setvar
16581
16582     set d_semctl_semid_ds
16583     eval $setvar
16584     ;;
16585 esac
16586 $rm_try tryh.h
16587
16588 : see if sendmsg exists
16589 set sendmsg d_sendmsg
16590 eval $inlibc
16591
16592 : see if setegid exists
16593 set setegid d_setegid
16594 eval $inlibc
16595
16596 : see if seteuid exists
16597 set seteuid d_seteuid
16598 eval $inlibc
16599
16600 : see if setgrent exists
16601 set setgrent d_setgrent
16602 eval $inlibc
16603
16604 : see if setgrent_r exists
16605 set setgrent_r d_setgrent_r
16606 eval $inlibc
16607 case "$d_setgrent_r" in
16608 "$define")
16609         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16610         case "$d_setgrent_r_proto:$usethreads" in
16611         ":define")      d_setgrent_r_proto=define
16612                 set d_setgrent_r_proto setgrent_r $hdrs
16613                 eval $hasproto ;;
16614         *)      ;;
16615         esac
16616         case "$d_setgrent_r_proto" in
16617         define)
16618         case "$setgrent_r_proto" in
16619         ''|0) try='int setgrent_r(FILE**);'
16620         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16621         esac
16622         case "$setgrent_r_proto" in
16623         ''|0) try='void setgrent_r(FILE**);'
16624         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16625         esac
16626         case "$setgrent_r_proto" in
16627         ''|0)   d_setgrent_r=undef
16628                 setgrent_r_proto=0
16629                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16630         * )     case "$setgrent_r_proto" in
16631                 REENTRANT_PROTO*) ;;
16632                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16633                 esac
16634                 echo "Prototype: $try" ;;
16635         esac
16636         ;;
16637         *)      case "$usethreads" in
16638                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16639                 esac
16640                 d_setgrent_r=undef
16641                 setgrent_r_proto=0
16642                 ;;
16643         esac
16644         ;;
16645 *)      setgrent_r_proto=0
16646         ;;
16647 esac
16648
16649 : see if sethostent exists
16650 set sethostent d_sethent
16651 eval $inlibc
16652
16653 : see if sethostent_r exists
16654 set sethostent_r d_sethostent_r
16655 eval $inlibc
16656 case "$d_sethostent_r" in
16657 "$define")
16658         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16659         case "$d_sethostent_r_proto:$usethreads" in
16660         ":define")      d_sethostent_r_proto=define
16661                 set d_sethostent_r_proto sethostent_r $hdrs
16662                 eval $hasproto ;;
16663         *)      ;;
16664         esac
16665         case "$d_sethostent_r_proto" in
16666         define)
16667         case "$sethostent_r_proto" in
16668         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16669         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16670         esac
16671         case "$sethostent_r_proto" in
16672         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16673         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16674         esac
16675         case "$sethostent_r_proto" in
16676         ''|0)   d_sethostent_r=undef
16677                 sethostent_r_proto=0
16678                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16679         * )     case "$sethostent_r_proto" in
16680                 REENTRANT_PROTO*) ;;
16681                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16682                 esac
16683                 echo "Prototype: $try" ;;
16684         esac
16685         ;;
16686         *)      case "$usethreads" in
16687                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16688                 esac
16689                 d_sethostent_r=undef
16690                 sethostent_r_proto=0
16691                 ;;
16692         esac
16693         ;;
16694 *)      sethostent_r_proto=0
16695         ;;
16696 esac
16697
16698 : see if setitimer exists
16699 set setitimer d_setitimer
16700 eval $inlibc
16701
16702 : see if setlinebuf exists
16703 set setlinebuf d_setlinebuf
16704 eval $inlibc
16705
16706 : see if setlocale exists
16707 set setlocale d_setlocale
16708 eval $inlibc
16709
16710 : see if locale.h is available
16711 set locale.h i_locale
16712 eval $inhdr
16713
16714 : see if setlocale_r exists
16715 set setlocale_r d_setlocale_r
16716 eval $inlibc
16717 case "$d_setlocale_r" in
16718 "$define")
16719         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16720         case "$d_setlocale_r_proto:$usethreads" in
16721         ":define")      d_setlocale_r_proto=define
16722                 set d_setlocale_r_proto setlocale_r $hdrs
16723                 eval $hasproto ;;
16724         *)      ;;
16725         esac
16726         case "$d_setlocale_r_proto" in
16727         define)
16728         case "$setlocale_r_proto" in
16729         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16730         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16731         esac
16732         case "$setlocale_r_proto" in
16733         ''|0)   d_setlocale_r=undef
16734                 setlocale_r_proto=0
16735                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16736         * )     case "$setlocale_r_proto" in
16737                 REENTRANT_PROTO*) ;;
16738                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16739                 esac
16740                 echo "Prototype: $try" ;;
16741         esac
16742         ;;
16743         *)      case "$usethreads" in
16744                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16745                 esac
16746                 d_setlocale_r=undef
16747                 setlocale_r_proto=0
16748                 ;;
16749         esac
16750         ;;
16751 *)      setlocale_r_proto=0
16752         ;;
16753 esac
16754
16755 : see if setnetent exists
16756 set setnetent d_setnent
16757 eval $inlibc
16758
16759 : see if setnetent_r exists
16760 set setnetent_r d_setnetent_r
16761 eval $inlibc
16762 case "$d_setnetent_r" in
16763 "$define")
16764         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16765         case "$d_setnetent_r_proto:$usethreads" in
16766         ":define")      d_setnetent_r_proto=define
16767                 set d_setnetent_r_proto setnetent_r $hdrs
16768                 eval $hasproto ;;
16769         *)      ;;
16770         esac
16771         case "$d_setnetent_r_proto" in
16772         define)
16773         case "$setnetent_r_proto" in
16774         ''|0) try='int setnetent_r(int, struct netent_data*);'
16775         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16776         esac
16777         case "$setnetent_r_proto" in
16778         ''|0) try='void setnetent_r(int, struct netent_data*);'
16779         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16780         esac
16781         case "$setnetent_r_proto" in
16782         ''|0)   d_setnetent_r=undef
16783                 setnetent_r_proto=0
16784                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16785         * )     case "$setnetent_r_proto" in
16786                 REENTRANT_PROTO*) ;;
16787                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16788                 esac
16789                 echo "Prototype: $try" ;;
16790         esac
16791         ;;
16792         *)      case "$usethreads" in
16793                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16794                 esac
16795                 d_setnetent_r=undef
16796                 setnetent_r_proto=0
16797                 ;;
16798         esac
16799         ;;
16800 *)      setnetent_r_proto=0
16801         ;;
16802 esac
16803
16804 : see if setprotoent exists
16805 set setprotoent d_setpent
16806 eval $inlibc
16807
16808 : see if setpgid exists
16809 set setpgid d_setpgid
16810 eval $inlibc
16811
16812 : see if setpgrp2 exists
16813 set setpgrp2 d_setpgrp2
16814 eval $inlibc
16815
16816 : see if setpriority exists
16817 set setpriority d_setprior
16818 eval $inlibc
16819
16820 : see if setproctitle exists
16821 set setproctitle d_setproctitle
16822 eval $inlibc
16823
16824 : see if setprotoent_r exists
16825 set setprotoent_r d_setprotoent_r
16826 eval $inlibc
16827 case "$d_setprotoent_r" in
16828 "$define")
16829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16830         case "$d_setprotoent_r_proto:$usethreads" in
16831         ":define")      d_setprotoent_r_proto=define
16832                 set d_setprotoent_r_proto setprotoent_r $hdrs
16833                 eval $hasproto ;;
16834         *)      ;;
16835         esac
16836         case "$d_setprotoent_r_proto" in
16837         define)
16838         case "$setprotoent_r_proto" in
16839         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16840         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16841         esac
16842         case "$setprotoent_r_proto" in
16843         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16844         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16845         esac
16846         case "$setprotoent_r_proto" in
16847         ''|0)   d_setprotoent_r=undef
16848                 setprotoent_r_proto=0
16849                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16850         * )     case "$setprotoent_r_proto" in
16851                 REENTRANT_PROTO*) ;;
16852                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16853                 esac
16854                 echo "Prototype: $try" ;;
16855         esac
16856         ;;
16857         *)      case "$usethreads" in
16858                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16859                 esac
16860                 d_setprotoent_r=undef
16861                 setprotoent_r_proto=0
16862                 ;;
16863         esac
16864         ;;
16865 *)      setprotoent_r_proto=0
16866         ;;
16867 esac
16868
16869 : see if setpwent exists
16870 set setpwent d_setpwent
16871 eval $inlibc
16872
16873 : see if setpwent_r exists
16874 set setpwent_r d_setpwent_r
16875 eval $inlibc
16876 case "$d_setpwent_r" in
16877 "$define")
16878         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16879         case "$d_setpwent_r_proto:$usethreads" in
16880         ":define")      d_setpwent_r_proto=define
16881                 set d_setpwent_r_proto setpwent_r $hdrs
16882                 eval $hasproto ;;
16883         *)      ;;
16884         esac
16885         case "$d_setpwent_r_proto" in
16886         define)
16887         case "$setpwent_r_proto" in
16888         ''|0) try='int setpwent_r(FILE**);'
16889         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16890         esac
16891         case "$setpwent_r_proto" in
16892         ''|0) try='void setpwent_r(FILE**);'
16893         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16894         esac
16895         case "$setpwent_r_proto" in
16896         ''|0)   d_setpwent_r=undef
16897                 setpwent_r_proto=0
16898                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16899         * )     case "$setpwent_r_proto" in
16900                 REENTRANT_PROTO*) ;;
16901                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16902                 esac
16903                 echo "Prototype: $try" ;;
16904         esac
16905         ;;
16906         *)      case "$usethreads" in
16907                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16908                 esac
16909                 d_setpwent_r=undef
16910                 setpwent_r_proto=0
16911                 ;;
16912         esac
16913         ;;
16914 *)      setpwent_r_proto=0
16915         ;;
16916 esac
16917
16918 : see if setregid exists
16919 set setregid d_setregid
16920 eval $inlibc
16921 set setresgid d_setresgid
16922 eval $inlibc
16923
16924 : see if setreuid exists
16925 set setreuid d_setreuid
16926 eval $inlibc
16927 set setresuid d_setresuid
16928 eval $inlibc
16929
16930 : see if setrgid exists
16931 set setrgid d_setrgid
16932 eval $inlibc
16933
16934 : see if setruid exists
16935 set setruid d_setruid
16936 eval $inlibc
16937
16938 : see if setservent exists
16939 set setservent d_setsent
16940 eval $inlibc
16941
16942 : see if setservent_r exists
16943 set setservent_r d_setservent_r
16944 eval $inlibc
16945 case "$d_setservent_r" in
16946 "$define")
16947         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16948         case "$d_setservent_r_proto:$usethreads" in
16949         ":define")      d_setservent_r_proto=define
16950                 set d_setservent_r_proto setservent_r $hdrs
16951                 eval $hasproto ;;
16952         *)      ;;
16953         esac
16954         case "$d_setservent_r_proto" in
16955         define)
16956         case "$setservent_r_proto" in
16957         ''|0) try='int setservent_r(int, struct servent_data*);'
16958         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16959         esac
16960         case "$setservent_r_proto" in
16961         ''|0) try='void setservent_r(int, struct servent_data*);'
16962         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16963         esac
16964         case "$setservent_r_proto" in
16965         ''|0)   d_setservent_r=undef
16966                 setservent_r_proto=0
16967                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16968         * )     case "$setservent_r_proto" in
16969                 REENTRANT_PROTO*) ;;
16970                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16971                 esac
16972                 echo "Prototype: $try" ;;
16973         esac
16974         ;;
16975         *)      case "$usethreads" in
16976                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16977                 esac
16978                 d_setservent_r=undef
16979                 setservent_r_proto=0
16980                 ;;
16981         esac
16982         ;;
16983 *)      setservent_r_proto=0
16984         ;;
16985 esac
16986
16987 : see if setsid exists
16988 set setsid d_setsid
16989 eval $inlibc
16990
16991 : see if setvbuf exists
16992 set setvbuf d_setvbuf
16993 eval $inlibc
16994
16995 : see if sfio.h is available
16996 set sfio.h i_sfio
16997 eval $inhdr
16998
16999 : see if sfio library is available
17000 case "$i_sfio" in
17001 $define)
17002         val=''
17003         set sfreserve val
17004         eval $inlibc
17005         ;;
17006 *)
17007         val="$undef"
17008         ;;
17009 esac
17010 : Ok, but do we want to use it.
17011 case "$val" in
17012 $define)
17013         case "$usesfio" in
17014         true|$define|[yY]*) dflt='y';;
17015         *) dflt='n';;
17016         esac
17017         echo "$package can use the sfio library, but it is experimental."
17018         case "$useperlio" in
17019         "$undef")
17020             echo "For sfio also the PerlIO abstraction layer is needed."
17021             echo "Earlier you said you wouldn't want that."
17022             ;;
17023         esac
17024         rp="You seem to have sfio available, do you want to try using it?"
17025         . ./myread
17026         case "$ans" in
17027         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17028                 useperlio="$define"
17029                 val="$define"
17030                 ;;
17031         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17032                 val="$undef"
17033                 ;;
17034         esac
17035         ;;
17036 *)      case "$usesfio" in
17037         true|$define|[yY]*)
17038                 echo "Sorry, cannot find sfio on this machine." >&4
17039                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17040                 val="$undef"
17041                 ;;
17042         esac
17043         ;;
17044 esac
17045 set d_sfio
17046 eval $setvar
17047 case "$d_sfio" in
17048 $define) usesfio='true';;
17049 *) usesfio='false';;
17050 esac
17051 case "$d_sfio" in
17052 $define) ;;
17053 *)      : Remove sfio from list of libraries to use
17054         case "$libs" in
17055         *-lsfio*)
17056                 echo "Removing unneeded -lsfio from library list" >&4
17057                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17058                 shift
17059                 libs="$*"
17060                 echo "libs = $libs" >&4
17061                 ;;
17062         esac
17063 ;;
17064 esac
17065
17066
17067 : see if shmctl exists
17068 set shmctl d_shmctl
17069 eval $inlibc
17070
17071 : see if shmget exists
17072 set shmget d_shmget
17073 eval $inlibc
17074
17075 : see if shmat exists
17076 set shmat d_shmat
17077 eval $inlibc
17078 : see what shmat returns
17079 case "$d_shmat" in
17080 "$define")
17081         $cat >shmat.c <<'END'
17082 #include <sys/shm.h>
17083 void *shmat();
17084 END
17085         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17086                 shmattype='void *'
17087         else
17088                 shmattype='char *'
17089         fi
17090         echo "and it returns ($shmattype)." >&4
17091         : see if a prototype for shmat is available
17092         xxx=`./findhdr sys/shm.h`
17093         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17094         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17095                 val="$define"
17096         else
17097                 val="$undef"
17098         fi
17099         $rm -f shmat.[co]
17100         ;;
17101 *)
17102         val="$undef"
17103         ;;
17104 esac
17105 set d_shmatprototype
17106 eval $setvar
17107
17108 : see if shmdt exists
17109 set shmdt d_shmdt
17110 eval $inlibc
17111
17112 : see how much of the 'shm*(2)' library is present.
17113 h_shm=true
17114 echo " "
17115 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17116 *"$undef"*) h_shm=false;;
17117 esac
17118 case "$osname" in
17119 freebsd)
17120     case "`ipcs 2>&1`" in
17121     "SVID shared memory"*"not configured"*)
17122         echo "Your $osname does not have the shm*(2) configured." >&4
17123         h_shm=false
17124         val="$undef"
17125         set shmctl d_shmctl
17126         evat $setvar
17127         set shmget d_shmget
17128         evat $setvar
17129         set shmat d_shmat
17130         evat $setvar
17131         set shmdt d_shmdt
17132         evat $setvar
17133         ;;
17134     esac
17135     ;;
17136 esac
17137 : we could also check for sys/ipc.h ...
17138 if $h_shm && $test `./findhdr sys/shm.h`; then
17139         echo "You have the full shm*(2) library." >&4
17140         val="$define"
17141 else
17142         echo "You don't have the full shm*(2) library." >&4
17143         val="$undef"
17144 fi
17145 set d_shm
17146 eval $setvar
17147
17148 : see if we have sigaction
17149 echo " "
17150 if set sigaction val -f d_sigaction; eval $csym; $val; then
17151         echo 'sigaction() found.' >&4
17152         $cat > try.c <<EOP
17153 #include <stdio.h>
17154 #include <sys/types.h>
17155 #include <signal.h>
17156 #$i_stdlib I_STDLIB
17157 #ifdef I_STDLIB
17158 #include <stdlib.h>
17159 #endif
17160 int main()
17161 {
17162     struct sigaction act, oact;
17163     act.sa_flags = 0;
17164     oact.sa_handler = 0;
17165     /* so that act and oact are used */
17166     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17167 }
17168 EOP
17169         set try
17170         if eval $compile_ok; then
17171                 val="$define"
17172         else
17173                 echo "But you don't seem to have a useable struct sigaction." >&4
17174                 val="$undef"
17175         fi
17176 else
17177         echo 'sigaction NOT found.' >&4
17178         val="$undef"
17179 fi
17180 set d_sigaction; eval $setvar
17181 $rm_try
17182
17183 : see if this is a sunmath.h system
17184 set sunmath.h i_sunmath
17185 eval $inhdr
17186
17187 : see if signbit exists
17188 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17189 $cat >try.c <<EOCP
17190 #$i_math I_MATH
17191 #$i_sunmath I_SUNMATH
17192 #ifdef I_MATH
17193 #  include <math.h>
17194 #endif
17195 #ifdef I_SUNMATH  /* Solaris special math library */
17196 #  include <sunmath.h>
17197 #endif
17198 #define NV $nvtype
17199 int main(int argc, char **argv)
17200 {
17201     NV x = 0.0;
17202     NV y = -0.0;
17203     if ((signbit(x) == 0) && (signbit(y) != 0))
17204         return 0;
17205     else
17206         return 1;
17207 }
17208 EOCP
17209 val="$undef"
17210 set try
17211 if eval $compile; then
17212     if $run ./try; then
17213         $echo "Yes." >&4
17214         val="$define"
17215     else
17216         $echo "Signbit seems to be available, but doesn't work as I expected."
17217         $echo "I won't use it." >&4
17218         val="$undef"
17219     fi
17220 else
17221     $echo "Nope." >&4
17222     dflt="$undef"
17223 fi
17224 set d_signbit
17225 eval $setvar
17226 $rm_try
17227
17228 : see if sigprocmask exists
17229 set sigprocmask d_sigprocmask
17230 eval $inlibc
17231
17232 : see if sigsetjmp exists
17233 echo " "
17234 case "$d_sigsetjmp" in
17235 '')
17236         $cat >try.c <<EOP
17237 #include <setjmp.h>
17238 #$i_stdlib I_STDLIB
17239 #ifdef I_STDLIB
17240 #include <stdlib.h>
17241 #endif
17242 sigjmp_buf env;
17243 int set = 1;
17244 int main()
17245 {
17246         if (sigsetjmp(env,1))
17247                 exit(set);
17248         set = 0;
17249         siglongjmp(env, 1);
17250         exit(1);
17251 }
17252 EOP
17253         set try
17254         if eval $compile; then
17255                 if $run ./try >/dev/null 2>&1; then
17256                         echo "POSIX sigsetjmp found." >&4
17257                         val="$define"
17258                 else
17259                         $cat >&4 <<EOM
17260 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17261 I'll ignore them.
17262 EOM
17263                         val="$undef"
17264                 fi
17265         else
17266                 echo "sigsetjmp not found." >&4
17267                 val="$undef"
17268         fi
17269         ;;
17270 *) val="$d_sigsetjmp"
17271         case "$d_sigsetjmp" in
17272         $define) echo "POSIX sigsetjmp found." >&4;;
17273         $undef) echo "sigsetjmp not found." >&4;;
17274         esac
17275         ;;
17276 esac
17277 set d_sigsetjmp
17278 eval $setvar
17279 $rm_try
17280
17281 : see if snprintf exists
17282 set snprintf d_snprintf
17283 eval $inlibc
17284
17285 : see if vsnprintf exists
17286 set vsnprintf d_vsnprintf
17287 eval $inlibc
17288
17289 case "$d_snprintf-$d_vsnprintf" in
17290 "$define-$define")
17291     $cat <<EOM
17292 Checking whether your snprintf() and vsnprintf() work okay...
17293 EOM
17294     $cat >try.c <<'EOCP'
17295 /* v?snprintf testing logic courtesy of Russ Allbery.
17296  * According to C99:
17297  * - if the buffer is too short it still must be \0-terminated
17298  * - if the buffer is too short the potentially required length
17299  *   must be returned and not -1
17300  * - if the buffer is NULL the potentially required length
17301  *   must be returned and not -1 or core dump
17302  */
17303 #include <stdio.h>
17304 #include <stdarg.h>
17305
17306 char buf[2];
17307
17308 int test (char *format, ...)
17309 {
17310     va_list args;
17311     int count;
17312
17313     va_start (args, format);
17314     count = vsnprintf (buf, sizeof buf, format, args);
17315     va_end (args);
17316     return count;
17317 }
17318
17319 int main ()
17320 {
17321     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17322              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17323 }
17324 EOCP
17325     set try
17326     if eval $compile; then
17327         `$run ./try`
17328         case "$?" in
17329         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17330         *) cat <<EOM >&4
17331 Your snprintf() and snprintf() don't seem to be working okay.
17332 EOM
17333            d_snprintf="$undef"
17334            d_vsnprintf="$undef"
17335            ;;
17336         esac
17337     else
17338         echo "(I can't seem to compile the test program--assuming they don't)"
17339         d_snprintf="$undef"
17340         d_vsnprintf="$undef"
17341     fi
17342     $rm_try
17343     ;;
17344 esac
17345
17346 : see if sockatmark exists
17347 set sockatmark d_sockatmark
17348 eval $inlibc
17349
17350 : see if prototype for sockatmark is available
17351 echo " "
17352 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17353 eval $hasproto
17354
17355 : see if socks5_init exists
17356 set socks5_init d_socks5_init
17357 eval $inlibc
17358
17359 : see if sprintf returns the length of the string in the buffer as per ANSI
17360 $echo "Checking whether sprintf returns the length of the string..." >&4
17361 $cat <<EOP >try.c
17362 #include <stdio.h>
17363 #$i_stdlib I_STDLIB
17364 #ifdef I_STDLIB
17365 #include <stdlib.h>
17366 #endif
17367 #$i_string I_STRING
17368 #ifdef I_STRING
17369 #  include <string.h>
17370 #else
17371 #  include <strings.h>
17372 #endif
17373 #$i_math I_MATH
17374 #ifdef I_MATH
17375 #include <math.h>
17376 #endif
17377
17378 char buffer[256];
17379
17380 int check (size_t expect, int test) {
17381   size_t got = strlen(buffer);
17382   if (expect == got)
17383     return 0;
17384
17385   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17386        test, buffer);
17387   exit (test);
17388 }
17389
17390 int main(int argc, char **argv) {
17391   int test = 0;
17392
17393   check(sprintf(buffer, ""), ++test);
17394   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17395   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17396
17397   return 0;
17398 }
17399 EOP
17400 set try
17401
17402 d_sprintf_returns_strlen="$undef"
17403 if eval $compile; then
17404     xxx="`$run ./try`"
17405     case "$?" in
17406         0) cat >&4 <<EOM
17407 sprintf returns the length of the string (as ANSI says it should)
17408 EOM
17409         d_sprintf_returns_strlen="$define"
17410         ;;
17411         *) cat >&4 <<EOM
17412 sprintf does not return the length of the string (how old is this system?)
17413 EOM
17414         d_sprintf_returns_strlen="$undef"
17415         ;;
17416     esac
17417 fi
17418 $rm_try
17419
17420 : see if srand48_r exists
17421 set srand48_r d_srand48_r
17422 eval $inlibc
17423 case "$d_srand48_r" in
17424 "$define")
17425         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17426         case "$d_srand48_r_proto:$usethreads" in
17427         ":define")      d_srand48_r_proto=define
17428                 set d_srand48_r_proto srand48_r $hdrs
17429                 eval $hasproto ;;
17430         *)      ;;
17431         esac
17432         case "$d_srand48_r_proto" in
17433         define)
17434         case "$srand48_r_proto" in
17435         ''|0) try='int srand48_r(long, struct drand48_data*);'
17436         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17437         esac
17438         case "$srand48_r_proto" in
17439         ''|0)   d_srand48_r=undef
17440                 srand48_r_proto=0
17441                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17442         * )     case "$srand48_r_proto" in
17443                 REENTRANT_PROTO*) ;;
17444                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17445                 esac
17446                 echo "Prototype: $try" ;;
17447         esac
17448         ;;
17449         *)      case "$usethreads" in
17450                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17451                 esac
17452                 d_srand48_r=undef
17453                 srand48_r_proto=0
17454                 ;;
17455         esac
17456         ;;
17457 *)      srand48_r_proto=0
17458         ;;
17459 esac
17460
17461 : see if srandom_r exists
17462 set srandom_r d_srandom_r
17463 eval $inlibc
17464 case "$d_srandom_r" in
17465 "$define")
17466         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17467         case "$d_srandom_r_proto:$usethreads" in
17468         ":define")      d_srandom_r_proto=define
17469                 set d_srandom_r_proto srandom_r $hdrs
17470                 eval $hasproto ;;
17471         *)      ;;
17472         esac
17473         case "$d_srandom_r_proto" in
17474         define)
17475         case "$srandom_r_proto" in
17476         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17477         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17478         esac
17479         case "$srandom_r_proto" in
17480         ''|0)   d_srandom_r=undef
17481                 srandom_r_proto=0
17482                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17483         * )     case "$srandom_r_proto" in
17484                 REENTRANT_PROTO*) ;;
17485                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17486                 esac
17487                 echo "Prototype: $try" ;;
17488         esac
17489         ;;
17490         *)      case "$usethreads" in
17491                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17492                 esac
17493                 d_srandom_r=undef
17494                 srandom_r_proto=0
17495                 ;;
17496         esac
17497         ;;
17498 *)      srandom_r_proto=0
17499         ;;
17500 esac
17501
17502 : see if prototype for setresgid is available
17503 echo " "
17504 set d_sresgproto setresgid $i_unistd unistd.h
17505 eval $hasproto
17506
17507 : see if prototype for setresuid is available
17508 echo " "
17509 set d_sresuproto setresuid $i_unistd unistd.h
17510 eval $hasproto
17511
17512 : see if sys/stat.h is available
17513 set sys/stat.h i_sysstat
17514 eval $inhdr
17515
17516 : see if stat knows about block sizes
17517 echo " "
17518 echo "Checking to see if your struct stat has st_blocks field..." >&4
17519 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17520 eval $hasfield
17521
17522 : see if this is a sys/vfs.h system
17523 set sys/vfs.h i_sysvfs
17524 eval $inhdr
17525
17526 : see if this is a sys/statfs.h system
17527 set sys/statfs.h i_sysstatfs
17528 eval $inhdr
17529
17530 : Check for statfs_s
17531 echo " "
17532 echo "Checking to see if your system supports struct statfs..." >&4
17533 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
17534 eval $hasstruct
17535 case "$d_statfs_s" in
17536 "$define")      echo "Yes, it does."   ;;
17537 *)              echo "No, it doesn't." ;;
17538 esac
17539
17540
17541 : see if struct statfs knows about f_flags
17542 case "$d_statfs_s" in
17543 define)
17544         echo " "
17545         echo "Checking to see if your struct statfs has f_flags field..." >&4
17546         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
17547         eval $hasfield
17548         ;;
17549 *)      val="$undef"
17550         set d_statfs_f_flags
17551         eval $setvar
17552         ;;
17553 esac
17554 case "$d_statfs_f_flags" in
17555 "$define")      echo "Yes, it does."   ;;
17556 *)              echo "No, it doesn't." ;;
17557 esac
17558
17559 : Check stream access
17560 $cat >&4 <<EOM
17561 Checking how to access stdio streams by file descriptor number...
17562 EOM
17563 case "$stdio_stream_array" in
17564 '')     $cat >try.c <<EOCP
17565 #include <stdio.h>
17566 int main() {
17567   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17568     printf("yes\n");
17569 }
17570 EOCP
17571         for s in _iob __iob __sF
17572         do
17573                 set try -DSTDIO_STREAM_ARRAY=$s
17574                 if eval $compile; then
17575                         case "`$run ./try`" in
17576                         yes)    stdio_stream_array=$s; break ;;
17577                         esac
17578                 fi
17579         done
17580         $rm_try
17581 esac
17582 case "$stdio_stream_array" in
17583 '')     $cat >&4 <<EOM
17584 I can't figure out how to access stdio streams by file descriptor number.
17585 EOM
17586         d_stdio_stream_array="$undef"
17587         ;;
17588 *)      $cat >&4 <<EOM
17589 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17590 EOM
17591         d_stdio_stream_array="$define"
17592         ;;
17593 esac
17594
17595 : see if strcoll exists
17596 set strcoll d_strcoll
17597 eval $inlibc
17598
17599 : check for structure copying
17600 echo " "
17601 echo "Checking to see if your C compiler can copy structs..." >&4
17602 $cat >try.c <<'EOCP'
17603 int main()
17604 {
17605         struct blurfl {
17606                 int dyick;
17607         } foo, bar;
17608
17609         foo = bar;
17610 }
17611 EOCP
17612 if $cc -c try.c >/dev/null 2>&1 ; then
17613         val="$define"
17614         echo "Yup, it can."
17615 else
17616         val="$undef"
17617         echo "Nope, it can't."
17618 fi
17619 set d_strctcpy
17620 eval $setvar
17621 $rm_try
17622
17623 : see if strerror and/or sys_errlist[] exist
17624 echo " "
17625 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17626     if set strerror val -f d_strerror; eval $csym; $val; then
17627                 echo 'strerror() found.' >&4
17628                 d_strerror="$define"
17629                 d_strerrm='strerror(e)'
17630                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17631                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17632                         d_syserrlst="$define"
17633                 else
17634                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17635                         d_syserrlst="$undef"
17636                 fi
17637     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17638                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17639                 echo 'strerror() found in string header.' >&4
17640                 d_strerror="$define"
17641                 d_strerrm='strerror(e)'
17642                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17643                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17644                                 d_syserrlst="$define"
17645                 else
17646                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17647                         d_syserrlst="$undef"
17648                 fi
17649     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17650                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17651                 d_strerror="$undef"
17652                 d_syserrlst="$define"
17653                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17654     else
17655                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17656                 d_strerror="$undef"
17657                 d_syserrlst="$undef"
17658                 d_strerrm='"unknown"'
17659     fi
17660 fi
17661
17662 : see if strerror_r exists
17663 set strerror_r d_strerror_r
17664 eval $inlibc
17665 case "$d_strerror_r" in
17666 "$define")
17667         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17668         case "$d_strerror_r_proto:$usethreads" in
17669         ":define")      d_strerror_r_proto=define
17670                 set d_strerror_r_proto strerror_r $hdrs
17671                 eval $hasproto ;;
17672         *)      ;;
17673         esac
17674         case "$d_strerror_r_proto" in
17675         define)
17676         case "$strerror_r_proto" in
17677         ''|0) try='int strerror_r(int, char*, size_t);'
17678         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17679         esac
17680         case "$strerror_r_proto" in
17681         ''|0) try='int strerror_r(int, char*, int);'
17682         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17683         esac
17684         case "$strerror_r_proto" in
17685         ''|0) try='char* strerror_r(int, char*, size_t);'
17686         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17687         esac
17688         case "$strerror_r_proto" in
17689         ''|0)   d_strerror_r=undef
17690                 strerror_r_proto=0
17691                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17692         * )     case "$strerror_r_proto" in
17693                 REENTRANT_PROTO*) ;;
17694                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17695                 esac
17696                 echo "Prototype: $try" ;;
17697         esac
17698         ;;
17699         *)      case "$usethreads" in
17700                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17701                 esac
17702                 d_strerror_r=undef
17703                 strerror_r_proto=0
17704                 ;;
17705         esac
17706         ;;
17707 *)      strerror_r_proto=0
17708         ;;
17709 esac
17710
17711 : see if strftime exists
17712 set strftime d_strftime
17713 eval $inlibc
17714
17715 : see if strlcat exists
17716 set strlcat d_strlcat
17717 eval $inlibc
17718
17719 : see if strlcpy exists
17720 set strlcpy d_strlcpy
17721 eval $inlibc
17722
17723 : see if strtod exists
17724 set strtod d_strtod
17725 eval $inlibc
17726
17727 : see if strtol exists
17728 set strtol d_strtol
17729 eval $inlibc
17730
17731 : see if strtold exists
17732 set strtold d_strtold
17733 eval $inlibc
17734
17735 : see if strtoll exists
17736 set strtoll d_strtoll
17737 eval $inlibc
17738
17739 case "$d_longlong-$d_strtoll" in
17740 "$define-$define")
17741         $cat <<EOM
17742 Checking whether your strtoll() works okay...
17743 EOM
17744         $cat >try.c <<'EOCP'
17745 #include <errno.h>
17746 #ifdef __hpux
17747 #define strtoll __strtoll
17748 #endif
17749 #ifdef __EMX__
17750 #define strtoll _strtoll
17751 #endif
17752 #include <stdio.h>
17753 extern long long int strtoll(char *s, char **, int);
17754 static int bad = 0;
17755 int check(char *s, long long ell, int een) {
17756         long long gll;
17757         errno = 0;
17758         gll = strtoll(s, 0, 10);
17759         if (!((gll == ell) && (errno == een)))
17760                 bad++;
17761 }
17762 int main() {
17763         check(" 1",                                      1LL, 0);
17764         check(" 0",                                      0LL, 0);
17765         check("-1",                                     -1LL, 0);
17766         check("-9223372036854775808", -9223372036854775808LL, 0);
17767         check("-9223372036854775808", -9223372036854775808LL, 0);
17768         check(" 9223372036854775807",  9223372036854775807LL, 0);
17769         check("-9223372036854775808", -9223372036854775808LL, 0);
17770         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17771         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17772         if (!bad)
17773                 printf("ok\n");
17774 }
17775 EOCP
17776         set try
17777         if eval $compile; then
17778                 yyy=`$run ./try`
17779                 case "$yyy" in
17780                 ok) echo "Your strtoll() seems to be working okay." ;;
17781                 *) cat <<EOM >&4
17782 Your strtoll() doesn't seem to be working okay.
17783 EOM
17784                    d_strtoll="$undef"
17785                    ;;
17786                 esac
17787         else
17788                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17789                 d_strtoll="$undef"
17790         fi
17791         ;;
17792 esac
17793
17794 : see if strtoq exists
17795 set strtoq d_strtoq
17796 eval $inlibc
17797
17798 : see if strtoul exists
17799 set strtoul d_strtoul
17800 eval $inlibc
17801
17802 case "$d_strtoul" in
17803 "$define")
17804         $cat <<EOM
17805 Checking whether your strtoul() works okay...
17806 EOM
17807         $cat >try.c <<'EOCP'
17808 #include <errno.h>
17809 #include <stdio.h>
17810 extern unsigned long int strtoul(char *s, char **, int);
17811 static int bad = 0;
17812 void check(char *s, unsigned long eul, int een) {
17813         unsigned long gul;
17814         errno = 0;
17815         gul = strtoul(s, 0, 10);
17816         if (!((gul == eul) && (errno == een)))
17817                 bad++;
17818 }
17819 int main() {
17820         check(" 1", 1L, 0);
17821         check(" 0", 0L, 0);
17822 EOCP
17823         case "$longsize" in
17824         8)
17825             $cat >>try.c <<'EOCP'
17826         check("18446744073709551615", 18446744073709551615UL, 0);
17827         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17828 #if 0 /* strtoul() for /^-/ strings is undefined. */
17829         check("-1", 18446744073709551615UL, 0);
17830         check("-18446744073709551614", 2, 0);
17831         check("-18446744073709551615", 1, 0);
17832         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17833         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17834 #endif
17835 EOCP
17836                 ;;
17837         4)
17838                     $cat >>try.c <<'EOCP'
17839         check("4294967295", 4294967295UL, 0);
17840         check("4294967296", 4294967295UL, ERANGE);
17841 #if 0 /* strtoul() for /^-/ strings is undefined. */
17842         check("-1", 4294967295UL, 0);
17843         check("-4294967294", 2, 0);
17844         check("-4294967295", 1, 0);
17845         check("-4294967296", 4294967295UL, ERANGE);
17846         check("-4294967297", 4294967295UL, ERANGE);
17847 #endif
17848 EOCP
17849                 ;;
17850         *)
17851 : Should we write these tests to be more portable by sprintf-ing
17852 : ~0 and then manipulating that char string as input for strtol?
17853                 ;;
17854         esac
17855         $cat >>try.c <<'EOCP'
17856         if (!bad)
17857                 printf("ok\n");
17858         return 0;
17859 }
17860 EOCP
17861         set try
17862         if eval $compile; then
17863                 case "`$run ./try`" in
17864                 ok) echo "Your strtoul() seems to be working okay." ;;
17865                 *) cat <<EOM >&4
17866 Your strtoul() doesn't seem to be working okay.
17867 EOM
17868                    d_strtoul="$undef"
17869                    ;;
17870                 esac
17871         else
17872                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17873                 d_strtoul="$undef"
17874         fi
17875         ;;
17876 esac
17877
17878 : see if strtoull exists
17879 set strtoull d_strtoull
17880 eval $inlibc
17881
17882 case "$d_longlong-$d_strtoull" in
17883 "$define-$define")
17884         $cat <<EOM
17885 Checking whether your strtoull() works okay...
17886 EOM
17887         $cat >try.c <<'EOCP'
17888 #include <errno.h>
17889 #ifdef __hpux
17890 #define strtoull __strtoull
17891 #endif
17892 #include <stdio.h>
17893 extern unsigned long long int strtoull(char *s, char **, int);
17894 static int bad = 0;
17895 int check(char *s, long long eull, int een) {
17896         long long gull;
17897         errno = 0;
17898         gull = strtoull(s, 0, 10);
17899         if (!((gull == eull) && (errno == een)))
17900                 bad++;
17901 }
17902 int main() {
17903         check(" 1",                                        1LL, 0);
17904         check(" 0",                                        0LL, 0);
17905         check("18446744073709551615",  18446744073709551615ULL, 0);
17906         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17907 #if 0 /* strtoull() for /^-/ strings is undefined. */
17908         check("-1",                    18446744073709551615ULL, 0);
17909         check("-18446744073709551614",                     2LL, 0);
17910         check("-18446744073709551615",                     1LL, 0);
17911         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17912         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17913 #endif
17914         if (!bad)
17915                 printf("ok\n");
17916 }
17917 EOCP
17918         set try
17919         if eval $compile; then
17920                 case "`$run ./try`" in
17921                 ok) echo "Your strtoull() seems to be working okay." ;;
17922                 *) cat <<EOM >&4
17923 Your strtoull() doesn't seem to be working okay.
17924 EOM
17925                    d_strtoull="$undef"
17926                    ;;
17927                 esac
17928         else
17929                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17930                 d_strtoull="$undef"
17931         fi
17932         ;;
17933 esac
17934
17935 : see if strtouq exists
17936 set strtouq d_strtouq
17937 eval $inlibc
17938
17939 case "$d_strtouq" in
17940 "$define")
17941         $cat <<EOM
17942 Checking whether your strtouq() works okay...
17943 EOM
17944         $cat >try.c <<'EOCP'
17945 #include <errno.h>
17946 #include <stdio.h>
17947 extern unsigned long long int strtouq(char *s, char **, int);
17948 static int bad = 0;
17949 void check(char *s, unsigned long long eull, int een) {
17950         unsigned long long gull;
17951         errno = 0;
17952         gull = strtouq(s, 0, 10);
17953         if (!((gull == eull) && (errno == een)))
17954                 bad++;
17955 }
17956 int main() {
17957         check(" 1",                                        1LL, 0);
17958         check(" 0",                                        0LL, 0);
17959         check("18446744073709551615",  18446744073709551615ULL, 0);
17960         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17961 #if 0 /* strtouq() for /^-/ strings is undefined. */
17962         check("-1",                    18446744073709551615ULL, 0);
17963         check("-18446744073709551614",                     2LL, 0);
17964         check("-18446744073709551615",                     1LL, 0);
17965         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17966         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17967 #endif
17968         if (!bad)
17969                 printf("ok\n");
17970         return 0;
17971 }
17972 EOCP
17973         set try
17974         if eval $compile; then
17975                 case "`$run ./try`" in
17976                 ok) echo "Your strtouq() seems to be working okay." ;;
17977                 *) cat <<EOM >&4
17978 Your strtouq() doesn't seem to be working okay.
17979 EOM
17980                    d_strtouq="$undef"
17981                    ;;
17982                 esac
17983         else
17984                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17985                 d_strtouq="$undef"
17986         fi
17987         ;;
17988 esac
17989
17990 : see if strxfrm exists
17991 set strxfrm d_strxfrm
17992 eval $inlibc
17993
17994 : see if symlink exists
17995 set symlink d_symlink
17996 eval $inlibc
17997
17998 : see if syscall exists
17999 set syscall d_syscall
18000 eval $inlibc
18001
18002 : see if prototype for syscall is available
18003 echo " "
18004 set d_syscallproto syscall $i_unistd unistd.h
18005 eval $hasproto
18006
18007 : see if sysconf exists
18008 set sysconf d_sysconf
18009 eval $inlibc
18010
18011 : see if system exists
18012 set system d_system
18013 eval $inlibc
18014
18015 : see if tcgetpgrp exists
18016 set tcgetpgrp d_tcgetpgrp
18017 eval $inlibc
18018
18019 : see if tcsetpgrp exists
18020 set tcsetpgrp d_tcsetpgrp
18021 eval $inlibc
18022
18023 : see if prototype for telldir is available
18024 echo " "
18025 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18026 eval $hasproto
18027
18028 : see if time exists
18029 echo " "
18030 if test "X$d_time" = X -o X"$timetype" = X; then
18031     if set time val -f d_time; eval $csym; $val; then
18032                 echo 'time() found.' >&4
18033                 val="$define"
18034                 rp="What is the type returned by time() on this system?"
18035                 set time_t timetype long stdio.h sys/types.h
18036                 eval $typedef_ask
18037     else
18038                 echo 'time() not found, hope that will do.' >&4
18039                 val="$undef"
18040                 timetype='int';
18041     fi
18042     set d_time
18043     eval $setvar
18044 fi
18045
18046 : see if this is a sys/times.h system
18047 set sys/times.h i_systimes
18048 eval $inhdr
18049
18050 : see if times exists
18051 echo " "
18052 if set times val -f d_times; eval $csym; $val; then
18053         echo 'times() found.' >&4
18054         d_times="$define"
18055         inc=''
18056         case "$i_systimes" in
18057         "$define") inc='sys/times.h';;
18058         esac
18059         rp="What is the type returned by times() on this system?"
18060         set clock_t clocktype long stdio.h sys/types.h $inc
18061         eval $typedef_ask
18062 else
18063         echo 'times() NOT found, hope that will do.' >&4
18064         d_times="$undef"
18065         clocktype='int'
18066 fi
18067
18068 : see if tmpnam_r exists
18069 set tmpnam_r d_tmpnam_r
18070 eval $inlibc
18071 case "$d_tmpnam_r" in
18072 "$define")
18073         hdrs="$i_systypes sys/types.h define stdio.h "
18074         case "$d_tmpnam_r_proto:$usethreads" in
18075         ":define")      d_tmpnam_r_proto=define
18076                 set d_tmpnam_r_proto tmpnam_r $hdrs
18077                 eval $hasproto ;;
18078         *)      ;;
18079         esac
18080         case "$d_tmpnam_r_proto" in
18081         define)
18082         case "$tmpnam_r_proto" in
18083         ''|0) try='char* tmpnam_r(char*);'
18084         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18085         esac
18086         case "$tmpnam_r_proto" in
18087         ''|0)   d_tmpnam_r=undef
18088                 tmpnam_r_proto=0
18089                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18090         * )     case "$tmpnam_r_proto" in
18091                 REENTRANT_PROTO*) ;;
18092                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18093                 esac
18094                 echo "Prototype: $try" ;;
18095         esac
18096         ;;
18097         *)      case "$usethreads" in
18098                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18099                 esac
18100                 d_tmpnam_r=undef
18101                 tmpnam_r_proto=0
18102                 ;;
18103         esac
18104         ;;
18105 *)      tmpnam_r_proto=0
18106         ;;
18107 esac
18108
18109 : see if truncate exists
18110 set truncate d_truncate
18111 eval $inlibc
18112
18113 : see if ttyname_r exists
18114 set ttyname_r d_ttyname_r
18115 eval $inlibc
18116 case "$d_ttyname_r" in
18117 "$define")
18118         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18119         case "$d_ttyname_r_proto:$usethreads" in
18120         ":define")      d_ttyname_r_proto=define
18121                 set d_ttyname_r_proto ttyname_r $hdrs
18122                 eval $hasproto ;;
18123         *)      ;;
18124         esac
18125         case "$d_ttyname_r_proto" in
18126         define)
18127         case "$ttyname_r_proto" in
18128         ''|0) try='int ttyname_r(int, char*, size_t);'
18129         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18130         esac
18131         case "$ttyname_r_proto" in
18132         ''|0) try='int ttyname_r(int, char*, int);'
18133         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18134         esac
18135         case "$ttyname_r_proto" in
18136         ''|0) try='char* ttyname_r(int, char*, int);'
18137         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18138         esac
18139         case "$ttyname_r_proto" in
18140         ''|0)   d_ttyname_r=undef
18141                 ttyname_r_proto=0
18142                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18143         * )     case "$ttyname_r_proto" in
18144                 REENTRANT_PROTO*) ;;
18145                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18146                 esac
18147                 echo "Prototype: $try" ;;
18148         esac
18149         ;;
18150         *)      case "$usethreads" in
18151                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18152                 esac
18153                 d_ttyname_r=undef
18154                 ttyname_r_proto=0
18155                 ;;
18156         esac
18157         ;;
18158 *)      ttyname_r_proto=0
18159         ;;
18160 esac
18161
18162 : see if tzname[] exists
18163 echo " "
18164 if set tzname val -a d_tzname; eval $csym; $val; then
18165         val="$define"
18166         echo 'tzname[] found.' >&4
18167 else
18168         val="$undef"
18169         echo 'tzname[] NOT found.' >&4
18170 fi
18171 set d_tzname
18172 eval $setvar
18173
18174 : Check if is a multiplatform env
18175 case "$osname" in
18176 next|rhapsody|darwin) multiarch="$define" ;;
18177 esac
18178 case "$multiarch" in
18179 ''|[nN]*) multiarch="$undef" ;;
18180 esac
18181
18182 : check for ordering of bytes in a UV
18183 echo " "
18184 case "$usecrosscompile$multiarch" in
18185 *$define*)
18186         $cat <<EOM
18187 You seem to be either cross-compiling or doing a multiarchitecture build,
18188 skipping the byteorder check.
18189
18190 EOM
18191         byteorder='ffff'
18192         ;;
18193 *)
18194         case "$byteorder" in
18195         '')
18196                 $cat <<'EOM'
18197 In the following, larger digits indicate more significance.  A big-endian
18198 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18199 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18200 machines may have weird orders like 3412.  A Cray will report 87654321,
18201 an Alpha will report 12345678. If the test program works the default is
18202 probably right.
18203 I'm now running the test program...
18204 EOM
18205                 $cat >try.c <<EOCP
18206 #include <stdio.h>
18207 #$i_stdlib I_STDLIB
18208 #ifdef I_STDLIB
18209 #include <stdlib.h>
18210 #endif
18211 #include <sys/types.h>
18212 typedef $uvtype UV;
18213 int main()
18214 {
18215         int i;
18216         union {
18217                 UV l;
18218                 char c[$uvsize];
18219         } u;
18220
18221         if ($uvsize > 4)
18222                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18223         else
18224                 u.l = (UV)0x04030201;
18225         for (i = 0; i < $uvsize; i++)
18226                 printf("%c", u.c[i]+'0');
18227         printf("\n");
18228         exit(0);
18229 }
18230 EOCP
18231                 xxx_prompt=y
18232                 set try
18233                 if eval $compile && $run ./try > /dev/null; then
18234                         dflt=`$run ./try`
18235                         case "$dflt" in
18236                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18237                                 echo "(The test program ran ok.)"
18238                                 echo "byteorder=$dflt"
18239                                 xxx_prompt=n
18240                         ;;
18241                         ????|????????) echo "(The test program ran ok.)" ;;
18242                         *) echo "(The test program didn't run right for some reason.)" ;;
18243                         esac
18244                 else
18245                         dflt='4321'
18246                         cat <<'EOM'
18247 (I can't seem to compile the test program.  Guessing big-endian...)
18248 EOM
18249                 fi
18250                 case "$xxx_prompt" in
18251                 y)
18252                         rp="What is the order of bytes in $uvtype?"
18253                         . ./myread
18254                         byteorder="$ans"
18255                         ;;
18256                 *)      byteorder=$dflt
18257                         ;;
18258                 esac
18259                 ;;
18260         esac
18261         $rm_try
18262         ;;
18263 esac
18264
18265 : Checking 32bit aligndness
18266 $cat <<EOM
18267
18268 Checking to see whether you can access character data unalignedly...
18269 EOM
18270 case "$d_u32align" in
18271 '')   $cat >try.c <<EOCP
18272 #include <stdio.h>
18273 #$i_stdlib I_STDLIB
18274 #ifdef I_STDLIB
18275 #include <stdlib.h>
18276 #endif
18277 #define U32 $u32type
18278 #define BYTEORDER 0x$byteorder
18279 #define U8 $u8type
18280 #include <signal.h>
18281 #ifdef SIGBUS
18282 $signal_t bletch(int s) { exit(4); }
18283 #endif
18284 int main() {
18285 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18286     U8 buf[8];
18287     U32 *up;
18288     int i;
18289
18290     if (sizeof(U32) != 4) {
18291         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18292         exit(1);
18293     }
18294
18295     fflush(stdout);
18296
18297 #ifdef SIGBUS
18298     signal(SIGBUS, bletch);
18299 #endif
18300
18301     buf[0] = 0;
18302     buf[1] = 0;
18303     buf[2] = 0;
18304     buf[3] = 1;
18305     buf[4] = 0;
18306     buf[5] = 0;
18307     buf[6] = 0;
18308     buf[7] = 1;
18309
18310     for (i = 0; i < 4; i++) {
18311         up = (U32*)(buf + i);
18312         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18313                (*up == 1 << (8*(3-i)))  /* little-endian */
18314               )
18315            )
18316         {
18317             printf("read failed (%x)\n", *up);
18318             exit(2);
18319         }
18320     }
18321
18322     /* write test */
18323     for (i = 0; i < 4; i++) {
18324         up = (U32*)(buf + i);
18325         *up = 0xBeef;
18326         if (*up != 0xBeef) {
18327             printf("write failed (%x)\n", *up);
18328             exit(3);
18329         }
18330     }
18331
18332     exit(0);
18333 #else
18334     printf("1\n");
18335     exit(1);
18336 #endif
18337     return 0;
18338 }
18339 EOCP
18340 set try
18341 if eval $compile_ok; then
18342         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18343         $run ./try 2>&1 >/dev/null
18344         case "$?" in
18345         0)      cat >&4 <<EOM
18346 You can access character data pretty unalignedly.
18347 EOM
18348                 d_u32align="$undef"
18349                 ;;
18350         *)      cat >&4 <<EOM
18351 It seems that you must access character data in an aligned manner.
18352 EOM
18353                 d_u32align="$define"
18354                 ;;
18355         esac
18356 else
18357         rp='Can you access character data at unaligned addresses?'
18358         dflt='n'
18359         . ./myread
18360         case "$ans" in
18361         [yY]*)  d_u32align="$undef"  ;;
18362         *)      d_u32align="$define" ;;
18363         esac
18364 fi
18365 $rm_try
18366 ;;
18367 esac
18368
18369 : see if ualarm exists
18370 set ualarm d_ualarm
18371 eval $inlibc
18372
18373 : see if umask exists
18374 set umask d_umask
18375 eval $inlibc
18376
18377 : see if unordered exists
18378 set unordered d_unordered
18379 eval $inlibc
18380
18381 : see if unsetenv exists
18382 set unsetenv d_unsetenv
18383 eval $inlibc
18384
18385 : see if usleep exists
18386 set usleep d_usleep
18387 eval $inlibc
18388
18389 : see if prototype for usleep is available
18390 echo " "
18391 set d_usleepproto usleep $i_unistd unistd.h
18392 eval $hasproto
18393
18394 : see if ustat exists
18395 set ustat d_ustat
18396 eval $inlibc
18397
18398 : see if closedir exists
18399 set closedir d_closedir
18400 eval $inlibc
18401
18402 case "$d_closedir" in
18403 "$define")
18404         echo " "
18405         echo "Checking whether closedir() returns a status..." >&4
18406         cat > try.c <<EOM
18407 #$i_dirent I_DIRENT             /**/
18408 #$i_sysdir I_SYS_DIR            /**/
18409 #$i_sysndir I_SYS_NDIR          /**/
18410 #$i_systypes I_SYS_TYPES        /**/
18411
18412 #if defined(I_SYS_TYPES)
18413 #include <sys/types.h>
18414 #endif
18415 #if defined(I_DIRENT)
18416 #include <dirent.h>
18417 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18418 #include <sys/dir.h>
18419 #endif
18420 #else
18421 #ifdef I_SYS_NDIR
18422 #include <sys/ndir.h>
18423 #else
18424 #ifdef I_SYS_DIR
18425 #ifdef hp9000s500
18426 #include <ndir.h>       /* may be wrong in the future */
18427 #else
18428 #include <sys/dir.h>
18429 #endif
18430 #endif
18431 #endif
18432 #endif
18433 int main() { return closedir(opendir(".")); }
18434 EOM
18435         set try
18436         if eval $compile_ok; then
18437                 if $run ./try > /dev/null 2>&1 ; then
18438                         echo "Yes, it does."
18439                         val="$undef"
18440                 else
18441                         echo "No, it doesn't."
18442                         val="$define"
18443                 fi
18444         else
18445                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18446                 val="$define"
18447         fi
18448         ;;
18449 *)
18450         val="$undef";
18451         ;;
18452 esac
18453 set d_void_closedir
18454 eval $setvar
18455 $rm_try
18456
18457 : see if there is a wait4
18458 set wait4 d_wait4
18459 eval $inlibc
18460
18461 : see if waitpid exists
18462 set waitpid d_waitpid
18463 eval $inlibc
18464
18465 : see if wcstombs exists
18466 set wcstombs d_wcstombs
18467 eval $inlibc
18468
18469 : see if wctomb exists
18470 set wctomb d_wctomb
18471 eval $inlibc
18472
18473 : see if writev exists
18474 set writev d_writev
18475 eval $inlibc
18476
18477 : preserve RCS keywords in files with variable substitution, grrr
18478 Date='$Date'
18479 Id='$Id'
18480 Log='$Log'
18481 RCSfile='$RCSfile'
18482 Revision='$Revision'
18483
18484 : check for alignment requirements
18485 echo " "
18486 case "$usecrosscompile$multiarch" in
18487 *$define*)
18488         $cat <<EOM
18489 You seem to be either cross-compiling or doing a multiarchitecture build,
18490 skipping the memory alignment check.
18491
18492 EOM
18493         case "$alignbytes" in
18494         '') alignbytes=8 ;;
18495         esac
18496         ;;
18497 *)
18498         case "$alignbytes" in
18499         '') echo "Checking alignment constraints..." >&4
18500                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18501                         $cat >try.c <<'EOCP'
18502 typedef long double NV;
18503 EOCP
18504                 else
18505                         $cat >try.c <<'EOCP'
18506 typedef double NV;
18507 EOCP
18508                 fi
18509                 $cat >>try.c <<'EOCP'
18510 #include <stdio.h>
18511 struct foobar {
18512         char foo;
18513         NV bar;
18514 } try_algn;
18515 int main()
18516 {
18517     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18518     return(0);
18519 }
18520 EOCP
18521                 set try
18522                 if eval $compile_ok; then
18523                         dflt=`$run ./try`
18524                 else
18525                         dflt='8'
18526                         echo "(I can't seem to compile the test program...)"
18527                 fi
18528                 ;;
18529         *) dflt="$alignbytes"
18530                 ;;
18531         esac
18532         rp="Doubles must be aligned on a how-many-byte boundary?"
18533         . ./myread
18534         alignbytes="$ans"
18535         $rm_try
18536         ;;
18537 esac
18538
18539
18540 : set the base revision
18541 baserev=5.0
18542
18543 : how do we concatenate cpp tokens here?
18544 echo " "
18545 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18546 $cat >cpp_stuff.c <<'EOCP'
18547 #define RCAT(a,b)a/**/b
18548 #define ACAT(a,b)a ## b
18549 RCAT(Rei,ser)
18550 ACAT(Cir,cus)
18551 EOCP
18552 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18553 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18554         echo "Oh!  Smells like ANSI's been here." >&4
18555         echo "We can catify or stringify, separately or together!"
18556         cpp_stuff=42
18557 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18558         echo "Ah, yes!  The good old days!" >&4
18559         echo "However, in the good old days we don't know how to stringify and"
18560         echo "catify at the same time."
18561         cpp_stuff=1
18562 else
18563         $cat >&4 <<EOM
18564 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18565 You're going to have to edit the values of CAT[2-5] in config.h...
18566 EOM
18567         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18568 fi
18569 $rm -f cpp_stuff.*
18570
18571 : see if this is a db.h system
18572 set db.h i_db
18573 eval $inhdr
18574
18575 case "$i_db" in
18576 $define)
18577         : Check db version.
18578         echo " "
18579         echo "Checking Berkeley DB version ..." >&4
18580         $cat >try.c <<EOCP
18581 #$d_const HASCONST
18582 #ifndef HASCONST
18583 #define const
18584 #endif
18585 #include <sys/types.h>
18586 #include <stdio.h>
18587 #$i_stdlib I_STDLIB
18588 #ifdef I_STDLIB
18589 #include <stdlib.h>
18590 #endif
18591 #include <db.h>
18592 int main(int argc, char *argv[])
18593 {
18594 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18595     int Major, Minor, Patch ;
18596     unsigned long Version ;
18597     (void)db_version(&Major, &Minor, &Patch) ;
18598     if (argc == 2) {
18599         printf("%d %d %d %d %d %d\n",
18600                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18601                Major, Minor, Patch);
18602         exit(0);
18603     }
18604     printf("You have Berkeley DB Version 2 or greater.\n");
18605
18606     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18607                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18608     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18609                 Major, Minor, Patch) ;
18610
18611     /* check that db.h & libdb are compatible */
18612     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18613         printf("db.h and libdb are incompatible.\n") ;
18614         exit(3);
18615     }
18616
18617     printf("db.h and libdb are compatible.\n") ;
18618
18619     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18620                 + DB_VERSION_PATCH ;
18621
18622     /* needs to be >= 2.3.4 */
18623     if (Version < 2003004) {
18624     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18625         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18626         exit(2);
18627     }
18628
18629     exit(0);
18630 #else
18631 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18632     if (argc == 2) {
18633         printf("1 0 0\n");
18634         exit(0);
18635     }
18636     printf("You have Berkeley DB Version 1.\n");
18637     exit(0);    /* DB version < 2: the coast is clear. */
18638 #else
18639     exit(1);    /* <db.h> not Berkeley DB? */
18640 #endif
18641 #endif
18642 }
18643 EOCP
18644         set try
18645         if eval $compile_ok && $run ./try; then
18646                 echo 'Looks OK.' >&4
18647                 set `$run ./try 1`
18648                 db_version_major=$1
18649                 db_version_minor=$2
18650                 db_version_patch=$3
18651         else
18652                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18653                 i_db=$undef
18654                 case " $libs " in
18655                 *"-ldb "*)
18656                         : Remove db from list of libraries to use
18657                         echo "Removing unusable -ldb from library list" >&4
18658                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18659                         shift
18660                         libs="$*"
18661                         echo "libs = $libs" >&4
18662                         ;;
18663                 esac
18664         fi
18665         $rm_try
18666         ;;
18667 esac
18668
18669 case "$i_db" in
18670 define)
18671         : Check the return type needed for hash
18672         echo " "
18673         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18674         $cat >try.c <<EOCP
18675 #$d_const HASCONST
18676 #ifndef HASCONST
18677 #define const
18678 #endif
18679 #include <sys/types.h>
18680 #include <db.h>
18681
18682 #ifndef DB_VERSION_MAJOR
18683 u_int32_t hash_cb (ptr, size)
18684 const void *ptr;
18685 size_t size;
18686 {
18687 }
18688 HASHINFO info;
18689 int main()
18690 {
18691         info.hash = hash_cb;
18692 }
18693 #endif
18694 EOCP
18695         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18696                 if $contains warning try.out >>/dev/null 2>&1 ; then
18697                         db_hashtype='int'
18698                 else
18699                         db_hashtype='u_int32_t'
18700                 fi
18701         else
18702                 : XXX Maybe we should just give up here.
18703                 db_hashtype=u_int32_t
18704                 $cat try.out >&4
18705                 echo "Help:  I can't seem to compile the db test program." >&4
18706                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18707         fi
18708         $rm_try
18709         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18710         ;;
18711 *)      db_hashtype=u_int32_t
18712         ;;
18713 esac
18714 case "$i_db" in
18715 define)
18716         : Check the return type needed for prefix
18717         echo " "
18718         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18719         cat >try.c <<EOCP
18720 #$d_const HASCONST
18721 #ifndef HASCONST
18722 #define const
18723 #endif
18724 #include <sys/types.h>
18725 #include <db.h>
18726
18727 #ifndef DB_VERSION_MAJOR
18728 size_t prefix_cb (key1, key2)
18729 const DBT *key1;
18730 const DBT *key2;
18731 {
18732 }
18733 BTREEINFO info;
18734 int main()
18735 {
18736         info.prefix = prefix_cb;
18737 }
18738 #endif
18739 EOCP
18740         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18741                 if $contains warning try.out >>/dev/null 2>&1 ; then
18742                         db_prefixtype='int'
18743                 else
18744                         db_prefixtype='size_t'
18745                 fi
18746         else
18747                 db_prefixtype='size_t'
18748                 : XXX Maybe we should just give up here.
18749                 $cat try.out >&4
18750                 echo "Help:  I can't seem to compile the db test program." >&4
18751                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18752         fi
18753         $rm_try
18754         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18755         ;;
18756 *)      db_prefixtype='size_t'
18757         ;;
18758 esac
18759
18760 : How can we generate normalized random numbers ?
18761 echo " "
18762 echo "Looking for a random number function..." >&4
18763 case "$randfunc" in
18764 '')
18765         if set drand48 val -f; eval $csym; $val; then
18766                 dflt="drand48"
18767                 echo "Good, found drand48()." >&4
18768         elif set random val -f; eval $csym; $val; then
18769                 dflt="random"
18770                 echo "OK, found random()." >&4
18771         else
18772                 dflt="rand"
18773                 echo "Yick, looks like I have to use rand()." >&4
18774         fi
18775         echo " "
18776         ;;
18777 *)
18778         dflt="$randfunc"
18779         ;;
18780 esac
18781 cont=true
18782
18783 case "$ccflags" in
18784 *-Dmy_rand=*|*-Dmy_srand=*)
18785         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18786         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18787         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18788         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18789         ;;
18790 esac
18791
18792 while $test "$cont"; do
18793         rp="Use which function to generate random numbers?"
18794         . ./myread
18795         if $test "$ans" = "$dflt"; then
18796                 : null
18797         else
18798                 randbits=''
18799         fi
18800         randfunc="$ans"
18801         if set $ans val -f; eval $csym; $val; then
18802                 cont=''
18803         else
18804                 dflt=y
18805                 rp="I cannot find function $ans. Use that name anyway?"
18806                 . ./myread
18807                 dflt=rand
18808                 case "$ans" in
18809                         [yY]*) cont='';;
18810                 esac
18811         fi
18812         case "$cont" in
18813         '')
18814                 case "$randfunc" in
18815                 drand48)
18816                         drand01="drand48()"
18817                         seedfunc="srand48"
18818                         randbits=48
18819                         randseedtype=long
18820                         ;;
18821                 rand|random)
18822                         case "$randbits" in
18823                         '')
18824 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18825                                 $cat >try.c <<EOCP
18826 #$i_unistd I_UNISTD
18827 #$i_stdlib I_STDLIB
18828 #include <stdio.h>
18829 #ifdef I_UNISTD
18830 #  include <unistd.h>
18831 #endif
18832 #ifdef I_STDLIB
18833 #  include <stdlib.h>
18834 #endif
18835 int main()
18836 {
18837         register int i;
18838         register unsigned long tmp;
18839         register unsigned long max = 0L;
18840
18841         for (i = 1000; i; i--) {
18842                 tmp = (unsigned long) $randfunc();
18843                 if (tmp > max) max = tmp;
18844         }
18845         for (i = 0; max; i++)
18846                 max /= 2;
18847         printf("%d\n",i);
18848 }
18849 EOCP
18850                                 set try
18851                                 if eval $compile_ok; then
18852                                         dflt=`try`
18853                                 else
18854                                         dflt='?'
18855                                         echo "(I can't seem to compile the test program...)"
18856                                 fi
18857                                 ;;
18858                         *)
18859                                 dflt="$randbits"
18860                                 ;;
18861                         esac
18862                         rp="How many bits does your $randfunc() function produce?"
18863                         . ./myread
18864                         randbits="$ans"
18865                         $rm_try
18866                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18867                         seedfunc="s$randfunc"
18868                         randseedtype=unsigned
18869                         ;;
18870                 *)
18871                         dflt="31"
18872                         rp="How many bits does your $randfunc() function produce?"
18873                         . ./myread
18874                         randbits="$ans"
18875                         seedfunc="s$randfunc"
18876                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18877                         if set $seedfunc val -f; eval $csym; $val; then
18878                                 echo "(Using $seedfunc() to seed random generator)"
18879                         else
18880                                 echo "(Warning: no $seedfunc() to seed random generator)"
18881                                 seedfunc=rand
18882                         fi
18883                         randseedtype=unsigned
18884                         ;;
18885                 esac
18886                 ;;
18887         esac
18888 done
18889
18890 : Determine if this is an EBCDIC system
18891 echo " "
18892 echo "Determining whether or not we are on an EBCDIC system..." >&4
18893 $cat >try.c <<'EOM'
18894 int main()
18895 {
18896   if ('M'==0xd4) return 0;
18897   return 1;
18898 }
18899 EOM
18900
18901 val=$undef
18902 set try
18903 if eval $compile_ok; then
18904         if $run ./try; then
18905                 echo "You seem to speak EBCDIC." >&4
18906                 val="$define"
18907         else
18908                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18909         fi
18910 else
18911         echo "I'm unable to compile the test program." >&4
18912         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18913 fi
18914 $rm_try
18915 set ebcdic
18916 eval $setvar
18917
18918 : Check how to flush
18919 echo " "
18920 $cat >&4 <<EOM
18921 Checking how to flush all pending stdio output...
18922 EOM
18923 # I only know how to find the first 32 possibly open files on SunOS.
18924 # See also hints/sunos_4_1.sh and util.c  --AD
18925 case "$osname" in
18926 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18927 esac
18928 $cat >>try.c <<EOCP
18929 #include <stdio.h>
18930 #$i_stdlib I_STDLIB
18931 #ifdef I_STDLIB
18932 #include <stdlib.h>
18933 #endif
18934 #$i_unistd I_UNISTD
18935 #ifdef I_UNISTD
18936 # include <unistd.h>
18937 #endif
18938 #$d_sysconf HAS_SYSCONF
18939 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18940 #ifdef HAS_STDIO_STREAM_ARRAY
18941 # define STDIO_STREAM_ARRAY $stdio_stream_array
18942 #endif
18943 int main() {
18944   FILE* p;
18945   unlink("try.out");
18946   p = fopen("try.out", "w");
18947 #ifdef TRY_FPUTC
18948   fputc('x', p);
18949 #else
18950 # ifdef TRY_FPRINTF
18951   fprintf(p, "x");
18952 # endif
18953 #endif
18954 #ifdef TRY_FFLUSH_NULL
18955   fflush(NULL);
18956 #endif
18957 #ifdef TRY_FFLUSH_ALL
18958   {
18959     long open_max = -1;
18960 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18961     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18962 # else
18963 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18964     open_max = sysconf(_SC_OPEN_MAX);
18965 #  else
18966 #   ifdef FOPEN_MAX
18967     open_max = FOPEN_MAX;
18968 #   else
18969 #    ifdef OPEN_MAX
18970     open_max = OPEN_MAX;
18971 #    else
18972 #     ifdef _NFILE
18973     open_max = _NFILE;
18974 #     endif
18975 #    endif
18976 #   endif
18977 #  endif
18978 # endif
18979 # ifdef HAS_STDIO_STREAM_ARRAY
18980     if (open_max > 0) {
18981       long i;
18982       for (i = 0; i < open_max; i++)
18983             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18984                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18985                 STDIO_STREAM_ARRAY[i]._flag)
18986                 fflush(&STDIO_STREAM_ARRAY[i]);
18987     }
18988   }
18989 # endif
18990 #endif
18991   _exit(42);
18992 }
18993 EOCP
18994 : first we have to find out how _not_ to flush
18995 $to try.c
18996 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18997     output=''
18998     set try -DTRY_FPUTC
18999     if eval $compile; then
19000             $run ./try 2>/dev/null
19001             code="$?"
19002             $from try.out
19003             if $test ! -s try.out -a "X$code" = X42; then
19004                 output=-DTRY_FPUTC
19005             fi
19006     fi
19007     case "$output" in
19008     '')
19009             set try -DTRY_FPRINTF
19010             if eval $compile; then
19011                     $run ./try 2>/dev/null
19012                     code="$?"
19013                     $from try.out
19014                     if $test ! -s try.out -a "X$code" = X42; then
19015                         output=-DTRY_FPRINTF
19016                     fi
19017             fi
19018         ;;
19019     esac
19020 fi
19021 : check for fflush NULL behaviour
19022 case "$fflushNULL" in
19023 '')     set try -DTRY_FFLUSH_NULL $output
19024         if eval $compile; then
19025                 $run ./try 2>/dev/null
19026                 code="$?"
19027                 $from try.out
19028                 if $test -s try.out -a "X$code" = X42; then
19029                         fflushNULL="`$cat try.out`"
19030                 else
19031                         if $test "X$code" != X42; then
19032                                 $cat >&4 <<EOM
19033 (If this test failed, don't worry, we'll try another method shortly.)
19034 EOM
19035                         fi
19036                 fi
19037         fi
19038         $rm_try
19039         case "$fflushNULL" in
19040         x)      $cat >&4 <<EOM
19041 Your fflush(NULL) works okay for output streams.
19042 Let's see if it clobbers input pipes...
19043 EOM
19044 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19045 # bug that improperly flushes the input end of pipes.  So we avoid the
19046 # autoflush on fork/system/exec support for now. :-(
19047 $cat >tryp.c <<EOCP
19048 #include <stdio.h>
19049 int
19050 main(int argc, char **argv)
19051 {
19052     char buf[1024];
19053     int i;
19054     char *bp = buf;
19055     while (1) {
19056         while ((i = getc(stdin)) != -1
19057                && (*bp++ = i) != '\n'
19058                && bp < &buf[1024])
19059         /* DO NOTHING */ ;
19060         *bp = '\0';
19061         fprintf(stdout, "%s", buf);
19062         fflush(NULL);
19063         if (i == -1)
19064             return 0;
19065         bp = buf;
19066     }
19067 }
19068 EOCP
19069                 fflushNULL="$define"
19070                 set tryp
19071                 if eval $compile; then
19072                     $rm -f tryp.out
19073                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19074                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19075                        $cat >&4 <<EOM
19076 fflush(NULL) seems to behave okay with input streams.
19077 EOM
19078                         fflushNULL="$define"
19079                     else
19080                         $cat >&4 <<EOM
19081 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19082 EOM
19083                         fflushNULL="$undef"
19084                     fi
19085                 fi
19086                 $rm -f core tryp.c tryp.core core.tryp.*
19087                 ;;
19088         '')     $cat >&4 <<EOM
19089 Your fflush(NULL) isn't working (contrary to ANSI C).
19090 EOM
19091                 fflushNULL="$undef"
19092                 ;;
19093         *)      $cat >&4 <<EOM
19094 Cannot figure out whether your fflush(NULL) works or not.
19095 I'm assuming it doesn't (contrary to ANSI C).
19096 EOM
19097                 fflushNULL="$undef"
19098                 ;;
19099         esac
19100         ;;
19101 $define|true|[yY]*)
19102         fflushNULL="$define"
19103         ;;
19104 *)
19105         fflushNULL="$undef"
19106         ;;
19107 esac
19108 : check explicit looping only if NULL did not work, and if the pipe
19109 : bug does not show up on an explicit flush too
19110 case "$fflushNULL" in
19111 "$undef")
19112         $cat >tryp.c <<EOCP
19113 #include <stdio.h>
19114 int
19115 main(int argc, char **argv)
19116 {
19117     char buf[1024];
19118     int i;
19119     char *bp = buf;
19120     while (1) {
19121         while ((i = getc(stdin)) != -1
19122                && (*bp++ = i) != '\n'
19123                && bp < &buf[1024])
19124         /* DO NOTHING */ ;
19125         *bp = '\0';
19126         fprintf(stdout, "%s", buf);
19127         fflush(stdin);
19128         if (i == -1)
19129             return 0;
19130         bp = buf;
19131     }
19132 }
19133 EOCP
19134         set tryp
19135         if eval $compile; then
19136             $rm -f tryp.out
19137             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19138             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19139                $cat >&4 <<EOM
19140 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19141 EOM
19142                 : now check for fflushall behaviour
19143                 case "$fflushall" in
19144                 '')     set try -DTRY_FFLUSH_ALL $output
19145                         if eval $compile; then
19146                                 $cat >&4 <<EOM
19147 (Now testing the other method--but note that this also may fail.)
19148 EOM
19149                                 $run ./try 2>/dev/null
19150                                 code=$?
19151                                 $from try.out
19152                                 if $test -s try.out -a "X$code" = X42; then
19153                                         fflushall="`$cat try.out`"
19154                                 fi
19155                         fi
19156                         $rm_try
19157                         case "$fflushall" in
19158                         x)      $cat >&4 <<EOM
19159 Whew. Flushing explicitly all the stdio streams works.
19160 EOM
19161                                 fflushall="$define"
19162                                 ;;
19163                         '')     $cat >&4 <<EOM
19164 Sigh. Flushing explicitly all the stdio streams doesn't work.
19165 EOM
19166                                 fflushall="$undef"
19167                                 ;;
19168                         *)      $cat >&4 <<EOM
19169 Cannot figure out whether flushing stdio streams explicitly works or not.
19170 I'm assuming it doesn't.
19171 EOM
19172                                 fflushall="$undef"
19173                                 ;;
19174                         esac
19175                         ;;
19176                 "$define"|true|[yY]*)
19177                         fflushall="$define"
19178                         ;;
19179                 *)
19180                         fflushall="$undef"
19181                         ;;
19182                 esac
19183             else
19184                 $cat >&4 <<EOM
19185 All is futile.  Even fflush(stdin) clobbers input pipes!
19186 EOM
19187                 fflushall="$undef"
19188             fi
19189         else
19190             fflushall="$undef"
19191         fi
19192         $rm -f core tryp.c tryp.core core.tryp.*
19193         ;;
19194 *)      fflushall="$undef"
19195         ;;
19196 esac
19197
19198 case "$fflushNULL$fflushall" in
19199 undefundef)
19200         $cat <<EOM
19201 OK, I give up.  I cannot figure out how to flush pending stdio output.
19202 We won't be flushing handles at all before fork/exec/popen.
19203 EOM
19204         ;;
19205 esac
19206 $rm_try tryp
19207
19208 : Store the full pathname to the ar program for use in the C program
19209 : Respect a hint or command line value for full_ar.
19210 case "$full_ar" in
19211 '') full_ar=$ar ;;
19212 esac
19213
19214 : Store the full pathname to the sed program for use in the C program
19215 full_sed=$sed
19216
19217 : see what type gids are declared as in the kernel
19218 echo " "
19219 echo "Looking for the type for group ids returned by getgid()."
19220 set gid_t gidtype xxx stdio.h sys/types.h
19221 eval $typedef
19222 case "$gidtype" in
19223 xxx)
19224         xxx=`./findhdr sys/user.h`
19225         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19226         case $1 in
19227         unsigned) dflt="$1 $2" ;;
19228         *) dflt="$1" ;;
19229         esac
19230         ;;
19231 *) dflt="$gidtype";;
19232 esac
19233 case "$gidtype" in
19234 gid_t) echo "gid_t found." ;;
19235 *)      rp="What is the type for group ids returned by getgid()?"
19236         . ./myread
19237         gidtype="$ans"
19238         ;;
19239 esac
19240
19241 : Check the size of GID
19242 echo " "
19243 case "$gidtype" in
19244 *_t) zzz="$gidtype"     ;;
19245 *)   zzz="gid"          ;;
19246 esac
19247 echo "Checking the size of $zzz..." >&4
19248 cat > try.c <<EOCP
19249 #include <sys/types.h>
19250 #include <stdio.h>
19251 #$i_stdlib I_STDLIB
19252 #ifdef I_STDLIB
19253 #include <stdlib.h>
19254 #endif
19255 int main() {
19256     printf("%d\n", (int)sizeof($gidtype));
19257     exit(0);
19258 }
19259 EOCP
19260 set try
19261 if eval $compile_ok; then
19262         yyy=`$run ./try`
19263         case "$yyy" in
19264         '')     gidsize=4
19265                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19266                 ;;
19267         *)      gidsize=$yyy
19268                 echo "Your $zzz is $gidsize bytes long."
19269                 ;;
19270         esac
19271 else
19272         gidsize=4
19273         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19274 fi
19275
19276
19277 : Check if GID is signed
19278 echo " "
19279 case "$gidtype" in
19280 *_t) zzz="$gidtype"     ;;
19281 *)   zzz="gid"          ;;
19282 esac
19283 echo "Checking the sign of $zzz..." >&4
19284 cat > try.c <<EOCP
19285 #include <sys/types.h>
19286 #include <stdio.h>
19287 int main() {
19288         $gidtype foo = -1;
19289         if (foo < 0)
19290                 printf("-1\n");
19291         else
19292                 printf("1\n");
19293 }
19294 EOCP
19295 set try
19296 if eval $compile; then
19297         yyy=`$run ./try`
19298         case "$yyy" in
19299         '')     gidsign=1
19300                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19301                 ;;
19302         *)      gidsign=$yyy
19303                 case "$gidsign" in
19304                  1) echo "Your $zzz is unsigned." ;;
19305                 -1) echo "Your $zzz is signed."   ;;
19306                 esac
19307                 ;;
19308         esac
19309 else
19310         gidsign=1
19311         echo "(I can't compile the test program--guessing unsigned.)" >&4
19312 fi
19313
19314
19315 : Check 64bit sizes
19316 echo " "
19317
19318 if $test X"$quadtype" != X; then
19319
19320 echo "Checking how to print 64-bit integers..." >&4
19321
19322 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19323         $cat >try.c <<'EOCP'
19324 #include <sys/types.h>
19325 #include <stdio.h>
19326 int main() {
19327   int q = 12345678901;
19328   printf("%ld\n", q);
19329 }
19330 EOCP
19331         set try
19332         if eval $compile; then
19333                 yyy=`$run ./try`
19334                 case "$yyy" in
19335                 12345678901)
19336                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19337                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19338                         echo "We will use %d."
19339                         ;;
19340                 esac
19341         fi
19342 fi
19343
19344 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19345         $cat >try.c <<'EOCP'
19346 #include <sys/types.h>
19347 #include <stdio.h>
19348 int main() {
19349   long q = 12345678901;
19350   printf("%ld\n", q);
19351 }
19352 EOCP
19353         set try
19354         if eval $compile; then
19355                 yyy=`$run ./try`
19356                 case "$yyy" in
19357                 12345678901)
19358                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19359                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19360                         echo "We will use %ld."
19361                         ;;
19362                 esac
19363         fi
19364 fi
19365
19366 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19367         $cat >try.c <<'EOCP'
19368 #include <sys/types.h>
19369 #include <inttypes.h>
19370 #include <stdio.h>
19371 int main() {
19372   int64_t q = 12345678901;
19373   printf("%" PRId64 "\n", q);
19374 }
19375 EOCP
19376         set try
19377         if eval $compile; then
19378                 yyy=`$run ./try`
19379                 case "$yyy" in
19380                 12345678901)
19381                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19382                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19383                         echo "We will use the C9X style."
19384                         ;;
19385                 esac
19386         fi
19387 fi
19388
19389 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19390         $cat >try.c <<EOCP
19391 #include <sys/types.h>
19392 #include <stdio.h>
19393 int main() {
19394   $quadtype q = 12345678901;
19395   printf("%Ld\n", q);
19396 }
19397 EOCP
19398         set try
19399         if eval $compile; then
19400                 yyy=`$run ./try`
19401                 case "$yyy" in
19402                 12345678901)
19403                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19404                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19405                         echo "We will use %Ld."
19406                         ;;
19407                 esac
19408         fi
19409 fi
19410
19411 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19412         $cat >try.c <<'EOCP'
19413 #include <sys/types.h>
19414 #include <stdio.h>
19415 int main() {
19416   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19417   printf("%lld\n", q);
19418 }
19419 EOCP
19420         set try
19421         if eval $compile; then
19422                 yyy=`$run ./try`
19423                 case "$yyy" in
19424                 12345678901)
19425                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19426                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19427                         echo "We will use the %lld style."
19428                         ;;
19429                 esac
19430         fi
19431 fi
19432
19433 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19434         $cat >try.c <<EOCP
19435 #include <sys/types.h>
19436 #include <stdio.h>
19437 int main() {
19438   $quadtype q = 12345678901;
19439   printf("%qd\n", q);
19440 }
19441 EOCP
19442         set try
19443         if eval $compile; then
19444                 yyy=`$run ./try`
19445                 case "$yyy" in
19446                 12345678901)
19447                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19448                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19449                         echo "We will use %qd."
19450                         ;;
19451                 esac
19452         fi
19453 fi
19454
19455 if $test X"$sPRId64" = X; then
19456         echo "Cannot figure out how to print 64-bit integers." >&4
19457 fi
19458 $rm_try
19459
19460 fi
19461
19462 case "$sPRId64" in
19463 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19464         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19465         ;;
19466 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19467         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19468         ;;
19469 esac
19470
19471 : Check format strings for internal types
19472 echo " "
19473 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19474
19475 if $test X"$ivsize" = X8; then
19476         ivdformat="$sPRId64"
19477         uvuformat="$sPRIu64"
19478         uvoformat="$sPRIo64"
19479         uvxformat="$sPRIx64"
19480         uvXUformat="$sPRIXU64"
19481 else
19482         if $test X"$ivsize" = X"$longsize"; then
19483                 ivdformat='"ld"'
19484                 uvuformat='"lu"'
19485                 uvoformat='"lo"'
19486                 uvxformat='"lx"'
19487                 uvXUformat='"lX"'
19488         else
19489                 if $test X"$ivsize" = X"$intsize"; then
19490                         ivdformat='"d"'
19491                         uvuformat='"u"'
19492                         uvoformat='"o"'
19493                         uvxformat='"x"'
19494                         uvXUformat='"X"'
19495                 else
19496                         : far out
19497                         if $test X"$ivsize" = X"$shortsize"; then
19498                                 ivdformat='"hd"'
19499                                 uvuformat='"hu"'
19500                                 uvoformat='"ho"'
19501                                 uvxformat='"hx"'
19502                                 uvXUformat='"hX"'
19503                         fi
19504                 fi
19505         fi
19506 fi
19507
19508 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19509         nveformat="$sPRIeldbl"
19510         nvfformat="$sPRIfldbl"
19511         nvgformat="$sPRIgldbl"
19512         nvEUformat="$sPRIEUldbl"
19513         nvFUformat="$sPRIFUldbl"
19514         nvGUformat="$sPRIGUldbl"
19515 else
19516         nveformat='"e"'
19517         nvfformat='"f"'
19518         nvgformat='"g"'
19519         nvEUformat='"E"'
19520         nvFUformat='"F"'
19521         nvGUformat='"G"'
19522 fi
19523
19524 case "$ivdformat" in
19525 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19526     exit 1
19527     ;;
19528 esac
19529
19530 : Check format string for GID
19531
19532 echo " "
19533 $echo "Checking the format string to be used for gids..." >&4
19534
19535 case "$gidsign" in
19536 -1)     if $test X"$gidsize" = X"$ivsize"; then
19537                 gidformat="$ivdformat"
19538         else
19539                 if $test X"$gidsize" = X"$longsize"; then
19540                         gidformat='"ld"'
19541                 else
19542                         if $test X"$gidsize" = X"$intsize"; then
19543                                 gidformat='"d"'
19544                         else
19545                                 if $test X"$gidsize" = X"$shortsize"; then
19546                                         gidformat='"hd"'
19547                                 fi
19548                         fi
19549                 fi
19550         fi
19551         ;;
19552 *)      if $test X"$gidsize" = X"$uvsize"; then
19553                 gidformat="$uvuformat"
19554         else
19555                 if $test X"$gidsize" = X"$longsize"; then
19556                         gidformat='"lu"'
19557                 else
19558                         if $test X"$gidsize" = X"$intsize"; then
19559                                 gidformat='"u"'
19560                         else
19561                                 if $test X"$gidsize" = X"$shortsize"; then
19562                                         gidformat='"hu"'
19563                                 fi
19564                         fi
19565                 fi
19566         fi
19567         ;;
19568 esac
19569
19570 : see if getgroups exists
19571 set getgroups d_getgrps
19572 eval $inlibc
19573
19574 : see if setgroups exists
19575 set setgroups d_setgrps
19576 eval $inlibc
19577
19578 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19579 echo " "
19580 case "$d_getgrps$d_setgrps" in
19581 *define*)
19582         case "$groupstype" in
19583         '') dflt="$gidtype" ;;
19584         *)  dflt="$groupstype" ;;
19585         esac
19586         $cat <<EOM
19587 What type of pointer is the second argument to getgroups() and setgroups()?
19588 Usually this is the same as group ids, $gidtype, but not always.
19589
19590 EOM
19591         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19592         . ./myread
19593         groupstype="$ans"
19594         ;;
19595 *)  groupstype="$gidtype";;
19596 esac
19597
19598 : MAD = Misc Attribute Definition
19599
19600 if $test $patchlevel -lt 9; then
19601 : MAD is not available in 5.8.x or earlier.
19602     ans=n;
19603 else
19604     case "$mad" in
19605     $define|true|[yY]*) dflt='y' ;;
19606     *)                  dflt='n' ;;
19607     esac
19608     cat <<EOM
19609
19610 Would you like to build with Misc Attribute Decoration? This is development
19611 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19612 overhead on the interpreter.
19613
19614 If this doesn't make any sense to you, just accept the default '$dflt'.
19615 EOM
19616     rp='Build Perl with MAD?'
19617     . ./myread
19618 fi
19619 case "$ans" in
19620 y|Y)    val="$define"
19621         madlyh='madly.h madly.act madly.tab'
19622         madlysrc='madly.c'
19623         madlyobj="madly$_o" ;;
19624 *)      val="$undef"
19625         madlyh=''
19626         madlysrc=''
19627         madlyobj='' ;;
19628 esac
19629 set mad
19630 eval $setvar
19631
19632 echo " "
19633 echo "Checking if your $make program sets \$(MAKE)..." >&4
19634 case "$make_set_make" in
19635 '')
19636         $sed 's/^X //' > testmake.mak << 'EOF'
19637 Xall:
19638 X       @echo 'maketemp="$(MAKE)"'
19639 EOF
19640         case "`$make -f testmake.mak 2>/dev/null`" in
19641         *maketemp=*) make_set_make='#' ;;
19642         *)      make_set_make="MAKE=$make" ;;
19643         esac
19644         $rm -f testmake.mak
19645         ;;
19646 esac
19647 case "$make_set_make" in
19648 '#') echo "Yup, it does.";;
19649 *) echo "Nope, it doesn't.";;
19650 esac
19651
19652 : see what type is used for mode_t
19653 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19654 set mode_t modetype int stdio.h sys/types.h
19655 eval $typedef_ask
19656
19657 : see if we need va_copy
19658 echo " "
19659 case "$i_stdarg" in
19660 "$define")
19661         $cat >try.c <<EOCP
19662 #include <stdarg.h>
19663 #include <stdio.h>
19664 #$i_stdlib I_STDLIB
19665 #ifdef I_STDLIB
19666 #include <stdlib.h>
19667 #endif
19668 #include <signal.h>
19669
19670 int
19671 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19672 {
19673   return vfprintf(f, fmt, *valp);
19674 }
19675
19676 int
19677 myvfprintf(FILE *f, const  char *fmt, va_list val)
19678 {
19679   return ivfprintf(f, fmt, &val);
19680 }
19681
19682 int
19683 myprintf(char *fmt, ...)
19684 {
19685   va_list val;
19686   va_start(val, fmt);
19687   return myvfprintf(stdout, fmt, val);
19688 }
19689
19690 int
19691 main(int ac, char **av)
19692 {
19693   signal(SIGSEGV, exit);
19694
19695   myprintf("%s%cs all right, then\n", "that", '\'');
19696   exit(0);
19697 }
19698 EOCP
19699         set try
19700         if eval $compile && $run ./try 2>&1 >/dev/null; then
19701                 case "`$run ./try`" in
19702                 "that's all right, then")
19703                         okay=yes
19704                         ;;
19705                 esac
19706         fi
19707         case "$okay" in
19708         yes)    echo "It seems that you don't need va_copy()." >&4
19709                 need_va_copy="$undef"
19710                 ;;
19711         *)      echo "It seems that va_copy() or similar will be needed." >&4
19712                 need_va_copy="$define"
19713                 ;;
19714         esac
19715         $rm_try
19716         ;;
19717 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19718         ;;
19719 esac
19720
19721 : see what type is used for size_t
19722 rp="What is the type used for the length parameter for string functions?"
19723 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19724 eval $typedef_ask
19725
19726 : check for type of arguments to gethostbyaddr. 
19727 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19728         case "$d_gethbyaddr" in
19729         $define)
19730                 $cat <<EOM
19731
19732 Checking to see what type of arguments are accepted by gethostbyaddr().
19733 EOM
19734                 hdrs="$define sys/types.h
19735                         $d_socket sys/socket.h 
19736                         $i_niin netinet/in.h 
19737                         $i_netdb netdb.h
19738                         $i_unistd unistd.h"
19739                 : The first arg can 'char *' or 'void *'
19740                 : The second arg is some of integral type
19741                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19742                         for yyy in size_t long int; do
19743                                 case "$netdb_host_type" in
19744                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19745                                         if ./protochk "$try" $hdrs; then
19746                                                 echo "Your system accepts $xxx for the first arg."
19747                                                 echo "...and $yyy for the second arg."
19748                                                 netdb_host_type="$xxx"
19749                                                 netdb_hlen_type="$yyy"
19750                                         fi
19751                                         ;;
19752                                 esac
19753                         done
19754                 done
19755                 : In case none of those worked, prompt the user.
19756                 case "$netdb_host_type" in
19757                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19758                         dflt='char *'
19759                         . ./myread
19760                         netdb_host_type=$ans
19761                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19762                         dflt="$sizetype"
19763                         . ./myread
19764                         netdb_hlen_type=$ans
19765                         ;;
19766                 esac
19767                 ;;
19768         *)      : no gethostbyaddr, so pick harmless defaults
19769                 netdb_host_type='char *'
19770                 netdb_hlen_type="$sizetype"
19771                 ;;
19772         esac
19773         # Remove the "const" if needed. -- but then we'll have a 
19774         # prototype clash!
19775         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19776 fi
19777
19778 : check for type of argument to gethostbyname. 
19779 if test "X$netdb_name_type" = X ; then
19780         case "$d_gethbyname" in
19781         $define)
19782                 $cat <<EOM
19783
19784 Checking to see what type of argument is accepted by gethostbyname().
19785 EOM
19786                 hdrs="$define sys/types.h
19787                         $d_socket sys/socket.h 
19788                         $i_niin netinet/in.h 
19789                         $i_netdb netdb.h
19790                         $i_unistd unistd.h"
19791                 for xxx in "const char *" "char *"; do
19792                         case "$netdb_name_type" in
19793                         '')     try="extern struct hostent *gethostbyname($xxx);"
19794                                 if ./protochk "$try" $hdrs; then
19795                                         echo "Your system accepts $xxx."
19796                                         netdb_name_type="$xxx"
19797                                 fi
19798                                 ;;
19799                         esac
19800                 done
19801                 : In case none of those worked, prompt the user.
19802                 case "$netdb_name_type" in
19803                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19804                         dflt='char *'
19805                         . ./myread
19806                         netdb_name_type=$ans
19807                         ;;
19808                 esac
19809                 ;;
19810         *)      : no gethostbyname, so pick harmless default
19811                 netdb_name_type='char *'
19812                 ;;
19813         esac
19814 fi
19815
19816 : check for type of 1st argument to getnetbyaddr. 
19817 if test "X$netdb_net_type" = X ; then
19818         case "$d_getnbyaddr" in
19819         $define)
19820                 $cat <<EOM
19821
19822 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19823 EOM
19824                 hdrs="$define sys/types.h
19825                         $d_socket sys/socket.h 
19826                         $i_niin netinet/in.h 
19827                         $i_netdb netdb.h
19828                         $i_unistd unistd.h"
19829                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19830                         case "$netdb_net_type" in
19831                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19832                                 if ./protochk "$try" $hdrs; then
19833                                         echo "Your system accepts $xxx."
19834                                         netdb_net_type="$xxx"
19835                                 fi
19836                                 ;;
19837                         esac
19838                 done
19839                 : In case none of those worked, prompt the user.
19840                 case "$netdb_net_type" in
19841                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19842                         dflt='long'
19843                         . ./myread
19844                         netdb_net_type=$ans
19845                         ;;
19846                 esac
19847                 ;;
19848         *)      : no getnetbyaddr, so pick harmless default
19849                 netdb_net_type='long'
19850                 ;;
19851         esac
19852 fi
19853 : locate the preferred pager for this system
19854 fn=f/
19855 case "$pager" in
19856 '')
19857         dflt=''
19858         case "$pg" in
19859         /*) dflt=$pg;;
19860         [a-zA-Z]:/*) dflt=$pg;;
19861         esac
19862         case "$more" in
19863         /*) dflt=$more;;
19864         [a-zA-Z]:/*) dflt=$more;;
19865         esac
19866         case "$less" in
19867         /*) dflt=$less;;
19868         [a-zA-Z]:/*) dflt=$less;;
19869         esac
19870         case "$dflt" in
19871         '') dflt=/usr/ucb/more;;
19872         esac
19873         ;;
19874 *)      dflt="$pager"
19875         : Instruct ./getfile to trust the hinted or previous pager value,
19876         : even if it does not begin with a slash.  For example, on os2,
19877         : pager might be cmd /c more.  See comments in UU/getfile.
19878         fn="f/($pager)"
19879         ;;
19880 esac
19881 echo " "
19882 rp='What pager is used on your system?'
19883 . ./getfile
19884 pager="$ans"
19885
19886 : see what type pids are declared as in the kernel
19887 rp="What is the type of process ids on this system?"
19888 set pid_t pidtype int stdio.h sys/types.h
19889 eval $typedef_ask
19890
19891 : see if ar generates random libraries by itself
19892 echo " "
19893 echo "Checking how to generate random libraries on your machine..." >&4
19894 echo 'int bar1() { return bar2(); }' > bar1.c
19895 echo 'int bar2() { return 2; }' > bar2.c
19896 $cat > foo.c <<EOP
19897 #$i_stdlib I_STDLIB
19898 #ifdef I_STDLIB
19899 #include <stdlib.h>
19900 #endif
19901 int main() { printf("%d\n", bar1()); exit(0); }
19902 EOP
19903 $cc $ccflags -c bar1.c >/dev/null 2>&1
19904 $cc $ccflags -c bar2.c >/dev/null 2>&1
19905 $cc $ccflags -c foo.c >/dev/null 2>&1
19906 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19907 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19908         $run ./foobar >/dev/null 2>&1; then
19909         echo "$ar appears to generate random libraries itself."
19910         orderlib=false
19911         if [ "X$ranlib" = "X" ]; then
19912             ranlib=":"
19913         fi
19914 elif $ar s bar$_a >/dev/null 2>&1 &&
19915         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19916         $run ./foobar >/dev/null 2>&1; then
19917                 echo "a table of contents needs to be added with '$ar s'."
19918                 orderlib=false
19919                 ranlib="$ar s"
19920 elif $ar ts bar$_a >/dev/null 2>&1 &&
19921         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19922         $run ./foobar >/dev/null 2>&1; then
19923                 echo "a table of contents needs to be added with '$ar ts'."
19924                 orderlib=false
19925                 ranlib="$ar ts"
19926 else
19927         case "$ranlib" in
19928         :) ranlib='';;
19929         '')
19930                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19931                 $test -f $ranlib || ranlib=''
19932                 ;;
19933         esac
19934         if $test -n "$ranlib"; then
19935                 echo "your system has '$ranlib'; we'll use that."
19936                 orderlib=false
19937         else
19938                 echo "your system doesn't seem to support random libraries"
19939                 echo "so we'll use lorder and tsort to order the libraries."
19940                 orderlib=true
19941                 ranlib=":"
19942         fi
19943 fi
19944 $rm -f foo* bar*
19945
19946 : check for type of arguments to select.
19947 case "$selecttype" in
19948 '') case "$d_select" in
19949         $define)
19950                 echo " "
19951                 $cat <<EOM
19952 Checking to see what type of arguments are accepted by select().
19953 EOM
19954                 hdrs="$define sys/types.h
19955                         $i_systime sys/time.h
19956                         $i_sysselct sys/select.h
19957                         $d_socket sys/socket.h"
19958                 : The first arg can be int, unsigned, or size_t
19959                 : The last arg may or may not be 'const'
19960                 val=''
19961                 : void pointer has been seen but using that
19962                 : breaks the selectminbits test
19963                 for xxx in 'fd_set *' 'int *'; do
19964                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19965                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19966                                         case "$val" in
19967                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19968                                                 if ./protochk "$try" $hdrs; then
19969                                                         echo "Your system accepts $xxx."
19970                                                         val="$xxx"
19971                                                 fi
19972                                                 ;;
19973                                         esac
19974                                 done
19975                         done
19976                 done
19977                 case "$val" in
19978                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19979                         case "$d_fd_set" in
19980                                 $define) dflt="fd_set *" ;;
19981                                 *)              dflt="int *" ;;
19982                         esac
19983                         . ./myread
19984                         val=$ans
19985                         ;;
19986                 esac
19987                 selecttype="$val"
19988                 ;;
19989         *)      : no select, so pick a harmless default
19990                 selecttype='int *'
19991                 ;;
19992         esac
19993         ;;
19994 esac
19995
19996 : check for the select 'width'
19997 case "$selectminbits" in
19998 '') safebits=`expr $ptrsize \* 8`
19999     case "$d_select" in
20000         $define)
20001                 $cat <<EOM
20002
20003 Checking to see on how many bits at a time your select() operates...
20004 EOM
20005                 $cat >try.c <<EOCP
20006 #include <sys/types.h>
20007 #$i_time I_TIME
20008 #$i_systime I_SYS_TIME
20009 #$i_systimek I_SYS_TIME_KERNEL
20010 #ifdef I_TIME
20011 #   include <time.h>
20012 #endif
20013 #ifdef I_SYS_TIME
20014 #   ifdef I_SYS_TIME_KERNEL
20015 #       define KERNEL
20016 #   endif
20017 #   include <sys/time.h>
20018 #   ifdef I_SYS_TIME_KERNEL
20019 #       undef KERNEL
20020 #   endif
20021 #endif
20022 #$i_sysselct I_SYS_SELECT
20023 #ifdef I_SYS_SELECT
20024 #include <sys/select.h>
20025 #endif
20026 #$d_socket HAS_SOCKET
20027 #ifdef HAS_SOCKET
20028 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20029 #endif
20030 #include <stdio.h>
20031 #$i_stdlib I_STDLIB
20032 #ifdef I_STDLIB
20033 #include <stdlib.h>
20034 #endif
20035 $selecttype b;
20036 #define S sizeof(*(b))
20037 #define MINBITS 64
20038 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20039 #define NBITS  (NBYTES * 8)
20040 int main() {
20041     char *s = (char *)malloc(NBYTES);
20042     struct timeval t;
20043     int i;
20044     FILE* fp;
20045     int fd;
20046
20047     if (!s)
20048         exit(1);
20049     fclose(stdin);
20050     fp = fopen("try.c", "r");
20051     if (fp == 0)
20052       exit(2);
20053     fd = fileno(fp);
20054     if (fd < 0)
20055       exit(3);
20056     b = ($selecttype)s;
20057     for (i = 0; i < NBITS; i++)
20058         FD_SET(i, b);
20059     t.tv_sec  = 0;
20060     t.tv_usec = 0;
20061     select(fd + 1, b, 0, 0, &t);
20062     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20063     free(s);
20064     printf("%d\n", i + 1);
20065     return 0;
20066 }
20067 EOCP
20068                 set try
20069                 if eval $compile_ok; then
20070                         selectminbits=`$run ./try`
20071                         case "$selectminbits" in
20072                         '')     cat >&4 <<EOM
20073 Cannot figure out on how many bits at a time your select() operates.
20074 I'll play safe and guess it is $safebits bits.
20075 EOM
20076                                 selectminbits=$safebits
20077                                 bits="$safebits bits"
20078                                 ;;
20079                         1)      bits="1 bit" ;;
20080                         *)      bits="$selectminbits bits" ;;
20081                         esac
20082                         echo "Your select() operates on $bits at a time." >&4
20083                 else
20084                         rp='What is the minimum number of bits your select() operates on?'
20085                         case "$byteorder" in
20086                         12345678)       dflt=64 ;;
20087                         1234)           dflt=32 ;;
20088                         *)              dflt=1  ;;
20089                         esac
20090                         . ./myread
20091                         val=$ans
20092                         selectminbits="$val"
20093                 fi
20094                 $rm_try
20095                 ;;
20096         *)      : no select, so pick a harmless default
20097                 selectminbits=$safebits
20098                 ;;
20099         esac
20100         ;;
20101 esac
20102
20103 : Trace out the files included by signal.h, then look for SIGxxx names.
20104 if [ "X$fieldn" = X ]; then
20105         : Just make some guesses.  We check them later.
20106         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20107 else
20108         xxx=`echo '#include <signal.h>' |
20109         $cppstdin $cppminus $cppflags 2>/dev/null |
20110         $grep '^[       ]*#.*include' |
20111         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20112                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20113 fi
20114 xxxfiles=''
20115 for xx in $xxx /dev/null ; do
20116         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20117 done
20118 case "$xxxfiles" in
20119 '')     xxxfiles=`./findhdr signal.h` ;;
20120 esac
20121 xxx=`awk '
20122 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20123         print substr($2, 4, 20)
20124 }
20125 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20126         print substr($3, 4, 20)
20127 }' $xxxfiles`
20128 : Append some common names just in case the awk scan failed.
20129 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20130 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20131 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20132 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20133 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20134
20135 : generate a few handy files for later
20136 $cat > signal.c <<EOCP
20137 #include <sys/types.h>
20138 #include <signal.h>
20139 #$i_stdlib I_STDLIB
20140 #ifdef I_STDLIB
20141 #include <stdlib.h>
20142 #endif
20143 #include <stdio.h>
20144 int main() {
20145
20146 /* Strange style to avoid deeply-nested #if/#else/#endif */
20147 #ifndef NSIG
20148 #  ifdef _NSIG
20149 #    define NSIG (_NSIG)
20150 #  endif
20151 #endif
20152
20153 #ifndef NSIG
20154 #  ifdef SIGMAX
20155 #    define NSIG (SIGMAX+1)
20156 #  endif
20157 #endif
20158
20159 #ifndef NSIG
20160 #  ifdef SIG_MAX
20161 #    define NSIG (SIG_MAX+1)
20162 #  endif
20163 #endif
20164
20165 #ifndef NSIG
20166 #  ifdef _SIG_MAX
20167 #    define NSIG (_SIG_MAX+1)
20168 #  endif
20169 #endif
20170
20171 #ifndef NSIG
20172 #  ifdef MAXSIG
20173 #    define NSIG (MAXSIG+1)
20174 #  endif
20175 #endif
20176
20177 #ifndef NSIG
20178 #  ifdef MAX_SIG
20179 #    define NSIG (MAX_SIG+1)
20180 #  endif
20181 #endif
20182
20183 #ifndef NSIG
20184 #  ifdef SIGARRAYSIZE
20185 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20186 #  endif
20187 #endif
20188
20189 #ifndef NSIG
20190 #  ifdef _sys_nsig
20191 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20192 #  endif
20193 #endif
20194
20195 /* Default to some arbitrary number that's big enough to get most
20196    of the common signals.
20197 */
20198 #ifndef NSIG
20199 #    define NSIG 50
20200 #endif
20201
20202 printf("NSIG %d\n", NSIG);
20203
20204 #ifndef JUST_NSIG
20205
20206 EOCP
20207
20208 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20209 {
20210         printf "#ifdef SIG"; printf $1; printf "\n"
20211         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20212         printf $1; printf ");\n"
20213         printf "#endif\n"
20214 }
20215 END {
20216         printf "#endif /* JUST_NSIG */\n";
20217         printf "exit(0);\n}\n";
20218 }
20219 ' >>signal.c
20220 $cat >signal.awk <<'EOP'
20221 BEGIN { ndups = 0 }
20222 $1 ~ /^NSIG$/ { nsig = $2 }
20223 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20224     if ($2 > maxsig) { maxsig = $2 }
20225     if (sig_name[$2]) {
20226         dup_name[ndups] = $1
20227         dup_num[ndups] = $2
20228         ndups++
20229     }
20230     else {
20231         sig_name[$2] = $1
20232         sig_num[$2] = $2
20233     }
20234 }
20235 END {
20236     if (nsig == 0) {
20237         nsig = maxsig + 1
20238     }
20239     printf("NSIG %d\n", nsig);
20240     for (n = 1; n < nsig; n++) {
20241         if (sig_name[n]) {
20242             printf("%s %d\n", sig_name[n], sig_num[n])
20243         }
20244         else {
20245             printf("NUM%d %d\n", n, n)
20246         }
20247     }
20248     for (n = 0; n < ndups; n++) {
20249         printf("%s %d\n", dup_name[n], dup_num[n])
20250     }
20251 }
20252 EOP
20253 $cat >signal_cmd <<EOS
20254 $startsh
20255 if $test -s signal.lst; then
20256     echo "Using your existing signal.lst file"
20257         exit 0
20258 fi
20259 xxx="$xxx"
20260 EOS
20261 $cat >>signal_cmd <<'EOS'
20262
20263 set signal
20264 if eval $compile_ok; then
20265         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20266                 $uniq | $awk -f signal.awk >signal.lst
20267 else
20268         echo "(I can't seem be able to compile the whole test program)" >&4
20269         echo "(I'll try it in little pieces.)" >&4
20270         set signal -DJUST_NSIG
20271         if eval $compile_ok; then
20272                 $run ./signal$_exe > signal.nsg
20273                 $cat signal.nsg
20274         else
20275                 echo "I can't seem to figure out how many signals you have." >&4
20276                 echo "Guessing 50." >&4
20277                 echo 'NSIG 50' > signal.nsg
20278         fi
20279         : Now look at all the signal names, one at a time.
20280         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20281                 $cat > signal.c <<EOCP
20282 #include <sys/types.h>
20283 #include <signal.h>
20284 #include <stdio.h>
20285 int main() {
20286 printf("$xx %d\n", SIG${xx});
20287 return 0;
20288 }
20289 EOCP
20290                 set signal
20291                 if eval $compile; then
20292                         echo "SIG${xx} found."
20293                         $run ./signal$_exe  >> signal.ls1
20294                 else
20295                         echo "SIG${xx} NOT found."
20296                 fi
20297         done
20298         if $test -s signal.ls1; then
20299                 $cat signal.nsg signal.ls1 |
20300                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20301         fi
20302
20303 fi
20304 if $test -s signal.lst; then
20305         :
20306 else
20307         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20308         echo 'kill -l' >signal
20309         set X `csh -f <signal`
20310         $rm -f signal
20311         shift
20312         case $# in
20313         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20314         esac
20315         echo $@ | $tr ' ' $trnl | \
20316             $awk '{ printf "%s %d\n", $1, ++s; }
20317                   END { printf "NSIG %d\n", ++s }' >signal.lst
20318 fi
20319 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20320 EOS
20321 chmod a+x signal_cmd
20322 $eunicefix signal_cmd
20323
20324 : generate list of signal names
20325 echo " "
20326 case "$sig_name_init" in
20327 '') doinit=yes ;;
20328 *)  case "$sig_num_init" in
20329     ''|*,*) doinit=yes ;;
20330     esac ;;
20331 esac
20332 case "$doinit" in
20333 yes)
20334         echo "Generating a list of signal names and numbers..." >&4
20335         . ./signal_cmd
20336         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20337         sig_name=`$awk 'BEGIN { printf "ZERO " }
20338                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20339         sig_num=`$awk  'BEGIN { printf "0 " }
20340                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20341         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20342                              !/^NSIG/   { printf "\"%s\", ", $1 }
20343                              END        { printf "0\n" }' signal.lst`
20344         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20345                              !/^NSIG/   { printf "%d, ", $2}
20346                              END        { printf "0\n"}' signal.lst`
20347         ;;
20348 esac
20349 echo "The following $sig_count signals are available:"
20350 echo " "
20351 echo $sig_name | $awk \
20352 'BEGIN { linelen = 0 }
20353 {
20354         for (i = 1; i <= NF; i++) {
20355                 name = "SIG" $i " "
20356                 linelen = linelen + length(name)
20357                 if (linelen > 70) {
20358                         printf "\n"
20359                         linelen = length(name)
20360                 }
20361                 printf "%s", name
20362         }
20363         printf "\n"
20364 }'
20365 sig_size=`echo $sig_name | awk '{print NF}'`
20366 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20367
20368 : Check size of size
20369 echo " "
20370 case "$sizetype" in
20371 *_t) zzz="$sizetype"    ;;
20372 *)   zzz="filesize"     ;;
20373 esac
20374 echo "Checking the size of $zzz..." >&4
20375 cat > try.c <<EOCP
20376 #include <sys/types.h>
20377 #include <stdio.h>
20378 #$i_stdlib I_STDLIB
20379 #ifdef I_STDLIB
20380 #include <stdlib.h>
20381 #endif
20382 int main() {
20383     printf("%d\n", (int)sizeof($sizetype));
20384     exit(0);
20385 }
20386 EOCP
20387 set try
20388 if eval $compile_ok; then
20389         yyy=`$run ./try`
20390         case "$yyy" in
20391         '')     sizesize=4
20392                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20393                 ;;
20394         *)      sizesize=$yyy
20395                 echo "Your $zzz size is $sizesize bytes."
20396                 ;;
20397         esac
20398 else
20399         sizesize=4
20400         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20401 fi
20402
20403
20404 : check for socklen_t
20405 echo " "
20406 echo "Checking to see if you have socklen_t..." >&4
20407 $cat >try.c <<EOCP
20408 #include <sys/types.h>
20409 #$d_socket HAS_SOCKET
20410 #ifdef HAS_SOCKET
20411 #include <sys/socket.h>
20412 #endif
20413 int main() { socklen_t x = 16; }
20414 EOCP
20415 set try
20416 if eval $compile; then
20417         val="$define"
20418         echo "You have socklen_t."
20419 else
20420         val="$undef"
20421         echo "You do not have socklen_t."
20422         case "$sizetype" in
20423         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20424         esac
20425 fi
20426 $rm_try
20427 set d_socklen_t
20428 eval $setvar
20429
20430 : see if this is a socks.h system
20431 set socks.h i_socks
20432 eval $inhdr
20433
20434 : check for type of the size argument to socket calls
20435 case "$d_socket" in
20436 "$define")
20437         $cat <<EOM
20438
20439 Checking to see what type is the last argument of accept().
20440 EOM
20441         yyy=''
20442         case "$d_socklen_t" in
20443         "$define") yyy="$yyy socklen_t"
20444         esac
20445         yyy="$yyy $sizetype int long unsigned"
20446         for xxx in $yyy; do
20447                 case "$socksizetype" in
20448                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20449                         case "$usesocks" in
20450                         "$define")
20451                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20452                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20453                                         socksizetype="$xxx"
20454                                 fi
20455                                 ;;
20456                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20457                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20458                                         socksizetype="$xxx"
20459                                 fi
20460                                 ;;
20461                         esac
20462                         ;;
20463                 esac
20464         done
20465 : In case none of those worked, prompt the user.
20466         case "$socksizetype" in
20467         '')     rp='What is the type for socket address structure sizes?'
20468                 dflt='int'
20469                 . ./myread
20470                 socksizetype=$ans
20471                 ;;
20472         esac
20473         ;;
20474 *)      : no sockets, so pick relatively harmless default
20475         socksizetype='int'
20476         ;;
20477 esac
20478
20479 : see what type is used for signed size_t
20480 set ssize_t ssizetype int stdio.h sys/types.h
20481 eval $typedef
20482 dflt="$ssizetype"
20483 $cat > try.c <<EOM
20484 #include <stdio.h>
20485 #$i_stdlib I_STDLIB
20486 #ifdef I_STDLIB
20487 #include <stdlib.h>
20488 #endif
20489 #include <sys/types.h>
20490 #define Size_t $sizetype
20491 #define SSize_t $dflt
20492 int main()
20493 {
20494         if (sizeof(Size_t) == sizeof(SSize_t))
20495                 printf("$dflt\n");
20496         else if (sizeof(Size_t) == sizeof(int))
20497                 printf("int\n");
20498         else
20499                 printf("long\n");
20500         exit(0);
20501 }
20502 EOM
20503 echo " "
20504 set try
20505 if eval $compile_ok && $run ./try > /dev/null; then
20506         ssizetype=`$run ./try`
20507         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20508 else
20509         $cat >&4 <<EOM
20510 Help! I can't compile and run the ssize_t test program: please enlighten me!
20511 (This is probably a misconfiguration in your system or libraries, and
20512 you really ought to fix it.  Still, I'll try anyway.)
20513
20514 I need a type that is the same size as $sizetype, but is guaranteed to
20515 be signed.  Common values are ssize_t, int and long.
20516
20517 EOM
20518         rp="What signed type is the same size as $sizetype?"
20519         . ./myread
20520         ssizetype="$ans"
20521 fi
20522 $rm_try
20523
20524 : see what type of char stdio uses.
20525 echo " "
20526 echo '#include <stdio.h>' > stdio.c
20527 $cppstdin $cppminus < stdio.c > stdioh
20528 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20529         echo "Your stdio uses unsigned chars." >&4
20530         stdchar="unsigned char"
20531 else
20532         echo "Your stdio uses signed chars." >&4
20533         stdchar="char"
20534 fi
20535 $rm -f stdio.* stdioh
20536
20537 : see what type uids are declared as in the kernel
20538 echo " "
20539 echo "Looking for the type for user ids returned by getuid()."
20540 set uid_t uidtype xxx stdio.h sys/types.h
20541 eval $typedef
20542 case "$uidtype" in
20543 xxx)
20544         xxx=`./findhdr sys/user.h`
20545         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20546         case $1 in
20547         unsigned) dflt="$1 $2" ;;
20548         *) dflt="$1" ;;
20549         esac
20550         ;;
20551 *) dflt="$uidtype";;
20552 esac
20553 case "$uidtype" in
20554 uid_t)  echo "uid_t found." ;;
20555 *)      rp="What is the type for user ids returned by getuid()?"
20556         . ./myread
20557         uidtype="$ans"
20558         ;;
20559 esac
20560
20561 : Check size of UID
20562 echo " "
20563 case "$uidtype" in
20564 *_t) zzz="$uidtype"     ;;
20565 *)   zzz="uid"          ;;
20566 esac
20567 echo "Checking the size of $zzz..." >&4
20568 cat > try.c <<EOCP
20569 #include <sys/types.h>
20570 #include <stdio.h>
20571 #$i_stdlib I_STDLIB
20572 #ifdef I_STDLIB
20573 #include <stdlib.h>
20574 #endif
20575 int main() {
20576     printf("%d\n", (int)sizeof($uidtype));
20577     exit(0);
20578 }
20579 EOCP
20580 set try
20581 if eval $compile_ok; then
20582         yyy=`$run ./try`
20583         case "$yyy" in
20584         '')     uidsize=4
20585                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20586                 ;;
20587         *)      uidsize=$yyy
20588                 echo "Your $zzz is $uidsize bytes long."
20589                 ;;
20590         esac
20591 else
20592         uidsize=4
20593         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20594 fi
20595
20596 : Check if UID is signed
20597 echo " "
20598 case "$uidtype" in
20599 *_t) zzz="$uidtype"     ;;
20600 *)   zzz="uid"          ;;
20601 esac
20602 echo "Checking the sign of $zzz..." >&4
20603 cat > try.c <<EOCP
20604 #include <sys/types.h>
20605 #include <stdio.h>
20606 int main() {
20607         $uidtype foo = -1;
20608         if (foo < 0)
20609                 printf("-1\n");
20610         else
20611                 printf("1\n");
20612 }
20613 EOCP
20614 set try
20615 if eval $compile; then
20616         yyy=`$run ./try`
20617         case "$yyy" in
20618         '')     uidsign=1
20619                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20620                 ;;
20621         *)      uidsign=$yyy
20622                 case "$uidsign" in
20623                  1) echo "Your $zzz is unsigned." ;;
20624                 -1) echo "Your $zzz is signed."   ;;
20625                 esac
20626                 ;;
20627         esac
20628 else
20629         uidsign=1
20630         echo "(I can't compile the test program--guessing unsigned.)" >&4
20631 fi
20632
20633
20634 : Check format string for UID
20635 echo " "
20636 $echo "Checking the format string to be used for uids..." >&4
20637
20638 case "$uidsign" in
20639 -1)     if $test X"$uidsize" = X"$ivsize"; then
20640                 uidformat="$ivdformat"
20641         else
20642                 if $test X"$uidsize" = X"$longsize"; then
20643                         uidformat='"ld"'
20644                 else
20645                         if $test X"$uidsize" = X"$intsize"; then
20646                                 uidformat='"d"'
20647                         else
20648                                 if $test X"$uidsize" = X"$shortsize"; then
20649                                         uidformat='"hd"'
20650                                 fi
20651                         fi
20652                 fi
20653         fi
20654         ;;
20655 *)      if $test X"$uidsize" = X"$uvsize"; then
20656                 uidformat="$uvuformat"
20657         else
20658                 if $test X"$uidsize" = X"$longsize"; then
20659                         uidformat='"lu"'
20660                 else
20661                         if $test X"$uidsize" = X"$intsize"; then
20662                                 uidformat='"u"'
20663                         else
20664                                 if $test X"$uidsize" = X"$shortsize"; then
20665                                         uidformat='"hu"'
20666                                 fi
20667                         fi
20668                 fi
20669         fi
20670         ;;
20671 esac
20672
20673 : Check if site customization support was requested
20674 case "$usesitecustomize" in
20675     $define|true|[Yy]*)
20676         usesitecustomize="$define"
20677         ;;
20678     *)
20679         usesitecustomize="$undef"
20680         ;;
20681     esac
20682
20683 : determine compiler compiler
20684 case "$yacc" in
20685 '')
20686         dflt=yacc;;
20687 *)
20688         dflt="$yacc";;
20689 esac
20690 echo " "
20691 comp='yacc'
20692 if $test -f "$byacc$_exe"; then
20693         dflt="$byacc"
20694         comp="byacc or $comp"
20695 fi
20696 if $test -f "$bison$_exe"; then
20697         comp="$comp or bison -y"
20698 fi
20699 rp="Which compiler compiler ($comp) shall I use?"
20700 . ./myread
20701 yacc="$ans"
20702 case "$yacc" in
20703 *bis*)
20704         case "$yacc" in
20705         *-y*) ;;
20706         *)
20707                 yacc="$yacc -y"
20708                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20709                 ;;
20710         esac
20711         ;;
20712 esac
20713
20714 : see if this is a assert.h system
20715 set assert.h i_assert
20716 eval $inhdr
20717
20718 : see if this is a fp.h system
20719 set fp.h i_fp
20720 eval $inhdr
20721
20722 : see if this is a fp_class.h system
20723 set fp_class.h i_fp_class
20724 eval $inhdr
20725
20726 : see if gdbm.h is available
20727 set gdbm.h t_gdbm
20728 eval $inhdr
20729 case "$t_gdbm" in
20730 $define)
20731         : see if gdbm_open exists
20732         set gdbm_open d_gdbm_open
20733         eval $inlibc
20734         case "$d_gdbm_open" in
20735         $undef)
20736                 t_gdbm="$undef"
20737                 echo "We won't be including <gdbm.h>"
20738                 ;;
20739         esac
20740         ;;
20741 esac
20742 val="$t_gdbm"
20743 set i_gdbm
20744 eval $setvar
20745
20746 : see if this is a ieeefp.h system
20747 case "$i_ieeefp" in
20748 '' ) set ieeefp.h i_ieeefp
20749      eval $inhdr
20750      ;;
20751 esac
20752
20753 : see if this is a libutil.h system
20754 set libutil.h i_libutil
20755 eval $inhdr
20756
20757 : see if mach cthreads are available
20758 if test "X$usethreads" = "X$define"; then
20759         set mach/cthreads.h i_machcthr
20760         eval $inhdr
20761 else
20762         i_machcthr="$undef"
20763 fi
20764
20765 : see if this is a mntent.h system
20766 set mntent.h i_mntent
20767 eval $inhdr
20768
20769 : see if ndbm.h is available
20770 set ndbm.h t_ndbm
20771 eval $inhdr
20772
20773 case "$t_ndbm" in
20774 $undef)
20775     # Some Linux distributions such as RedHat 7.1 put the
20776     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20777     if $test -f /usr/include/gdbm/ndbm.h; then
20778         echo '<gdbm/ndbm.h> found.'
20779         ccflags="$ccflags -I/usr/include/gdbm"
20780         cppflags="$cppflags -I/usr/include/gdbm"
20781         t_ndbm=$define
20782     fi
20783     ;;
20784 esac
20785
20786 case "$t_ndbm" in
20787 $define)
20788         : see if dbm_open exists
20789         set dbm_open d_dbm_open
20790         eval $inlibc
20791         case "$d_dbm_open" in
20792         $undef)
20793                 t_ndbm="$undef"
20794                 echo "We won't be including <ndbm.h>"
20795                 ;;
20796         esac
20797         ;;
20798 esac
20799 val="$t_ndbm"
20800 set i_ndbm
20801 eval $setvar
20802
20803 : see if net/errno.h is available
20804 val=''
20805 set net/errno.h val
20806 eval $inhdr
20807
20808 : Unfortunately, it causes problems on some systems.  Arrgh.
20809 case "$val" in
20810 $define)
20811         cat > try.c <<'EOM'
20812 #include <stdio.h>
20813 #include <errno.h>
20814 #include <net/errno.h>
20815 int func()
20816 {
20817         return ENOTSOCK;
20818 }
20819 EOM
20820         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20821                 echo "We'll be including <net/errno.h>." >&4
20822         else
20823                 echo "We won't be including <net/errno.h>." >&4
20824                 val="$undef"
20825         fi
20826         $rm_try
20827         ;;
20828 esac
20829 set i_neterrno
20830 eval $setvar
20831
20832 : see if netinet/tcp.h is available
20833 set netinet/tcp.h i_netinettcp
20834 eval $inhdr
20835
20836 : see if this is a poll.h system
20837 set poll.h i_poll
20838 eval $inhdr
20839
20840 : see if this is a prot.h system
20841 set prot.h i_prot
20842 eval $inhdr
20843
20844 : Preprocessor symbols
20845 echo " "
20846 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20847 $cat <<'EOSH' > Cppsym.know
20848 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20849 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20850 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20851 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20852 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20853 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20854 bull c cadmus clipper CMU COFF COMPILER_VERSION
20855 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20856 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20857 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20858 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20859 GLIBC GLIBC_MINOR
20860 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20861 H3050R H3050RX hbullx20 hcx host_mips
20862 hp200 hp300 hp700 HP700 hp800 hp9000
20863 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20864 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20865 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20866 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20867 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20868 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20869 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20870 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20871 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20872 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20873 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20874 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20875 MATH_HAS_NO_SIDE_EFFECTS
20876 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20877 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20878 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20879 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20880 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20881 NetBSD news1500 news1700 news1800 news1900 news3700
20882 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20883 ns32016 ns32332 ns32k nsc32000
20884 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20885 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20886 pc532 pdp11 PGC PIC plexus PORTAR posix
20887 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20888 POSIX_C_SOURCE POSIX_SOURCE POWER
20889 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20890 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20891 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20892 sony sony_news sonyrisc sparc sparclite spectrum
20893 stardent stdc STDC_EXT stratos sun sun3 sun386
20894 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20895 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20896 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20897 sysV68 sysV88 Tek4132 Tek4300 titan
20898 TM3200 TM5400 TM5600
20899 tower tower32 tower32_200 tower32_600 tower32_700
20900 tower32_800 tower32_850 tss
20901 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20902 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20903 unix UNIX95 UNIX99 unixpc unos
20904 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20905 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20906 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20907 USGr4 USGr4_2
20908 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20909 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20910 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20911 z8000
20912 EOSH
20913 # Maybe put other stuff here too.
20914 cat <<EOSH >>Cppsym.know
20915 $osname
20916 EOSH
20917 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20918 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20919 $cat Cppsym.know > Cppsym.c
20920 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20921 $rm -f Cppsym.a Cppsym.b Cppsym.c
20922 cat <<EOSH > Cppsym
20923 $startsh
20924 if $test \$# -gt 0; then
20925     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20926     if $test -s Cppsym.got; then
20927         $rm -f Cppsym.got
20928         exit 0
20929     fi
20930     $rm -f Cppsym.got
20931     exit 1
20932 else
20933     $tr " " "$trnl" | ./Cppsym.try
20934     exit 0
20935 fi
20936 EOSH
20937 chmod +x Cppsym
20938 $eunicefix Cppsym
20939 cat <<EOSH > Cppsym.try
20940 $startsh
20941 cat <<'EOCP' > try.c
20942 #include <stdio.h>
20943 #if cpp_stuff == 1
20944 #define STRINGIFY(a)    "a"
20945 #endif
20946 #if cpp_stuff == 42
20947 #define StGiFy(a)  #a
20948 #define STRINGIFY(a)    StGiFy(a)
20949 #endif
20950 #if $cpp_stuff != 1 && $cpp_stuff != 42
20951 #   include "Bletch: How does this C preprocessor stringify macros?"
20952 #endif
20953 int main() {
20954 EOCP
20955 $awk \\
20956 EOSH
20957 cat <<'EOSH' >> Cppsym.try
20958 'length($1) > 0 {
20959     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20960     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20961     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20962     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20963 }'       >> try.c
20964 echo 'return 0;}' >> try.c
20965 EOSH
20966 cat <<EOSH >> Cppsym.try
20967 ccflags="$ccflags"
20968 case "$osname-$gccversion" in
20969 irix-) ccflags="\$ccflags -woff 1178" ;;
20970 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20971 esac
20972 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20973 EOSH
20974 chmod +x Cppsym.try
20975 $eunicefix Cppsym.try
20976 ./Cppsym < Cppsym.know > Cppsym.true
20977 : Add in any linux cpp "predefined macros":
20978 case "$osname::$gccversion" in
20979   *linux*::*.*)
20980     tHdrH=_tmpHdr
20981     rm -f $tHdrH'.h' $tHdrH
20982     touch $tHdrH'.h'
20983     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20984        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20985        if [ -s $tHdrH'_cppsym.real' ]; then
20986           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20987        fi
20988     fi
20989     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20990   ;;
20991 esac
20992 : now check the C compiler for additional symbols
20993 postprocess_cc_v=''
20994 case "$osname" in
20995 aix) postprocess_cc_v="|$tr , ' '" ;;
20996 esac
20997 $cat >ccsym <<EOS
20998 $startsh
20999 $cat >tmp.c <<EOF
21000 extern int foo;
21001 EOF
21002 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21003 do
21004         case "\$i" in
21005         -D*) echo "\$i" | $sed 's/^-D//';;
21006         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21007         esac
21008 done
21009 $rm_try
21010 EOS
21011 postprocess_cc_v=''
21012 chmod +x ccsym
21013 $eunicefix ccsym
21014 ./ccsym > ccsym1.raw
21015 if $test -s ccsym1.raw; then
21016        $sort ccsym1.raw | $uniq >ccsym.raw
21017 else
21018        mv ccsym1.raw ccsym.raw
21019 fi
21020
21021 $awk '/\=/ { print $0; next }
21022         { print $0"=1" }' ccsym.raw >ccsym.list
21023 $comm -13 Cppsym.true ccsym.list >ccsym.own
21024 $comm -12 Cppsym.true ccsym.list >ccsym.com
21025 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21026 also=''
21027 if $test -z ccsym.raw; then
21028         echo "Your C compiler doesn't seem to define any symbols!" >&4
21029         echo " "
21030         echo "However, your C preprocessor defines the following symbols:"
21031         $cat Cppsym.true
21032         ccsymbols=''
21033         cppsymbols=`$cat Cppsym.true`
21034         cppsymbols=`echo $cppsymbols`
21035         cppccsymbols="$cppsymbols"
21036 else
21037         if $test -s ccsym.com; then
21038                 echo "Your C compiler and pre-processor define these symbols:"
21039                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21040                 also='also '
21041                 symbols='ones'
21042                 cppccsymbols=`$cat ccsym.com`
21043                 cppccsymbols=`echo $cppccsymbols`
21044                 $test "$silent" || sleep 1
21045         fi
21046         if $test -s ccsym.cpp; then
21047                 $test "$also" && echo " "
21048                 echo "Your C pre-processor ${also}defines the following symbols:"
21049                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21050                 also='further '
21051                 cppsymbols=`$cat ccsym.cpp`
21052                 cppsymbols=`echo $cppsymbols`
21053                 $test "$silent" || sleep 1
21054         fi
21055         if $test -s ccsym.own; then
21056                 $test "$also" && echo " "
21057                 echo "Your C compiler ${also}defines the following cpp symbols:"
21058                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21059                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21060                 ccsymbols=`$cat ccsym.own`
21061                 ccsymbols=`echo $ccsymbols`
21062                 $test "$silent" || sleep 1
21063         fi
21064 fi
21065
21066 : see if this is a termio system
21067 val="$undef"
21068 val2="$undef"
21069 val3="$undef"
21070 if $test `./findhdr termios.h`; then
21071         set tcsetattr i_termios
21072         eval $inlibc
21073         val3="$i_termios"
21074 fi
21075 echo " "
21076 case "$val3" in
21077 "$define") echo "You have POSIX termios.h... good!" >&4;;
21078 *) if ./Cppsym pyr; then
21079                 case "`/bin/universe`" in
21080                 ucb) if $test `./findhdr sgtty.h`; then
21081                                 val2="$define"
21082                                 echo "<sgtty.h> found." >&4
21083                         else
21084                                 echo "System is pyramid with BSD universe."
21085                                 echo "<sgtty.h> not found--you could have problems." >&4
21086                         fi;;
21087                 *) if $test `./findhdr termio.h`; then
21088                                 val="$define"
21089                                 echo "<termio.h> found." >&4
21090                         else
21091                                 echo "System is pyramid with USG universe."
21092                                 echo "<termio.h> not found--you could have problems." >&4
21093                         fi;;
21094                 esac
21095         elif ./usg; then
21096                 if $test `./findhdr termio.h`; then
21097                         echo "<termio.h> found." >&4
21098                         val="$define"
21099                 elif $test `./findhdr sgtty.h`; then
21100                         echo "<sgtty.h> found." >&4
21101                         val2="$define"
21102                 else
21103 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
21104                 fi
21105         else
21106                 if $test `./findhdr sgtty.h`; then
21107                         echo "<sgtty.h> found." >&4
21108                         val2="$define"
21109                 elif $test `./findhdr termio.h`; then
21110                         echo "<termio.h> found." >&4
21111                         val="$define"
21112                 else
21113 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
21114                 fi
21115         fi;;
21116 esac
21117 set i_termio; eval $setvar
21118 val=$val2; set i_sgtty; eval $setvar
21119 val=$val3; set i_termios; eval $setvar
21120
21121 : see if stddef is available
21122 set stddef.h i_stddef
21123 eval $inhdr
21124
21125 : see if sys/access.h is available
21126 set sys/access.h i_sysaccess
21127 eval $inhdr
21128
21129 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21130 set sys/filio.h i_sysfilio
21131 eval $inhdr
21132 echo " "
21133 if $test `./findhdr sys/ioctl.h`; then
21134         val="$define"
21135         echo '<sys/ioctl.h> found.' >&4
21136 else
21137         val="$undef"
21138         if $test $i_sysfilio = "$define"; then
21139             echo '<sys/ioctl.h> NOT found.' >&4
21140         else
21141                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21142                 $test $i_termio = "$define" && xxx="termio.h"
21143                 $test $i_termios = "$define" && xxx="termios.h"
21144 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21145         fi
21146 fi
21147 set i_sysioctl
21148 eval $setvar
21149
21150 : see if socket ioctl defs are in sys/sockio.h
21151 echo " "
21152 xxx=`./findhdr sys/sockio.h`
21153 if $test "$xxx"; then
21154         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21155                 val="$define"
21156                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21157         else
21158                 val="$undef"
21159                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21160         fi
21161 else
21162         val="$undef"
21163         $cat <<EOM
21164 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21165 EOM
21166 fi
21167 set i_syssockio
21168 eval $setvar
21169
21170 : see if this is a syslog.h system
21171 set syslog.h i_syslog
21172 eval $inhdr
21173
21174 : see if this is a sys/mode.h system
21175 set sys/mode.h i_sysmode
21176 eval $inhdr
21177
21178 : see if sys/resource.h has to be included
21179 set sys/resource.h i_sysresrc
21180 eval $inhdr
21181
21182 : see if sys/security.h is available
21183 set sys/security.h i_syssecrt
21184 eval $inhdr
21185
21186 : see if this is a sys/statvfs.h system
21187 set sys/statvfs.h i_sysstatvfs
21188 eval $inhdr
21189
21190 : see if this is a sys/un.h system
21191 set sys/un.h i_sysun
21192 eval $inhdr
21193
21194 : see if this is a sys/utsname.h system
21195 set sys/utsname.h i_sysutsname
21196 eval $inhdr
21197
21198 : see if this is a syswait system
21199 set sys/wait.h i_syswait
21200 eval $inhdr
21201
21202 : see if this is a ustat.h system
21203 set ustat.h i_ustat
21204 eval $inhdr
21205
21206 : see if this is an utime system
21207 set utime.h i_utime
21208 eval $inhdr
21209
21210 : see if this is a values.h system
21211 set values.h i_values
21212 eval $inhdr
21213
21214 : see if this is a vfork system
21215 case "$d_vfork" in
21216 "$define")
21217         set vfork.h i_vfork
21218         eval $inhdr
21219         ;;
21220 *)
21221         i_vfork="$undef"
21222         ;;
21223 esac
21224
21225 : Check extensions
21226 echo " "
21227 echo "Looking for extensions..." >&4
21228 : If we are using the old config.sh, known_extensions may contain
21229 : old or inaccurate or duplicate values.
21230 known_extensions=''
21231 nonxs_extensions=''
21232 : We do not use find because it might not be available.
21233 : We do not just use MANIFEST because the user may have dropped
21234 : some additional extensions into the source tree and expect them
21235 : to be built.
21236
21237 : Function to recursively find available extensions, ignoring DynaLoader
21238 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21239 find_extensions='
21240     for xxx in *; do
21241         case "$xxx" in
21242             DynaLoader|dynaload) ;;
21243             *)
21244             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21245                 known_extensions="$known_extensions $1$xxx";
21246             elif $test -f $xxx/Makefile.PL; then
21247                 nonxs_extensions="$nonxs_extensions $1$xxx";
21248             else
21249                 if $test -d $xxx -a $# -lt 10; then
21250                     set $1$xxx/ $*;
21251                     cd "$xxx";
21252                     eval $find_extensions;
21253                     cd ..;
21254                     shift;
21255                 fi;
21256             fi
21257             ;;
21258         esac;
21259     done'
21260 tdir=`pwd`
21261 cd "$rsrc/ext"
21262 set X
21263 shift
21264 eval $find_extensions
21265 # Special case:  Add in modules that nest beyond the first level.
21266 # Currently threads/shared and Hash/Util/FieldHash, since they are
21267 # not picked up by the recursive find above (and adding in general
21268 # recursive finding breaks SDBM_File/sdbm).
21269 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21270 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21271 set X $known_extensions
21272 shift
21273 known_extensions="$*"
21274 set X $nonxs_extensions
21275 shift
21276 nonxs_extensions="$*"
21277 cd "$tdir"
21278
21279 : Now see which are supported on this system.
21280 avail_ext=''
21281 for xxx in $known_extensions ; do
21282         case "$xxx" in
21283         DB_File|db_file)
21284                 case "$i_db" in
21285                 $define) avail_ext="$avail_ext $xxx" ;;
21286                 esac
21287                 ;;
21288         GDBM_File|gdbm_fil)
21289                 case "$i_gdbm" in
21290                 $define) avail_ext="$avail_ext $xxx" ;;
21291                 esac
21292                 ;;
21293         I18N/Langinfo|i18n_lan)
21294                 case "$i_langinfo$d_nl_langinfo" in
21295                 $define$define) avail_ext="$avail_ext $xxx" ;;
21296                 esac
21297                 ;;
21298         IPC/SysV|ipc/sysv)
21299                 : XXX Do we need a useipcsysv variable here
21300                 case "${d_msg}${d_sem}${d_shm}" in
21301                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21302                 esac
21303                 ;;
21304         NDBM_File|ndbm_fil)
21305                 case "$i_ndbm" in
21306                 $define)
21307                     case "$osname-$use64bitint" in
21308                     hpux-define)
21309                         case "$libs" in
21310                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21311                         esac
21312                         ;;
21313                     *) avail_ext="$avail_ext $xxx" ;;
21314                     esac
21315                     ;;
21316                 esac
21317                 ;;
21318         ODBM_File|odbm_fil)
21319                 case "${i_dbm}${i_rpcsvcdbm}" in
21320                 *"${define}"*)
21321                     case "$d_cplusplus" in
21322                     define) ;; # delete as a function name will not work
21323                     *)  case "$osname-$use64bitint" in
21324                         hpux-define)
21325                             case "$libs" in
21326                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21327                             esac
21328                             ;;
21329                         *) avail_ext="$avail_ext $xxx" ;;
21330                         esac
21331                         ;;
21332                     esac
21333                     ;;
21334                 esac
21335                 ;;
21336         Opcode|opcode)
21337                 case "$useopcode" in
21338                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21339                 esac
21340                 ;;
21341         POSIX|posix)
21342                 case "$useposix" in
21343                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21344                 esac
21345                 ;;
21346         Socket|socket)
21347                 case "$d_socket" in
21348                 true|$define|y)
21349                     case "$osname" in
21350                     beos) ;; # not unless BONE
21351                     *) avail_ext="$avail_ext $xxx" ;;
21352                     esac
21353                     ;;
21354                 esac
21355                 ;;
21356         Sys/Syslog|sys/syslog)
21357                 : XXX syslog requires socket
21358                 case "$d_socket" in
21359                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21360                 esac
21361                 ;;
21362         Thread|thread)
21363                 case "$usethreads" in
21364                 true|$define|y)
21365                         case "$use5005threads" in
21366                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21367                         esac
21368                 esac
21369                 ;;
21370         threads|threads/shared)
21371                 # threads and threads::shared are special cases.
21372                 # To stop people from asking "Perl 5.8.0 was supposed
21373                 # to have this new fancy threads implementation but my
21374                 # perl doesn't have it" and from people trying to
21375                 # (re)install the threads module using CPAN.pm and
21376                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21377                 # the threads.pm and threads/shared.pm will always be
21378                 # there, croaking informatively ("you need to rebuild
21379                 # all of Perl with threads, sorry") when threads haven't
21380                 # been compiled in.
21381                 # --jhi
21382                 avail_ext="$avail_ext $xxx"
21383                 ;;
21384         Win32*)
21385                 case "$osname" in
21386                 cygwin) avail_ext="$avail_ext $xxx" ;;
21387                 esac
21388                 ;;
21389         XS/APItest|xs/apitest)
21390                 # This is just for testing.  Skip it unless we have dynamic loading.
21391
21392                 case "$usedl" in
21393                 $define) avail_ext="$avail_ext $xxx" ;;
21394                 esac
21395                 ;;
21396         XS/Typemap|xs/typemap)
21397                 # This is just for testing.  Skip it unless we have dynamic loading.
21398                 case "$usedl" in
21399                 $define) avail_ext="$avail_ext $xxx" ;;
21400                 esac
21401                 ;;
21402         *)      avail_ext="$avail_ext $xxx"
21403                 ;;
21404         esac
21405 done
21406
21407 set X $avail_ext
21408 shift
21409 avail_ext="$*"
21410
21411 case "$onlyextensions" in
21412 '') ;;
21413 *)  keepextensions=''
21414     echo "You have requested that only certains extensions be included..." >&4
21415     for i in $onlyextensions; do
21416         case " $avail_ext " in
21417         *" $i "*)
21418             echo "Keeping extension $i."
21419             keepextensions="$keepextensions $i"
21420             ;;
21421         *) echo "Ignoring extension $i." ;;
21422         esac
21423     done
21424     avail_ext="$keepextensions"
21425     ;;
21426 esac
21427
21428 case "$noextensions" in
21429 '') ;;
21430 *)  keepextensions=''
21431     echo "You have requested that certain extensions be ignored..." >&4
21432     for i in $avail_ext; do
21433         case " $noextensions " in
21434         *" $i "*) echo "Ignoring extension $i." ;;
21435         *) echo "Keeping extension $i.";
21436            keepextensions="$keepextensions $i"
21437            ;;
21438         esac
21439     done
21440     avail_ext="$keepextensions"
21441     ;;
21442 esac
21443
21444 : Now see which nonxs extensions are supported on this system.
21445 : For now assume all are.
21446 nonxs_ext=''
21447 for xxx in $nonxs_extensions ; do
21448         case "$xxx" in
21449         *)      nonxs_ext="$nonxs_ext $xxx"
21450                 ;;
21451         esac
21452 done
21453
21454 set X $nonxs_ext
21455 shift
21456 nonxs_ext="$*"
21457
21458 case $usedl in
21459 $define)
21460         $cat <<EOM
21461 A number of extensions are supplied with $package.  You may choose to
21462 compile these extensions for dynamic loading (the default), compile
21463 them into the $package executable (static loading), or not include
21464 them at all.  Answer "none" to include no extensions.
21465 Note that DynaLoader is always built and need not be mentioned here.
21466
21467 EOM
21468         case "$dynamic_ext" in
21469         '')
21470                 : Exclude those listed in static_ext
21471                 dflt=''
21472                 for xxx in $avail_ext; do
21473                         case " $static_ext " in
21474                         *" $xxx "*) ;;
21475                         *) dflt="$dflt $xxx" ;;
21476                         esac
21477                 done
21478                 set X $dflt
21479                 shift
21480                 dflt="$*"
21481                 ;;
21482         *)      dflt="$dynamic_ext"
21483                 # Perhaps we are reusing an old out-of-date config.sh.
21484                 case "$hint" in
21485                 previous)
21486                         if test X"$dynamic_ext" != X"$avail_ext"; then
21487                                 $cat <<EOM
21488 NOTICE:  Your previous config.sh list may be incorrect.
21489 The extensions now available to you are
21490         ${avail_ext}
21491 but the default list from your previous config.sh is
21492         ${dynamic_ext}
21493
21494 EOM
21495                         fi
21496                         ;;
21497                 esac
21498                 ;;
21499         esac
21500         case "$dflt" in
21501         '')     dflt=none;;
21502         esac
21503         rp="What extensions do you wish to load dynamically?"
21504         . ./myread
21505         case "$ans" in
21506         none) dynamic_ext=' ' ;;
21507         *) dynamic_ext="$ans" ;;
21508         esac
21509
21510         case "$static_ext" in
21511         '')
21512                 : Exclude those already listed in dynamic linking
21513                 dflt=''
21514                 for xxx in $avail_ext; do
21515                         case " $dynamic_ext " in
21516                         *" $xxx "*) ;;
21517                         *) dflt="$dflt $xxx" ;;
21518                         esac
21519                 done
21520                 set X $dflt
21521                 shift
21522                 dflt="$*"
21523                 ;;
21524         *)  dflt="$static_ext"
21525                 ;;
21526         esac
21527
21528         case "$dflt" in
21529         '')     dflt=none;;
21530         esac
21531         rp="What extensions do you wish to load statically?"
21532         . ./myread
21533         case "$ans" in
21534         none) static_ext=' ' ;;
21535         *) static_ext="$ans" ;;
21536         esac
21537         ;;
21538 *)
21539         $cat <<EOM
21540 A number of extensions are supplied with $package.  Answer "none"
21541 to include no extensions.
21542 Note that DynaLoader is always built and need not be mentioned here.
21543
21544 EOM
21545         case "$static_ext" in
21546         '') dflt="$avail_ext" ;;
21547         *)      dflt="$static_ext"
21548                 # Perhaps we are reusing an old out-of-date config.sh.
21549                 case "$hint" in
21550                 previous)
21551                         if test X"$static_ext" != X"$avail_ext"; then
21552                                 $cat <<EOM
21553 NOTICE:  Your previous config.sh list may be incorrect.
21554 The extensions now available to you are
21555         ${avail_ext}
21556 but the default list from your previous config.sh is
21557         ${static_ext}
21558
21559 EOM
21560                         fi
21561                         ;;
21562                 esac
21563                 ;;
21564         esac
21565         : Exclude those that are not xs extensions
21566         case "$dflt" in
21567         '')     dflt=none;;
21568         esac
21569         rp="What extensions do you wish to include?"
21570         . ./myread
21571         case "$ans" in
21572         none) static_ext=' ' ;;
21573         *) static_ext="$ans" ;;
21574         esac
21575         ;;
21576 esac
21577 #
21578 # Encode is a special case.  If we are building Encode as a static
21579 # extension, we need to explicitly list its subextensions as well.
21580 # For other nested extensions, this is handled automatically by
21581 # the appropriate Makefile.PL.
21582 case " $static_ext " in
21583         *" Encode "*) # Add the subextensions of Encode
21584         cd "$rsrc/ext"
21585         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21586                 static_ext="$static_ext Encode/$xxx"
21587         done
21588         cd "$tdir"
21589         ;;
21590 esac
21591
21592 set X $dynamic_ext $static_ext $nonxs_ext
21593 shift
21594 extensions="$*"
21595
21596 # Sanity check:  We require an extension suitable for use with
21597 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21598 # should show up as failures in the test suite, but it's helpful to
21599 # catch them now.) The 'extensions' list is normally sorted
21600 # alphabetically, so we need to accept either
21601 #    DB_File ... Fcntl ... IO  ....
21602 # or something like
21603 #    Fcntl ... NDBM_File ... IO  ....
21604 case " $extensions"  in
21605 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21606 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21607 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21608 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21609    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21610    ;;
21611 esac
21612
21613 : Remove libraries needed only for extensions
21614 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21615 : The exception is SunOS 4.x, which needs them.
21616 case "${osname}X${osvers}" in
21617 sunos*X4*)
21618     perllibs="$libs"
21619     ;;
21620 *) case "$usedl" in
21621     $define|true|[yY]*)
21622             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21623             shift
21624             perllibs="$*"
21625             ;;
21626     *)  perllibs="$libs"
21627             ;;
21628     esac
21629     ;;
21630 esac
21631
21632 : Remove build directory name from cppstdin so it can be used from
21633 : either the present location or the final installed location.
21634 echo " "
21635 : Get out of the UU directory to get correct path name.
21636 cd ..
21637 case "$cppstdin" in
21638 `pwd`/cppstdin)
21639         echo "Stripping down cppstdin path name"
21640         cppstdin=cppstdin
21641         ;;
21642 esac
21643 cd UU
21644
21645 : end of configuration questions
21646 echo " "
21647 echo "End of configuration questions."
21648 echo " "
21649
21650 : back to where it started
21651 if test -d ../UU; then
21652         cd ..
21653 fi
21654
21655 : configuration may be unconditionally patched via a 'config.arch' file
21656 if $test -f config.arch; then
21657         echo "I see a config.arch file, loading it." >&4
21658         . ./config.arch
21659 fi
21660
21661 : configuration may be patched via a 'config.over' file
21662 if $test -f config.over; then
21663         echo " "
21664         dflt=y
21665         rp='I see a config.over file.  Do you wish to load it?'
21666         . UU/myread
21667         case "$ans" in
21668         n*) echo "OK, I'll ignore it.";;
21669         *)      . ./config.over
21670                 echo "Configuration override changes have been loaded."
21671                 ;;
21672         esac
21673 fi
21674
21675 : in case they want portability, strip down executable paths
21676 case "$d_portable" in
21677 "$define")
21678         echo " "
21679         echo "Stripping down executable paths..." >&4
21680         for file in $loclist $trylist; do
21681                 eval temp=\$$file
21682                 eval $file=`basename $temp`
21683         done
21684         ;;
21685 esac
21686
21687 : create config.sh file
21688 echo " "
21689 echo "Creating config.sh..." >&4
21690 $spitshell <<EOT >config.sh
21691 $startsh
21692 #
21693 # This file was produced by running the Configure script. It holds all the
21694 # definitions figured out by Configure. Should you modify one of these values,
21695 # do not forget to propagate your changes by running "Configure -der". You may
21696 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21697 #
21698
21699 # Package name      : $package
21700 # Source directory  : $src
21701 # Configuration time: $cf_time
21702 # Configured by     : $cf_by
21703 # Target system     : $myuname
21704
21705 EOT
21706 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21707 $spitshell <<EOT >>config.sh
21708
21709 Author='$Author'
21710 Date='$Date'
21711 Header='$Header'
21712 Id='$Id'
21713 Locker='$Locker'
21714 Log='$Log'
21715 RCSfile='$RCSfile'
21716 Revision='$Revision'
21717 Source='$Source'
21718 State='$State'
21719 _a='$_a'
21720 _exe='$_exe'
21721 _o='$_o'
21722 afs='$afs'
21723 afsroot='$afsroot'
21724 alignbytes='$alignbytes'
21725 ansi2knr='$ansi2knr'
21726 aphostname='$aphostname'
21727 api_revision='$api_revision'
21728 api_subversion='$api_subversion'
21729 api_version='$api_version'
21730 api_versionstring='$api_versionstring'
21731 ar='$ar'
21732 archlib='$archlib'
21733 archlibexp='$archlibexp'
21734 archname64='$archname64'
21735 archname='$archname'
21736 archobjs='$archobjs'
21737 asctime_r_proto='$asctime_r_proto'
21738 awk='$awk'
21739 baserev='$baserev'
21740 bash='$bash'
21741 bin='$bin'
21742 binexp='$binexp'
21743 bison='$bison'
21744 byacc='$byacc'
21745 byteorder='$byteorder'
21746 c='$c'
21747 castflags='$castflags'
21748 cat='$cat'
21749 cc='$cc'
21750 cccdlflags='$cccdlflags'
21751 ccdlflags='$ccdlflags'
21752 ccflags='$ccflags'
21753 ccflags_uselargefiles='$ccflags_uselargefiles'
21754 ccname='$ccname'
21755 ccsymbols='$ccsymbols'
21756 ccversion='$ccversion'
21757 cf_by='$cf_by'
21758 cf_email='$cf_email'
21759 cf_time='$cf_time'
21760 chgrp='$chgrp'
21761 chmod='$chmod'
21762 chown='$chown'
21763 clocktype='$clocktype'
21764 comm='$comm'
21765 compress='$compress'
21766 contains='$contains'
21767 cp='$cp'
21768 cpio='$cpio'
21769 cpp='$cpp'
21770 cpp_stuff='$cpp_stuff'
21771 cppccsymbols='$cppccsymbols'
21772 cppflags='$cppflags'
21773 cpplast='$cpplast'
21774 cppminus='$cppminus'
21775 cpprun='$cpprun'
21776 cppstdin='$cppstdin'
21777 cppsymbols='$cppsymbols'
21778 crypt_r_proto='$crypt_r_proto'
21779 cryptlib='$cryptlib'
21780 csh='$csh'
21781 ctermid_r_proto='$ctermid_r_proto'
21782 ctime_r_proto='$ctime_r_proto'
21783 d_Gconvert='$d_Gconvert'
21784 d_PRIEUldbl='$d_PRIEUldbl'
21785 d_PRIFUldbl='$d_PRIFUldbl'
21786 d_PRIGUldbl='$d_PRIGUldbl'
21787 d_PRIXU64='$d_PRIXU64'
21788 d_PRId64='$d_PRId64'
21789 d_PRIeldbl='$d_PRIeldbl'
21790 d_PRIfldbl='$d_PRIfldbl'
21791 d_PRIgldbl='$d_PRIgldbl'
21792 d_PRIi64='$d_PRIi64'
21793 d_PRIo64='$d_PRIo64'
21794 d_PRIu64='$d_PRIu64'
21795 d_PRIx64='$d_PRIx64'
21796 d_SCNfldbl='$d_SCNfldbl'
21797 d__fwalk='$d__fwalk'
21798 d_access='$d_access'
21799 d_accessx='$d_accessx'
21800 d_aintl='$d_aintl'
21801 d_alarm='$d_alarm'
21802 d_archlib='$d_archlib'
21803 d_asctime_r='$d_asctime_r'
21804 d_atolf='$d_atolf'
21805 d_atoll='$d_atoll'
21806 d_attribute_format='$d_attribute_format'
21807 d_attribute_malloc='$d_attribute_malloc'
21808 d_attribute_nonnull='$d_attribute_nonnull'
21809 d_attribute_noreturn='$d_attribute_noreturn'
21810 d_attribute_pure='$d_attribute_pure'
21811 d_attribute_unused='$d_attribute_unused'
21812 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21813 d_bcmp='$d_bcmp'
21814 d_bcopy='$d_bcopy'
21815 d_bsd='$d_bsd'
21816 d_bsdgetpgrp='$d_bsdgetpgrp'
21817 d_bsdsetpgrp='$d_bsdsetpgrp'
21818 d_builtin_choose_expr='$d_builtin_choose_expr'
21819 d_builtin_expect='$d_builtin_expect'
21820 d_bzero='$d_bzero'
21821 d_c99_variadic_macros='$d_c99_variadic_macros'
21822 d_casti32='$d_casti32'
21823 d_castneg='$d_castneg'
21824 d_charvspr='$d_charvspr'
21825 d_chown='$d_chown'
21826 d_chroot='$d_chroot'
21827 d_chsize='$d_chsize'
21828 d_class='$d_class'
21829 d_clearenv='$d_clearenv'
21830 d_closedir='$d_closedir'
21831 d_cmsghdr_s='$d_cmsghdr_s'
21832 d_const='$d_const'
21833 d_copysignl='$d_copysignl'
21834 d_cplusplus='$d_cplusplus'
21835 d_crypt='$d_crypt'
21836 d_crypt_r='$d_crypt_r'
21837 d_csh='$d_csh'
21838 d_ctermid='$d_ctermid'
21839 d_ctermid_r='$d_ctermid_r'
21840 d_ctime_r='$d_ctime_r'
21841 d_cuserid='$d_cuserid'
21842 d_dbl_dig='$d_dbl_dig'
21843 d_dbminitproto='$d_dbminitproto'
21844 d_difftime='$d_difftime'
21845 d_dir_dd_fd='$d_dir_dd_fd'
21846 d_dirfd='$d_dirfd'
21847 d_dirnamlen='$d_dirnamlen'
21848 d_dlerror='$d_dlerror'
21849 d_dlopen='$d_dlopen'
21850 d_dlsymun='$d_dlsymun'
21851 d_dosuid='$d_dosuid'
21852 d_drand48_r='$d_drand48_r'
21853 d_drand48proto='$d_drand48proto'
21854 d_dup2='$d_dup2'
21855 d_eaccess='$d_eaccess'
21856 d_endgrent='$d_endgrent'
21857 d_endgrent_r='$d_endgrent_r'
21858 d_endhent='$d_endhent'
21859 d_endhostent_r='$d_endhostent_r'
21860 d_endnent='$d_endnent'
21861 d_endnetent_r='$d_endnetent_r'
21862 d_endpent='$d_endpent'
21863 d_endprotoent_r='$d_endprotoent_r'
21864 d_endpwent='$d_endpwent'
21865 d_endpwent_r='$d_endpwent_r'
21866 d_endsent='$d_endsent'
21867 d_endservent_r='$d_endservent_r'
21868 d_eofnblk='$d_eofnblk'
21869 d_eunice='$d_eunice'
21870 d_faststdio='$d_faststdio'
21871 d_fchdir='$d_fchdir'
21872 d_fchmod='$d_fchmod'
21873 d_fchown='$d_fchown'
21874 d_fcntl='$d_fcntl'
21875 d_fcntl_can_lock='$d_fcntl_can_lock'
21876 d_fd_macros='$d_fd_macros'
21877 d_fd_set='$d_fd_set'
21878 d_fds_bits='$d_fds_bits'
21879 d_fgetpos='$d_fgetpos'
21880 d_finite='$d_finite'
21881 d_finitel='$d_finitel'
21882 d_flexfnam='$d_flexfnam'
21883 d_flock='$d_flock'
21884 d_flockproto='$d_flockproto'
21885 d_fork='$d_fork'
21886 d_fp_class='$d_fp_class'
21887 d_fpathconf='$d_fpathconf'
21888 d_fpclass='$d_fpclass'
21889 d_fpclassify='$d_fpclassify'
21890 d_fpclassl='$d_fpclassl'
21891 d_fpos64_t='$d_fpos64_t'
21892 d_frexpl='$d_frexpl'
21893 d_fs_data_s='$d_fs_data_s'
21894 d_fseeko='$d_fseeko'
21895 d_fsetpos='$d_fsetpos'
21896 d_fstatfs='$d_fstatfs'
21897 d_fstatvfs='$d_fstatvfs'
21898 d_fsync='$d_fsync'
21899 d_ftello='$d_ftello'
21900 d_ftime='$d_ftime'
21901 d_futimes='$d_futimes'
21902 d_getcwd='$d_getcwd'
21903 d_getespwnam='$d_getespwnam'
21904 d_getfsstat='$d_getfsstat'
21905 d_getgrent='$d_getgrent'
21906 d_getgrent_r='$d_getgrent_r'
21907 d_getgrgid_r='$d_getgrgid_r'
21908 d_getgrnam_r='$d_getgrnam_r'
21909 d_getgrps='$d_getgrps'
21910 d_gethbyaddr='$d_gethbyaddr'
21911 d_gethbyname='$d_gethbyname'
21912 d_gethent='$d_gethent'
21913 d_gethname='$d_gethname'
21914 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21915 d_gethostbyname_r='$d_gethostbyname_r'
21916 d_gethostent_r='$d_gethostent_r'
21917 d_gethostprotos='$d_gethostprotos'
21918 d_getitimer='$d_getitimer'
21919 d_getlogin='$d_getlogin'
21920 d_getlogin_r='$d_getlogin_r'
21921 d_getmnt='$d_getmnt'
21922 d_getmntent='$d_getmntent'
21923 d_getnbyaddr='$d_getnbyaddr'
21924 d_getnbyname='$d_getnbyname'
21925 d_getnent='$d_getnent'
21926 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21927 d_getnetbyname_r='$d_getnetbyname_r'
21928 d_getnetent_r='$d_getnetent_r'
21929 d_getnetprotos='$d_getnetprotos'
21930 d_getpagsz='$d_getpagsz'
21931 d_getpbyname='$d_getpbyname'
21932 d_getpbynumber='$d_getpbynumber'
21933 d_getpent='$d_getpent'
21934 d_getpgid='$d_getpgid'
21935 d_getpgrp2='$d_getpgrp2'
21936 d_getpgrp='$d_getpgrp'
21937 d_getppid='$d_getppid'
21938 d_getprior='$d_getprior'
21939 d_getprotobyname_r='$d_getprotobyname_r'
21940 d_getprotobynumber_r='$d_getprotobynumber_r'
21941 d_getprotoent_r='$d_getprotoent_r'
21942 d_getprotoprotos='$d_getprotoprotos'
21943 d_getprpwnam='$d_getprpwnam'
21944 d_getpwent='$d_getpwent'
21945 d_getpwent_r='$d_getpwent_r'
21946 d_getpwnam_r='$d_getpwnam_r'
21947 d_getpwuid_r='$d_getpwuid_r'
21948 d_getsbyname='$d_getsbyname'
21949 d_getsbyport='$d_getsbyport'
21950 d_getsent='$d_getsent'
21951 d_getservbyname_r='$d_getservbyname_r'
21952 d_getservbyport_r='$d_getservbyport_r'
21953 d_getservent_r='$d_getservent_r'
21954 d_getservprotos='$d_getservprotos'
21955 d_getspnam='$d_getspnam'
21956 d_getspnam_r='$d_getspnam_r'
21957 d_gettimeod='$d_gettimeod'
21958 d_gmtime_r='$d_gmtime_r'
21959 d_gnulibc='$d_gnulibc'
21960 d_grpasswd='$d_grpasswd'
21961 d_hasmntopt='$d_hasmntopt'
21962 d_htonl='$d_htonl'
21963 d_ilogbl='$d_ilogbl'
21964 d_inc_version_list='$d_inc_version_list'
21965 d_index='$d_index'
21966 d_inetaton='$d_inetaton'
21967 d_int64_t='$d_int64_t'
21968 d_isascii='$d_isascii'
21969 d_isfinite='$d_isfinite'
21970 d_isinf='$d_isinf'
21971 d_isnan='$d_isnan'
21972 d_isnanl='$d_isnanl'
21973 d_killpg='$d_killpg'
21974 d_lchown='$d_lchown'
21975 d_ldbl_dig='$d_ldbl_dig'
21976 d_libm_lib_version='$d_libm_lib_version'
21977 d_link='$d_link'
21978 d_localtime_r='$d_localtime_r'
21979 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21980 d_locconv='$d_locconv'
21981 d_lockf='$d_lockf'
21982 d_longdbl='$d_longdbl'
21983 d_longlong='$d_longlong'
21984 d_lseekproto='$d_lseekproto'
21985 d_lstat='$d_lstat'
21986 d_madvise='$d_madvise'
21987 d_malloc_good_size='$d_malloc_good_size'
21988 d_malloc_size='$d_malloc_size'
21989 d_mblen='$d_mblen'
21990 d_mbstowcs='$d_mbstowcs'
21991 d_mbtowc='$d_mbtowc'
21992 d_memchr='$d_memchr'
21993 d_memcmp='$d_memcmp'
21994 d_memcpy='$d_memcpy'
21995 d_memmove='$d_memmove'
21996 d_memset='$d_memset'
21997 d_mkdir='$d_mkdir'
21998 d_mkdtemp='$d_mkdtemp'
21999 d_mkfifo='$d_mkfifo'
22000 d_mkstemp='$d_mkstemp'
22001 d_mkstemps='$d_mkstemps'
22002 d_mktime='$d_mktime'
22003 d_mmap='$d_mmap'
22004 d_modfl='$d_modfl'
22005 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22006 d_modflproto='$d_modflproto'
22007 d_mprotect='$d_mprotect'
22008 d_msg='$d_msg'
22009 d_msg_ctrunc='$d_msg_ctrunc'
22010 d_msg_dontroute='$d_msg_dontroute'
22011 d_msg_oob='$d_msg_oob'
22012 d_msg_peek='$d_msg_peek'
22013 d_msg_proxy='$d_msg_proxy'
22014 d_msgctl='$d_msgctl'
22015 d_msgget='$d_msgget'
22016 d_msghdr_s='$d_msghdr_s'
22017 d_msgrcv='$d_msgrcv'
22018 d_msgsnd='$d_msgsnd'
22019 d_msync='$d_msync'
22020 d_munmap='$d_munmap'
22021 d_mymalloc='$d_mymalloc'
22022 d_nice='$d_nice'
22023 d_nl_langinfo='$d_nl_langinfo'
22024 d_nv_preserves_uv='$d_nv_preserves_uv'
22025 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22026 d_off64_t='$d_off64_t'
22027 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22028 d_oldpthreads='$d_oldpthreads'
22029 d_oldsock='$d_oldsock'
22030 d_open3='$d_open3'
22031 d_pathconf='$d_pathconf'
22032 d_pause='$d_pause'
22033 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22034 d_phostname='$d_phostname'
22035 d_pipe='$d_pipe'
22036 d_poll='$d_poll'
22037 d_portable='$d_portable'
22038 d_printf_format_null='$d_printf_format_null'
22039 d_procselfexe='$d_procselfexe'
22040 d_pseudofork='$d_pseudofork'
22041 d_pthread_atfork='$d_pthread_atfork'
22042 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22043 d_pthread_yield='$d_pthread_yield'
22044 d_pwage='$d_pwage'
22045 d_pwchange='$d_pwchange'
22046 d_pwclass='$d_pwclass'
22047 d_pwcomment='$d_pwcomment'
22048 d_pwexpire='$d_pwexpire'
22049 d_pwgecos='$d_pwgecos'
22050 d_pwpasswd='$d_pwpasswd'
22051 d_pwquota='$d_pwquota'
22052 d_qgcvt='$d_qgcvt'
22053 d_quad='$d_quad'
22054 d_random_r='$d_random_r'
22055 d_readdir64_r='$d_readdir64_r'
22056 d_readdir='$d_readdir'
22057 d_readdir_r='$d_readdir_r'
22058 d_readlink='$d_readlink'
22059 d_readv='$d_readv'
22060 d_recvmsg='$d_recvmsg'
22061 d_rename='$d_rename'
22062 d_rewinddir='$d_rewinddir'
22063 d_rmdir='$d_rmdir'
22064 d_safebcpy='$d_safebcpy'
22065 d_safemcpy='$d_safemcpy'
22066 d_sanemcmp='$d_sanemcmp'
22067 d_sbrkproto='$d_sbrkproto'
22068 d_scalbnl='$d_scalbnl'
22069 d_sched_yield='$d_sched_yield'
22070 d_scm_rights='$d_scm_rights'
22071 d_seekdir='$d_seekdir'
22072 d_select='$d_select'
22073 d_sem='$d_sem'
22074 d_semctl='$d_semctl'
22075 d_semctl_semid_ds='$d_semctl_semid_ds'
22076 d_semctl_semun='$d_semctl_semun'
22077 d_semget='$d_semget'
22078 d_semop='$d_semop'
22079 d_sendmsg='$d_sendmsg'
22080 d_setegid='$d_setegid'
22081 d_seteuid='$d_seteuid'
22082 d_setgrent='$d_setgrent'
22083 d_setgrent_r='$d_setgrent_r'
22084 d_setgrps='$d_setgrps'
22085 d_sethent='$d_sethent'
22086 d_sethostent_r='$d_sethostent_r'
22087 d_setitimer='$d_setitimer'
22088 d_setlinebuf='$d_setlinebuf'
22089 d_setlocale='$d_setlocale'
22090 d_setlocale_r='$d_setlocale_r'
22091 d_setnent='$d_setnent'
22092 d_setnetent_r='$d_setnetent_r'
22093 d_setpent='$d_setpent'
22094 d_setpgid='$d_setpgid'
22095 d_setpgrp2='$d_setpgrp2'
22096 d_setpgrp='$d_setpgrp'
22097 d_setprior='$d_setprior'
22098 d_setproctitle='$d_setproctitle'
22099 d_setprotoent_r='$d_setprotoent_r'
22100 d_setpwent='$d_setpwent'
22101 d_setpwent_r='$d_setpwent_r'
22102 d_setregid='$d_setregid'
22103 d_setresgid='$d_setresgid'
22104 d_setresuid='$d_setresuid'
22105 d_setreuid='$d_setreuid'
22106 d_setrgid='$d_setrgid'
22107 d_setruid='$d_setruid'
22108 d_setsent='$d_setsent'
22109 d_setservent_r='$d_setservent_r'
22110 d_setsid='$d_setsid'
22111 d_setvbuf='$d_setvbuf'
22112 d_sfio='$d_sfio'
22113 d_shm='$d_shm'
22114 d_shmat='$d_shmat'
22115 d_shmatprototype='$d_shmatprototype'
22116 d_shmctl='$d_shmctl'
22117 d_shmdt='$d_shmdt'
22118 d_shmget='$d_shmget'
22119 d_sigaction='$d_sigaction'
22120 d_signbit='$d_signbit'
22121 d_sigprocmask='$d_sigprocmask'
22122 d_sigsetjmp='$d_sigsetjmp'
22123 d_sitearch='$d_sitearch'
22124 d_snprintf='$d_snprintf'
22125 d_sockatmark='$d_sockatmark'
22126 d_sockatmarkproto='$d_sockatmarkproto'
22127 d_socket='$d_socket'
22128 d_socklen_t='$d_socklen_t'
22129 d_sockpair='$d_sockpair'
22130 d_socks5_init='$d_socks5_init'
22131 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22132 d_sqrtl='$d_sqrtl'
22133 d_srand48_r='$d_srand48_r'
22134 d_srandom_r='$d_srandom_r'
22135 d_sresgproto='$d_sresgproto'
22136 d_sresuproto='$d_sresuproto'
22137 d_statblks='$d_statblks'
22138 d_statfs_f_flags='$d_statfs_f_flags'
22139 d_statfs_s='$d_statfs_s'
22140 d_statvfs='$d_statvfs'
22141 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22142 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22143 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22144 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22145 d_stdio_stream_array='$d_stdio_stream_array'
22146 d_stdiobase='$d_stdiobase'
22147 d_stdstdio='$d_stdstdio'
22148 d_strchr='$d_strchr'
22149 d_strcoll='$d_strcoll'
22150 d_strctcpy='$d_strctcpy'
22151 d_strerrm='$d_strerrm'
22152 d_strerror='$d_strerror'
22153 d_strerror_r='$d_strerror_r'
22154 d_strftime='$d_strftime'
22155 d_strlcat='$d_strlcat'
22156 d_strlcpy='$d_strlcpy'
22157 d_strtod='$d_strtod'
22158 d_strtol='$d_strtol'
22159 d_strtold='$d_strtold'
22160 d_strtoll='$d_strtoll'
22161 d_strtoq='$d_strtoq'
22162 d_strtoul='$d_strtoul'
22163 d_strtoull='$d_strtoull'
22164 d_strtouq='$d_strtouq'
22165 d_strxfrm='$d_strxfrm'
22166 d_suidsafe='$d_suidsafe'
22167 d_symlink='$d_symlink'
22168 d_syscall='$d_syscall'
22169 d_syscallproto='$d_syscallproto'
22170 d_sysconf='$d_sysconf'
22171 d_sysernlst='$d_sysernlst'
22172 d_syserrlst='$d_syserrlst'
22173 d_system='$d_system'
22174 d_tcgetpgrp='$d_tcgetpgrp'
22175 d_tcsetpgrp='$d_tcsetpgrp'
22176 d_telldir='$d_telldir'
22177 d_telldirproto='$d_telldirproto'
22178 d_time='$d_time'
22179 d_times='$d_times'
22180 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22181 d_tm_tm_zone='$d_tm_tm_zone'
22182 d_tmpnam_r='$d_tmpnam_r'
22183 d_truncate='$d_truncate'
22184 d_ttyname_r='$d_ttyname_r'
22185 d_tzname='$d_tzname'
22186 d_u32align='$d_u32align'
22187 d_ualarm='$d_ualarm'
22188 d_umask='$d_umask'
22189 d_uname='$d_uname'
22190 d_union_semun='$d_union_semun'
22191 d_unordered='$d_unordered'
22192 d_unsetenv='$d_unsetenv'
22193 d_usleep='$d_usleep'
22194 d_usleepproto='$d_usleepproto'
22195 d_ustat='$d_ustat'
22196 d_vendorarch='$d_vendorarch'
22197 d_vendorbin='$d_vendorbin'
22198 d_vendorlib='$d_vendorlib'
22199 d_vendorscript='$d_vendorscript'
22200 d_vfork='$d_vfork'
22201 d_void_closedir='$d_void_closedir'
22202 d_voidsig='$d_voidsig'
22203 d_voidtty='$d_voidtty'
22204 d_volatile='$d_volatile'
22205 d_vprintf='$d_vprintf'
22206 d_vsnprintf='$d_vsnprintf'
22207 d_wait4='$d_wait4'
22208 d_waitpid='$d_waitpid'
22209 d_wcstombs='$d_wcstombs'
22210 d_wctomb='$d_wctomb'
22211 d_writev='$d_writev'
22212 d_xenix='$d_xenix'
22213 date='$date'
22214 db_hashtype='$db_hashtype'
22215 db_prefixtype='$db_prefixtype'
22216 db_version_major='$db_version_major'
22217 db_version_minor='$db_version_minor'
22218 db_version_patch='$db_version_patch'
22219 defvoidused='$defvoidused'
22220 direntrytype='$direntrytype'
22221 dlext='$dlext'
22222 dlsrc='$dlsrc'
22223 doublesize='$doublesize'
22224 drand01='$drand01'
22225 drand48_r_proto='$drand48_r_proto'
22226 dtrace='$dtrace'
22227 dynamic_ext='$dynamic_ext'
22228 eagain='$eagain'
22229 ebcdic='$ebcdic'
22230 echo='$echo'
22231 egrep='$egrep'
22232 emacs='$emacs'
22233 endgrent_r_proto='$endgrent_r_proto'
22234 endhostent_r_proto='$endhostent_r_proto'
22235 endnetent_r_proto='$endnetent_r_proto'
22236 endprotoent_r_proto='$endprotoent_r_proto'
22237 endpwent_r_proto='$endpwent_r_proto'
22238 endservent_r_proto='$endservent_r_proto'
22239 eunicefix='$eunicefix'
22240 exe_ext='$exe_ext'
22241 expr='$expr'
22242 extensions='$extensions'
22243 extras='$extras'
22244 fflushNULL='$fflushNULL'
22245 fflushall='$fflushall'
22246 find='$find'
22247 firstmakefile='$firstmakefile'
22248 flex='$flex'
22249 fpossize='$fpossize'
22250 fpostype='$fpostype'
22251 freetype='$freetype'
22252 from='$from'
22253 full_ar='$full_ar'
22254 full_csh='$full_csh'
22255 full_sed='$full_sed'
22256 gccansipedantic='$gccansipedantic'
22257 gccosandvers='$gccosandvers'
22258 gccversion='$gccversion'
22259 getgrent_r_proto='$getgrent_r_proto'
22260 getgrgid_r_proto='$getgrgid_r_proto'
22261 getgrnam_r_proto='$getgrnam_r_proto'
22262 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22263 gethostbyname_r_proto='$gethostbyname_r_proto'
22264 gethostent_r_proto='$gethostent_r_proto'
22265 getlogin_r_proto='$getlogin_r_proto'
22266 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22267 getnetbyname_r_proto='$getnetbyname_r_proto'
22268 getnetent_r_proto='$getnetent_r_proto'
22269 getprotobyname_r_proto='$getprotobyname_r_proto'
22270 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22271 getprotoent_r_proto='$getprotoent_r_proto'
22272 getpwent_r_proto='$getpwent_r_proto'
22273 getpwnam_r_proto='$getpwnam_r_proto'
22274 getpwuid_r_proto='$getpwuid_r_proto'
22275 getservbyname_r_proto='$getservbyname_r_proto'
22276 getservbyport_r_proto='$getservbyport_r_proto'
22277 getservent_r_proto='$getservent_r_proto'
22278 getspnam_r_proto='$getspnam_r_proto'
22279 gidformat='$gidformat'
22280 gidsign='$gidsign'
22281 gidsize='$gidsize'
22282 gidtype='$gidtype'
22283 glibpth='$glibpth'
22284 gmake='$gmake'
22285 gmtime_r_proto='$gmtime_r_proto'
22286 gnulibc_version='$gnulibc_version'
22287 grep='$grep'
22288 groupcat='$groupcat'
22289 groupstype='$groupstype'
22290 gzip='$gzip'
22291 h_fcntl='$h_fcntl'
22292 h_sysfile='$h_sysfile'
22293 hint='$hint'
22294 hostcat='$hostcat'
22295 html1dir='$html1dir'
22296 html1direxp='$html1direxp'
22297 html3dir='$html3dir'
22298 html3direxp='$html3direxp'
22299 i16size='$i16size'
22300 i16type='$i16type'
22301 i32size='$i32size'
22302 i32type='$i32type'
22303 i64size='$i64size'
22304 i64type='$i64type'
22305 i8size='$i8size'
22306 i8type='$i8type'
22307 i_arpainet='$i_arpainet'
22308 i_assert='$i_assert'
22309 i_bsdioctl='$i_bsdioctl'
22310 i_crypt='$i_crypt'
22311 i_db='$i_db'
22312 i_dbm='$i_dbm'
22313 i_dirent='$i_dirent'
22314 i_dld='$i_dld'
22315 i_dlfcn='$i_dlfcn'
22316 i_fcntl='$i_fcntl'
22317 i_float='$i_float'
22318 i_fp='$i_fp'
22319 i_fp_class='$i_fp_class'
22320 i_gdbm='$i_gdbm'
22321 i_grp='$i_grp'
22322 i_ieeefp='$i_ieeefp'
22323 i_inttypes='$i_inttypes'
22324 i_langinfo='$i_langinfo'
22325 i_libutil='$i_libutil'
22326 i_limits='$i_limits'
22327 i_locale='$i_locale'
22328 i_machcthr='$i_machcthr'
22329 i_malloc='$i_malloc'
22330 i_math='$i_math'
22331 i_memory='$i_memory'
22332 i_mntent='$i_mntent'
22333 i_ndbm='$i_ndbm'
22334 i_netdb='$i_netdb'
22335 i_neterrno='$i_neterrno'
22336 i_netinettcp='$i_netinettcp'
22337 i_niin='$i_niin'
22338 i_poll='$i_poll'
22339 i_prot='$i_prot'
22340 i_pthread='$i_pthread'
22341 i_pwd='$i_pwd'
22342 i_rpcsvcdbm='$i_rpcsvcdbm'
22343 i_sfio='$i_sfio'
22344 i_sgtty='$i_sgtty'
22345 i_shadow='$i_shadow'
22346 i_socks='$i_socks'
22347 i_stdarg='$i_stdarg'
22348 i_stddef='$i_stddef'
22349 i_stdlib='$i_stdlib'
22350 i_string='$i_string'
22351 i_sunmath='$i_sunmath'
22352 i_sysaccess='$i_sysaccess'
22353 i_sysdir='$i_sysdir'
22354 i_sysfile='$i_sysfile'
22355 i_sysfilio='$i_sysfilio'
22356 i_sysin='$i_sysin'
22357 i_sysioctl='$i_sysioctl'
22358 i_syslog='$i_syslog'
22359 i_sysmman='$i_sysmman'
22360 i_sysmode='$i_sysmode'
22361 i_sysmount='$i_sysmount'
22362 i_sysndir='$i_sysndir'
22363 i_sysparam='$i_sysparam'
22364 i_sysresrc='$i_sysresrc'
22365 i_syssecrt='$i_syssecrt'
22366 i_sysselct='$i_sysselct'
22367 i_syssockio='$i_syssockio'
22368 i_sysstat='$i_sysstat'
22369 i_sysstatfs='$i_sysstatfs'
22370 i_sysstatvfs='$i_sysstatvfs'
22371 i_systime='$i_systime'
22372 i_systimek='$i_systimek'
22373 i_systimes='$i_systimes'
22374 i_systypes='$i_systypes'
22375 i_sysuio='$i_sysuio'
22376 i_sysun='$i_sysun'
22377 i_sysutsname='$i_sysutsname'
22378 i_sysvfs='$i_sysvfs'
22379 i_syswait='$i_syswait'
22380 i_termio='$i_termio'
22381 i_termios='$i_termios'
22382 i_time='$i_time'
22383 i_unistd='$i_unistd'
22384 i_ustat='$i_ustat'
22385 i_utime='$i_utime'
22386 i_values='$i_values'
22387 i_varargs='$i_varargs'
22388 i_varhdr='$i_varhdr'
22389 i_vfork='$i_vfork'
22390 ignore_versioned_solibs='$ignore_versioned_solibs'
22391 inc_version_list='$inc_version_list'
22392 inc_version_list_init='$inc_version_list_init'
22393 incpath='$incpath'
22394 inews='$inews'
22395 initialinstalllocation='$initialinstalllocation'
22396 installarchlib='$installarchlib'
22397 installbin='$installbin'
22398 installhtml1dir='$installhtml1dir'
22399 installhtml3dir='$installhtml3dir'
22400 installman1dir='$installman1dir'
22401 installman3dir='$installman3dir'
22402 installprefix='$installprefix'
22403 installprefixexp='$installprefixexp'
22404 installprivlib='$installprivlib'
22405 installscript='$installscript'
22406 installsitearch='$installsitearch'
22407 installsitebin='$installsitebin'
22408 installsitehtml1dir='$installsitehtml1dir'
22409 installsitehtml3dir='$installsitehtml3dir'
22410 installsitelib='$installsitelib'
22411 installsiteman1dir='$installsiteman1dir'
22412 installsiteman3dir='$installsiteman3dir'
22413 installsitescript='$installsitescript'
22414 installstyle='$installstyle'
22415 installusrbinperl='$installusrbinperl'
22416 installvendorarch='$installvendorarch'
22417 installvendorbin='$installvendorbin'
22418 installvendorhtml1dir='$installvendorhtml1dir'
22419 installvendorhtml3dir='$installvendorhtml3dir'
22420 installvendorlib='$installvendorlib'
22421 installvendorman1dir='$installvendorman1dir'
22422 installvendorman3dir='$installvendorman3dir'
22423 installvendorscript='$installvendorscript'
22424 intsize='$intsize'
22425 issymlink='$issymlink'
22426 ivdformat='$ivdformat'
22427 ivsize='$ivsize'
22428 ivtype='$ivtype'
22429 known_extensions='$known_extensions'
22430 ksh='$ksh'
22431 ld='$ld'
22432 lddlflags='$lddlflags'
22433 ldflags='$ldflags'
22434 ldflags_uselargefiles='$ldflags_uselargefiles'
22435 ldlibpthname='$ldlibpthname'
22436 less='$less'
22437 lib_ext='$lib_ext'
22438 libc='$libc'
22439 libperl='$libperl'
22440 libpth='$libpth'
22441 libs='$libs'
22442 libsdirs='$libsdirs'
22443 libsfiles='$libsfiles'
22444 libsfound='$libsfound'
22445 libspath='$libspath'
22446 libswanted='$libswanted'
22447 libswanted_uselargefiles='$libswanted_uselargefiles'
22448 line='$line'
22449 lint='$lint'
22450 lkflags='$lkflags'
22451 ln='$ln'
22452 lns='$lns'
22453 localtime_r_proto='$localtime_r_proto'
22454 locincpth='$locincpth'
22455 loclibpth='$loclibpth'
22456 longdblsize='$longdblsize'
22457 longlongsize='$longlongsize'
22458 longsize='$longsize'
22459 lp='$lp'
22460 lpr='$lpr'
22461 ls='$ls'
22462 lseeksize='$lseeksize'
22463 lseektype='$lseektype'
22464 mad='$mad'
22465 madlyh='$madlyh'
22466 madlyobj='$madlyobj'
22467 madlysrc='$madlysrc'
22468 mail='$mail'
22469 mailx='$mailx'
22470 make='$make'
22471 make_set_make='$make_set_make'
22472 mallocobj='$mallocobj'
22473 mallocsrc='$mallocsrc'
22474 malloctype='$malloctype'
22475 man1dir='$man1dir'
22476 man1direxp='$man1direxp'
22477 man1ext='$man1ext'
22478 man3dir='$man3dir'
22479 man3direxp='$man3direxp'
22480 man3ext='$man3ext'
22481 mips_type='$mips_type'
22482 mistrustnm='$mistrustnm'
22483 mkdir='$mkdir'
22484 mmaptype='$mmaptype'
22485 modetype='$modetype'
22486 more='$more'
22487 multiarch='$multiarch'
22488 mv='$mv'
22489 myarchname='$myarchname'
22490 mydomain='$mydomain'
22491 myhostname='$myhostname'
22492 myuname='$myuname'
22493 n='$n'
22494 need_va_copy='$need_va_copy'
22495 netdb_hlen_type='$netdb_hlen_type'
22496 netdb_host_type='$netdb_host_type'
22497 netdb_name_type='$netdb_name_type'
22498 netdb_net_type='$netdb_net_type'
22499 nm='$nm'
22500 nm_opt='$nm_opt'
22501 nm_so_opt='$nm_so_opt'
22502 nonxs_ext='$nonxs_ext'
22503 nroff='$nroff'
22504 nvEUformat='$nvEUformat'
22505 nvFUformat='$nvFUformat'
22506 nvGUformat='$nvGUformat'
22507 nv_overflows_integers_at='$nv_overflows_integers_at'
22508 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22509 nveformat='$nveformat'
22510 nvfformat='$nvfformat'
22511 nvgformat='$nvgformat'
22512 nvsize='$nvsize'
22513 nvtype='$nvtype'
22514 o_nonblock='$o_nonblock'
22515 obj_ext='$obj_ext'
22516 old_pthread_create_joinable='$old_pthread_create_joinable'
22517 optimize='$optimize'
22518 orderlib='$orderlib'
22519 osname='$osname'
22520 osvers='$osvers'
22521 otherlibdirs='$otherlibdirs'
22522 package='$package'
22523 pager='$pager'
22524 passcat='$passcat'
22525 patchlevel='$patchlevel'
22526 path_sep='$path_sep'
22527 perl5='$perl5'
22528 perl='$perl'
22529 perl_patchlevel='$perl_patchlevel'
22530 perladmin='$perladmin'
22531 perllibs='$perllibs'
22532 perlpath='$perlpath'
22533 pg='$pg'
22534 phostname='$phostname'
22535 pidtype='$pidtype'
22536 plibpth='$plibpth'
22537 pmake='$pmake'
22538 pr='$pr'
22539 prefix='$prefix'
22540 prefixexp='$prefixexp'
22541 privlib='$privlib'
22542 privlibexp='$privlibexp'
22543 procselfexe='$procselfexe'
22544 prototype='$prototype'
22545 ptrsize='$ptrsize'
22546 quadkind='$quadkind'
22547 quadtype='$quadtype'
22548 randbits='$randbits'
22549 randfunc='$randfunc'
22550 random_r_proto='$random_r_proto'
22551 randseedtype='$randseedtype'
22552 ranlib='$ranlib'
22553 rd_nodata='$rd_nodata'
22554 readdir64_r_proto='$readdir64_r_proto'
22555 readdir_r_proto='$readdir_r_proto'
22556 revision='$revision'
22557 rm='$rm'
22558 rm_try='$rm_try'
22559 rmail='$rmail'
22560 run='$run'
22561 runnm='$runnm'
22562 sPRIEUldbl='$sPRIEUldbl'
22563 sPRIFUldbl='$sPRIFUldbl'
22564 sPRIGUldbl='$sPRIGUldbl'
22565 sPRIXU64='$sPRIXU64'
22566 sPRId64='$sPRId64'
22567 sPRIeldbl='$sPRIeldbl'
22568 sPRIfldbl='$sPRIfldbl'
22569 sPRIgldbl='$sPRIgldbl'
22570 sPRIi64='$sPRIi64'
22571 sPRIo64='$sPRIo64'
22572 sPRIu64='$sPRIu64'
22573 sPRIx64='$sPRIx64'
22574 sSCNfldbl='$sSCNfldbl'
22575 sched_yield='$sched_yield'
22576 scriptdir='$scriptdir'
22577 scriptdirexp='$scriptdirexp'
22578 sed='$sed'
22579 seedfunc='$seedfunc'
22580 selectminbits='$selectminbits'
22581 selecttype='$selecttype'
22582 sendmail='$sendmail'
22583 setgrent_r_proto='$setgrent_r_proto'
22584 sethostent_r_proto='$sethostent_r_proto'
22585 setlocale_r_proto='$setlocale_r_proto'
22586 setnetent_r_proto='$setnetent_r_proto'
22587 setprotoent_r_proto='$setprotoent_r_proto'
22588 setpwent_r_proto='$setpwent_r_proto'
22589 setservent_r_proto='$setservent_r_proto'
22590 sh='$sh'
22591 shar='$shar'
22592 sharpbang='$sharpbang'
22593 shmattype='$shmattype'
22594 shortsize='$shortsize'
22595 shrpenv='$shrpenv'
22596 shsharp='$shsharp'
22597 sig_count='$sig_count'
22598 sig_name='$sig_name'
22599 sig_name_init='$sig_name_init'
22600 sig_num='$sig_num'
22601 sig_num_init='$sig_num_init'
22602 sig_size='$sig_size'
22603 signal_t='$signal_t'
22604 sitearch='$sitearch'
22605 sitearchexp='$sitearchexp'
22606 sitebin='$sitebin'
22607 sitebinexp='$sitebinexp'
22608 sitehtml1dir='$sitehtml1dir'
22609 sitehtml1direxp='$sitehtml1direxp'
22610 sitehtml3dir='$sitehtml3dir'
22611 sitehtml3direxp='$sitehtml3direxp'
22612 sitelib='$sitelib'
22613 sitelib_stem='$sitelib_stem'
22614 sitelibexp='$sitelibexp'
22615 siteman1dir='$siteman1dir'
22616 siteman1direxp='$siteman1direxp'
22617 siteman3dir='$siteman3dir'
22618 siteman3direxp='$siteman3direxp'
22619 siteprefix='$siteprefix'
22620 siteprefixexp='$siteprefixexp'
22621 sitescript='$sitescript'
22622 sitescriptexp='$sitescriptexp'
22623 sizesize='$sizesize'
22624 sizetype='$sizetype'
22625 sleep='$sleep'
22626 smail='$smail'
22627 so='$so'
22628 sockethdr='$sockethdr'
22629 socketlib='$socketlib'
22630 socksizetype='$socksizetype'
22631 sort='$sort'
22632 spackage='$spackage'
22633 spitshell='$spitshell'
22634 srand48_r_proto='$srand48_r_proto'
22635 srandom_r_proto='$srandom_r_proto'
22636 src='$src'
22637 ssizetype='$ssizetype'
22638 startperl='$startperl'
22639 startsh='$startsh'
22640 static_ext='$static_ext'
22641 stdchar='$stdchar'
22642 stdio_base='$stdio_base'
22643 stdio_bufsiz='$stdio_bufsiz'
22644 stdio_cnt='$stdio_cnt'
22645 stdio_filbuf='$stdio_filbuf'
22646 stdio_ptr='$stdio_ptr'
22647 stdio_stream_array='$stdio_stream_array'
22648 strerror_r_proto='$strerror_r_proto'
22649 strings='$strings'
22650 submit='$submit'
22651 subversion='$subversion'
22652 sysman='$sysman'
22653 tail='$tail'
22654 tar='$tar'
22655 targetarch='$targetarch'
22656 tbl='$tbl'
22657 tee='$tee'
22658 test='$test'
22659 timeincl='$timeincl'
22660 timetype='$timetype'
22661 tmpnam_r_proto='$tmpnam_r_proto'
22662 to='$to'
22663 touch='$touch'
22664 tr='$tr'
22665 trnl='$trnl'
22666 troff='$troff'
22667 ttyname_r_proto='$ttyname_r_proto'
22668 u16size='$u16size'
22669 u16type='$u16type'
22670 u32size='$u32size'
22671 u32type='$u32type'
22672 u64size='$u64size'
22673 u64type='$u64type'
22674 u8size='$u8size'
22675 u8type='$u8type'
22676 uidformat='$uidformat'
22677 uidsign='$uidsign'
22678 uidsize='$uidsize'
22679 uidtype='$uidtype'
22680 uname='$uname'
22681 uniq='$uniq'
22682 uquadtype='$uquadtype'
22683 use5005threads='$use5005threads'
22684 use64bitall='$use64bitall'
22685 use64bitint='$use64bitint'
22686 usecrosscompile='$usecrosscompile'
22687 usedl='$usedl'
22688 usedtrace='$usedtrace'
22689 usefaststdio='$usefaststdio'
22690 useithreads='$useithreads'
22691 uselargefiles='$uselargefiles'
22692 uselongdouble='$uselongdouble'
22693 usemallocwrap='$usemallocwrap'
22694 usemorebits='$usemorebits'
22695 usemultiplicity='$usemultiplicity'
22696 usemymalloc='$usemymalloc'
22697 usenm='$usenm'
22698 useopcode='$useopcode'
22699 useperlio='$useperlio'
22700 useposix='$useposix'
22701 usereentrant='$usereentrant'
22702 userelocatableinc='$userelocatableinc'
22703 usesfio='$usesfio'
22704 useshrplib='$useshrplib'
22705 usesitecustomize='$usesitecustomize'
22706 usesocks='$usesocks'
22707 usethreads='$usethreads'
22708 usevendorprefix='$usevendorprefix'
22709 usevfork='$usevfork'
22710 usrinc='$usrinc'
22711 uuname='$uuname'
22712 uvXUformat='$uvXUformat'
22713 uvoformat='$uvoformat'
22714 uvsize='$uvsize'
22715 uvtype='$uvtype'
22716 uvuformat='$uvuformat'
22717 uvxformat='$uvxformat'
22718 vendorarch='$vendorarch'
22719 vendorarchexp='$vendorarchexp'
22720 vendorbin='$vendorbin'
22721 vendorbinexp='$vendorbinexp'
22722 vendorhtml1dir='$vendorhtml1dir'
22723 vendorhtml1direxp='$vendorhtml1direxp'
22724 vendorhtml3dir='$vendorhtml3dir'
22725 vendorhtml3direxp='$vendorhtml3direxp'
22726 vendorlib='$vendorlib'
22727 vendorlib_stem='$vendorlib_stem'
22728 vendorlibexp='$vendorlibexp'
22729 vendorman1dir='$vendorman1dir'
22730 vendorman1direxp='$vendorman1direxp'
22731 vendorman3dir='$vendorman3dir'
22732 vendorman3direxp='$vendorman3direxp'
22733 vendorprefix='$vendorprefix'
22734 vendorprefixexp='$vendorprefixexp'
22735 vendorscript='$vendorscript'
22736 vendorscriptexp='$vendorscriptexp'
22737 version='$version'
22738 version_patchlevel_string='$version_patchlevel_string'
22739 versiononly='$versiononly'
22740 vi='$vi'
22741 voidflags='$voidflags'
22742 xlibpth='$xlibpth'
22743 yacc='$yacc'
22744 yaccflags='$yaccflags'
22745 zcat='$zcat'
22746 zip='$zip'
22747 EOT
22748
22749 : Add in command line options if available
22750 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22751
22752 : add special variables
22753 $test -f $src/patchlevel.h && \
22754 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22755 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22756 echo "PERL_CONFIG_SH=true" >>config.sh
22757
22758 : propagate old symbols
22759 if $test -f UU/config.sh; then
22760         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22761         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22762                 config.sh config.sh UU/oldconfig.sh |\
22763                 $sort | $uniq -u >UU/oldsyms
22764         set X `cat UU/oldsyms`
22765         shift
22766         case $# in
22767         0) ;;
22768         *)
22769                 cat <<EOM
22770 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22771 EOM
22772                 echo ": Variables propagated from previous config.sh file." >>config.sh
22773                 for sym in `cat UU/oldsyms`; do
22774                         echo "    Propagating $hint variable "'$'"$sym..."
22775                         eval 'tmp="$'"${sym}"'"'
22776                         echo "$tmp" | \
22777                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22778                 done
22779                 ;;
22780         esac
22781 fi
22782
22783 : Finish up by extracting the .SH files
22784 case "$alldone" in
22785 exit)
22786         $rm -rf UU
22787         echo "Extraction done."
22788         exit 0
22789         ;;
22790 cont)
22791         ;;
22792 '')
22793         dflt=''
22794         nostick=true
22795         $cat <<EOM
22796
22797 If you'd like to make any changes to the config.sh file before I begin
22798 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22799
22800 EOM
22801         rp="Press return or use a shell escape to edit config.sh:"
22802         . UU/myread
22803         nostick=''
22804         case "$ans" in
22805         '') ;;
22806         *) : in case they cannot read
22807                 sh 1>&4 -c "$ans";;
22808         esac
22809         ;;
22810 esac
22811
22812 : if this fails, just run all the .SH files by hand
22813 . ./config.sh
22814
22815 echo " "
22816 exec 1>&4
22817 pwd=`pwd`
22818 . ./UU/extract
22819 cd "$pwd"
22820
22821 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22822         dflt=y
22823         case "$silent" in
22824         true) ;;
22825         *)
22826                 $cat <<EOM
22827
22828 Now you need to generate make dependencies by running "$make depend".
22829 You might prefer to run it in background: "$make depend > makedepend.out &"
22830 It can take a while, so you might not want to run it right now.
22831
22832 EOM
22833                 ;;
22834         esac
22835         rp="Run $make depend now?"
22836         . UU/myread
22837         case "$ans" in
22838         y*)
22839                 $make depend && echo "Now you must run '$make'."
22840                 ;;
22841         *)
22842                 echo "You must run '$make depend' then '$make'."
22843                 ;;
22844         esac
22845 elif test -f [Mm]akefile; then
22846         echo " "
22847         echo "Now you must run a $make."
22848 else
22849         echo "Configure done."
22850 fi
22851
22852 if $test -f Policy.sh; then
22853     $cat <<EOM
22854
22855 If you compile $package on a different machine or from a different object
22856 directory, copy the Policy.sh file from this object directory to the
22857 new one before you run Configure -- this will help you with most of
22858 the policy defaults.
22859
22860 EOM
22861 fi
22862 if $test -f config.msg; then
22863     echo "Hmm.  I also noted the following information while running:"
22864     echo " "
22865     $cat config.msg >&4
22866     $rm -f config.msg
22867 fi
22868 $rm -f kit*isdone ark*isdone
22869 $rm -rf UU
22870
22871 : End of Configure
22872