1194303a8ab273591f8fde72573b320e36ec3697
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Fri Aug 22 17:08:28 CEST 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 d_timegm=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_assert=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_mallocmalloc=''
874 i_math=''
875 i_memory=''
876 i_mntent=''
877 d_ndbm=''
878 i_gdbm_ndbm=''
879 i_gdbmndbm=''
880 i_ndbm=''
881 i_netdb=''
882 i_neterrno=''
883 i_netinettcp=''
884 i_niin=''
885 i_sysin=''
886 i_poll=''
887 i_prot=''
888 i_pthread=''
889 d_pwage=''
890 d_pwchange=''
891 d_pwclass=''
892 d_pwcomment=''
893 d_pwexpire=''
894 d_pwgecos=''
895 d_pwpasswd=''
896 d_pwquota=''
897 i_pwd=''
898 i_sfio=''
899 i_shadow=''
900 i_socks=''
901 i_stddef=''
902 i_stdlib=''
903 i_string=''
904 strings=''
905 i_sunmath=''
906 i_sysaccess=''
907 i_sysdir=''
908 i_sysfile=''
909 d_voidtty=''
910 i_bsdioctl=''
911 i_sysfilio=''
912 i_sysioctl=''
913 i_syssockio=''
914 i_syslog=''
915 i_sysmman=''
916 i_sysmode=''
917 i_sysmount=''
918 i_sysndir=''
919 i_sysparam=''
920 i_syspoll=''
921 i_sysresrc=''
922 i_syssecrt=''
923 i_sysselct=''
924 i_sysstat=''
925 i_sysstatfs=''
926 i_sysstatvfs=''
927 i_systimes=''
928 i_systypes=''
929 i_sysuio=''
930 i_sysun=''
931 i_sysutsname=''
932 i_sysvfs=''
933 i_syswait=''
934 i_sgtty=''
935 i_termio=''
936 i_termios=''
937 d_tm_tm_gmtoff=''
938 d_tm_tm_zone=''
939 i_systime=''
940 i_systimek=''
941 i_time=''
942 timeincl=''
943 i_unistd=''
944 i_ustat=''
945 i_utime=''
946 i_values=''
947 i_stdarg=''
948 i_varargs=''
949 i_varhdr=''
950 i_vfork=''
951 d_inc_version_list=''
952 inc_version_list=''
953 inc_version_list_init=''
954 installprefix=''
955 installprefixexp=''
956 installstyle=''
957 installusrbinperl=''
958 intsize=''
959 longsize=''
960 shortsize=''
961 issymlink=''
962 libc=''
963 ldlibpthname=''
964 libperl=''
965 shrpenv=''
966 useshrplib=''
967 glibpth=''
968 libpth=''
969 loclibpth=''
970 plibpth=''
971 xlibpth=''
972 ignore_versioned_solibs=''
973 libs=''
974 libsdirs=''
975 libsfiles=''
976 libsfound=''
977 libspath=''
978 lns=''
979 d_PRIEUldbl=''
980 d_PRIFUldbl=''
981 d_PRIGUldbl=''
982 d_PRIeldbl=''
983 d_PRIfldbl=''
984 d_PRIgldbl=''
985 d_SCNfldbl=''
986 sPRIEUldbl=''
987 sPRIFUldbl=''
988 sPRIGUldbl=''
989 sPRIeldbl=''
990 sPRIfldbl=''
991 sPRIgldbl=''
992 sSCNfldbl=''
993 lseeksize=''
994 lseektype=''
995 mad=''
996 madlyh=''
997 madlyobj=''
998 madlysrc=''
999 make_set_make=''
1000 d_mymalloc=''
1001 freetype=''
1002 mallocobj=''
1003 mallocsrc=''
1004 malloctype=''
1005 usemallocwrap=''
1006 usemymalloc=''
1007 installman1dir=''
1008 man1dir=''
1009 man1direxp=''
1010 man1ext=''
1011 installman3dir=''
1012 man3dir=''
1013 man3direxp=''
1014 man3ext=''
1015 modetype=''
1016 multiarch=''
1017 mydomain=''
1018 myhostname=''
1019 phostname=''
1020 c=''
1021 n=''
1022 d_eofnblk=''
1023 eagain=''
1024 o_nonblock=''
1025 rd_nodata=''
1026 need_va_copy=''
1027 netdb_hlen_type=''
1028 netdb_host_type=''
1029 netdb_name_type=''
1030 netdb_net_type=''
1031 groupcat=''
1032 hostcat=''
1033 passcat=''
1034 orderlib=''
1035 ranlib=''
1036 d_perl_otherlibdirs=''
1037 otherlibdirs=''
1038 package=''
1039 spackage=''
1040 pager=''
1041 api_revision=''
1042 api_subversion=''
1043 api_version=''
1044 api_versionstring=''
1045 patchlevel=''
1046 perl_patchlevel=''
1047 revision=''
1048 subversion=''
1049 version=''
1050 version_patchlevel_string=''
1051 perl5=''
1052 perladmin=''
1053 perlpath=''
1054 d_nv_preserves_uv=''
1055 d_nv_zero_is_allbits_zero=''
1056 i16size=''
1057 i16type=''
1058 i32size=''
1059 i32type=''
1060 i64size=''
1061 i64type=''
1062 i8size=''
1063 i8type=''
1064 ivsize=''
1065 ivtype=''
1066 nv_overflows_integers_at=''
1067 nv_preserves_uv_bits=''
1068 nvsize=''
1069 nvtype=''
1070 u16size=''
1071 u16type=''
1072 u32size=''
1073 u32type=''
1074 u64size=''
1075 u64type=''
1076 u8size=''
1077 u8type=''
1078 uvsize=''
1079 uvtype=''
1080 ivdformat=''
1081 nvEUformat=''
1082 nvFUformat=''
1083 nvGUformat=''
1084 nveformat=''
1085 nvfformat=''
1086 nvgformat=''
1087 uvXUformat=''
1088 uvoformat=''
1089 uvuformat=''
1090 uvxformat=''
1091 pidtype=''
1092 prefix=''
1093 prefixexp=''
1094 installprivlib=''
1095 privlib=''
1096 privlibexp=''
1097 prototype=''
1098 ptrsize=''
1099 d_PRIXU64=''
1100 d_PRId64=''
1101 d_PRIi64=''
1102 d_PRIo64=''
1103 d_PRIu64=''
1104 d_PRIx64=''
1105 sPRIXU64=''
1106 sPRId64=''
1107 sPRIi64=''
1108 sPRIo64=''
1109 sPRIu64=''
1110 sPRIx64=''
1111 d_quad=''
1112 quadkind=''
1113 quadtype=''
1114 uquadtype=''
1115 drand01=''
1116 randbits=''
1117 randfunc=''
1118 randseedtype=''
1119 seedfunc=''
1120 installscript=''
1121 scriptdir=''
1122 scriptdirexp=''
1123 selectminbits=''
1124 selecttype=''
1125 sh=''
1126 sig_count=''
1127 sig_name=''
1128 sig_name_init=''
1129 sig_num=''
1130 sig_num_init=''
1131 sig_size=''
1132 d_sitearch=''
1133 installsitearch=''
1134 sitearch=''
1135 sitearchexp=''
1136 installsitebin=''
1137 sitebin=''
1138 sitebinexp=''
1139 installsitehtml1dir=''
1140 sitehtml1dir=''
1141 sitehtml1direxp=''
1142 installsitehtml3dir=''
1143 sitehtml3dir=''
1144 sitehtml3direxp=''
1145 installsitelib=''
1146 sitelib=''
1147 sitelib_stem=''
1148 sitelibexp=''
1149 installsiteman1dir=''
1150 siteman1dir=''
1151 siteman1direxp=''
1152 installsiteman3dir=''
1153 siteman3dir=''
1154 siteman3direxp=''
1155 siteprefix=''
1156 siteprefixexp=''
1157 installsitescript=''
1158 sitescript=''
1159 sitescriptexp=''
1160 sizesize=''
1161 sizetype=''
1162 so=''
1163 socksizetype=''
1164 sharpbang=''
1165 shsharp=''
1166 spitshell=''
1167 src=''
1168 ssizetype=''
1169 startperl=''
1170 startsh=''
1171 stdchar=''
1172 d_stdio_stream_array=''
1173 stdio_stream_array=''
1174 sysman=''
1175 sGMTIME_max=''
1176 sGMTIME_min=''
1177 trnl=''
1178 uidformat=''
1179 uidsign=''
1180 uidsize=''
1181 uidtype=''
1182 archname64=''
1183 use64bitall=''
1184 use64bitint=''
1185 dtrace=''
1186 usedtrace=''
1187 usefaststdio=''
1188 ccflags_uselargefiles=''
1189 ldflags_uselargefiles=''
1190 libswanted_uselargefiles=''
1191 uselargefiles=''
1192 uselongdouble=''
1193 usemorebits=''
1194 usemultiplicity=''
1195 nm_opt=''
1196 nm_so_opt=''
1197 runnm=''
1198 usenm=''
1199 useperlio=''
1200 usesocks=''
1201 d_oldpthreads=''
1202 use5005threads=''
1203 useithreads=''
1204 usereentrant=''
1205 usethreads=''
1206 incpath=''
1207 mips_type=''
1208 usrinc=''
1209 d_vendorarch=''
1210 installvendorarch=''
1211 vendorarch=''
1212 vendorarchexp=''
1213 d_vendorbin=''
1214 installvendorbin=''
1215 vendorbin=''
1216 vendorbinexp=''
1217 installvendorhtml1dir=''
1218 vendorhtml1dir=''
1219 vendorhtml1direxp=''
1220 installvendorhtml3dir=''
1221 vendorhtml3dir=''
1222 vendorhtml3direxp=''
1223 d_vendorlib=''
1224 installvendorlib=''
1225 vendorlib=''
1226 vendorlib_stem=''
1227 vendorlibexp=''
1228 installvendorman1dir=''
1229 vendorman1dir=''
1230 vendorman1direxp=''
1231 installvendorman3dir=''
1232 vendorman3dir=''
1233 vendorman3direxp=''
1234 usevendorprefix=''
1235 vendorprefix=''
1236 vendorprefixexp=''
1237 d_vendorscript=''
1238 installvendorscript=''
1239 vendorscript=''
1240 vendorscriptexp=''
1241 versiononly=''
1242 defvoidused=''
1243 voidflags=''
1244 yacc=''
1245 yaccflags=''
1246 CONFIG=''
1247
1248 : Detect odd OSs
1249 define='define'
1250 undef='undef'
1251 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1252 rmlist=''
1253
1254 : We must find out about Eunice early
1255 eunicefix=':'
1256 if test -f /etc/unixtovms; then
1257         eunicefix=/etc/unixtovms
1258 fi
1259 if test -f /etc/unixtovms.exe; then
1260         eunicefix=/etc/unixtovms.exe
1261 fi
1262
1263 : Set executable suffix now -- needed before hints available
1264 if test -f "/libs/version.library"; then
1265 : Amiga OS
1266     _exe=""
1267 elif test -f "/system/gnu_library/bin/ar.pm"; then
1268 : Stratus VOS
1269     _exe=".pm"
1270 elif test -n "$DJGPP"; then
1271 : DOS DJGPP
1272     _exe=".exe"
1273 elif test -d c:/. -o -n "$is_os2" ; then
1274 : OS/2 or cygwin
1275     _exe=".exe"
1276 fi
1277
1278 groupstype=''
1279 i_whoami=''
1280 : Trailing extension.  Override this in a hint file, if needed.
1281 : Extra object files, if any, needed on this platform.
1282 archobjs=''
1283 archname=''
1284 libnames=''
1285 : change the next line if compiling for Xenix/286 on Xenix/386
1286 xlibpth='/usr/lib/386 /lib/386'
1287 : Possible local library directories to search.
1288 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1289 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1290
1291 : general looking path for locating libraries
1292 glibpth="/lib /usr/lib $xlibpth"
1293 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1294 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1295 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1296 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1297
1298 : Private path used by Configure to find libraries.  Its value
1299 : is prepended to libpth. This variable takes care of special
1300 : machines, like the mips.  Usually, it should be empty.
1301 plibpth=''
1302
1303 : default library list
1304 libswanted=''
1305 : some systems want to use only the non-versioned libso:s
1306 ignore_versioned_solibs=''
1307 : set usethreads on the Configure command line to enable threads.
1308 usereentrant='undef'
1309 : full support for void wanted by default
1310 defvoidused=15
1311
1312 : Possible local include directories to search.
1313 : Set locincpth to "" in a hint file to defeat local include searches.
1314 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1315 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1316 :
1317 : no include file wanted by default
1318 inclwanted=''
1319
1320 : Enable -DEBUGGING and -DDEBUGGING from the command line
1321 EBUGGING=''
1322 DEBUGGING=old
1323
1324 ccname=''
1325 ccversion=''
1326 perllibs=''
1327 : set useposix=false in your hint file to disable the POSIX extension.
1328 useposix=true
1329 : set useopcode=false in your hint file to disable the Opcode extension.
1330 useopcode=true
1331 archname64=''
1332 ccflags_uselargefiles=''
1333 ldflags_uselargefiles=''
1334 libswanted_uselargefiles=''
1335 : set usemultiplicity on the Configure command line to enable multiplicity.
1336 : set usesocks on the Configure command line to enable socks.
1337 : List of libraries we want.
1338 : If anyone needs extra -lxxx, put those in a hint file.
1339 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1340 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1341 : We probably want to search /usr/shlib before most other libraries.
1342 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1343 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1344 glibpth="/usr/shlib $glibpth"
1345 : Do not use vfork unless overridden by a hint file.
1346 usevfork=false
1347
1348 : Find the basic shell for Bourne shell scripts
1349 case "$sh" in
1350 '')
1351         case "$SYSTYPE" in
1352         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1353         *) xxx='/bin/sh';;
1354         esac
1355         if test -f "$xxx"; then
1356                 sh="$xxx"
1357         else
1358                 : Build up a list and do a single loop so we can 'break' out.
1359                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1360                 for xxx in sh bash ksh pdksh ash; do
1361                         for p in $pth; do
1362                                 try="$try ${p}/${xxx}"
1363                         done
1364                 done
1365                 for xxx in $try; do
1366                         if test -f "$xxx"; then
1367                                 sh="$xxx";
1368                                 break
1369                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1370                                 sh="$xxx";
1371                                 break
1372                         elif test -f "$xxx.exe"; then
1373                                 sh="$xxx";
1374                                 break
1375                         fi
1376                 done
1377         fi
1378         ;;
1379 esac
1380
1381 case "$sh" in
1382 '')     cat >&2 <<EOM
1383 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1384
1385 Usually it's in /bin/sh.  How did you even get this far?
1386 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1387 we'll try to straighten this all out.
1388 EOM
1389         exit 1
1390         ;;
1391 esac
1392
1393 : see if sh knows # comments
1394 if `$sh -c '#' >/dev/null 2>&1`; then
1395         shsharp=true
1396         spitshell=cat
1397         xcat=/bin/cat
1398         test -f $xcat$_exe || xcat=/usr/bin/cat
1399         if test ! -f $xcat$_exe; then
1400                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1401                         if test -f $p/cat$_exe; then
1402                                 xcat=$p/cat
1403                                 break
1404                         fi
1405                 done
1406                 if test ! -f $xcat$_exe; then
1407                         echo "Can't find cat anywhere!"
1408                         exit 1
1409                 fi
1410         fi
1411         echo "#!$xcat" >sharp
1412         $eunicefix sharp
1413         chmod +x sharp
1414         ./sharp > today 2>/dev/null
1415         if test -s today; then
1416                 sharpbang='#!'
1417         else
1418                 echo "#! $xcat" > sharp
1419                 $eunicefix sharp
1420                 chmod +x sharp
1421                 ./sharp > today 2>/dev/null
1422                 if test -s today; then
1423                         sharpbang='#! '
1424                 else
1425                         sharpbang=': use '
1426                 fi
1427         fi
1428 else
1429         echo " "
1430         echo "Your $sh doesn't grok # comments--I will strip them later on."
1431         shsharp=false
1432         cd ..
1433         echo "exec grep -v '^[  ]*#'" >spitshell
1434         chmod +x spitshell
1435         $eunicefix spitshell
1436         spitshell=`pwd`/spitshell
1437         cd UU
1438         echo "I presume that if # doesn't work, #! won't work either!"
1439         sharpbang=': use '
1440 fi
1441 rm -f sharp today
1442
1443 : figure out how to guarantee sh startup
1444 case "$startsh" in
1445 '') startsh=${sharpbang}${sh} ;;
1446 *)
1447 esac
1448 cat >sharp <<EOSS
1449 $startsh
1450 set abc
1451 test "$?abc" != 1
1452 EOSS
1453
1454 chmod +x sharp
1455 $eunicefix sharp
1456 if ./sharp; then
1457         : echo "Yup, it does."
1458 else
1459         echo "Hmm... '$startsh' does not guarantee sh startup..."
1460         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1461 fi
1462 rm -f sharp
1463
1464 : Save command line options in file UU/cmdline.opt for later use in
1465 : generating config.sh.
1466 cat > cmdline.opt <<EOSH
1467 : Configure command line arguments.
1468 config_arg0='$0'
1469 config_args='$*'
1470 config_argc=$#
1471 EOSH
1472 argn=1
1473 args_exp=''
1474 args_sep=''
1475 for arg in "$@"; do
1476         cat >>cmdline.opt <<EOSH
1477 config_arg$argn='$arg'
1478 EOSH
1479         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1480 $arg
1481 EOC
1482         arg_exp=`cat cmdl.opt`
1483         args_exp="$args_exp$args_sep'$arg_exp'"
1484         argn=`expr $argn + 1`
1485         args_sep=' '
1486 done
1487 rm -f cmdl.opt
1488
1489 : produce awk script to parse command line options
1490 cat >options.awk <<'EOF'
1491 BEGIN {
1492         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1493
1494         len = length(optstr);
1495         for (i = 1; i <= len; i++) {
1496                 c = substr(optstr, i, 1);
1497                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1498                 if (a == ":") {
1499                         arg[c] = 1;
1500                         i++;
1501                 }
1502                 opt[c] = 1;
1503         }
1504 }
1505 {
1506         expect = 0;
1507         str = $0;
1508         if (substr(str, 1, 1) != "-") {
1509                 printf("'%s'\n", str);
1510                 next;
1511         }
1512         len = length($0);
1513         for (i = 2; i <= len; i++) {
1514                 c = substr(str, i, 1);
1515                 if (!opt[c]) {
1516                         printf("-%s\n", substr(str, i));
1517                         next;
1518                 }
1519                 printf("-%s\n", c);
1520                 if (arg[c]) {
1521                         if (i < len)
1522                                 printf("'%s'\n", substr(str, i + 1));
1523                         else
1524                                 expect = 1;
1525                         next;
1526                 }
1527         }
1528 }
1529 END {
1530         if (expect)
1531                 print "?";
1532 }
1533 EOF
1534
1535 : process the command line options
1536 set X `for arg in "$@"; do echo "X$arg"; done |
1537         sed -e s/X// | awk -f options.awk`
1538 eval "set $*"
1539 shift
1540 rm -f options.awk
1541
1542 : set up default values
1543 fastread=''
1544 reuseval=false
1545 config_sh=''
1546 alldone=''
1547 error=''
1548 silent=''
1549 extractsh=''
1550 override=''
1551 knowitall=''
1552 rm -f optdef.sh posthint.sh
1553 cat >optdef.sh <<EOS
1554 $startsh
1555 EOS
1556
1557
1558 : option parsing
1559 while test $# -gt 0; do
1560         case "$1" in
1561         -d) shift; fastread=yes;;
1562         -e) shift; alldone=cont;;
1563         -f)
1564                 shift
1565                 cd ..
1566                 if test -r "$1"; then
1567                         config_sh="$1"
1568                 else
1569                         echo "$me: cannot read config file $1." >&2
1570                         error=true
1571                 fi
1572                 cd UU
1573                 shift;;
1574         --help|\
1575         -h) shift; error=true;;
1576         -r) shift; reuseval=true;;
1577         -s) shift; silent=true; realsilent=true;;
1578         -E) shift; alldone=exit;;
1579         -K) shift; knowitall=true;;
1580         -O) shift; override=true;;
1581         -S) shift; silent=true; extractsh=true;;
1582         -D)
1583                 shift
1584                 case "$1" in
1585                 *=)
1586                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1587                         echo "$me: ignoring -D $1" >&2
1588                         ;;
1589                 *=*) echo "$1" | \
1590                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1591                 *) echo "$1='define'" >> optdef.sh;;
1592                 esac
1593                 shift
1594                 ;;
1595         -U)
1596                 shift
1597                 case "$1" in
1598                 *=) echo "$1" >> optdef.sh;;
1599                 *=*)
1600                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1601                         echo "$me: ignoring -U $1" >&2
1602                         ;;
1603                 *) echo "$1='undef'" >> optdef.sh;;
1604                 esac
1605                 shift
1606                 ;;
1607         -A)
1608             shift
1609             xxx=''
1610             yyy="$1"
1611             zzz=''
1612             uuu=undef
1613             case "$yyy" in
1614             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1615                  case "$zzz" in
1616                  *:*) zzz='' ;;
1617                  *)   xxx=append
1618                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1619                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1620                  esac
1621                  ;;
1622             esac
1623             case "$xxx" in
1624             '')  case "$yyy" in
1625                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1626                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1627                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1628                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1629                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1630                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1631                  esac
1632                  ;;
1633             esac
1634             case "$xxx" in
1635             append)
1636                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1637             clear)
1638                 echo "$yyy=''"                  >> posthint.sh ;;
1639             define)
1640                 case "$zzz" in
1641                 '') zzz=define ;;
1642                 esac
1643                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1644             eval)
1645                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1646             prepend)
1647                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1648             undef)
1649                 case "$zzz" in
1650                 '') zzz="$uuu" ;;
1651                 esac
1652                 echo "$yyy=$zzz"                >> posthint.sh ;;
1653             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1654             esac
1655             shift
1656             ;;
1657         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1658             exit 0;;
1659         --) break;;
1660         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1661         *) break;;
1662         esac
1663 done
1664
1665 case "$error" in
1666 true)
1667         cat >&2 <<EOM
1668 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1669                  [-U symbol] [-U symbol=] [-A command:symbol...]
1670   -d : use defaults for all answers.
1671   -e : go on without questioning past the production of config.sh.
1672   -f : specify an alternate default configuration file.
1673   -h : print this help message and exit (with an error status).
1674   -r : reuse C symbols value if possible (skips costly nm extraction).
1675   -s : silent mode, only echoes questions and essential information.
1676   -D : define symbol to have some value:
1677          -D symbol         symbol gets the value 'define'
1678          -D symbol=value   symbol gets the value 'value'
1679        common used examples (see INSTALL for more info):
1680          -Duse64bitint            use 64bit integers
1681          -Duse64bitall            use 64bit integers and pointers
1682          -Dusethreads             use thread support
1683          -Dinc_version_list=none  do not include older perl trees in @INC
1684          -DEBUGGING=none          DEBUGGING options
1685          -Dcc=gcc                 choose your compiler
1686          -Dprefix=/opt/perl5      choose your destination
1687   -E : stop at the end of questions, after having produced config.sh.
1688   -K : do not use unless you know what you are doing.
1689   -O : let -D and -U override definitions from loaded configuration file.
1690   -S : perform variable substitutions on all .SH files (can mix with -f)
1691   -U : undefine symbol:
1692          -U symbol    symbol gets the value 'undef'
1693          -U symbol=   symbol gets completely empty
1694        e.g.:  -Uversiononly
1695   -A : manipulate symbol after the platform specific hints have been applied:
1696          -A append:symbol=value   append value to symbol
1697          -A symbol=value          like append:, but with a separating space
1698          -A define:symbol=value   define symbol to have value
1699          -A clear:symbol          define symbol to be ''
1700          -A define:symbol         define symbol to be 'define'
1701          -A eval:symbol=value     define symbol to be eval of value
1702          -A prepend:symbol=value  prepend value to symbol
1703          -A undef:symbol          define symbol to be 'undef'
1704          -A undef:symbol=         define symbol to be ''
1705        e.g.:  -A prepend:libswanted='cl pthread '
1706               -A ccflags=-DSOME_MACRO
1707   -V : print version number and exit (with a zero status).
1708 EOM
1709         exit 1
1710         ;;
1711 esac
1712
1713 : Sanity checks
1714 case "$fastread$alldone" in
1715 yescont|yesexit) ;;
1716 *)
1717         case "$extractsh" in
1718         true) ;;
1719         *)
1720                 if test ! -t 0; then
1721                         echo "Say 'sh Configure', not 'sh <Configure'"
1722                         exit 1
1723                 fi
1724                 ;;
1725         esac
1726         ;;
1727 esac
1728
1729 exec 4>&1
1730 case "$silent" in
1731 true) exec 1>/dev/null;;
1732 esac
1733
1734 : run the defines and the undefines, if any, but leave the file out there...
1735 touch optdef.sh
1736 . ./optdef.sh
1737 : create the posthint manipulation script and leave the file out there...
1738 touch posthint.sh
1739
1740 : set package name
1741 package='perl5'
1742 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1743 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1744 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1745 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1746 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1747 esac
1748
1749 : Some greps do not return status, grrr.
1750 echo "grimblepritz" >grimble
1751 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1752         contains=contains
1753 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1754         contains=grep
1755 else
1756         contains=contains
1757 fi
1758 rm -f grimble
1759 : the following should work in any shell
1760 case "$contains" in
1761 contains*)
1762         echo " "
1763         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1764         cat >contains <<'EOSS'
1765 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1766 EOSS
1767 chmod +x contains
1768 esac
1769
1770 : Find the path to the source tree
1771 case "$src" in
1772 '') case "$0" in
1773     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1774          case "$src" in
1775          /*)    ;;
1776          .)     ;;
1777          *)     src=`cd ../$src && pwd` ;;
1778          esac
1779          ;;
1780     *)   src='.';;
1781     esac;;
1782 esac
1783 case "$src" in
1784 '')     src=/
1785         rsrc=/
1786         ;;
1787 /*)     rsrc="$src";;
1788 *)      rsrc="../$src";;
1789 esac
1790 if test -f $rsrc/Configure && \
1791         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1792 then
1793    : found it, so we are ok.
1794 else
1795         rsrc=''
1796         for src in . .. ../.. ../../.. ../../../..; do
1797                 if test -f ../$src/Configure && \
1798                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1799                 then
1800                         rsrc=../$src
1801                         break
1802                 fi
1803         done
1804 fi
1805 case "$rsrc" in
1806 '')
1807         cat <<EOM >&4
1808
1809 Sorry, I can't seem to locate the source dir for $package.  Please start
1810 Configure with an explicit path -- i.e. /some/path/Configure.
1811
1812 EOM
1813         exit 1
1814         ;;
1815 ../.)   rsrc='..';;
1816 *)
1817         echo " "
1818         echo "Sources for $package found in \"$src\"." >&4
1819         ;;
1820 esac
1821
1822 : script used to extract .SH files with variable substitutions
1823 cat >extract <<'EOS'
1824 PERL_CONFIG_SH=true
1825 echo "Doing variable substitutions on .SH files..."
1826 if test -f MANIFEST; then
1827         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1828 else
1829         echo "(Looking for .SH files under the source directory.)"
1830         set x `(cd "$src"; find . -name "*.SH" -print)`
1831 fi
1832 shift
1833 case $# in
1834 0) set x `(cd "$src"; echo *.SH)`; shift;;
1835 esac
1836 if test ! -f "$src/$1"; then
1837         shift
1838 fi
1839 mkdir_p='
1840 name=$1;
1841 create="";
1842 while test $name; do
1843         if test ! -d "$name"; then
1844                 create="$name $create";
1845                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1846                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1847         else
1848                 name="";
1849         fi;
1850 done;
1851 for file in $create; do
1852         mkdir $file;
1853 done
1854 '
1855 for file in $*; do
1856         case "$src" in
1857         ".")
1858                 case "$file" in
1859                 */*)
1860                         dir=`expr X$file : 'X\(.*\)/'`
1861                         file=`expr X$file : 'X.*/\(.*\)'`
1862                         (cd "$dir" && . ./$file)
1863                         ;;
1864                 *)
1865                         . ./$file
1866                         ;;
1867                 esac
1868                 ;;
1869         *)
1870                 case "$file" in
1871                 */*)
1872                         dir=`expr X$file : 'X\(.*\)/'`
1873                         file=`expr X$file : 'X.*/\(.*\)'`
1874                         (set x $dir; shift; eval $mkdir_p)
1875                         sh <"$src/$dir/$file"
1876                         ;;
1877                 *)
1878                         sh <"$src/$file"
1879                         ;;
1880                 esac
1881                 ;;
1882         esac
1883 done
1884 if test -f "$src/config_h.SH"; then
1885         if test ! -f config.h; then
1886         : oops, they left it out of MANIFEST, probably, so do it anyway.
1887         . "$src/config_h.SH"
1888         fi
1889 fi
1890 EOS
1891
1892 : extract files and exit if asked to do so
1893 case "$extractsh" in
1894 true)
1895         case "$realsilent" in
1896         true) ;;
1897         *) exec 1>&4;;
1898         esac
1899         case "$config_sh" in
1900         '') config_sh='config.sh';;
1901         esac
1902         echo " "
1903         echo "Fetching answers from $config_sh..."
1904         cd ..
1905         . $config_sh
1906         test "$override" && . ./optdef.sh
1907         echo " "
1908         . UU/extract
1909         rm -rf UU
1910         echo "Extraction done."
1911         exit 0
1912         ;;
1913 esac
1914
1915 : Eunice requires " " instead of "", can you believe it
1916 echo " "
1917 : Here we go...
1918 echo "Beginning of configuration questions for $package."
1919
1920 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1921
1922 : first determine how to suppress newline on echo command
1923 echo " "
1924 echo "Checking echo to see how to suppress newlines..."
1925 (echo "hi there\c" ; echo " ") >.echotmp
1926 if $contains c .echotmp >/dev/null 2>&1 ; then
1927         echo "...using -n."
1928         n='-n'
1929         c=''
1930 else
1931         cat <<'EOM'
1932 ...using \c
1933 EOM
1934         n=''
1935         c='\c'
1936 fi
1937 echo $n "The star should be here-->$c"
1938 echo '*'
1939 rm -f .echotmp
1940
1941 : Now test for existence of everything in MANIFEST
1942 echo " "
1943 if test -f "$rsrc/MANIFEST"; then
1944         echo "First let's make sure your kit is complete.  Checking..." >&4
1945         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1946                 (split -l 50 2>/dev/null || split -50)
1947         rm -f missing
1948         tmppwd=`pwd`
1949         for filelist in x??; do
1950                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1951                         >/dev/null 2>>"$tmppwd/missing")
1952         done
1953         if test -s missing; then
1954                 cat missing >&4
1955                 cat >&4 <<'EOM'
1956
1957 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1958
1959 You have the option of continuing the configuration process, despite the
1960 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1961 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1962 and contact the author (perlbug@perl.org).
1963
1964 EOM
1965                 echo $n "Continue? [n] $c" >&4
1966                 read ans
1967                 case "$ans" in
1968                 y*)
1969                         echo "Continuing..." >&4
1970                         rm -f missing
1971                         ;;
1972                 *)
1973                         echo "ABORTING..." >&4
1974                         kill $$
1975                         ;;
1976                 esac
1977         else
1978                 echo "Looks good..."
1979         fi
1980 else
1981         echo "There is no MANIFEST file.  I hope your kit is complete !"
1982 fi
1983 rm -f missing x??
1984
1985 : Find the appropriate value for a newline for tr
1986 echo " "
1987 if test -n "$DJGPP"; then
1988        trnl='\012'
1989 fi
1990 if test X"$trnl" = X; then
1991         case "`echo foo|tr '\n' x 2>/dev/null`" in
1992         foox) trnl='\n' ;;
1993         esac
1994 fi
1995 if test X"$trnl" = X; then
1996         case "`echo foo|tr '\012' x 2>/dev/null`" in
1997         foox) trnl='\012' ;;
1998         esac
1999 fi
2000 if test X"$trnl" = X; then
2001        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2002        fooxy) trnl='\n\r' ;;
2003        esac
2004 fi
2005 if test X"$trnl" = X; then
2006         cat <<EOM >&2
2007
2008 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2009
2010 EOM
2011         exit 1
2012 fi
2013
2014 : compute the number of columns on the terminal for proper question formatting
2015 case "$COLUMNS" in
2016 '') COLUMNS='80';;
2017 esac
2018
2019 : set up the echo used in my read
2020 myecho="case \"\$xxxm\" in
2021 '') echo $n \"\$rp $c\" >&4;;
2022 *) case \"\$rp\" in
2023         '') echo $n \"[\$xxxm] $c\";;
2024         *)
2025                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2026                         echo \"\$rp\" >&4
2027                         echo $n \"[\$xxxm] $c\" >&4
2028                 else
2029                         echo $n \"\$rp [\$xxxm] $c\" >&4
2030                 fi
2031                 ;;
2032         esac;;
2033 esac"
2034
2035 : now set up to do reads with possible shell escape and default assignment
2036 cat <<EOSC >myread
2037 $startsh
2038 xxxm=\$dflt
2039 $myecho
2040 ans='!'
2041 case "\$fastread" in
2042 yes) case "\$dflt" in
2043         '') ;;
2044         *) ans='';
2045                 case "\$silent-\$rp" in
2046                 true-) ;;
2047                 *) echo " " >&4;;
2048                 esac;;
2049         esac;;
2050 *) case "\$silent" in
2051         true) case "\$rp" in
2052                 '') ans='';;
2053                 esac;;
2054         esac;;
2055 esac
2056 while expr "X\$ans" : "X!" >/dev/null; do
2057         read answ
2058         set x \$xxxm
2059         shift
2060         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2061         case  "\$answ" in
2062         "!")
2063                 sh 1>&4
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         !*)
2068                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2069                 shift
2070                 sh 1>&4 -c "\$*"
2071                 echo " "
2072                 $myecho
2073                 ;;
2074         "\$ans")
2075                 case "\$ans" in
2076                 \\&*)
2077                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2078                         shift
2079                         case "\$1" in
2080                         -d)
2081                                 fastread=yes
2082                                 echo "(OK, I'll run with -d after this question.)" >&4
2083                                 ;;
2084                         -*)
2085                                 echo "*** Sorry, \$1 not supported yet." >&4
2086                                 ;;
2087                         esac
2088                         $myecho
2089                         ans=!
2090                         ;;
2091                 esac;;
2092         *)
2093                 case "\$aok" in
2094                 y)
2095                         echo "*** Substitution done -- please confirm."
2096                         xxxm="\$ans"
2097                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2098                         xxxm="\$ans"
2099                         ans=!
2100                         ;;
2101                 *)
2102                         echo "*** Error -- try again."
2103                         ans=!
2104                         ;;
2105                 esac
2106                 $myecho
2107                 ;;
2108         esac
2109         case "\$ans\$xxxm\$nostick" in
2110         '')
2111                 ans=!
2112                 $myecho
2113                 ;;
2114         esac
2115 done
2116 case "\$ans" in
2117 '') ans="\$xxxm";;
2118 esac
2119 EOSC
2120
2121 : create .config dir to save info across Configure sessions
2122 test -d ../.config || mkdir ../.config
2123 cat >../.config/README <<EOF
2124 This directory created by Configure to save information that should
2125 persist across sessions for $package.
2126
2127 You may safely delete it if you wish.
2128 EOF
2129
2130 : See if we are using a devel version and want that
2131 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2132 case "$usedevel" in
2133 $define|true|[yY]*) ;;
2134 *) case "$xversion" in
2135    *[13579])
2136         cat >&4 <<EOH
2137 *** WHOA THERE!!! ***
2138
2139     This is an UNSTABLE DEVELOPMENT release.
2140     The version of this $package distribution is $xversion, that is, odd,
2141     (as opposed to even) and that signifies a development release.
2142     If you want a maintenance release, you want an even-numbered version.
2143
2144     Do ***NOT*** install this into production use.
2145     Data corruption and crashes are possible.
2146
2147     It is most seriously suggested that you do not continue any further
2148     unless you want to help in developing and debugging Perl.
2149
2150     If you *still* want to build perl, you can answer 'y' now,
2151     or pass -Dusedevel to Configure.
2152
2153 EOH
2154         rp='Do you really want to continue?'
2155         dflt='n'
2156         . ./myread
2157         case "$ans" in
2158         [yY]) echo >&4 "Okay, continuing."
2159               usedevel="$define" ;;
2160         *) echo >&4 "Okay, bye."
2161            exit 1
2162            ;;
2163         esac
2164         ;;
2165     esac
2166     ;;
2167 esac
2168 case "$usedevel" in
2169 $define|true|[yY]*)
2170         case "$versiononly" in
2171         '') versiononly="$define" ;;
2172         esac
2173         case "$installusrbinperl" in
2174         '') installusrbinperl="$undef" ;;
2175         esac
2176         ;;
2177 esac
2178
2179 : general instructions
2180 needman=true
2181 firsttime=true
2182 user=`(logname) 2>/dev/null`
2183 case "$user" in
2184 '') user=`whoami 2>&1`;;
2185 esac
2186 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2187         firsttime=false
2188         echo " "
2189         rp='Would you like to see the instructions?'
2190         dflt=n
2191         . ./myread
2192         case "$ans" in
2193         [yY]*) ;;
2194         *) needman=false;;
2195         esac
2196 fi
2197 if $needman; then
2198         cat <<EOH
2199
2200 This installation shell script will examine your system and ask you questions
2201 to determine how the perl5 package should be installed. If you get
2202 stuck on a question, you may use a ! shell escape to start a subshell or
2203 execute a command.  Many of the questions will have default answers in square
2204 brackets; typing carriage return will give you the default.
2205
2206 On some of the questions which ask for file or directory names you are allowed
2207 to use the ~name construct to specify the login directory belonging to "name",
2208 even if you don't have a shell which knows about that.  Questions where this is
2209 allowed will be marked "(~name ok)".
2210
2211 EOH
2212         rp=''
2213         dflt='Type carriage return to continue'
2214         . ./myread
2215         cat <<'EOH'
2216
2217 The prompter used in this script allows you to use shell variables and
2218 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2219 in the default answer, as if the default line was a set of arguments given to a
2220 script shell.  This means you may also use $* to repeat the whole default line,
2221 so you do not have to re-type everything to add something to the default.
2222
2223 Everytime there is a substitution, you will have to confirm.  If there is an
2224 error (e.g. an unmatched backtick), the default answer will remain unchanged
2225 and you will be prompted again.
2226
2227 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2228 the questions and use the computed defaults (or the previous answers if there
2229 was already a config.sh file). Type 'Configure -h' for a list of options.
2230 You may also start interactively and then answer '& -d' at any prompt to turn
2231 on the non-interactive behaviour for the remainder of the execution.
2232
2233 EOH
2234         . ./myread
2235         cat <<EOH
2236
2237 Much effort has been expended to ensure that this shell script will run on any
2238 Unix system.  If despite that it blows up on yours, your best bet is to edit
2239 Configure and run it again.  If you can't run Configure for some reason,
2240 you'll have to generate a config.sh file by hand.  Whatever problems you
2241 have, let me (perlbug@perl.org) know how I blew it.
2242
2243 This installation script affects things in two ways:
2244
2245 1) it may do direct variable substitutions on some of the files included
2246    in this kit.
2247 2) it builds a config.h file for inclusion in C programs.  You may edit
2248    any of these files as the need arises after running this script.
2249
2250 If you make a mistake on a question, there is no easy way to back up to it
2251 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2252 files.  Configure will offer to let you do this before it runs the SH files.
2253
2254 EOH
2255         dflt='Type carriage return to continue'
2256         . ./myread
2257         case "$firsttime" in
2258         true) echo $user >>../.config/instruct;;
2259         esac
2260 fi
2261
2262 : find out where common programs are
2263 echo " "
2264 echo "Locating common programs..." >&4
2265 cat <<EOSC >loc
2266 $startsh
2267 case \$# in
2268 0) exit 1;;
2269 esac
2270 thing=\$1
2271 shift
2272 dflt=\$1
2273 shift
2274 for dir in \$*; do
2275         case "\$thing" in
2276         .)
2277         if test -d \$dir/\$thing; then
2278                 echo \$dir
2279                 exit 0
2280         fi
2281         ;;
2282         *)
2283         for thisthing in \$dir/\$thing; do
2284                 : just loop through to pick last item
2285         done
2286         if test -f \$thisthing; then
2287                 echo \$thisthing
2288                 exit 0
2289         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2290                 echo \$thisthing
2291                 exit 0
2292         elif test -f \$dir/\$thing.exe; then
2293                 if test -n "$DJGPP"; then
2294                         echo \$dir/\$thing.exe
2295                 elif test "$eunicefix" != ":"; then
2296                         : on Eunice apparently
2297                         echo \$dir/\$thing
2298                 fi
2299                 exit 0
2300         fi
2301         ;;
2302         esac
2303 done
2304 echo \$dflt
2305 exit 1
2306 EOSC
2307 chmod +x loc
2308 $eunicefix loc
2309 loclist="
2310 awk
2311 cat
2312 chmod
2313 comm
2314 cp
2315 echo
2316 expr
2317 grep
2318 ls
2319 mkdir
2320 rm
2321 sed
2322 sort
2323 touch
2324 tr
2325 uniq
2326 "
2327 trylist="
2328 ar
2329 bison
2330 byacc
2331 cpp
2332 csh
2333 date
2334 egrep
2335 gmake
2336 gzip
2337 less
2338 ln
2339 make
2340 more
2341 nm
2342 nroff
2343 pg
2344 test
2345 uname
2346 zip
2347 "
2348 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2349 pth="$pth /lib /usr/lib"
2350 for file in $loclist; do
2351         eval xxx=\$$file
2352         case "$xxx" in
2353         /*|?:[\\/]*)
2354                 if test -f "$xxx"; then
2355                         : ok
2356                 else
2357                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2358                         xxx=`./loc $file $file $pth`
2359                 fi
2360                 ;;
2361         '') xxx=`./loc $file $file $pth`;;
2362         *) xxx=`./loc $xxx $xxx $pth`;;
2363         esac
2364         eval $file=$xxx$_exe
2365         eval _$file=$xxx
2366         case "$xxx" in
2367         /*)
2368                 echo $file is in $xxx.
2369                 ;;
2370         ?:[\\/]*)
2371                 echo $file is in $xxx.
2372                 ;;
2373         *)
2374                 echo "I don't know where '$file' is, and my life depends on it." >&4
2375                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2376                 exit 1
2377                 ;;
2378         esac
2379 done
2380 echo " "
2381 echo "Don't worry if any of the following aren't found..."
2382 say=offhand
2383 for file in $trylist; do
2384         eval xxx=\$$file
2385         case "$xxx" in
2386         /*|?:[\\/]*)
2387                 if test -f "$xxx"; then
2388                         : ok
2389                 else
2390                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391                         xxx=`./loc $file $file $pth`
2392                 fi
2393                 ;;
2394         '') xxx=`./loc $file $file $pth`;;
2395         *) xxx=`./loc $xxx $xxx $pth`;;
2396         esac
2397         eval $file=$xxx$_exe
2398         eval _$file=$xxx
2399         case "$xxx" in
2400         /*)
2401                 echo $file is in $xxx.
2402                 ;;
2403         ?:[\\/]*)
2404                 echo $file is in $xxx.
2405                 ;;
2406         *)
2407                 echo "I don't see $file out there, $say."
2408                 say=either
2409                 ;;
2410         esac
2411 done
2412 case "$egrep" in
2413 egrep)
2414         echo "Substituting grep for egrep."
2415         egrep=$grep
2416         _egrep=$grep
2417         ;;
2418 esac
2419 case "$ln" in
2420 ln)
2421         echo "Substituting cp for ln."
2422         ln=$cp
2423         _ln=$cp
2424         ;;
2425 esac
2426 case "$make" in
2427 make)
2428         case "$gmake" in
2429         gmake)
2430         echo "I can't find make or gmake, and my life depends on it." >&4
2431         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2432         exit 1
2433         ;;
2434         esac
2435         ;;
2436 esac
2437 case "$gmake" in
2438 gmake)  ;;
2439 *)      # We can't have osname yet.
2440         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2441                 # Assume that gmake, if found, is definitely GNU make
2442                 # and prefer it over the system make.
2443                 echo "Substituting gmake for make."
2444                 make=$gmake
2445                 _make=$gmake
2446         fi
2447         ;;
2448 esac
2449 case "$test" in
2450 test)
2451         echo "Hopefully test is built into your sh."
2452         ;;
2453 *)
2454         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2455                 echo "Using the test built into your sh."
2456                 test=test
2457                 _test=test
2458         fi
2459         ;;
2460 esac
2461 case "$echo" in
2462 echo)
2463         echo "Hopefully echo is built into your sh."
2464         ;;
2465 '') ;;
2466 *)
2467         echo " "
2468 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2469         $echo $n "hi there$c" >foo1
2470         echo $n "hi there$c" >foo2
2471         if cmp foo1 foo2 >/dev/null 2>&1; then
2472                 echo "They are compatible.  In fact, they may be identical."
2473         else
2474                 case "$n" in
2475                 '-n') n='' c='\c';;
2476                 *) n='-n' c='';;
2477                 esac
2478                 cat <<FOO
2479 They are not compatible!  You are probably running ksh on a non-USG system.
2480 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2481 have echo built in and we may have to run some Bourne shell scripts.  That
2482 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2483
2484 FOO
2485                 $echo $n "The star should be here-->$c"
2486                 $echo "*"
2487         fi
2488         $rm -f foo1 foo2
2489         ;;
2490 esac
2491
2492 # This question was auctioned at YAPC::Europe-2007 in Vienna
2493 # I never promised you could answer it. I only auctioned the question.
2494 cat <<FOO
2495 The following message is sponsored by
2496
2497   Dresden.pm<--The stars should be here.
2498
2499 Dear Perl user, system administrator or package
2500 maintainer, the Perl community sends greetings to
2501 you. Do you (emblematical) greet back [Y/n]? n
2502
2503 FOO
2504
2505 : Check what type of C compiler we use
2506 cat <<EOS >trygcc
2507 $startsh
2508 EOS
2509 cat <<'EOSC' >>trygcc
2510 case "$cc" in
2511 '') ;;
2512 *)  $rm -f try try.*
2513     $cat >try.c <<EOM
2514 int main(int argc, char *argv[]) {
2515   return 0;
2516 }
2517 EOM
2518     if $cc -o try $ccflags $ldflags try.c; then
2519        :
2520     else
2521         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522         despair=yes
2523         trygcc=yes
2524         case "$cc" in
2525         *gcc*) trygcc=no ;;
2526         esac
2527         # Skip this test because it gives a false match on output like:
2528         #    ./trygcc: line 23: cc: command not found
2529         # case "`$cc -v -c try.c 2>&1`" in
2530         # *gcc*) trygcc=no ;;
2531         # esac
2532         if $test X"$trygcc" = Xyes; then
2533             if gcc -o try -c try.c; then
2534                 echo " "
2535                 echo "You seem to have a working gcc, though." >&4
2536                 # Switching compilers may undo the work of hints files.
2537                 # The most common problem is -D_REENTRANT for threads.
2538                 # This heuristic catches that case, but gets false positives
2539                 # if -Dusethreads was not actually specified.  Better to
2540                 # bail out here with a useful message than fail 
2541                 # mysteriously later. Should we perhaps just try to
2542                 # re-invoke Configure -Dcc=gcc config_args ?
2543                 if $test -f usethreads.cbu; then
2544                         $cat >&4 <<EOM 
2545
2546 *** However, any setting of the C compiler flags (e.g. for thread support)
2547 *** will be lost.  It may be necessary for you to restart Configure and
2548 *** add -Dcc=gcc to your Configure command line.
2549
2550 EOM
2551                         rp="Would you like to go ahead and try gcc anyway?"
2552                         dflt=n
2553                 else
2554                         rp="Would you like to use it?"
2555                         dflt=y
2556                 fi
2557                 if $test -f myread; then
2558                     . ./myread
2559                 else
2560                     if $test -f UU/myread; then
2561                         . ./UU/myread
2562                     else
2563                         echo "Cannot find myread, sorry.  Aborting." >&2
2564                         exit 1
2565                     fi
2566                 fi  
2567                 case "$ans" in
2568                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2569                 esac
2570             fi
2571         fi
2572     fi
2573     $rm -f try try.*
2574     ;;
2575 esac
2576 EOSC
2577
2578 cat <<EOS >checkcc
2579 $startsh
2580 EOS
2581 cat <<'EOSC' >>checkcc
2582 case "$cc" in        
2583 '') ;;
2584 *)  $rm -f try try.*              
2585     $cat >try.c <<EOM
2586 int main(int argc, char *argv[]) {
2587   return 0;
2588 }
2589 EOM
2590     if $cc -o try $ccflags $ldflags try.c; then
2591        :
2592     else
2593         if $test X"$despair" = Xyes; then
2594            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2595         fi
2596         $cat >&4 <<EOM         
2597 You need to find a working C compiler.
2598 Either (purchase and) install the C compiler supplied by your OS vendor,
2599 or for a free C compiler try http://gcc.gnu.org/
2600 I cannot continue any further, aborting.
2601 EOM
2602         exit 1
2603     fi
2604     $rm -f try try.*
2605     ;;
2606 esac
2607 EOSC
2608
2609 : determine whether symbolic links are supported
2610 echo " "
2611 $touch blurfl
2612 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2613         echo "Symbolic links are supported." >&4
2614         lns="$ln -s"
2615 else
2616         echo "Symbolic links are NOT supported." >&4
2617         lns="$ln"
2618 fi
2619 $rm -f blurfl sym
2620
2621 : determine whether symbolic links are supported
2622 echo " "
2623 case "$lns" in
2624 *"ln"*" -s")
2625         echo "Checking how to test for symbolic links..." >&4
2626         $lns blurfl sym
2627         if $test "X$issymlink" = X; then
2628                 case "$newsh" in
2629                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2630                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2631                 esac
2632                 if test $? = 0; then
2633                         issymlink="test -h"
2634                 else
2635                         echo "Your builtin 'test -h' may be broken." >&4
2636                         case "$test" in
2637                         /*)     ;;
2638                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2639                                 for p in $pth
2640                                 do
2641                                         if test -f "$p/$test"; then
2642                                                 test="$p/$test"
2643                                                 break
2644                                         fi
2645                                 done
2646                                 ;;
2647                         esac
2648                         case "$test" in
2649                         /*)
2650                                 echo "Trying external '$test -h'." >&4
2651                                 issymlink="$test -h"
2652                                 if $test ! -h sym >/dev/null 2>&1; then
2653                                         echo "External '$test -h' is broken, too." >&4
2654                                         issymlink=''
2655                                 fi
2656                                 ;;
2657                         *)      issymlink='' ;;
2658                         esac
2659                 fi              
2660         fi
2661         if $test "X$issymlink" = X; then
2662                 if $test -L sym 2>/dev/null; then
2663                         issymlink="$test -L"
2664                         echo "The builtin '$test -L' worked." >&4
2665                 fi
2666         fi
2667         if $test "X$issymlink" != X; then
2668                 echo "You can test for symbolic links with '$issymlink'." >&4
2669         else
2670                 echo "I do not know how you can test for symbolic links." >&4
2671         fi
2672         $rm -f blurfl sym
2673         ;;
2674 *)      echo "No symbolic links, so not testing for their testing..." >&4
2675         ;;
2676 esac
2677 echo " "
2678
2679 : Make symlinks util
2680 case "$mksymlinks" in
2681 $define|true|[yY]*)
2682         case "$src" in
2683         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2684                 exit 1
2685                 ;;
2686         *)      case "$lns:$issymlink" in
2687                 *"ln"*" -s:"*"test -"?)
2688                         echo "Creating the symbolic links..." >&4
2689                         echo "(First creating the subdirectories...)" >&4
2690                         cd ..
2691                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2692                                 read directory
2693                                 test -z "$directory" && break
2694                                 mkdir -p $directory
2695                         done
2696                         # Sanity check 1.
2697                         if test ! -d t/base; then
2698                                 echo "Failed to create the subdirectories.  Aborting." >&4
2699                                 exit 1
2700                         fi
2701                         echo "(Then creating the symlinks...)" >&4
2702                         awk '{print $1}' $src/MANIFEST | while true; do
2703                                 read filename
2704                                 test -z "$filename" && break
2705                                 if test -f $filename; then
2706                                         if $issymlink $filename; then
2707                                                 rm -f $filename
2708                                         fi
2709                                 fi
2710                                 if test -f $filename; then
2711                                         echo "$filename already exists, not symlinking."
2712                                 else
2713                                         ln -s $src/$filename $filename
2714                                 fi
2715                         done
2716                         # Sanity check 2.
2717                         if test ! -f t/base/lex.t; then
2718                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2719                                 exit 1
2720                         fi
2721                         cd UU
2722                         ;;
2723                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2724                         ;;
2725                 esac
2726                 ;;
2727         esac
2728         ;;
2729 esac
2730
2731 : Check for Cross-Compilation
2732 case "$usecrosscompile" in
2733 $define|true|[yY]*)
2734         $echo "Cross-compiling..."
2735         croak=''
2736         case "$cc" in
2737         *-*-gcc) # A cross-compiling gcc, probably.
2738             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2739             ar=$targetarch-ar
2740             # leave out ld, choosing it is more complex
2741             nm=$targetarch-nm
2742             ranlib=$targetarch-ranlib
2743             $echo 'extern int foo;' > try.c
2744             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2745             shift
2746             if $test $# -gt 0; then
2747                 incpth="$incpth $*"
2748                 incpth="`$echo $incpth|$sed 's/^ //'`"
2749                 echo "Guessing incpth '$incpth'." >&4
2750                 for i in $*; do
2751                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2752                     if $test -d $j; then
2753                         libpth="$libpth $j"
2754                     fi
2755                 done   
2756                 libpth="`$echo $libpth|$sed 's/^ //'`"
2757                 echo "Guessing libpth '$libpth'." >&4
2758             fi
2759             $rm -f try.c
2760             ;;
2761         esac
2762         case "$targetarch" in
2763         '') echo "Targetarch not defined." >&4; croak=y ;;
2764         *)  echo "Using targetarch $targetarch." >&4 ;;
2765         esac
2766         case "$incpth" in
2767         '') echo "Incpth not defined." >&4; croak=y ;;
2768         *)  echo "Using incpth '$incpth'." >&4 ;;
2769         esac
2770         case "$libpth" in
2771         '') echo "Libpth not defined." >&4; croak=y ;;
2772         *)  echo "Using libpth '$libpth'." >&4 ;;
2773         esac
2774         case "$usrinc" in
2775         '') for i in $incpth; do
2776                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2777                     usrinc=$i
2778                     echo "Guessing usrinc $usrinc." >&4
2779                     break
2780                 fi
2781             done
2782             case "$usrinc" in
2783             '') echo "Usrinc not defined." >&4; croak=y ;;
2784             esac
2785             ;;
2786         *)  echo "Using usrinc $usrinc." >&4 ;;
2787         esac
2788         case "$targethost" in
2789         '') echo "Targethost not defined." >&4; croak=y ;;
2790         *)  echo "Using targethost $targethost." >&4
2791         esac
2792         locincpth=' '
2793         loclibpth=' '
2794         case "$croak" in
2795         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2796         esac
2797         case "$src" in
2798         /*) run=$src/Cross/run
2799             targetmkdir=$src/Cross/mkdir
2800             to=$src/Cross/to
2801             from=$src/Cross/from
2802             ;;
2803         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2804             run=$pwd/Cross/run
2805             targetmkdir=$pwd/Cross/mkdir
2806             to=$pwd/Cross/to
2807             from=$pwd/Cross/from
2808             ;;
2809         esac
2810         case "$targetrun" in
2811         '') targetrun=ssh ;;
2812         esac
2813         case "$targetto" in
2814         '') targetto=scp ;;
2815         esac
2816         case "$targetfrom" in
2817         '') targetfrom=scp ;;
2818         esac
2819         run=$run-$targetrun
2820         to=$to-$targetto
2821         from=$from-$targetfrom
2822         case "$targetdir" in
2823         '')  targetdir=/tmp
2824              echo "Guessing targetdir $targetdir." >&4
2825              ;;
2826         esac
2827         case "$targetuser" in
2828         '')  targetuser=root
2829              echo "Guessing targetuser $targetuser." >&4
2830              ;;
2831         esac
2832         case "$targetfrom" in
2833         scp)    q=-q ;;
2834         *)      q='' ;;
2835         esac
2836         case "$targetrun" in
2837         ssh|rsh)
2838             cat >$run <<EOF
2839 #!/bin/sh
2840 case "\$1" in
2841 -cwd)
2842   shift
2843   cwd=\$1
2844   shift
2845   ;;
2846 esac
2847 case "\$cwd" in
2848 '') cwd=$targetdir ;;
2849 esac
2850 exe=\$1
2851 shift
2852 if $test ! -f \$exe.xok; then
2853   $to \$exe
2854   $touch \$exe.xok
2855 fi
2856 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2857 EOF
2858             ;;
2859         *)  echo "Unknown targetrun '$targetrun'" >&4
2860             exit 1
2861             ;;
2862         esac
2863         case "$targetmkdir" in
2864         */Cross/mkdir)
2865             cat >$targetmkdir <<EOF
2866 #!/bin/sh
2867 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2868 EOF
2869             $chmod a+rx $targetmkdir
2870             ;;
2871         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2872             exit 1
2873             ;;
2874         esac
2875         case "$targetto" in
2876         scp|rcp)
2877             cat >$to <<EOF
2878 #!/bin/sh
2879 for f in \$@
2880 do
2881   case "\$f" in
2882   /*)
2883     $targetmkdir \`dirname \$f\`
2884     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2885     ;;
2886   *)
2887     $targetmkdir $targetdir/\`dirname \$f\`
2888     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2889     ;;
2890   esac
2891 done
2892 exit 0
2893 EOF
2894             ;;
2895         cp) cat >$to <<EOF
2896 #!/bin/sh
2897 for f in \$@
2898 do
2899   case "\$f" in
2900   /*)
2901     $mkdir -p $targetdir/\`dirname \$f\`
2902     $cp \$f $targetdir/\$f || exit 1
2903     ;;
2904   *)
2905     $targetmkdir $targetdir/\`dirname \$f\`
2906     $cp \$f $targetdir/\$f || exit 1
2907     ;;
2908   esac
2909 done
2910 exit 0
2911 EOF
2912             ;;
2913         *)  echo "Unknown targetto '$targetto'" >&4
2914             exit 1
2915             ;;
2916         esac
2917         case "$targetfrom" in
2918         scp|rcp)
2919           cat >$from <<EOF
2920 #!/bin/sh
2921 for f in \$@
2922 do
2923   $rm -f \$f
2924   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2925 done
2926 exit 0
2927 EOF
2928             ;;
2929         cp) cat >$from <<EOF
2930 #!/bin/sh
2931 for f in \$@
2932 do
2933   $rm -f \$f
2934   cp $targetdir/\$f . || exit 1
2935 done
2936 exit 0
2937 EOF
2938             ;;
2939         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2940             exit 1
2941             ;;
2942         esac
2943         if $test ! -f $run; then
2944             echo "Target 'run' script '$run' not found." >&4
2945         else
2946             $chmod a+rx $run
2947         fi
2948         if $test ! -f $to; then
2949             echo "Target 'to' script '$to' not found." >&4
2950         else
2951             $chmod a+rx $to
2952         fi
2953         if $test ! -f $from; then
2954             echo "Target 'from' script '$from' not found." >&4
2955         else
2956             $chmod a+rx $from
2957         fi
2958         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2959             exit 1
2960         fi
2961         cat >&4 <<EOF
2962 Using '$run' for remote execution,
2963 and '$from' and '$to'
2964 for remote file transfer.
2965 EOF
2966         ;;
2967 *)      run=''
2968         to=:
2969         from=:
2970         usecrosscompile='undef'
2971         targetarch=''
2972         ;;
2973 esac
2974
2975 : see whether [:lower:] and [:upper:] are supported character classes
2976 echo " "
2977 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2978 ABYZ)
2979         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2980         up='[:upper:]'
2981         low='[:lower:]'
2982         ;;
2983 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2984         # (0xd9 and 0xe2), therefore that is a nice testing point.
2985         if test "X$up" = X -o "X$low" = X; then
2986             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2987             rs) up='[A-Z]'
2988                 low='[a-z]'
2989                 ;;
2990             esac
2991         fi
2992         if test "X$up" = X -o "X$low" = X; then
2993             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2994             rs) up='A-Z'
2995                 low='a-z'
2996                 ;;
2997             esac
2998         fi
2999         if test "X$up" = X -o "X$low" = X; then
3000             case "`echo RS | od -x 2>/dev/null`" in
3001             *D9E2*|*d9e2*)
3002                 echo "Hey, this might be EBCDIC." >&4
3003                 if test "X$up" = X -o "X$low" = X; then
3004                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3005                     rs) up='[A-IJ-RS-Z]'
3006                         low='[a-ij-rs-z]'
3007                         ;;
3008                     esac
3009                 fi
3010                 if test "X$up" = X -o "X$low" = X; then
3011                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3012                     rs) up='A-IJ-RS-Z'
3013                         low='a-ij-rs-z'
3014                         ;;
3015                     esac
3016                 fi
3017                 ;;
3018             esac
3019         fi
3020 esac
3021 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3022 rs)
3023     echo "Using $up and $low to convert case." >&4
3024     ;;
3025 *)
3026     echo "I don't know how to translate letters from upper to lower case." >&4
3027     echo "Your tr is not acting any way I know of." >&4
3028     exit 1
3029     ;;
3030 esac
3031 : set up the translation script tr, must be called with ./tr of course
3032 cat >tr <<EOSC
3033 $startsh
3034 case "\$1\$2" in
3035 '[A-Z][a-z]') exec $tr '$up' '$low';;
3036 '[a-z][A-Z]') exec $tr '$low' '$up';;
3037 esac
3038 exec $tr "\$@"
3039 EOSC
3040 chmod +x tr
3041 $eunicefix tr
3042
3043 : Try to determine whether config.sh was made on this system
3044 case "$config_sh" in
3045 '')
3046 myuname=`$uname -a 2>/dev/null`
3047 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3048 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3049 # because the A-Z/a-z are not consecutive.
3050 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3051         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3052 newmyuname="$myuname"
3053 dflt=n
3054 case "$knowitall" in
3055 '')
3056         if test -f ../config.sh; then
3057                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3058                         eval "`grep myuname= ../config.sh`"
3059                 fi
3060                 if test "X$myuname" = "X$newmyuname"; then
3061                         dflt=y
3062                 fi
3063         fi
3064         ;;
3065 *) dflt=y;;
3066 esac
3067
3068 : Get old answers from old config file if Configure was run on the
3069 : same system, otherwise use the hints.
3070 hint=default
3071 cd ..
3072 if test -f config.sh; then
3073         echo " "
3074         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3075         . UU/myread
3076         case "$ans" in
3077         n*|N*) echo "OK, I'll ignore it."
3078                 mv config.sh config.sh.old
3079                 myuname="$newmyuname"
3080                 ;;
3081         *)  echo "Fetching default answers from your old config.sh file..." >&4
3082                 tmp_n="$n"
3083                 tmp_c="$c"
3084                 tmp_sh="$sh"
3085                 . ./config.sh
3086                 cp config.sh UU
3087                 n="$tmp_n"
3088                 c="$tmp_c"
3089                 : Older versions did not always set $sh.  Catch re-use of such
3090                 : an old config.sh.
3091                 case "$sh" in
3092                 '') sh="$tmp_sh" ;;
3093                 esac
3094                 hint=previous
3095                 ;;
3096         esac
3097 fi
3098 . ./UU/checkcc
3099 if test ! -f config.sh; then
3100         $cat <<EOM
3101
3102 First time through, eh?  I have some defaults handy for some systems
3103 that need some extra help getting the Configure answers right:
3104
3105 EOM
3106         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3107         dflt=''
3108         : Half the following guesses are probably wrong... If you have better
3109         : tests or hints, please send them to perlbug@perl.org
3110         : The metaconfig authors would also appreciate a copy...
3111         $test -f /irix && osname=irix
3112         $test -f /xenix && osname=sco_xenix
3113         $test -f /dynix && osname=dynix
3114         $test -f /dnix && osname=dnix
3115         $test -f /lynx.os && osname=lynxos
3116         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3117         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3118         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3119         $test -f /bin/mips && /bin/mips && osname=mips
3120         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3121                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3122         $test -d /usr/apollo/bin && osname=apollo
3123         $test -f /etc/saf/_sactab && osname=svr4
3124         $test -d /usr/include/minix && osname=minix
3125         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3126         if $test -d /MachTen -o -d /MachTen_Folder; then
3127                 osname=machten
3128                 if $test -x /sbin/version; then
3129                         osvers=`/sbin/version | $awk '{print $2}' |
3130                         $sed -e 's/[A-Za-z]$//'`
3131                 elif $test -x /usr/etc/version; then
3132                         osvers=`/usr/etc/version | $awk '{print $2}' |
3133                         $sed -e 's/[A-Za-z]$//'`
3134                 else
3135                         osvers="$2.$3"
3136                 fi
3137         fi
3138
3139         $test -f /sys/posix.dll &&
3140                 $test -f /usr/bin/what &&
3141                 set X `/usr/bin/what /sys/posix.dll` &&
3142                 $test "$3" = UWIN &&
3143                 osname=uwin &&
3144                 osvers="$5"
3145
3146         if $test -f $uname; then
3147                 set X $myuname
3148                 shift
3149
3150                 case "$5" in
3151                 fps*) osname=fps ;;
3152                 mips*)
3153                         case "$4" in
3154                         umips) osname=umips ;;
3155                         *) osname=mips ;;
3156                         esac;;
3157                 [23]100) osname=mips ;;
3158                 next*) osname=next ;;
3159                 i386*)
3160                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3161                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3162                                 osname='sco'
3163                                 osvers=$tmp
3164                         elif $test -f /etc/kconfig; then
3165                                 osname=isc
3166                                 if test "$lns" = "$ln -s"; then
3167                                         osvers=4
3168                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3169                                         osvers=3
3170                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3171                                         osvers=2
3172                                 fi
3173                         fi
3174                         tmp=''
3175                         ;;
3176                 pc*)
3177                         if test -n "$DJGPP"; then
3178                                 osname=dos
3179                                 osvers=djgpp
3180                         fi
3181                         ;;
3182                 esac
3183
3184                 case "$1" in
3185                 aix) osname=aix
3186                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3187                         case "$tmp" in
3188                         # oslevel can fail with:
3189                         # oslevel: Unable to acquire lock.
3190                         *not\ found) osvers="$4"."$3" ;;
3191                         '<3240'|'<>3240') osvers=3.2.0 ;;
3192                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3193                         '=3250'|'>3250') osvers=3.2.5 ;;
3194                         *) osvers=$tmp;;
3195                         esac
3196                         ;;
3197                 bsd386) osname=bsd386
3198                         osvers=`$uname -r`
3199                         ;;
3200                 cygwin*) osname=cygwin
3201                         osvers="$3"
3202                         ;;
3203                 *dc.osx) osname=dcosx
3204                         osvers="$3"
3205                         ;;
3206                 dnix) osname=dnix
3207                         osvers="$3"
3208                         ;;
3209                 domainos) osname=apollo
3210                         osvers="$3"
3211                         ;;
3212                 dgux)   osname=dgux
3213                         osvers="$3"
3214                         ;;
3215                 dragonfly) osname=dragonfly
3216                         osvers="$3"
3217                         ;;
3218                 dynixptx*) osname=dynixptx
3219                         osvers=`echo "$4"|sed 's/^v//'`
3220                         ;;
3221                 freebsd) osname=freebsd
3222                         osvers="$3" ;;
3223                 genix)  osname=genix ;;
3224                 gnu)    osname=gnu
3225                         osvers="$3" ;;
3226                 hp*)    osname=hpux
3227                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3228                         ;;
3229                 irix*)  osname=irix
3230                         case "$3" in
3231                         4*) osvers=4 ;;
3232                         5*) osvers=5 ;;
3233                         *)      osvers="$3" ;;
3234                         esac
3235                         ;;
3236                 linux)  osname=linux
3237                         case "$3" in
3238                         *)      osvers="$3" ;;
3239                         esac
3240                         ;;
3241                 MiNT)   osname=mint
3242                         ;;
3243                 netbsd*) osname=netbsd
3244                         osvers="$3"
3245                         ;;
3246                 news-os) osvers="$3"
3247                         case "$3" in
3248                         4*) osname=newsos4 ;;
3249                         *) osname=newsos ;;
3250                         esac
3251                         ;;
3252                 next*) osname=next ;;
3253                 nonstop-ux) osname=nonstopux ;;
3254                 openbsd) osname=openbsd
3255                         osvers="$3"
3256                         ;;
3257                 os2)    osname=os2
3258                         osvers="$4"
3259                         ;;
3260                 POSIX-BC | posix-bc ) osname=posix-bc
3261                         osvers="$3"
3262                         ;;
3263                 powerux | power_ux | powermax_os | powermaxos | \
3264                 powerunix | power_unix) osname=powerux
3265                         osvers="$3"
3266                         ;;
3267                 qnx) osname=qnx
3268                         osvers="$4"
3269                         ;;
3270                 solaris) osname=solaris
3271                         case "$3" in
3272                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 sunos) osname=sunos
3277                         case "$3" in
3278                         5*) osname=solaris
3279                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3280                         *)      osvers="$3" ;;
3281                         esac
3282                         ;;
3283                 titanos) osname=titanos
3284                         case "$3" in
3285                         1*) osvers=1 ;;
3286                         2*) osvers=2 ;;
3287                         3*) osvers=3 ;;
3288                         4*) osvers=4 ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 ultrix) osname=ultrix
3293                         osvers="$3"
3294                         ;;
3295                 osf1|mls+)      case "$5" in
3296                                 alpha)
3297                                         osname=dec_osf
3298                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3299                                         case "$osvers" in
3300                                         [1-9].[0-9]*) ;;
3301                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3302                                         esac
3303                                         ;;
3304                         hp*)    osname=hp_osf1  ;;
3305                         mips)   osname=mips_osf1 ;;
3306                         esac
3307                         ;;
3308                 # UnixWare 7.1.2 is known as Open UNIX 8
3309                 openunix|unixware) osname=svr5
3310                         osvers="$4"
3311                         ;;
3312                 uts)    osname=uts
3313                         osvers="$3"
3314                         ;;
3315                 vos) osvers="$3"
3316                         ;;
3317                 $2) case "$osname" in
3318                         *isc*) ;;
3319                         *freebsd*) ;;
3320                         svr*)
3321                                 : svr4.x or possibly later
3322                                 case "svr$3" in
3323                                 ${osname}*)
3324                                         osname=svr$3
3325                                         osvers=$4
3326                                         ;;
3327                                 esac
3328                                 case "$osname" in
3329                                 svr4.0)
3330                                         : Check for ESIX
3331                                         if test -f /stand/boot ; then
3332                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3333                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3334                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3335                                                         if test -n "$isesix"; then
3336                                                                 osname=esix4
3337                                                         fi
3338                                                 fi
3339                                         fi
3340                                         ;;
3341                                 esac
3342                                 ;;
3343                         *)      if test -f /etc/systemid; then
3344                                         osname=sco
3345                                         set `echo $3 | $sed 's/\./ /g'` $4
3346                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3347                                                 osvers=$1.$2.$3
3348                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3349                                                 osvers=$1.$2
3350                                         elif $test -f $src/hints/sco_$1.sh; then
3351                                                 osvers=$1
3352                                         fi
3353                                 else
3354                                         case "$osname" in
3355                                         '') : Still unknown.  Probably a generic Sys V.
3356                                                 osname="sysv"
3357                                                 osvers="$3"
3358                                                 ;;
3359                                         esac
3360                                 fi
3361                                 ;;
3362                         esac
3363                         ;;
3364                 *)      case "$osname" in
3365                         '') : Still unknown.  Probably a generic BSD.
3366                                 osname="$1"
3367                                 osvers="$3"
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372         else
3373                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3374                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3375                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3376                                 osname=news_os
3377                         fi
3378                         $rm -f UU/kernel.what
3379                 elif test -d c:/. -o -n "$is_os2" ; then
3380                         set X $myuname
3381                         osname=os2
3382                         osvers="$5"
3383                 fi
3384         fi
3385
3386         case "$targetarch" in
3387         '') ;;
3388         *)  hostarch=$osname
3389             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3390             osvers=''
3391             ;;
3392         esac
3393
3394         : Now look for a hint file osname_osvers, unless one has been
3395         : specified already.
3396         case "$hintfile" in
3397         ''|' ')
3398                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3399                 : Also try without trailing minor version numbers.
3400                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3401                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3402                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3403                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3404                 case "$file" in
3405                 '') dflt=none ;;
3406                 *)  case "$osvers" in
3407                         '') dflt=$file
3408                                 ;;
3409                         *)  if $test -f $src/hints/$file.sh ; then
3410                                         dflt=$file
3411                                 elif $test -f $src/hints/$xfile.sh ; then
3412                                         dflt=$xfile
3413                                 elif $test -f $src/hints/$xxfile.sh ; then
3414                                         dflt=$xxfile
3415                                 elif $test -f $src/hints/$xxxfile.sh ; then
3416                                         dflt=$xxxfile
3417                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3418                                         dflt=$xxxxfile
3419                                 elif $test -f "$src/hints/${osname}.sh" ; then
3420                                         dflt="${osname}"
3421                                 else
3422                                         dflt=none
3423                                 fi
3424                                 ;;
3425                         esac
3426                         ;;
3427                 esac
3428                 if $test -f Policy.sh ; then
3429                         case "$dflt" in
3430                         *Policy*) ;;
3431                         none) dflt="Policy" ;;
3432                         *) dflt="Policy $dflt" ;;
3433                         esac
3434                 fi
3435                 ;;
3436         *)
3437                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3438                 ;;
3439         esac
3440
3441         if $test -f Policy.sh ; then
3442                 $cat <<EOM
3443
3444 There's also a Policy hint file available, which should make the
3445 site-specific (policy) questions easier to answer.
3446 EOM
3447
3448         fi
3449
3450         $cat <<EOM
3451
3452 You may give one or more space-separated answers, or "none" if appropriate.
3453 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3454 previous run of Configure, you may specify it as well as or instead of
3455 OS-specific hints.  If hints are provided for your OS, you should use them:
3456 although Perl can probably be built without hints on many platforms, using
3457 hints often improve performance and may enable features that Configure can't
3458 set up on its own. If there are no hints that match your OS, specify "none";
3459 DO NOT give a wrong version or a wrong OS.
3460
3461 EOM
3462
3463         rp="Which of these apply, if any?"
3464         . UU/myread
3465         tans=$ans
3466         for file in $tans; do
3467                 if $test X$file = XPolicy -a -f Policy.sh; then
3468                         . Policy.sh
3469                         $cat Policy.sh >> UU/config.sh
3470                 elif $test -f $src/hints/$file.sh; then
3471                         . $src/hints/$file.sh
3472                         $cat $src/hints/$file.sh >> UU/config.sh
3473                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3474                         : nothing
3475                 else
3476                         : Give one chance to correct a possible typo.
3477                         echo "$file.sh does not exist"
3478                         dflt=$file
3479                         rp="hint to use instead?"
3480                         . UU/myread
3481                         for file in $ans; do
3482                                 if $test -f "$src/hints/$file.sh"; then
3483                                         . $src/hints/$file.sh
3484                                         $cat $src/hints/$file.sh >> UU/config.sh
3485                                 elif $test X$ans = X -o X$ans = Xnone ; then
3486                                         : nothing
3487                                 else
3488                                         echo "$file.sh does not exist -- ignored."
3489                                 fi
3490                         done
3491                 fi
3492         done
3493
3494         hint=recommended
3495         : Remember our hint file for later.
3496         if $test -f "$src/hints/$file.sh" ; then
3497                 hintfile="$file"
3498         else
3499                 hintfile=''
3500         fi
3501 fi
3502 cd UU
3503 ;;
3504 *)
3505         echo " "
3506         echo "Fetching default answers from $config_sh..." >&4
3507         tmp_n="$n"
3508         tmp_c="$c"
3509         cd ..
3510         cp $config_sh config.sh 2>/dev/null
3511         chmod +w config.sh
3512         . ./config.sh
3513         cd UU
3514         cp ../config.sh .
3515         n="$tmp_n"
3516         c="$tmp_c"
3517         hint=previous
3518         ;;
3519 esac
3520 test "$override" && . ./optdef.sh
3521
3522 : Restore computed paths
3523 for file in $loclist $trylist; do
3524         eval $file="\$_$file"
3525 done
3526
3527 cat << EOM
3528
3529 Configure uses the operating system name and version to set some defaults.
3530 The default value is probably right if the name rings a bell. Otherwise,
3531 since spelling matters for me, either accept the default or answer "none"
3532 to leave it blank.
3533
3534 EOM
3535 case "$osname" in
3536         ''|' ')
3537                 case "$hintfile" in
3538                 ''|' '|none) dflt=none ;;
3539                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3540                 esac
3541                 ;;
3542         *) dflt="$osname" ;;
3543 esac
3544 rp="Operating system name?"
3545 . ./myread
3546 case "$ans" in
3547 none)  osname='' ;;
3548 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3549 esac
3550 echo " "
3551 case "$osvers" in
3552         ''|' ')
3553                 case "$hintfile" in
3554                 ''|' '|none) dflt=none ;;
3555                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3556                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3557                         case "$dflt" in
3558                         ''|' ') dflt=none ;;
3559                         esac
3560                         ;;
3561                 esac
3562                 ;;
3563         *) dflt="$osvers" ;;
3564 esac
3565 rp="Operating system version?"
3566 . ./myread
3567 case "$ans" in
3568 none)  osvers='' ;;
3569 *) osvers="$ans" ;;
3570 esac
3571
3572
3573 . ./posthint.sh
3574
3575 : who configured the system
3576 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3577 case "$cf_by" in
3578 "")
3579         cf_by=`(logname) 2>/dev/null`
3580         case "$cf_by" in
3581         "")
3582                 cf_by=`(whoami) 2>/dev/null`
3583                 case "$cf_by" in
3584                 "") cf_by=unknown ;;
3585                 esac ;;
3586         esac ;;
3587 esac
3588
3589 : decide how portable to be.  Allow command line overrides.
3590 case "$d_portable" in
3591 "$undef") ;;
3592 *)      d_portable="$define" ;;
3593 esac
3594
3595 : set up shell script to do ~ expansion
3596 cat >filexp <<EOSS
3597 $startsh
3598 : expand filename
3599 case "\$1" in
3600  \~/*|\~)
3601         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3602         ;;
3603  \~*)
3604         if $test -f /bin/csh; then
3605                 /bin/csh -f -c "glob \$1"
3606                 failed=\$?
3607                 echo ""
3608                 exit \$failed
3609         else
3610                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3611                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3612                 if $test ! -d "\$dir"; then
3613                         me=\`basename \$0\`
3614                         echo "\$me: can't locate home directory for: \$name" >&2
3615                         exit 1
3616                 fi
3617                 case "\$1" in
3618                 */*)
3619                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3620                         ;;
3621                 *)
3622                         echo \$dir
3623                         ;;
3624                 esac
3625         fi
3626         ;;
3627 *)
3628         echo \$1
3629         ;;
3630 esac
3631 EOSS
3632 chmod +x filexp
3633 $eunicefix filexp
3634
3635 : now set up to get a file name
3636 cat <<EOS >getfile
3637 $startsh
3638 EOS
3639 cat <<'EOSC' >>getfile
3640 tilde=''
3641 fullpath=''
3642 already=''
3643 skip=''
3644 none_ok=''
3645 exp_file=''
3646 nopath_ok=''
3647 orig_rp="$rp"
3648 orig_dflt="$dflt"
3649 case "$gfpth" in
3650 '') gfpth='.' ;;
3651 esac
3652
3653 case "$fn" in
3654 *\(*)
3655         : getfile will accept an answer from the comma-separated list
3656         : enclosed in parentheses even if it does not meet other criteria.
3657         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3658         fn=`echo $fn | sed 's/(.*)//'`
3659         ;;
3660 esac
3661
3662 case "$fn" in
3663 *:*)
3664         loc_file=`expr $fn : '.*:\(.*\)'`
3665         fn=`expr $fn : '\(.*\):.*'`
3666         ;;
3667 esac
3668
3669 case "$fn" in
3670 *~*) tilde=true;;
3671 esac
3672 case "$fn" in
3673 */*) fullpath=true;;
3674 esac
3675 case "$fn" in
3676 *+*) skip=true;;
3677 esac
3678 case "$fn" in
3679 *n*) none_ok=true;;
3680 esac
3681 case "$fn" in
3682 *e*) exp_file=true;;
3683 esac
3684 case "$fn" in
3685 *p*) nopath_ok=true;;
3686 esac
3687
3688 case "$fn" in
3689 *f*) type='File';;
3690 *d*) type='Directory';;
3691 *l*) type='Locate';;
3692 esac
3693
3694 what="$type"
3695 case "$what" in
3696 Locate) what='File';;
3697 esac
3698
3699 case "$exp_file" in
3700 '')
3701         case "$d_portable" in
3702         "$define") ;;
3703         *) exp_file=true;;
3704         esac
3705         ;;
3706 esac
3707
3708 cd ..
3709 while test "$type"; do
3710         redo=''
3711         rp="$orig_rp"
3712         dflt="$orig_dflt"
3713         case "$tilde" in
3714         true) rp="$rp (~name ok)";;
3715         esac
3716         . UU/myread
3717         if test -f UU/getfile.ok && \
3718                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3719         then
3720                 value="$ans"
3721                 ansexp="$ans"
3722                 break
3723         fi
3724         case "$ans" in
3725         none)
3726                 value=''
3727                 ansexp=''
3728                 case "$none_ok" in
3729                 true) type='';;
3730                 esac
3731                 ;;
3732         *)
3733                 case "$tilde" in
3734                 '') value="$ans"
3735                         ansexp="$ans";;
3736                 *)
3737                         value=`UU/filexp $ans`
3738                         case $? in
3739                         0)
3740                                 if test "$ans" != "$value"; then
3741                                         echo "(That expands to $value on this system.)"
3742                                 fi
3743                                 ;;
3744                         *) value="$ans";;
3745                         esac
3746                         ansexp="$value"
3747                         case "$exp_file" in
3748                         '') value="$ans";;
3749                         esac
3750                         ;;
3751                 esac
3752                 case "$fullpath" in
3753                 true)
3754                         case "$ansexp" in
3755                         /*) value="$ansexp" ;;
3756                         [a-zA-Z]:/*) value="$ansexp" ;;
3757                         *)
3758                                 redo=true
3759                                 case "$already" in
3760                                 true)
3761                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3762                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3763                                         ;;
3764                                 *)
3765                                 echo "Please give a full path name, starting with slash." >&4
3766                                         case "$tilde" in
3767                                         true)
3768                                 echo "Note that using ~name is ok provided it expands well." >&4
3769                                                 already=true
3770                                                 ;;
3771                                         esac
3772                                 esac
3773                                 ;;
3774                         esac
3775                         ;;
3776                 esac
3777                 case "$redo" in
3778                 '')
3779                         case "$type" in
3780                         File)
3781                                 for fp in $gfpth; do
3782                                         if test "X$fp" = X.; then
3783                                             pf="$ansexp"
3784                                         else    
3785                                             pf="$fp/$ansexp"
3786                                         fi
3787                                         if test -f "$pf"; then
3788                                                 type=''
3789                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3790                                         then
3791                                                 echo "($value is not a plain file, but that's ok.)"
3792                                                 type=''
3793                                         fi
3794                                         if test X"$type" = X; then
3795                                             value="$pf"
3796                                             break
3797                                         fi
3798                                 done
3799                                 ;;
3800                         Directory)
3801                                 for fp in $gfpth; do
3802                                         if test "X$fp" = X.; then
3803                                             dir="$ans"
3804                                             direxp="$ansexp"
3805                                         else    
3806                                             dir="$fp/$ansexp"
3807                                             direxp="$fp/$ansexp"
3808                                         fi
3809                                         if test -d "$direxp"; then
3810                                                 type=''
3811                                                 value="$dir"
3812                                                 break
3813                                         fi
3814                                 done
3815                                 ;;
3816                         Locate)
3817                                 if test -d "$ansexp"; then
3818                                         echo "(Looking for $loc_file in directory $value.)"
3819                                         value="$value/$loc_file"
3820                                         ansexp="$ansexp/$loc_file"
3821                                 fi
3822                                 if test -f "$ansexp"; then
3823                                         type=''
3824                                 fi
3825                                 case "$nopath_ok" in
3826                                 true)   case "$value" in
3827                                         */*) ;;
3828                                         *)      echo "Assuming $value will be in people's path."
3829                                                 type=''
3830                                                 ;;
3831                                         esac
3832                                         ;;
3833                                 esac
3834                                 ;;
3835                         esac
3836
3837                         case "$skip" in
3838                         true) type='';
3839                         esac
3840
3841                         case "$type" in
3842                         '') ;;
3843                         *)
3844                                 if test "$fastread" = yes; then
3845                                         dflt=y
3846                                 else
3847                                         dflt=n
3848                                 fi
3849                                 rp="$what $value doesn't exist.  Use that name anyway?"
3850                                 . UU/myread
3851                                 dflt=''
3852                                 case "$ans" in
3853                                 y*) type='';;
3854                                 *) echo " ";;
3855                                 esac
3856                                 ;;
3857                         esac
3858                         ;;
3859                 esac
3860                 ;;
3861         esac
3862 done
3863 cd UU
3864 ans="$value"
3865 rp="$orig_rp"
3866 dflt="$orig_dflt"
3867 rm -f getfile.ok
3868 test "X$gfpthkeep" != Xy && gfpth=""
3869 EOSC
3870
3871 : determine root of directory hierarchy where package will be installed.
3872 case "$prefix" in
3873 '')
3874         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3875         ;;
3876 *?/)
3877         dflt=`echo "$prefix" | sed 's/.$//'`
3878         ;;
3879 *)
3880         dflt="$prefix"
3881         ;;
3882 esac
3883 $cat <<EOM
3884
3885 By default, $package will be installed in $dflt/bin, manual pages
3886 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3887 installation directories. Typically this is something like /usr/local.
3888 If you wish to have binaries under /usr/bin but other parts of the
3889 installation under /usr/local, that's ok: you will be prompted
3890 separately for each of the installation directories, the prefix being
3891 only used to set the defaults.
3892
3893 EOM
3894 fn=d~
3895 rp='Installation prefix to use?'
3896 . ./getfile
3897 oldprefix=''
3898 case "$prefix" in
3899 '') ;;
3900 *)
3901         case "$ans" in
3902         "$prefix") ;;
3903         *) oldprefix="$prefix";;
3904         esac
3905         ;;
3906 esac
3907 prefix="$ans"
3908 prefixexp="$ansexp"
3909
3910 : allow them to override the AFS root
3911 case "$afsroot" in
3912 '')     afsroot=/afs ;;
3913 *)      afsroot=$afsroot ;;
3914 esac
3915
3916 : is AFS running?
3917 echo " "
3918 case "$afs" in
3919 $define|true)   afs=true ;;
3920 $undef|false)   afs=false ;;
3921 *)      if $test -d $afsroot; then
3922                 afs=true
3923         else
3924                 afs=false
3925         fi
3926         ;;
3927 esac
3928 if $afs; then
3929         echo "AFS may be running... I'll be extra cautious then..." >&4
3930 else
3931         echo "AFS does not seem to be running..." >&4
3932 fi
3933
3934 : determine installation prefix for where package is to be installed.
3935 if $afs; then 
3936 $cat <<EOM
3937
3938 Since you are running AFS, I need to distinguish the directory in which
3939 files will reside from the directory in which they are installed (and from
3940 which they are presumably copied to the former directory by occult means).
3941
3942 EOM
3943         case "$installprefix" in
3944         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3945         *) dflt="$installprefix";;
3946         esac
3947 else
3948 $cat <<EOM
3949
3950 In some special cases, particularly when building $package for distribution,
3951 it is convenient to distinguish the directory in which files should be
3952 installed from the directory ($prefix) in which they will
3953 eventually reside.  For most users, these two directories are the same.
3954
3955 EOM
3956         case "$installprefix" in
3957         '') dflt=$prefix ;;
3958         *) dflt=$installprefix;;
3959         esac
3960 fi
3961 fn=d~
3962 rp='What installation prefix should I use for installing files?'
3963 . ./getfile
3964 installprefix="$ans"
3965 installprefixexp="$ansexp"
3966
3967 : Perform the prefixexp/installprefixexp correction if necessary
3968 cat <<EOS >installprefix
3969 $startsh
3970 EOS
3971 cat <<'EOSC' >>installprefix
3972 : Change installation prefix, if necessary.
3973 if $test X"$prefix" != X"$installprefix"; then
3974     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3975 else
3976     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3977 fi
3978 EOSC
3979 chmod +x installprefix
3980 $eunicefix installprefix
3981
3982 : Set variables such as privlib and privlibexp from the output of ./getfile
3983 : performing the prefixexp/installprefixexp correction if necessary.
3984 cat <<EOS >setprefixvar
3985 $startsh
3986 EOS
3987 cat <<'EOSC' >>setprefixvar
3988 eval "${prefixvar}=\"\$ans\""
3989 eval "${prefixvar}exp=\"\$ansexp\""
3990 . ./installprefix
3991 EOSC
3992 chmod +x setprefixvar
3993 $eunicefix setprefixvar
3994
3995 : set up the script used to warn in case of inconsistency
3996 cat <<EOS >whoa
3997 $startsh
3998 EOS
3999 cat <<'EOSC' >>whoa
4000 dflt=y
4001 case "$hint" in
4002     recommended)
4003         case "$hintfile" in
4004         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4005                 ;;
4006         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4007                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4008                 ;;
4009         esac
4010         ;;
4011     *)  echo " "
4012         echo "*** WHOA THERE!!! ***" >&4
4013         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4014         ;;
4015 esac
4016 rp="    Keep the $hint value?"
4017 . ./myread
4018 case "$ans" in
4019 y) td=$was; tu=$was;;
4020 esac
4021 EOSC
4022
4023 : function used to set '$1' to '$val'
4024 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4025 case "$val$was" in
4026 $define$undef) . ./whoa; eval "$var=\$td";;
4027 $undef$define) . ./whoa; eval "$var=\$tu";;
4028 *) eval "$var=$val";;
4029 esac'
4030
4031 : Check is we will use socks
4032 case "$usesocks" in
4033 $define|true|[yY]*)     dflt='y';;
4034 *) dflt='n';;
4035 esac
4036 cat <<EOM
4037
4038 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4039 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4040 to use the PerlIO abstraction layer, this will be implicitly selected.
4041
4042 If this doesn't make any sense to you, just accept the default '$dflt'.
4043 EOM
4044 rp='Build Perl for SOCKS?'
4045 . ./myread
4046 case "$ans" in
4047 y|Y)    val="$define" ;;
4048 *)      val="$undef" ;;
4049 esac
4050 set usesocks
4051 eval $setvar
4052
4053 case "$usesocks" in
4054 $define|true|[yY]*) useperlio="$define";;
4055 esac
4056
4057 : Check if we want perlio
4058 case "$useperlio" in
4059 $define|true|[yY]*|'')  dflt='y';;
4060 *) dflt='n';;
4061 esac
4062 cat <<EOM
4063
4064 Previous version of $package used the standard IO mechanisms as
4065 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4066 alternate IO mechanisms via the PerlIO abstraction layer, but the
4067 stdio mechanism is still available if needed.  The abstraction layer
4068 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4069 Using PerlIO with sfio may cause problems with some extension modules.
4070
4071 If this doesn't make any sense to you, just accept the default '$dflt'.
4072 EOM
4073 rp='Use the PerlIO abstraction layer?'
4074 . ./myread
4075 case "$ans" in
4076 y|Y)
4077         val="$define"
4078         ;;
4079 *)
4080         echo "Ok, doing things the stdio way."
4081         val="$undef"
4082         ;;
4083 esac
4084 set useperlio
4085 eval $setvar
4086
4087 case "$usesocks" in
4088 $define|true|[yY]*)
4089         case "$useperlio" in
4090         $define|true|[yY]*) ;;
4091         *)      cat >&4 <<EOM
4092
4093 You are using the SOCKS proxy protocol library which means that you
4094 should also use the PerlIO layer.  You may be headed for trouble.
4095
4096 EOM
4097                 ;;
4098         esac
4099         ;;
4100 esac
4101
4102 : get the patchlevel
4103 echo " "
4104 echo "Getting the current patchlevel..." >&4
4105 if $test -r $rsrc/patchlevel.h;then
4106         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4107         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4108         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4109         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4110         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4111         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4112         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4113 else
4114         revision=0
4115         patchlevel=0
4116         subversion=0
4117         api_revision=0
4118         api_version=0
4119         api_subversion=0
4120         perl_patchlevel=0
4121         $echo "(You do not have patchlevel.h.  Eek.)"
4122 fi
4123 if $test -r $rsrc/.patch ; then
4124         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4125                 perl_patchlevel=`cat $rsrc/.patch`
4126         fi
4127 fi
4128 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4129 version_patchlevel_string="version $patchlevel subversion $subversion"
4130 case "$perl_patchlevel" in
4131 0|'') ;;
4132 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4133 esac
4134
4135 $echo "(You have $package $version_patchlevel_string.)"
4136
4137 case "$osname" in
4138 dos|vms)
4139         : XXX Should be a Configure test for double-dots in filenames.
4140         version=`echo $revision $patchlevel $subversion | \
4141                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4142         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4143                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4144         ;;
4145 *)
4146         version=`echo $revision $patchlevel $subversion | \
4147                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4148         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4149                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4150         ;;
4151 esac
4152 : Special case the 5.005_xx maintenance series, which used 5.005
4153 : without any subversion label as a subdirectory in $sitelib
4154 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4155         api_versionstring='5.005'
4156 fi
4157
4158 : Do we want threads support and if so, what type
4159 case "$usethreads" in
4160 $define|true|[yY]*)     dflt='y';;
4161 *)     # Catch case where user specified ithreads or 5005threads but
4162        # forgot -Dusethreads (A.D. 4/2002)
4163        case "$useithreads$use5005threads" in
4164        *$define*)
4165                 case "$useperlio" in
4166                 "$define")      dflt='y' ;;
4167                 *)              dflt='n' ;;
4168                 esac
4169                 ;;
4170        *)       dflt='n';;
4171        esac
4172        ;;
4173 esac
4174 cat <<EOM
4175
4176 Perl can be built to take advantage of threads on some systems.
4177 To do so, Configure can be run with -Dusethreads.
4178
4179 Note that Perl built with threading support runs slightly slower
4180 and uses more memory than plain Perl. The current implementation
4181 is believed to be stable, but it is fairly new, and so should be
4182 treated with caution.
4183
4184 If this doesn't make any sense to you, just accept the default '$dflt'.
4185 EOM
4186 rp='Build a threading Perl?'
4187 . ./myread
4188 case "$ans" in
4189 y|Y)    val="$define" ;;
4190 *)      val="$undef" ;;
4191 esac
4192 set usethreads
4193 eval $setvar
4194
4195 if $test $patchlevel -lt 9; then
4196     case "$usethreads" in
4197     $define)
4198         $cat <<EOM
4199
4200 Since release 5.6, Perl has had two different threading implementations,
4201 the newer interpreter-based version (ithreads) with one interpreter per
4202 thread, and the older 5.005 version (5005threads).
4203 The 5005threads version is effectively unmaintained and will probably be
4204 removed in Perl 5.10, so there should be no need to build a Perl using it
4205 unless needed for backwards compatibility with some existing 5.005threads
4206 code.
4207
4208 EOM
4209         : Default to ithreads unless overridden on command line or with
4210         : old config.sh
4211         dflt='y'
4212         case "$use5005threads" in
4213                 $define|true|[yY]*) dflt='n';;
4214         esac
4215         case "$useithreads" in
4216                 $undef|false|[nN]*) dflt='n';;
4217         esac
4218         rp='Use the newer interpreter-based ithreads?'
4219         . ./myread
4220         case "$ans" in
4221         y|Y)    val="$define" ;;
4222         *)      val="$undef" ;;
4223         esac
4224         set useithreads
4225         eval $setvar
4226         : Now set use5005threads to the opposite value.
4227         case "$useithreads" in
4228         $define) val="$undef" ;;
4229         *) val="$define" ;;
4230         esac
4231         set use5005threads
4232         eval $setvar
4233         ;;
4234     *)
4235         useithreads="$undef"
4236         use5005threads="$undef"
4237         ;;
4238     esac
4239
4240     case "$useithreads$use5005threads" in
4241     "$define$define")
4242         $cat >&4 <<EOM
4243
4244 You cannot have both the ithreads and the 5.005 threads enabled
4245 at the same time.  Disabling the 5.005 threads since they are
4246 much less stable than the ithreads.
4247
4248 EOM
4249         use5005threads="$undef"
4250         ;;
4251     esac
4252
4253 else
4254 : perl-5.9.x and later
4255
4256     if test X"$usethreads" = "X$define"; then
4257         case "$use5005threads" in
4258             $define|true|[yY]*)
4259                 $cat >&4 <<EOM
4260
4261 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4262
4263 EOM
4264             ;;
4265         esac
4266     fi
4267
4268     use5005threads="$undef"
4269     useithreads="$usethreads"
4270 fi
4271
4272 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4273         cat >&4 <<EOF
4274 ***
4275 *** To build with ithreads you must also use the PerlIO layer.
4276 *** Cannot continue, aborting.
4277 ***
4278 EOF
4279         exit 1
4280 fi
4281
4282 case "$d_oldpthreads" in
4283 '')     : Configure tests would be welcome here.  For now, assume undef.
4284         val="$undef" ;;
4285 *)      val="$d_oldpthreads" ;;
4286 esac
4287 set d_oldpthreads
4288 eval $setvar
4289
4290
4291 : Look for a hint-file generated 'call-back-unit'.  If the
4292 : user has specified that a threading perl is to be built,
4293 : we may need to set or change some other defaults.
4294 if $test -f usethreads.cbu; then
4295     echo "Your platform has some specific hints regarding threaded builds, using them..."
4296     . ./usethreads.cbu
4297 else
4298     case "$usethreads" in
4299         "$define"|true|[yY]*)
4300                 $cat <<EOM
4301 (Your platform does not have any specific hints for threaded builds.
4302  Assuming POSIX threads, then.)
4303 EOM
4304         ;;
4305     esac
4306 fi
4307
4308 : Check if multiplicity is required
4309 cat <<EOM
4310
4311 Perl can be built so that multiple Perl interpreters can coexist
4312 within the same Perl executable.
4313 EOM
4314
4315 case "$useithreads" in
4316 $define)
4317         cat <<EOM
4318 This multiple interpreter support is required for interpreter-based threads.
4319 EOM
4320         val="$define"
4321         ;;
4322 *)      case "$usemultiplicity" in
4323         $define|true|[yY]*)     dflt='y';;
4324         *) dflt='n';;
4325         esac
4326         echo " "
4327         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4328         rp='Build Perl for multiplicity?'
4329         . ./myread
4330         case "$ans" in
4331         y|Y)    val="$define" ;;
4332         *)      val="$undef" ;;
4333         esac
4334         ;;
4335 esac
4336 set usemultiplicity
4337 eval $setvar
4338
4339 : Check if morebits is requested
4340 case "$usemorebits" in
4341 "$define"|true|[yY]*)
4342         use64bitint="$define"
4343         uselongdouble="$define"
4344         usemorebits="$define"
4345         ;;
4346 *)      usemorebits="$undef"
4347         ;;
4348 esac
4349
4350 : Determine the C compiler to be used
4351 echo " "
4352 case "$cc" in
4353 '') dflt=cc;;
4354 *) dflt="$cc";;
4355 esac
4356 rp="Use which C compiler?"
4357 . ./myread
4358 cc="$ans"
4359
4360 : See whether they have no cc but they do have gcc
4361 . ./trygcc
4362 if $test -f cc.cbu; then
4363     . ./cc.cbu
4364 fi
4365 . ./checkcc
4366
4367 : make some quick guesses about what we are up against
4368 echo " "
4369 $echo $n "Hmm...  $c"
4370 echo exit 1 >bsd
4371 echo exit 1 >usg
4372 echo exit 1 >v7
4373 echo exit 1 >osf1
4374 echo exit 1 >eunice
4375 echo exit 1 >xenix
4376 echo exit 1 >venix
4377 echo exit 1 >os2
4378 d_bsd="$undef"
4379 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4380 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4381 then
4382         echo "Looks kind of like an OSF/1 system, but we'll see..."
4383         echo exit 0 >osf1
4384 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4385         xxx=`./loc addbib blurfl $pth`
4386         if $test -f $xxx; then
4387         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4388                 echo exit 0 >bsd
4389                 echo exit 0 >usg
4390         else
4391                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4392                         echo "Looks kind of like an extended USG system, but we'll see..."
4393                 else
4394                         echo "Looks kind of like a USG system, but we'll see..."
4395                 fi
4396                 echo exit 0 >usg
4397         fi
4398 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4399         echo "Looks kind of like a BSD system, but we'll see..."
4400         d_bsd="$define"
4401         echo exit 0 >bsd
4402 else
4403         echo "Looks kind of like a Version 7 system, but we'll see..."
4404         echo exit 0 >v7
4405 fi
4406 case "$eunicefix" in
4407 *unixtovms*)
4408         $cat <<'EOI'
4409 There is, however, a strange, musty smell in the air that reminds me of
4410 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4411 EOI
4412         echo exit 0 >eunice
4413         d_eunice="$define"
4414 : it so happens the Eunice I know will not run shell scripts in Unix format
4415         ;;
4416 *)
4417         echo " "
4418         echo "Congratulations.  You aren't running Eunice."
4419         d_eunice="$undef"
4420         ;;
4421 esac
4422 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4423 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4424 : semicolon as a patch separator
4425 case "$p_" in
4426 :) ;;
4427 *)
4428         $cat <<'EOI'
4429 I have the feeling something is not exactly right, however...don't tell me...
4430 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4431 (Or you may be running DOS with DJGPP.)
4432 EOI
4433         echo exit 0 >os2
4434         ;;
4435 esac
4436 if test -f /xenix; then
4437         echo "Actually, this looks more like a XENIX system..."
4438         echo exit 0 >xenix
4439         d_xenix="$define"
4440 else
4441         echo " "
4442         echo "It's not Xenix..."
4443         d_xenix="$undef"
4444 fi
4445 chmod +x xenix
4446 $eunicefix xenix
4447 if test -f /venix; then
4448         echo "Actually, this looks more like a VENIX system..."
4449         echo exit 0 >venix
4450 else
4451         echo " "
4452         if ./xenix; then
4453                 : null
4454         else
4455                 echo "Nor is it Venix..."
4456         fi
4457 fi
4458 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4459 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4460 $rm -f foo
4461
4462 : Check if we are using GNU gcc and what its version is
4463 echo " "
4464 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4465 $cat >try.c <<EOM
4466 #include <stdio.h>
4467 int main() {
4468 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4469 #ifdef __VERSION__
4470         printf("%s\n", __VERSION__);
4471 #else
4472         printf("%s\n", "1");
4473 #endif
4474 #endif
4475         return(0);
4476 }
4477 EOM
4478 if $cc -o try $ccflags $ldflags try.c; then
4479         gccversion=`$run ./try`
4480         case "$gccversion" in
4481         '') echo "You are not using GNU cc." ;;
4482         *)  echo "You are using GNU cc $gccversion."
4483             ccname=gcc
4484             ;;
4485         esac
4486 else
4487         echo " "
4488         echo "*** WHOA THERE!!! ***" >&4
4489         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4490         case "$knowitall" in
4491         '')
4492         echo "    You'd better start hunting for one and let me know about it." >&4
4493                 exit 1
4494                 ;;
4495         esac
4496 fi
4497 $rm -f try try.*
4498 case "$gccversion" in
4499 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4500 esac
4501 case "$gccversion" in
4502 '') gccosandvers='' ;;
4503 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4504    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4505    gccshortvers=''
4506    case "$gccosandvers" in
4507    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4508    $osname$osvers) ;; # looking good
4509    $osname*) cat <<EOM >&4
4510
4511 *** WHOA THERE!!! ***
4512
4513     Your gcc has not been compiled for the exact release of
4514     your operating system ($gccosandvers versus $osname$osvers).
4515
4516     In general it is a good idea to keep gcc synchronized with
4517     the operating system because otherwise serious problems
4518     may ensue when trying to compile software, like Perl.
4519
4520     I'm trying to be optimistic here, though, and will continue.
4521     If later during the configuration and build icky compilation
4522     problems appear (headerfile conflicts being the most common
4523     manifestation), I suggest reinstalling the gcc to match
4524     your operating system release.
4525
4526 EOM
4527       ;;
4528    *) gccosandvers='' ;; # failed to parse, better be silent
4529    esac
4530    ;;
4531 esac
4532 case "$ccname" in
4533 '') ccname="$cc" ;;
4534 esac
4535
4536 # gcc 3.* complain about adding -Idirectories that they already know about,
4537 # so we will take those off from locincpth.
4538 case "$gccversion" in
4539 3*)
4540     echo "main(){}">try.c
4541     for incdir in $locincpth; do
4542        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4543              grep '^c[cp]p*[01]: warning: changing search order '`
4544        if test "X$warn" != X; then
4545            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4546        fi
4547     done
4548     $rm -f try try.*
4549 esac
4550
4551 : What should the include directory be ?
4552 echo " "
4553 $echo $n "Hmm...  $c"
4554 dflt='/usr/include'
4555 incpath=''
4556 mips_type=''
4557 if $test -f /bin/mips && /bin/mips; then
4558         echo "Looks like a MIPS system..."
4559         $cat >usr.c <<'EOCP'
4560 #ifdef SYSTYPE_BSD43
4561 /bsd43
4562 #endif
4563 EOCP
4564         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4565                 dflt='/bsd43/usr/include'
4566                 incpath='/bsd43'
4567                 mips_type='BSD 4.3'
4568         else
4569                 mips_type='System V'
4570         fi
4571         $rm -f usr.c usr.out
4572         echo "and you're compiling with the $mips_type compiler and libraries."
4573         xxx_prompt=y
4574         echo "exit 0" >mips
4575 else
4576         echo "Doesn't look like a MIPS system."
4577         xxx_prompt=n
4578         echo "exit 1" >mips
4579 fi
4580 chmod +x mips
4581 $eunicefix mips
4582 case "$usrinc" in
4583 '') ;;
4584 *) dflt="$usrinc";;
4585 esac
4586 case "$xxx_prompt" in
4587 y)      fn=d/
4588         echo " "
4589         rp='Where are the include files you want to use?'
4590         . ./getfile
4591         usrinc="$ans"
4592         ;;
4593 *)      usrinc="$dflt"
4594         ;;
4595 esac
4596
4597 : see how we invoke the C preprocessor
4598 echo " "
4599 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4600 cat <<'EOT' >testcpp.c
4601 #define ABC abc
4602 #define XYZ xyz
4603 ABC.XYZ
4604 EOT
4605 cd ..
4606 if test ! -f cppstdin; then
4607         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4608                 # AIX cc -E doesn't show the absolute headerfile
4609                 # locations but we'll cheat by using the -M flag.
4610                 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
4611         else
4612                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4613         fi
4614 else
4615         echo "Keeping your $hint cppstdin wrapper."
4616 fi
4617 chmod 755 cppstdin
4618 wrapper=`pwd`/cppstdin
4619 ok='false'
4620 cd UU
4621
4622 if $test "X$cppstdin" != "X" && \
4623         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4625 then
4626         echo "You used to use $cppstdin $cppminus so we'll use that again."
4627         case "$cpprun" in
4628         '') echo "But let's see if we can live without a wrapper..." ;;
4629         *)
4630                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4631                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4632                 then
4633                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4634                         ok='true'
4635                 else
4636                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4637                 fi
4638                 ;;
4639         esac
4640 else
4641         case "$cppstdin" in
4642         '') ;;
4643         *)
4644                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4645                 ;;
4646         esac
4647 fi
4648
4649 if $ok; then
4650         : nothing
4651 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4652         $cc -E <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         echo "Yup, it does."
4655         x_cpp="$cc -E"
4656         x_minus='';
4657 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4658         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Yup, it does."
4661         x_cpp="$cc -E"
4662         x_minus='-';
4663 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4664         $cc -P <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         echo "Yipee, that works!"
4667         x_cpp="$cc -P"
4668         x_minus='';
4669 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4670         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4671         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672         echo "At long last!"
4673         x_cpp="$cc -P"
4674         x_minus='-';
4675 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4676         $cpp <testcpp.c >testcpp.out 2>&1; \
4677         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678         echo "It works!"
4679         x_cpp="$cpp"
4680         x_minus='';
4681 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4682         $cpp - <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         echo "Hooray, it works!  I was beginning to wonder."
4685         x_cpp="$cpp"
4686         x_minus='-';
4687 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4688         $wrapper <testcpp.c >testcpp.out 2>&1; \
4689         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690         x_cpp="$wrapper"
4691         x_minus=''
4692         echo "Eureka!"
4693 else
4694         dflt=''
4695         rp="No dice.  I can't find a C preprocessor.  Name one:"
4696         . ./myread
4697         x_cpp="$ans"
4698         x_minus=''
4699         $x_cpp <testcpp.c >testcpp.out 2>&1
4700         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701                 echo "OK, that will do." >&4
4702         else
4703 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4704                 exit 1
4705         fi
4706 fi
4707
4708 case "$ok" in
4709 false)
4710         cppstdin="$x_cpp"
4711         cppminus="$x_minus"
4712         cpprun="$x_cpp"
4713         cpplast="$x_minus"
4714         set X $x_cpp
4715         shift
4716         case "$1" in
4717         "$cpp")
4718                 echo "Perhaps can we force $cc -E using a wrapper..."
4719                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4720                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4721                 then
4722                         echo "Yup, we can."
4723                         cppstdin="$wrapper"
4724                         cppminus='';
4725                 else
4726                         echo "Nope, we'll have to live without it..."
4727                 fi
4728                 ;;
4729         esac
4730         case "$cpprun" in
4731         "$wrapper")
4732                 cpprun=''
4733                 cpplast=''
4734                 ;;
4735         esac
4736         ;;
4737 esac
4738
4739 case "$cppstdin" in
4740 "$wrapper"|'cppstdin') ;;
4741 *) $rm -f $wrapper;;
4742 esac
4743 $rm -f testcpp.c testcpp.out
4744
4745 : Set private lib path
4746 case "$plibpth" in
4747 '') if ./mips; then
4748                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4749         fi;;
4750 esac
4751 case "$libpth" in
4752 ' ') dlist='';;
4753 '') dlist="$loclibpth $plibpth $glibpth";;
4754 *) dlist="$libpth";;
4755 esac
4756
4757 : Now check and see which directories actually exist, avoiding duplicates
4758 libpth=''
4759 for xxx in $dlist
4760 do
4761     if $test -d $xxx; then
4762                 case " $libpth " in
4763                 *" $xxx "*) ;;
4764                 *) libpth="$libpth $xxx";;
4765                 esac
4766     fi
4767 done
4768 $cat <<'EOM'
4769
4770 Some systems have incompatible or broken versions of libraries.  Among
4771 the directories listed in the question below, please remove any you
4772 know not to be holding relevant libraries, and add any that are needed.
4773 Say "none" for none.
4774
4775 EOM
4776 case "$libpth" in
4777 '') dflt='none';;
4778 *)
4779         set X $libpth
4780         shift
4781         dflt=${1+"$@"}
4782         ;;
4783 esac
4784 rp="Directories to use for library searches?"
4785 . ./myread
4786 case "$ans" in
4787 none) libpth=' ';;
4788 *) libpth="$ans";;
4789 esac
4790
4791 : compute shared library extension
4792 case "$so" in
4793 '')
4794         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4795                 dflt='sl'
4796         else
4797                 dflt='so'
4798         fi
4799         ;;
4800 *) dflt="$so";;
4801 esac
4802 $cat <<EOM
4803
4804 On some systems, shared libraries may be available.  Answer 'none' if
4805 you want to suppress searching of shared libraries for the remainder
4806 of this configuration.
4807
4808 EOM
4809 rp='What is the file extension used for shared libraries?'
4810 . ./myread
4811 so="$ans"
4812
4813 : Define several unixisms.
4814 : Hints files or command line option can be used to override them.
4815 : The convoluted testing is in case hints files set either the old
4816 : or the new name.
4817 case "$_exe" in
4818 '')     case "$exe_ext" in
4819         '')     ;;
4820         *)      _exe="$exe_ext" ;;
4821         esac
4822         ;;
4823 esac
4824 case "$_a" in
4825 '')     case "$lib_ext" in
4826     '') _a='.a';;
4827         *)      _a="$lib_ext" ;;
4828         esac
4829         ;;
4830 esac
4831 case "$_o" in
4832 '') case "$obj_ext" in
4833         '')     _o='.o';;
4834         *)      _o="$obj_ext";;
4835         esac
4836         ;;
4837 esac
4838 case "$p_" in
4839 '') case "$path_sep" in
4840         '')     p_=':';;
4841         *)      p_="$path_sep";;
4842         esac
4843         ;;
4844 esac
4845 exe_ext=$_exe
4846 lib_ext=$_a
4847 obj_ext=$_o
4848 path_sep=$p_
4849
4850 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4851
4852 : Which makefile gets called first.  This is used by make depend.
4853 case "$firstmakefile" in
4854 '') firstmakefile='makefile';;
4855 esac
4856
4857 : Check for uselongdouble support
4858 case "$ccflags" in
4859 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4860 esac
4861
4862 case "$uselongdouble" in
4863 $define|true|[yY]*)     dflt='y';;
4864 *) dflt='n';;
4865 esac
4866 cat <<EOM
4867
4868 Perl can be built to take advantage of long doubles which
4869 (if available) may give more accuracy and range for floating point numbers.
4870
4871 If this doesn't make any sense to you, just accept the default '$dflt'.
4872 EOM
4873 rp='Try to use long doubles if available?'
4874 . ./myread
4875 case "$ans" in
4876 y|Y)    val="$define"   ;;
4877 *)      val="$undef"    ;;
4878 esac
4879 set uselongdouble
4880 eval $setvar
4881
4882 case "$uselongdouble" in
4883 true|[yY]*) uselongdouble="$define" ;;
4884 esac
4885
4886 : Look for a hint-file generated 'call-back-unit'.  If the
4887 : user has specified that long doubles should be used,
4888 : we may need to set or change some other defaults.
4889 if $test -f uselongdouble.cbu; then
4890     echo "Your platform has some specific hints regarding long doubles, using them..."
4891     . ./uselongdouble.cbu
4892 else
4893     case "$uselongdouble" in
4894         $define)
4895                 $cat <<EOM
4896 (Your platform does not have any specific hints for long doubles.)
4897 EOM
4898         ;;
4899     esac
4900 fi
4901
4902 : Looking for optional libraries
4903 echo " "
4904 echo "Checking for optional libraries..." >&4
4905 case "$libs" in
4906 ' '|'') dflt='';;
4907 *) dflt="$libs";;
4908 esac
4909 case "$libswanted" in
4910 '') libswanted='c_s';;
4911 esac
4912 case "$usesocks" in
4913 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4914 esac
4915 libsfound=''
4916 libsfiles=''
4917 libsdirs=''
4918 libspath=''
4919 for thisdir in $libpth $xlibpth; do
4920   test -d $thisdir && libspath="$libspath $thisdir"
4921 done
4922 for thislib in $libswanted; do
4923         for thisdir in $libspath; do
4924             xxx=''
4925             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4926                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4927                 $test -f "$xxx" && eval $libscheck
4928                 $test -f "$xxx" && libstyle=shared
4929             fi
4930             if test ! -f "$xxx"; then
4931                 xxx=$thisdir/lib$thislib.$so
4932                 $test -f "$xxx" && eval $libscheck
4933                 $test -f "$xxx" && libstyle=shared
4934             fi
4935             if test ! -f "$xxx"; then
4936                 xxx=$thisdir/lib$thislib$_a
4937                 $test -f "$xxx" && eval $libscheck
4938                 $test -f "$xxx" && libstyle=static
4939             fi
4940             if test ! -f "$xxx"; then
4941                 xxx=$thisdir/$thislib$_a
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=static
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/lib${thislib}_s$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949                 $test -f "$xxx" && thislib=${thislib}_s
4950             fi
4951             if test ! -f "$xxx"; then
4952                 xxx=$thisdir/Slib$thislib$_a
4953                 $test -f "$xxx" && eval $libscheck
4954                 $test -f "$xxx" && libstyle=static
4955             fi
4956             if $test -f "$xxx"; then
4957                 case "$libstyle" in
4958                 shared) echo "Found -l$thislib (shared)." ;;
4959                 static) echo "Found -l$thislib." ;;
4960                 *)      echo "Found -l$thislib ($libstyle)." ;;
4961                 esac
4962                 case " $dflt " in
4963                 *"-l$thislib "*);;
4964                 *) dflt="$dflt -l$thislib"
4965                    libsfound="$libsfound $xxx"
4966                    yyy=`basename $xxx`
4967                    libsfiles="$libsfiles $yyy"
4968                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4969                    case " $libsdirs " in
4970                    *" $yyy "*) ;;
4971                    *) libsdirs="$libsdirs $yyy" ;;
4972                    esac
4973                    ;;
4974                 esac
4975                 break
4976             fi
4977         done
4978         if $test ! -f "$xxx"; then
4979             echo "No -l$thislib."
4980         fi
4981 done
4982 set X $dflt
4983 shift
4984 dflt="$*"
4985 case "$libs" in
4986 '') dflt="$dflt";;
4987 *) dflt="$libs";;
4988 esac
4989 case "$dflt" in
4990 ' '|'') dflt='none';;
4991 esac
4992
4993 $cat <<EOM
4994
4995 In order to compile $package on your machine, a number of libraries
4996 are usually needed.  Include any other special libraries here as well.
4997 Say "none" for none.  The default list is almost always right.
4998 EOM
4999
5000 echo " "
5001 rp="What libraries to use?"
5002 . ./myread
5003 case "$ans" in
5004 none) libs=' ';;
5005 *) libs="$ans";;
5006 esac
5007
5008 : determine optimization, if desired, or use for debug flag also
5009 case "$optimize" in
5010 ' '|$undef) dflt='none';;
5011 '') dflt='-O';;
5012 *) dflt="$optimize";;
5013 esac
5014 $cat <<EOH
5015
5016 By default, $package compiles with the -O flag to use the optimizer.
5017 Alternately, you might want to use the symbolic debugger, which uses
5018 the -g flag (on traditional Unix systems).  Either flag can be
5019 specified here.  To use neither flag, specify the word "none".
5020
5021 EOH
5022 rp="What optimizer/debugger flag should be used?"
5023 . ./myread
5024 optimize="$ans"
5025 case "$optimize" in
5026 'none') optimize=" ";;
5027 esac
5028
5029 : Check what DEBUGGING is required from the command line
5030 : -DEBUGGING      or -DDEBUGGING or
5031 : -DEBUGGING=both                       = -g + -DDEBUGGING
5032 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5033 : -DEBUGGING=none or -UDEBUGGING        =
5034 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5035 case "$EBUGGING" in
5036 '')     ;;
5037 *)      DEBUGGING=$EBUGGING ;;
5038 esac
5039
5040 case "$DEBUGGING" in
5041 -g|both|$define)
5042     case "$optimize" in
5043         *-g*) ;;
5044         *)    optimize="$optimize -g" ;;
5045     esac ;;
5046 none|$undef)
5047     case "$optimize" in
5048         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5049                 shift
5050                 optimize="$*"
5051                 ;;
5052     esac ;;
5053 esac
5054
5055 dflt=''
5056 case "$DEBUGGING" in
5057 both|$define) dflt='-DDEBUGGING'
5058 esac
5059
5060 : argument order is deliberate, as the flag will start with - which set could
5061 : think is an option
5062 checkccflag='check=$1; flag=$2; callback=$3;
5063 echo " ";
5064 echo "Checking if your compiler accepts $flag" 2>&1;
5065 echo "int main(void) { return 0; }" > gcctest.c;
5066 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5067     echo "Yes, it does." 2>&1;
5068     if $test -s gcctest.out ; then
5069         echo "But your platform does not like it:";
5070         cat gcctest.out;
5071     else
5072         case "$ccflags" in
5073         *$check*)
5074             echo "Leaving current flags $ccflags alone." 2>&1
5075             ;;
5076         *) dflt="$dflt $flag";
5077             eval $callback
5078             ;;
5079         esac
5080     fi
5081 else
5082     echo "Nope, it does not, but that is ok." 2>&1;
5083 fi
5084 '
5085
5086 : We will not override a previous value, but we might want to
5087 : augment a hint file
5088 case "$hint" in
5089 default|recommended)
5090         case "$gccversion" in
5091         1*) dflt="$dflt -fpcc-struct-return" ;;
5092         esac
5093         case "$optimize:$DEBUGGING" in
5094         *-g*:old) dflt="$dflt -DDEBUGGING";;
5095         esac
5096         case "$gccversion" in
5097         2*) if $test -d /etc/conf/kconfig.d &&
5098                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5099                 then
5100                         # Interactive Systems (ISC) POSIX mode.
5101                         dflt="$dflt -posix"
5102                 fi
5103                 ;;
5104         esac
5105         case "$gccversion" in
5106         1*) ;;
5107         2.[0-8]*) ;;
5108         ?*)     set strict-aliasing -fno-strict-aliasing
5109                 eval $checkccflag
5110                 ;;
5111         esac
5112         # For gcc, adding -pipe speeds up compilations for some, but apparently
5113         # some assemblers can't read from stdin.  (It also slows down compilations
5114         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5115         case "$gccversion" in
5116         ?*)     set pipe -pipe
5117                 eval $checkccflag
5118                 ;;
5119         esac
5120
5121         # on x86_64 (at least) we require an extra library (libssp) in the
5122         # link command line. This library is not named, so I infer that it is
5123         # an implementation detail that may change. Hence the safest approach
5124         # is to add the flag to the flags passed to the compiler at link time,
5125         # as that way the compiler can do the right implementation dependant
5126         # thing. (NWC)
5127         case "$gccversion" in
5128         ?*)     set stack-protector -fstack-protector
5129                 eval $checkccflag
5130                 ;;
5131         esac
5132         ;;
5133 esac
5134
5135 case "$mips_type" in
5136 *BSD*|'') inclwanted="$locincpth $usrinc";;
5137 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5138 esac
5139 for thisincl in $inclwanted; do
5140         if $test -d $thisincl; then
5141                 if $test x$thisincl != x$usrinc; then
5142                         case "$dflt" in
5143                         *" -I$thisincl "*);;
5144                         *) dflt="$dflt -I$thisincl ";;
5145                         esac
5146                 fi
5147         fi
5148 done
5149
5150 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5151         xxx=true;
5152 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5153         xxx=true;
5154 else
5155         xxx=false;
5156 fi;
5157 if $xxx; then
5158         case "$dflt" in
5159         *$2*);;
5160         *) dflt="$dflt -D$2";;
5161         esac;
5162 fi'
5163
5164 set signal.h LANGUAGE_C; eval $inctest
5165
5166 case "$usesocks" in
5167 $define)
5168         ccflags="$ccflags -DSOCKS"
5169         ;;
5170 esac
5171
5172 case "$hint" in
5173 default|recommended) dflt="$ccflags $dflt" ;;
5174 *) dflt="$ccflags";;
5175 esac
5176
5177 case "$dflt" in
5178 ''|' ') dflt=none;;
5179 esac
5180
5181 $cat <<EOH
5182
5183 Your C compiler may want other flags.  For this question you should include
5184 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5185 but you should NOT include libraries or ld flags like -lwhatever.  If you
5186 want $package to honor its debug switch, you should include -DDEBUGGING here.
5187 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5188
5189 To use no flags, specify the word "none".
5190
5191 EOH
5192 set X $dflt
5193 shift
5194 dflt=${1+"$@"}
5195 rp="Any additional cc flags?"
5196 . ./myread
5197 case "$ans" in
5198 none) ccflags='';;
5199 *) ccflags="$ans";;
5200 esac
5201
5202 : the following weeds options from ccflags that are of no interest to cpp
5203 case "$cppflags" in
5204 '') cppflags="$ccflags" ;;
5205 *)  cppflags="$cppflags $ccflags" ;;
5206 esac
5207 case "$gccversion" in
5208 1*) cppflags="$cppflags -D__GNUC__"
5209 esac
5210 case "$mips_type" in
5211 '');;
5212 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5213 esac
5214 case "$cppflags" in
5215 '');;
5216 *)
5217         echo " "
5218         echo "Let me guess what the preprocessor flags are..." >&4
5219         set X $cppflags
5220         shift
5221         cppflags=''
5222         $cat >cpp.c <<'EOM'
5223 #define BLURFL foo
5224
5225 BLURFL xx LFRULB
5226 EOM
5227         previous=''
5228         for flag in $*
5229         do
5230                 case "$flag" in
5231                 -*) ftry="$flag";;
5232                 *) ftry="$previous $flag";;
5233                 esac
5234                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5235                         >cpp1.out 2>/dev/null && \
5236                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5237                         >cpp2.out 2>/dev/null && \
5238                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5239                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5240                 then
5241                         cppflags="$cppflags $ftry"
5242                         previous=''
5243                 else
5244                         previous="$flag"
5245                 fi
5246         done
5247         set X $cppflags
5248         shift
5249         cppflags=${1+"$@"}
5250         case "$cppflags" in
5251         *-*)  echo "They appear to be: $cppflags";;
5252         esac
5253         $rm -f cpp.c cpp?.out
5254         ;;
5255 esac
5256
5257 : flags used in final linking phase
5258 case "$ldflags" in
5259 '') if ./venix; then
5260                 dflt='-i -z'
5261         else
5262                 dflt=''
5263         fi
5264         case "$ccflags" in
5265         *-posix*) dflt="$dflt -posix" ;;
5266         esac
5267         ;;
5268 *) dflt="$ldflags";;
5269 esac
5270 # See note above about -fstack-protector
5271 case "$ccflags" in
5272 *-fstack-protector*) 
5273         case "$dflt" in
5274         *-fstack-protector*) ;; # Don't add it again
5275         *) dflt="$dflt -fstack-protector" ;; 
5276         esac
5277         ;;
5278 esac
5279
5280 : Try to guess additional flags to pick up local libraries.
5281 for thislibdir in $libpth; do
5282         case " $loclibpth " in
5283         *" $thislibdir "*)
5284                 case "$dflt " in
5285                 *"-L$thislibdir "*) ;;
5286                 *)  dflt="$dflt -L$thislibdir" ;;
5287                 esac
5288                 ;;
5289         esac
5290 done
5291
5292 case "$dflt" in
5293 '') dflt='none' ;;
5294 esac
5295
5296 $cat <<EOH
5297
5298 Your C linker may need flags.  For this question you should
5299 include -L/whatever and any other flags used by the C linker, but you
5300 should NOT include libraries like -lwhatever.
5301
5302 Make sure you include the appropriate -L/path flags if your C linker
5303 does not normally search all of the directories you specified above,
5304 namely
5305         $libpth
5306 To use no flags, specify the word "none".
5307
5308 EOH
5309
5310 rp="Any additional ld flags (NOT including libraries)?"
5311 . ./myread
5312 case "$ans" in
5313 none) ldflags='';;
5314 *) ldflags="$ans";;
5315 esac
5316 rmlist="$rmlist pdp11"
5317
5318 : coherency check
5319 echo " "
5320 echo "Checking your choice of C compiler and flags for coherency..." >&4
5321 $cat > try.c <<'EOF'
5322 #include <stdio.h>
5323 int main() { printf("Ok\n"); return(0); }
5324 EOF
5325 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5326 shift
5327 $cat >try.msg <<'EOM'
5328 I've tried to compile and run the following simple program:
5329
5330 EOM
5331 $cat try.c >> try.msg
5332
5333 $cat >> try.msg <<EOM
5334
5335 I used the command:
5336
5337         $*
5338         $run ./try
5339
5340 and I got the following output:
5341
5342 EOM
5343 dflt=y
5344 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5345         if $sh -c "$run ./try " >>try.msg 2>&1; then
5346                 xxx=`$run ./try`
5347                 case "$xxx" in
5348                 "Ok") dflt=n ;;
5349                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5350                         case " $libs " in
5351                         *" -lsfio "*)
5352                                 cat >> try.msg <<'EOQS'
5353 If $libs contains -lsfio, and sfio is mis-configured, then it
5354 sometimes (apparently) runs and exits with a 0 status, but with no
5355 output!  It may have to do with sfio's use of _exit vs. exit.
5356
5357 EOQS
5358                                 rp="You have a big problem.  Shall I abort Configure"
5359                                 dflt=y
5360                                 ;;
5361                         esac
5362                         ;;
5363                 esac
5364         else
5365                 echo "The program compiled OK, but exited with status $?." >>try.msg
5366                 rp="You have a problem.  Shall I abort Configure"
5367                 dflt=y
5368         fi
5369 else
5370         echo "I can't compile the test program." >>try.msg
5371         rp="You have a BIG problem.  Shall I abort Configure"
5372         dflt=y
5373 fi
5374 case "$dflt" in
5375 y)
5376         $cat try.msg >&4
5377         case "$knowitall" in
5378         '')
5379                 echo "(The supplied flags or libraries might be incorrect.)"
5380                 ;;
5381         *) dflt=n;;
5382         esac
5383         echo " "
5384         . ./myread
5385         case "$ans" in
5386         n*|N*) ;;
5387         *)      echo "Ok.  Stopping Configure." >&4
5388                 exit 1
5389                 ;;
5390         esac
5391         ;;
5392 n) echo "OK, that should do.";;
5393 esac
5394 $rm_try gcctest gcctest.out
5395
5396 : define a shorthand compile call
5397 compile='
5398 mc_file=$1;
5399 shift;
5400 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5401 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5402 exit 1;
5403 fi;
5404 esac;
5405 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5406 : define a shorthand compile call for compilations that should be ok.
5407 compile_ok='
5408 mc_file=$1;
5409 shift;
5410 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5411
5412 : determine filename position in cpp output
5413 echo " "
5414 echo "Computing filename position in cpp output for #include directives..." >&4
5415 case "$osname" in
5416 vos) testaccess=-e ;;
5417 *)   testaccess=-r ;;
5418 esac
5419 echo '#include <stdio.h>' > foo.c
5420 $cat >fieldn <<EOF
5421 $startsh
5422 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5423 $grep '^[       ]*#.*stdio\.h' | \
5424 while read cline; do
5425         pos=1
5426         set \$cline
5427         while $test \$# -gt 0; do
5428                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5429                         echo "\$pos"
5430                         exit 0
5431                 fi
5432                 shift
5433                 pos=\`expr \$pos + 1\`
5434         done
5435 done
5436 EOF
5437 chmod +x fieldn
5438 fieldn=`./fieldn`
5439 $rm -f foo.c fieldn
5440 case $fieldn in
5441 '') pos='???';;
5442 1) pos=first;;
5443 2) pos=second;;
5444 3) pos=third;;
5445 *) pos="${fieldn}th";;
5446 esac
5447 echo "Your cpp writes the filename in the $pos field of the line."
5448
5449 case "$osname" in
5450 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5451 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5452 *)   cppfilter='' ;;
5453 esac
5454 : locate header file
5455 $cat >findhdr <<EOF
5456 $startsh
5457 wanted=\$1
5458 name=''
5459 for usrincdir in $usrinc
5460 do
5461         if test -f \$usrincdir/\$wanted; then
5462                 echo "\$usrincdir/\$wanted"
5463                 exit 0
5464         fi
5465 done
5466 awkprg='{ print \$$fieldn }'
5467 echo "#include <\$wanted>" > foo\$\$.c
5468 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5469 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5470 while read cline; do
5471         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5472         case "\$name" in
5473         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5474         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5475         *) exit 2;;
5476         esac;
5477 done;
5478 #
5479 # status = 0: grep returned 0 lines, case statement not executed
5480 # status = 1: headerfile found
5481 # status = 2: while loop executed, no headerfile found
5482 #
5483 status=\$?
5484 $rm -f foo\$\$.c;
5485 if test \$status -eq 1; then
5486         exit 0;
5487 fi
5488 exit 1
5489 EOF
5490 chmod +x findhdr
5491
5492 : define an alternate in-header-list? function
5493 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5494 cont=true; xxf="echo \"<\$1> found.\" >&4";
5495 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5496 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5497 esac;
5498 case $# in 4) instead=instead;; *) instead="at last";; esac;
5499 while $test "$cont"; do
5500         xxx=`./findhdr $1`
5501         var=$2; eval "was=\$$2";
5502         if $test "$xxx" && $test -r "$xxx";
5503         then eval $xxf;
5504         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5505                 cont="";
5506         else eval $xxnf;
5507         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5508         set $yyy; shift; shift; yyy=$@;
5509         case $# in 0) cont="";;
5510         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5511                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5512         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5513                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5514         esac;
5515 done;
5516 while $test "$yyy";
5517 do set $yyy; var=$2; eval "was=\$$2";
5518         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5519         set $yyy; shift; shift; yyy=$@;
5520 done'
5521
5522 : see if stdlib is available
5523 set stdlib.h i_stdlib
5524 eval $inhdr
5525
5526 : check for lengths of integral types
5527 echo " "
5528 case "$intsize" in
5529 '')
5530         echo "Checking to see how big your integers are..." >&4
5531         $cat >try.c <<EOCP
5532 #include <stdio.h>
5533 #$i_stdlib I_STDLIB
5534 #ifdef I_STDLIB
5535 #include <stdlib.h>
5536 #endif
5537 int main()
5538 {
5539         printf("intsize=%d;\n", (int)sizeof(int));
5540         printf("longsize=%d;\n", (int)sizeof(long));
5541         printf("shortsize=%d;\n", (int)sizeof(short));
5542         exit(0);
5543 }
5544 EOCP
5545         set try
5546         if eval $compile_ok && $run ./try > /dev/null; then
5547                 eval `$run ./try`
5548                 echo "Your integers are $intsize bytes long."
5549                 echo "Your long integers are $longsize bytes long."
5550                 echo "Your short integers are $shortsize bytes long."
5551         else
5552                 $cat >&4 <<EOM
5553 !
5554 Help! I can't compile and run the intsize test program: please enlighten me!
5555 (This is probably a misconfiguration in your system or libraries, and
5556 you really ought to fix it.  Still, I'll try anyway.)
5557 !
5558 EOM
5559                 dflt=4
5560                 rp="What is the size of an integer (in bytes)?"
5561                 . ./myread
5562                 intsize="$ans"
5563                 dflt=$intsize
5564                 rp="What is the size of a long integer (in bytes)?"
5565                 . ./myread
5566                 longsize="$ans"
5567                 dflt=2
5568                 rp="What is the size of a short integer (in bytes)?"
5569                 . ./myread
5570                 shortsize="$ans"
5571         fi
5572         ;;
5573 esac
5574 $rm_try
5575
5576 : check for long long
5577 echo " "
5578 echo "Checking to see if you have long long..." >&4
5579 echo 'int main() { long long x = 7; return 0; }' > try.c
5580 set try
5581 if eval $compile; then
5582         val="$define"
5583         echo "You have long long."
5584 else
5585         val="$undef"
5586         echo "You do not have long long."
5587 fi
5588 $rm_try
5589 set d_longlong
5590 eval $setvar
5591
5592 : check for length of long long
5593 case "${d_longlong}${longlongsize}" in
5594 $define)
5595         echo " "
5596         echo "Checking to see how big your long longs are..." >&4
5597         $cat >try.c <<'EOCP'
5598 #include <stdio.h>
5599 int main()
5600 {
5601     printf("%d\n", (int)sizeof(long long));
5602     return(0);
5603 }
5604 EOCP
5605         set try
5606         if eval $compile_ok; then
5607                 longlongsize=`$run ./try`
5608                 echo "Your long longs are $longlongsize bytes long."
5609         else
5610                 dflt='8'
5611                 echo " "
5612                 echo "(I can't seem to compile the test program.  Guessing...)"
5613                 rp="What is the size of a long long (in bytes)?"
5614                 . ./myread
5615                 longlongsize="$ans"
5616         fi
5617         if $test "X$longsize" = "X$longlongsize"; then
5618                 echo "(That isn't any different from an ordinary long.)"
5619         fi
5620         ;;
5621 esac
5622 $rm_try
5623
5624 : see if inttypes.h is available
5625 : we want a real compile instead of Inhdr because some systems
5626 : have an inttypes.h which includes non-existent headers
5627 echo " "
5628 $cat >try.c <<EOCP
5629 #include <inttypes.h>
5630 int main() {
5631         static int32_t foo32 = 0x12345678;
5632 }
5633 EOCP
5634 set try
5635 if eval $compile; then
5636         echo "<inttypes.h> found." >&4
5637         val="$define"
5638 else
5639         echo "<inttypes.h> NOT found." >&4
5640         val="$undef"
5641 fi
5642 $rm_try
5643 set i_inttypes
5644 eval $setvar
5645
5646 : check for int64_t
5647 echo " "
5648 echo "Checking to see if you have int64_t..." >&4
5649 $cat >try.c <<EOCP
5650 #include <sys/types.h>
5651 #$i_inttypes I_INTTYPES
5652 #ifdef I_INTTYPES
5653 #include <inttypes.h>
5654 #endif
5655 int main() { int64_t x = 7; }
5656 EOCP
5657 set try
5658 if eval $compile; then
5659         val="$define"
5660         echo "You have int64_t."
5661 else
5662         val="$undef"
5663         echo "You do not have int64_t."
5664 fi
5665 $rm_try
5666 set d_int64_t
5667 eval $setvar
5668
5669 : Check if 64bit ints have a quad type
5670 echo " "
5671 echo "Checking which 64-bit integer type we could use..." >&4
5672
5673 case "$intsize" in
5674 8) val=int
5675    set quadtype
5676    eval $setvar
5677    val='"unsigned int"'
5678    set uquadtype
5679    eval $setvar
5680    quadkind=1
5681    ;;
5682 *) case "$longsize" in
5683    8) val=long
5684       set quadtype
5685       eval $setvar
5686       val='"unsigned long"'
5687       set uquadtype
5688       eval $setvar
5689       quadkind=2
5690       ;;
5691    *) case "$d_longlong:$longlongsize" in
5692       define:8)
5693         val='"long long"'
5694         set quadtype
5695         eval $setvar
5696         val='"unsigned long long"'
5697         set uquadtype
5698         eval $setvar
5699         quadkind=3
5700         ;;
5701       *) case "$d_int64_t" in
5702          define)
5703            val=int64_t
5704            set quadtype
5705            eval $setvar
5706            val=uint64_t
5707            set uquadtype
5708            eval $setvar
5709            quadkind=4
5710            ;;
5711          esac
5712          ;;
5713       esac
5714       ;;
5715    esac
5716    ;;
5717 esac
5718
5719 case "$quadtype" in
5720 '')     echo "Alas, no 64-bit integer types in sight." >&4
5721         d_quad="$undef"
5722         ;;
5723 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5724         d_quad="$define"
5725         ;;
5726 esac
5727
5728 : Do we want 64bit support
5729 case "$uselonglong" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5734 EOM
5735         use64bitint="$define"
5736         ;;
5737 esac
5738 case "$use64bits" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$use64bitints" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitsint" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5761 EOM
5762         use64bitint="$define"
5763         ;;
5764 esac
5765 case "$uselonglongs" in
5766 "$define"|true|[yY]*)
5767         cat <<EOM >&4
5768
5769 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5770 EOM
5771         use64bitint="$define"
5772         ;;
5773 esac
5774 case "$use64bitsall" in
5775 "$define"|true|[yY]*)
5776         cat <<EOM >&4
5777
5778 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5779 EOM
5780         use64bitall="$define"
5781         ;;
5782 esac
5783
5784 case "$ccflags" in
5785 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5786 esac
5787 case "$use64bitall" in
5788 "$define"|true|[yY]*) use64bitint="$define" ;;
5789 esac
5790
5791 case "$longsize" in
5792 8) cat <<EOM
5793
5794 You have natively 64-bit long integers.
5795 EOM
5796    val="$define"
5797    ;;
5798 *) case "$use64bitint" in
5799    "$define"|true|[yY]*) dflt='y';;
5800    *) dflt='n';;
5801    esac
5802    case "$d_quad" in
5803    "$define") ;;
5804    *) dflt='n' ;;
5805    esac
5806    cat <<EOM
5807
5808 Perl can be built to take advantage of 64-bit integer types
5809 on some systems.  To do so, Configure can be run with -Duse64bitint.
5810 Choosing this option will most probably introduce binary incompatibilities.
5811
5812 If this doesn't make any sense to you, just accept the default '$dflt'.
5813 (The default has been chosen based on your configuration.)
5814 EOM
5815    rp='Try to use 64-bit integers, if available?'
5816    . ./myread
5817    case "$ans" in
5818    [yY]*) val="$define" ;;
5819    *)     val="$undef"  ;;
5820    esac
5821    ;;
5822 esac
5823 set use64bitint
5824 eval $setvar
5825
5826 case "$use64bitall" in
5827 "$define"|true|[yY]*) dflt='y' ;;
5828 *) case "$longsize" in
5829    8) dflt='y' ;;
5830    *) dflt='n' ;;
5831    esac
5832    ;;
5833 esac
5834 cat <<EOM
5835
5836 You may also choose to try maximal 64-bitness.  It means using as much
5837 64-bitness as possible on the platform.  This in turn means even more
5838 binary incompatibilities.  On the other hand, your platform may not
5839 have any more 64-bitness available than what you already have chosen.
5840
5841 If this doesn't make any sense to you, just accept the default '$dflt'.
5842 (The default has been chosen based on your configuration.)
5843 EOM
5844 rp='Try to use maximal 64-bit support, if available?'
5845 . ./myread
5846 case "$ans" in
5847 [yY]*) val="$define" ;;
5848 *)     val="$undef"  ;;
5849 esac
5850 set use64bitall
5851 eval $setvar
5852 case "$use64bitall" in
5853 "$define")
5854         case "$use64bitint" in
5855         "$undef")
5856                 cat <<EOM
5857
5858 Since you have chosen a maximally 64-bit build, I'm also turning on
5859 the use of 64-bit integers.
5860 EOM
5861                 use64bitint="$define" ;;
5862         esac
5863         ;;
5864 esac
5865
5866 : Look for a hint-file generated 'call-back-unit'.  If the
5867 : user has specified that a 64-bit perl is to be built,
5868 : we may need to set or change some other defaults.
5869 if $test -f use64bitint.cbu; then
5870         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5871         . ./use64bitint.cbu
5872 fi
5873 case "$use64bitint" in
5874 "$define"|true|[yY]*)
5875         case "$longsize" in
5876         4) case "$archname64" in
5877            '') archname64=64int ;;
5878            esac
5879            ;;
5880         esac
5881         ;;
5882 esac
5883
5884 : Look for a hint-file generated 'call-back-unit'.  If the
5885 : user has specified that a maximally 64-bit perl is to be built,
5886 : we may need to set or change some other defaults.
5887 if $test -f use64bitall.cbu; then
5888         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5889         . ./use64bitall.cbu
5890 fi
5891 case "$use64bitall" in
5892 "$define"|true|[yY]*)
5893         case "$longsize" in
5894         4) case "$archname64" in
5895            ''|64int) archname64=64all ;;
5896            esac
5897            ;;
5898         esac
5899         ;;
5900 esac
5901
5902 case "$d_quad:$use64bitint" in
5903 $undef:$define)
5904         cat >&4 <<EOF
5905
5906 *** You have chosen to use 64-bit integers,
5907 *** but none can be found.
5908 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5909 *** Cannot continue, aborting.
5910
5911 EOF
5912         exit 1
5913         ;;
5914 esac
5915
5916 : check for length of double
5917 echo " "
5918 case "$doublesize" in
5919 '')
5920         echo "Checking to see how big your double precision numbers are..." >&4
5921         $cat >try.c <<EOCP
5922 #include <stdio.h>
5923 #$i_stdlib I_STDLIB
5924 #ifdef I_STDLIB
5925 #include <stdlib.h>
5926 #endif
5927 int main()
5928 {
5929     printf("%d\n", (int)sizeof(double));
5930     exit(0);
5931 }
5932 EOCP
5933         set try
5934         if eval $compile_ok; then
5935                 doublesize=`$run ./try`
5936                 echo "Your double is $doublesize bytes long."
5937         else
5938                 dflt='8'
5939                 echo "(I can't seem to compile the test program.  Guessing...)"
5940                 rp="What is the size of a double precision number (in bytes)?"
5941                 . ./myread
5942                 doublesize="$ans"
5943         fi
5944         ;;
5945 esac
5946 $rm_try
5947
5948 : check for long doubles
5949 echo " "
5950 echo "Checking to see if you have long double..." >&4
5951 echo 'int main() { long double x = 7.0; }' > try.c
5952 set try
5953 if eval $compile; then
5954         val="$define"
5955         echo "You have long double."
5956 else
5957         val="$undef"
5958         echo "You do not have long double."
5959 fi
5960 $rm_try
5961 set d_longdbl
5962 eval $setvar
5963
5964 : check for length of long double
5965 case "${d_longdbl}${longdblsize}" in
5966 $define)
5967         echo " "
5968         echo "Checking to see how big your long doubles are..." >&4
5969         $cat >try.c <<'EOCP'
5970 #include <stdio.h>
5971 int main()
5972 {
5973         printf("%d\n", sizeof(long double));
5974 }
5975 EOCP
5976         set try
5977         set try
5978         if eval $compile; then
5979                 longdblsize=`$run ./try`
5980                 echo "Your long doubles are $longdblsize bytes long."
5981         else
5982                 dflt='8'
5983                 echo " "
5984                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5985                 rp="What is the size of a long double (in bytes)?"
5986                 . ./myread
5987                 longdblsize="$ans"
5988         fi
5989         if $test "X$doublesize" = "X$longdblsize"; then
5990                 echo "That isn't any different from an ordinary double."
5991                 echo "I'll keep your setting anyway, but you may see some"
5992                 echo "harmless compilation warnings."
5993         fi
5994         ;;
5995 esac
5996 $rm_try
5997
5998 : determine the architecture name
5999 echo " "
6000 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6001         tarch=`arch`"-$osname"
6002 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6003         if uname -m > tmparch 2>&1 ; then
6004                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6005                         -e 's/$/'"-$osname/" tmparch`
6006         else
6007                 tarch="$osname"
6008         fi
6009         $rm -f tmparch
6010 else
6011         tarch="$osname"
6012 fi
6013 case "$myarchname" in
6014 ''|"$tarch") ;;
6015 *)
6016         echo "(Your architecture name used to be $myarchname.)"
6017         archname=''
6018         ;;
6019 esac
6020 case "$targetarch" in
6021 '') ;;
6022 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6023 esac
6024 myarchname="$tarch"
6025 case "$archname" in
6026 '') dflt="$tarch";;
6027 *) dflt="$archname";;
6028 esac
6029 rp='What is your architecture name'
6030 . ./myread
6031 archname="$ans"
6032 case "$usethreads" in
6033 $define)
6034         echo "Threads selected." >&4
6035         case "$archname" in
6036         *-thread*) echo "...and architecture name already has -thread." >&4
6037                 ;;
6038         *)      archname="$archname-thread"
6039                 echo "...setting architecture name to $archname." >&4
6040                 ;;
6041         esac
6042         ;;
6043 esac
6044 case "$usemultiplicity" in
6045 $define)
6046         echo "Multiplicity selected." >&4
6047         case "$archname" in
6048         *-multi*) echo "...and architecture name already has -multi." >&4
6049                 ;;
6050         *)      archname="$archname-multi"
6051                 echo "...setting architecture name to $archname." >&4
6052                 ;;
6053         esac
6054         ;;
6055 esac
6056 case "$use64bitint$use64bitall" in
6057 *"$define"*)
6058         case "$archname64" in
6059         '')
6060                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6061                 ;;
6062         *)
6063                 case "$use64bitint" in
6064                 "$define") echo "64 bit integers selected." >&4 ;;
6065                 esac
6066                 case "$use64bitall" in
6067                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6068                 esac
6069                 case "$archname" in
6070                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6071                         ;;
6072                 *)      archname="$archname-$archname64"
6073                         echo "...setting architecture name to $archname." >&4
6074                         ;;
6075                 esac
6076                 ;;
6077         esac
6078 esac
6079 case "$uselongdouble" in
6080 $define)
6081         echo "Long doubles selected." >&4
6082         case "$longdblsize" in
6083         $doublesize)
6084                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6085                 ;;
6086         *)
6087                 case "$archname" in
6088                 *-ld*) echo "...and architecture name already has -ld." >&4
6089                         ;;
6090                 *)      archname="$archname-ld"
6091                         echo "...setting architecture name to $archname." >&4
6092                         ;;
6093                 esac
6094                 ;;
6095         esac
6096         ;;
6097 esac
6098 case "$useperlio" in
6099 $define)
6100         echo "Perlio selected." >&4
6101         ;;
6102 *)
6103         echo "Perlio not selected, using stdio." >&4
6104         case "$archname" in
6105         *-stdio*) echo "...and architecture name already has -stdio." >&4
6106                 ;;
6107         *)      archname="$archname-stdio"
6108                 echo "...setting architecture name to $archname." >&4
6109                 ;;
6110         esac
6111         ;;
6112 esac
6113 if $test -f archname.cbu; then
6114         echo "Your platform has some specific hints for architecture name, using them..."
6115         . ./archname.cbu
6116 fi
6117
6118 : set the prefixit variable, to compute a suitable default value
6119 prefixit='case "$3" in
6120 ""|none)
6121         case "$oldprefix" in
6122         "") eval "$1=\"\$$2\"";;
6123         *)
6124                 case "$3" in
6125                 "") eval "$1=";;
6126                 none)
6127                         eval "tp=\"\$$2\"";
6128                         case "$tp" in
6129                         ""|" ") eval "$1=\"\$$2\"";;
6130                         *) eval "$1=";;
6131                         esac;;
6132                 esac;;
6133         esac;;
6134 *)
6135         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6136         case "$tp" in
6137         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6138         /*-$oldprefix/*|\~*-$oldprefix/*)
6139                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6140         *) eval "$1=\"\$$2\"";;
6141         esac;;
6142 esac'
6143
6144 : determine installation style
6145 : For now, try to deduce it from prefix unless it is already set.
6146 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6147 case "$installstyle" in
6148 '')     case "$prefix" in
6149                 *perl*) dflt='lib';;
6150                 *) dflt='lib/perl5' ;;
6151         esac
6152         ;;
6153 *)      dflt="$installstyle" ;;
6154 esac
6155 : Probably not worth prompting for this since we prompt for all
6156 : the directories individually, and the prompt would be too long and
6157 : confusing anyway.
6158 installstyle=$dflt
6159
6160 : determine where public executables go
6161 echo " "
6162 set dflt bin bin
6163 eval $prefixit
6164 fn=d~
6165 rp='Pathname where the public executables will reside?'
6166 . ./getfile
6167 if $test "X$ansexp" != "X$binexp"; then
6168         installbin=''
6169 fi
6170 prefixvar=bin
6171 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6172 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6173 :     this via initialinstalllocation
6174 . ./setprefixvar
6175
6176 case "$userelocatableinc" in
6177 $define|true|[yY]*)     dflt='y' ;;
6178 *)                      dflt='n' ;;
6179 esac
6180 cat <<EOM
6181
6182 Would you like to build Perl so that the installation is relocatable, so that
6183 library paths in @INC are determined relative to the path of the perl binary?
6184 This is not advised for system Perl installs, or if you need to run setid
6185 scripts or scripts under taint mode.
6186
6187 If this doesn't make any sense to you, just accept the default '$dflt'.
6188 EOM
6189 rp='Use relocatable @INC?'
6190 . ./myread
6191 case "$ans" in
6192 y|Y)    val="$define" ;;
6193 *)      val="$undef"  ;;
6194 esac
6195 set userelocatableinc
6196 eval $setvar
6197
6198 initialinstalllocation="$binexp"
6199 : Default prefix is now "up one level from where the binaries are"
6200 case "$userelocatableinc" in
6201 $define|true|[yY]*)
6202     bin=".../"
6203     binexp=".../"
6204     prefix=".../.."
6205     prefixexp=".../.."
6206     installprefixexp=".../.."
6207     ;;
6208 esac
6209
6210 : determine where private library files go
6211 : Usual default is /usr/local/lib/perl5/$version.
6212 : Also allow things like /opt/perl/lib/$version, since
6213 : /opt/perl/lib/perl5... would be redundant.
6214 : The default "style" setting is made in installstyle.U
6215 case "$installstyle" in
6216 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6217 *)       set dflt privlib lib/$version ;;
6218 esac
6219 eval $prefixit
6220 $cat <<EOM
6221
6222 There are some auxiliary files for $package that need to be put into a
6223 private library directory that is accessible by everyone.
6224
6225 EOM
6226 fn=$binexp
6227 fn=d~+
6228 rp='Pathname where the private library files will reside?'
6229 . ./getfile
6230 prefixvar=privlib
6231 . ./setprefixvar
6232
6233 : set the prefixup variable, to restore leading tilda escape
6234 prefixup='case "$prefixexp" in
6235 "$prefix") ;;
6236 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6237 esac'
6238
6239 : determine where public architecture dependent libraries go
6240 set archlib archlib
6241 eval $prefixit
6242 : privlib default is /usr/local/lib/$package/$version
6243 : archlib default is /usr/local/lib/$package/$version/$archname
6244 : privlib may have an optional trailing /share.
6245 tdflt=`echo $privlib | $sed 's,/share$,,'`
6246 tdflt=$tdflt/$archname
6247 case "$archlib" in
6248 '')     dflt=$tdflt
6249         ;;
6250 *)      dflt="$archlib"
6251     ;;
6252 esac
6253 $cat <<EOM
6254
6255 $spackage contains architecture-dependent library files.  If you are
6256 sharing libraries in a heterogeneous environment, you might store
6257 these files in a separate location.  Otherwise, you can just include
6258 them with the rest of the public library files.
6259
6260 EOM
6261 fn=$binexp
6262 fn=d+~
6263 rp='Where do you want to put the public architecture-dependent libraries?'
6264 . ./getfile
6265 prefixvar=archlib
6266 . ./setprefixvar
6267 if $test X"$archlib" = X"$privlib"; then
6268         d_archlib="$undef"
6269 else
6270         d_archlib="$define"
6271 fi
6272
6273 : see if setuid scripts can be secure
6274 $cat <<EOM
6275
6276 Some kernels have a bug that prevents setuid #! scripts from being
6277 secure.  Some sites have disabled setuid #! scripts because of this.
6278
6279 First let's decide if your kernel supports secure setuid #! scripts.
6280 (If setuid #! scripts would be secure but have been disabled anyway,
6281 don't say that they are secure if asked.)
6282
6283 EOM
6284
6285 val="$undef"
6286 if $test -d /dev/fd; then
6287         echo "#!$ls" >reflect
6288         chmod +x,u+s reflect
6289         ./reflect >flect 2>&1
6290         if $contains "/dev/fd" flect >/dev/null; then
6291                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6292                 val="$define"
6293         else
6294                 $cat <<EOM
6295 If you are not sure if they are secure, I can check but I'll need a
6296 username and password different from the one you are using right now.
6297 If you don't have such a username or don't want me to test, simply
6298 enter 'none'.
6299
6300 EOM
6301                 rp='Other username to test security of setuid scripts with?'
6302                 dflt='none'
6303                 . ./myread
6304                 case "$ans" in
6305                 n|none)
6306                         case "$d_suidsafe" in
6307                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6308                                 dflt=n;;
6309                         "$undef")
6310                                 echo "Well, the $hint value is *not* secure." >&4
6311                                 dflt=n;;
6312                         *)      echo "Well, the $hint value *is* secure." >&4
6313                                 dflt=y;;
6314                         esac
6315                         ;;
6316                 *)
6317                         $rm -f reflect flect
6318                         echo "#!$ls" >reflect
6319                         chmod +x,u+s reflect
6320                         echo >flect
6321                         chmod a+w flect
6322                         echo '"su" will (probably) prompt you for '"$ans's password."
6323                         su $ans -c './reflect >flect'
6324                         if $contains "/dev/fd" flect >/dev/null; then
6325                                 echo "Okay, it looks like setuid scripts are secure." >&4
6326                                 dflt=y
6327                         else
6328                                 echo "I don't think setuid scripts are secure." >&4
6329                                 dflt=n
6330                         fi
6331                         ;;
6332                 esac
6333                 rp='Does your kernel have *secure* setuid scripts?'
6334                 . ./myread
6335                 case "$ans" in
6336                 [yY]*)  val="$define";;
6337                 *)      val="$undef";;
6338                 esac
6339         fi
6340 else
6341         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6342         echo "(That's for file descriptors, not floppy disks.)"
6343         val="$undef"
6344 fi
6345 set d_suidsafe
6346 eval $setvar
6347
6348 $rm -f reflect flect
6349
6350 : now see if they want to do setuid emulation
6351 echo " "
6352 val="$undef"
6353 case "$d_suidsafe" in
6354 "$define")
6355         val="$undef"
6356         echo "No need to emulate SUID scripts since they are secure here." >&4
6357         ;;
6358 *)
6359         $cat <<EOM
6360 Some systems have disabled setuid scripts, especially systems where
6361 setuid scripts cannot be secure.  On systems where setuid scripts have
6362 been disabled, the setuid/setgid bits on scripts are currently
6363 useless.  It is possible for $package to detect those bits and emulate
6364 setuid/setgid in a secure fashion.  This emulation will only work if
6365 setuid scripts have been disabled in your kernel.
6366
6367 EOM
6368         case "$d_dosuid" in
6369         "$define") dflt=y ;;
6370         *) dflt=n ;;
6371         esac
6372         rp="Do you want to do setuid/setgid emulation?"
6373         . ./myread
6374         case "$ans" in
6375         [yY]*)  val="$define";;
6376         *)      val="$undef";;
6377         esac
6378         ;;
6379 esac
6380 set d_dosuid
6381 eval $setvar
6382
6383 : Find perl5.005 or later.
6384 echo "Looking for a previously installed perl5.005 or later... "
6385 case "$perl5" in
6386 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6387                 : Check if this perl is recent and can load a simple module
6388                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6389                         perl5=$tdir/perl
6390                         break;
6391                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6392                         perl5=$tdir/perl5
6393                         break;
6394                 fi
6395         done
6396         ;;
6397 *)      perl5="$perl5"
6398         ;;
6399 esac
6400 case "$perl5" in
6401 '')     echo "None found.  That's ok.";;
6402 *)      echo "Using $perl5." ;;
6403 esac
6404
6405 : Set the siteprefix variables
6406 $cat <<EOM
6407
6408 After $package is installed, you may wish to install various
6409 add-on modules and utilities.  Typically, these add-ons will
6410 be installed under $prefix with the rest
6411 of this package.  However, you may wish to install such add-ons
6412 elsewhere under a different prefix.
6413
6414 If you do not wish to put everything under a single prefix, that's
6415 ok.  You will be prompted for the individual locations; this siteprefix
6416 is only used to suggest the defaults.
6417
6418 The default should be fine for most people.
6419
6420 EOM
6421 fn=d~+
6422 rp='Installation prefix to use for add-on modules and utilities?'
6423 : XXX Here might be another good place for an installstyle setting.
6424 case "$siteprefix" in
6425 '') dflt=$prefix ;;
6426 *)  dflt=$siteprefix ;;
6427 esac
6428 . ./getfile
6429 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6430 oldsiteprefix=''
6431 case "$siteprefix" in
6432 '') ;;
6433 *)      case "$ans" in
6434         "$prefix") ;;
6435         *) oldsiteprefix="$prefix";;
6436         esac
6437         ;;
6438 esac
6439 siteprefix="$ans"
6440 siteprefixexp="$ansexp"
6441
6442 : determine where site specific libraries go.
6443 : Usual default is /usr/local/lib/perl5/site_perl/$version
6444 : The default "style" setting is made in installstyle.U
6445 : XXX No longer works with Prefixit stuff.
6446 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6447 case "$sitelib" in
6448 '') case "$installstyle" in
6449         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6450         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6451         esac
6452         ;;
6453 *)      dflt="$sitelib"
6454         ;;
6455 esac
6456 $cat <<EOM
6457
6458 The installation process will create a directory for
6459 site-specific extensions and modules.  Most users find it convenient
6460 to place all site-specific files in this directory rather than in the
6461 main distribution directory.
6462
6463 EOM
6464 fn=d~+
6465 rp='Pathname for the site-specific library files?'
6466 . ./getfile
6467 prefixvar=sitelib
6468 . ./setprefixvar
6469 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6470
6471 : Determine list of previous versions to include in @INC
6472 $cat > getverlist <<EOPL
6473 #!$perl5 -w
6474 use File::Basename;
6475 \$api_versionstring = "$api_versionstring";
6476 \$version = "$version";
6477 \$stem = "$sitelib_stem";
6478 \$archname = "$archname";
6479 EOPL
6480         $cat >> getverlist <<'EOPL'
6481 # The list found is store twice for each entry: the original name, and
6482 # the binary broken down version as pack "sss", so sorting is easy and
6483 # unambiguous. This will work for all versions that have a maximum of
6484 # three digit groups, separate by '.'s or '_'s. Names are extended with
6485 # ".0.0" to ensure at least three elements for the pack.
6486 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6487
6488 # Can't have leading @ because metaconfig interprets it as a command!
6489 ;@inc_version_list=();
6490 # XXX Redo to do opendir/readdir?
6491 if (-d $stem) {
6492     chdir($stem);
6493     ;@candidates = map {
6494         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6495 }
6496 else {
6497     ;@candidates = ();
6498 }
6499
6500 ($pversion, $aversion, $vsn5005) = map {
6501     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6502 foreach $d (@candidates) {
6503     if ($d->[1] lt $pversion) {
6504         if ($d->[1] ge $aversion) {
6505             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6506         }
6507         elsif ($d->[1] ge $vsn5005) {
6508             unshift(@inc_version_list, grep { -d } $d->[0]);
6509         }
6510     }
6511     else {
6512         # Skip newer version.  I.e. don't look in
6513         # 5.7.0 if we're installing 5.6.1.
6514     }
6515 }
6516
6517 if (@inc_version_list) {
6518     print join(' ', @inc_version_list);
6519 }
6520 else {
6521     # Blank space to preserve value for next Configure run.
6522     print " ";
6523 }
6524 EOPL
6525 chmod +x getverlist
6526 case "$inc_version_list" in
6527 '')     if test -x "$perl5$exe_ext"; then
6528                 dflt=`$perl5 getverlist`
6529         else
6530                 dflt='none'
6531         fi
6532         ;;
6533 $undef) dflt='none' ;;
6534 *)  eval dflt=\"$inc_version_list\" ;;
6535 esac
6536 case "$dflt" in
6537 ''|' ') dflt=none ;;
6538 esac
6539 case "$dflt" in
6540 5.005) dflt=none ;;
6541 esac
6542 $cat <<EOM
6543
6544 In order to ease the process of upgrading, this version of perl
6545 can be configured to use modules built and installed with earlier
6546 versions of perl that were installed under $prefix.  Specify here
6547 the list of earlier versions that this version of perl should check.
6548 If Configure detected no earlier versions of perl installed under
6549 $prefix, then the list will be empty.  Answer 'none' to tell perl
6550 to not search earlier versions.
6551
6552 The default should almost always be sensible, so if you're not sure,
6553 just accept the default.
6554 EOM
6555
6556 rp='List of earlier versions to include in @INC?'
6557 . ./myread
6558 case "$ans" in
6559 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6560 *) inc_version_list="$ans" ;;
6561 esac
6562 case "$inc_version_list" in
6563 ''|' ')
6564         inc_version_list_init='0'
6565         d_inc_version_list="$undef"
6566         ;;
6567 *)      inc_version_list_init=`echo $inc_version_list |
6568                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6569         d_inc_version_list="$define"
6570         ;;
6571 esac
6572 $rm -f getverlist
6573
6574 : see if malloc/malloc.h has to be included
6575 set malloc/malloc.h i_mallocmalloc
6576 eval $inhdr
6577
6578 : see if this is a malloc.h system
6579 : we want a real compile instead of Inhdr because some systems have a
6580 : malloc.h that just gives a compile error saying to use stdlib.h instead
6581 echo " "
6582 $cat >try.c <<EOCP
6583 #include <stdlib.h>
6584 #include <malloc.h>
6585 #$i_mallocmalloc I_MALLOCMALLOC
6586 #ifdef I_MALLOCMALLOC
6587 # include <malloc/malloc.h>
6588 #endif
6589
6590 int main () { return 0; }
6591 EOCP
6592 set try
6593 if eval $compile; then
6594     echo "<malloc.h> found." >&4
6595     val="$define"
6596 else
6597     echo "<malloc.h> NOT found." >&4
6598     val="$undef"
6599 fi
6600 $rm_try
6601 set i_malloc
6602 eval $setvar
6603
6604 : check for void type
6605 echo " "
6606 echo "Checking to see how well your C compiler groks the void type..." >&4
6607 case "$voidflags" in
6608 '')
6609         $cat >try.c <<EOCP
6610 #$i_stdlib I_STDLIB
6611 #ifdef I_STDLIB
6612 #include <stdlib.h>
6613 #endif
6614 #if TRY & 1
6615 void sub() {
6616 #else
6617 sub() {
6618 #endif
6619         extern void moo();      /* function returning void */
6620         void (*goo)();          /* ptr to func returning void */
6621 #if TRY & 8
6622         void *hue;              /* generic ptr */
6623 #endif
6624 #if TRY & 2
6625         void (*foo[10])();
6626 #endif
6627
6628 #if TRY & 4
6629         if(goo == moo) {
6630                 exit(0);
6631         }
6632 #endif
6633         exit(0);
6634 }
6635 int main() { sub(); }
6636 EOCP
6637         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6638                 voidflags=$defvoidused
6639         echo "Good.  It appears to support void to the level $package wants.">&4
6640                 if $contains warning .out >/dev/null 2>&1; then
6641                         echo "However, you might get some warnings that look like this:"
6642                         $cat .out
6643                 fi
6644         else
6645 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6646                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6647                         echo "It supports 1..."
6648                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6649                                 echo "It also supports 2..."
6650                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6651                                         voidflags=7
6652                                         echo "And it supports 4 but not 8 definitely."
6653                                 else
6654                                         echo "It doesn't support 4..."
6655                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6656                                                 voidflags=11
6657                                                 echo "But it supports 8."
6658                                         else
6659                                                 voidflags=3
6660                                                 echo "Neither does it support 8."
6661                                         fi
6662                                 fi
6663                         else
6664                                 echo "It does not support 2..."
6665                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6666                                         voidflags=13
6667                                         echo "But it supports 4 and 8."
6668                                 else
6669                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6670                                                 voidflags=5
6671                                                 echo "And it supports 4 but has not heard about 8."
6672                                         else
6673                                                 echo "However it supports 8 but not 4."
6674                                         fi
6675                                 fi
6676                         fi
6677                 else
6678                         echo "There is no support at all for void."
6679                         voidflags=0
6680                 fi
6681         fi
6682 esac
6683 case "$voidflags" in
6684 "$defvoidused") ;;
6685 *)      $cat >&4 <<'EOM'
6686   Support flag bits are:
6687     1: basic void declarations.
6688     2: arrays of pointers to functions returning void.
6689     4: operations between pointers to and addresses of void functions.
6690     8: generic void pointers.
6691 EOM
6692         dflt="$voidflags";
6693         rp="Your void support flags add up to what?"
6694         . ./myread
6695         voidflags="$ans"
6696         ;;
6697 esac
6698 $rm_try
6699
6700 : check for length of pointer
6701 echo " "
6702 case "$ptrsize" in
6703 '')
6704         echo "Checking to see how big your pointers are..." >&4
6705         if test "$voidflags" -gt 7; then
6706                 echo '#define VOID_PTR char *' > try.c
6707         else
6708                 echo '#define VOID_PTR void *' > try.c
6709         fi
6710         $cat >>try.c <<EOCP
6711 #include <stdio.h>
6712 #$i_stdlib I_STDLIB
6713 #ifdef I_STDLIB
6714 #include <stdlib.h>
6715 #endif
6716 int main()
6717 {
6718     printf("%d\n", (int)sizeof(VOID_PTR));
6719     exit(0);
6720 }
6721 EOCP
6722         set try
6723         if eval $compile_ok; then
6724                 ptrsize=`$run ./try`
6725                 echo "Your pointers are $ptrsize bytes long."
6726         else
6727                 dflt='4'
6728                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6729                 rp="What is the size of a pointer (in bytes)?"
6730                 . ./myread
6731                 ptrsize="$ans"
6732         fi
6733         ;;
6734 esac
6735 $rm_try
6736 case "$use64bitall" in
6737 "$define"|true|[yY]*)
6738         case "$ptrsize" in
6739         4)      cat <<EOM >&4
6740
6741 *** You have chosen a maximally 64-bit build,
6742 *** but your pointers are only 4 bytes wide.
6743 *** Please rerun Configure without -Duse64bitall.
6744 EOM
6745                 case "$d_quad" in
6746                 define)
6747                         cat <<EOM >&4
6748 *** Since you have quads, you could possibly try with -Duse64bitint.
6749 EOM
6750                         ;;
6751                 esac
6752                 cat <<EOM >&4
6753 *** Cannot continue, aborting.
6754
6755 EOM
6756
6757                 exit 1
6758                 ;;
6759         esac
6760         ;;
6761 esac
6762
6763
6764 : determine whether to use malloc wrapping
6765 echo " "
6766 case "$usemallocwrap" in
6767 [yY]*|true|$define)     dflt='y' ;;
6768 [nN]*|false|$undef)     dflt='n' ;;
6769 *)      case "$usedevel" in
6770         [yY]*|true|$define)     dflt='y' ;;
6771         *) dflt='n' ;;
6772         esac
6773         ;;
6774 esac
6775 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6776 . ./myread
6777 usemallocwrap="$ans"
6778 case "$ans" in
6779 y*|true)
6780         usemallocwrap="$define" ;;
6781 *)
6782         usemallocwrap="$undef" ;;
6783 esac
6784
6785 : determine which malloc to compile in
6786 echo " "
6787 case "$usemymalloc" in
6788 [yY]*|true|$define)     dflt='y' ;;
6789 [nN]*|false|$undef)     dflt='n' ;;
6790 *)      case "$ptrsize" in
6791         4) dflt='y' ;;
6792         *) dflt='n' ;;
6793         esac
6794         ;;
6795 esac
6796 rp="Do you wish to attempt to use the malloc that comes with $package?"
6797 . ./myread
6798 usemymalloc="$ans"
6799 case "$ans" in
6800 y*|true)
6801         usemymalloc='y'
6802         mallocsrc='malloc.c'
6803         mallocobj="malloc$_o"
6804         d_mymalloc="$define"
6805         case "$libs" in
6806         *-lmalloc*)
6807                 : Remove malloc from list of libraries to use
6808                 echo "Removing unneeded -lmalloc from library list" >&4
6809                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6810                 shift
6811                 libs="$*"
6812                 echo "libs = $libs" >&4
6813                 ;;
6814         esac
6815         ;;
6816 *)
6817         usemymalloc='n'
6818         mallocsrc=''
6819         mallocobj=''
6820         d_mymalloc="$undef"
6821         ;;
6822 esac
6823
6824 : compute the return types of malloc and free
6825 echo " "
6826 $cat >malloc.c <<END
6827 #$i_malloc I_MALLOC
6828 #$i_stdlib I_STDLIB
6829 #include <stdio.h>
6830 #include <sys/types.h>
6831 #ifdef I_MALLOC
6832 #include <malloc.h>
6833 #endif
6834 #ifdef I_STDLIB
6835 #include <stdlib.h>
6836 #endif
6837 #ifdef TRY_MALLOC
6838 void *malloc();
6839 #endif
6840 #ifdef TRY_FREE
6841 void free();
6842 #endif
6843 END
6844 case "$malloctype" in
6845 '')
6846         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6847                 malloctype='void *'
6848         else
6849                 malloctype='char *'
6850         fi
6851         ;;
6852 esac
6853 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6854
6855 case "$freetype" in
6856 '')
6857         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6858                 freetype='void'
6859         else
6860                 freetype='int'
6861         fi
6862         ;;
6863 esac
6864 echo "Your system uses $freetype free(), it would seem." >&4
6865 $rm -f malloc.[co]
6866 : determine where site specific architecture-dependent libraries go.
6867 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6868 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6869 : sitelib may have an optional trailing /share.
6870 case "$sitearch" in
6871 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6872         dflt="$dflt/$archname"
6873         ;;
6874 *)      dflt="$sitearch"
6875         ;;
6876 esac
6877 set sitearch sitearch none
6878 eval $prefixit
6879 $cat <<EOM
6880
6881 The installation process will also create a directory for
6882 architecture-dependent site-specific extensions and modules.
6883
6884 EOM
6885 fn=d~+
6886 rp='Pathname for the site-specific architecture-dependent library files?'
6887 . ./getfile
6888 prefixvar=sitearch
6889 . ./setprefixvar
6890 if $test X"$sitearch" = X"$sitelib"; then
6891         d_sitearch="$undef"
6892 else
6893         d_sitearch="$define"
6894 fi
6895
6896 : Set the vendorprefix variables
6897 $cat <<EOM
6898
6899 The installation process will also create a directory for
6900 vendor-supplied add-ons.  Vendors who supply perl with their system
6901 may find it convenient to place all vendor-supplied files in this
6902 directory rather than in the main distribution directory.  This will
6903 ease upgrades between binary-compatible maintenance versions of perl.
6904
6905 Of course you may also use these directories in whatever way you see
6906 fit.  For example, you might use them to access modules shared over a
6907 company-wide network.
6908
6909 The default answer should be fine for most people.
6910 This causes further questions about vendor add-ons to be skipped
6911 and no vendor-specific directories will be configured for perl.
6912
6913 EOM
6914 rp='Do you want to configure vendor-specific add-on directories?'
6915 case "$usevendorprefix" in
6916 define|true|[yY]*) dflt=y ;;
6917 *)      : User may have set vendorprefix directly on Configure command line.
6918         case "$vendorprefix" in
6919         ''|' ') dflt=n ;;
6920         *)      dflt=y ;;
6921         esac
6922         ;;
6923 esac
6924 . ./myread
6925 case "$ans" in
6926 [yY]*)  fn=d~+
6927         rp='Installation prefix to use for vendor-supplied add-ons?'
6928         case "$vendorprefix" in
6929         '') dflt='' ;;
6930         *)  dflt=$vendorprefix ;;
6931         esac
6932         . ./getfile
6933         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6934         oldvendorprefix=''
6935         case "$vendorprefix" in
6936         '') ;;
6937         *)      case "$ans" in
6938                 "$prefix") ;;
6939                 *) oldvendorprefix="$prefix";;
6940                 esac
6941                 ;;
6942         esac
6943         usevendorprefix="$define"
6944         vendorprefix="$ans"
6945         vendorprefixexp="$ansexp"
6946         ;;
6947 *)      usevendorprefix="$undef"
6948         vendorprefix=''
6949         vendorprefixexp=''
6950         ;;
6951 esac
6952
6953 : Set the vendorlib variables
6954 case "$vendorprefix" in
6955 '')     d_vendorlib="$undef"
6956         vendorlib=''
6957         vendorlibexp=''
6958         ;;
6959 *)      d_vendorlib="$define"
6960         : determine where vendor-supplied modules go.
6961         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6962         case "$vendorlib" in
6963         '')
6964                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6965                 case "$installstyle" in
6966                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6967                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6968                 esac
6969                 ;;
6970         *)      dflt="$vendorlib"
6971                 ;;
6972         esac
6973         fn=d~+
6974         rp='Pathname for the vendor-supplied library files?'
6975         . ./getfile
6976         vendorlib="$ans"
6977         vendorlibexp="$ansexp"
6978         ;;
6979 esac
6980 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6981 prefixvar=vendorlib
6982 . ./installprefix
6983
6984 : Set the vendorarch variables
6985 case "$vendorprefix" in
6986 '')     d_vendorarch="$undef"
6987         vendorarch=''
6988         vendorarchexp=''
6989         ;;
6990 *)      d_vendorarch="$define"
6991         : determine where vendor-supplied architecture-dependent libraries go.
6992         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6993         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6994         : vendorlib may have an optional trailing /share.
6995         case "$vendorarch" in
6996         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6997                 dflt="$dflt/$archname"
6998                 ;;
6999         *)      dflt="$vendorarch" ;;
7000         esac
7001         fn=d~+
7002         rp='Pathname for vendor-supplied architecture-dependent files?'
7003         . ./getfile
7004         vendorarch="$ans"
7005         vendorarchexp="$ansexp"
7006         ;;
7007 esac
7008 prefixvar=vendorarch
7009 . ./installprefix
7010
7011 : Final catch-all directories to search
7012 $cat <<EOM
7013
7014 Lastly, you can have perl look in other directories for extensions and
7015 modules in addition to those already specified.
7016 These directories will be searched after 
7017         $sitearch 
7018         $sitelib 
7019 EOM
7020 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7021 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7022 echo ' '
7023 case "$otherlibdirs" in
7024 ''|' ') dflt='none' ;;
7025 *)      dflt="$otherlibdirs" ;;
7026 esac
7027 $cat <<EOM
7028 Enter a colon-separated set of extra paths to include in perl's @INC
7029 search path, or enter 'none' for no extra paths.
7030
7031 EOM
7032
7033 rp='Colon-separated list of additional directories for perl to search?'
7034 . ./myread
7035 case "$ans" in
7036 ' '|''|none)    otherlibdirs=' ' ;;     
7037 *)      otherlibdirs="$ans" ;;
7038 esac
7039 case "$otherlibdirs" in
7040 ' ') val=$undef ;;
7041 *)      val=$define ;;
7042 esac
7043 set d_perl_otherlibdirs
7044 eval $setvar
7045
7046 : Cruising for prototypes
7047 echo " "
7048 echo "Checking out function prototypes..." >&4
7049 $cat >prototype.c <<EOCP
7050 #$i_stdlib I_STDLIB
7051 #ifdef I_STDLIB
7052 #include <stdlib.h>
7053 #endif
7054 int main(int argc, char *argv[]) {
7055         exit(0);}
7056 EOCP
7057 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7058         echo "Your C compiler appears to support function prototypes."
7059         val="$define"
7060 else
7061         echo "Your C compiler doesn't seem to understand function prototypes."
7062         val="$undef"
7063 fi
7064 set prototype
7065 eval $setvar
7066 $rm -f prototype*
7067
7068 : Check if ansi2knr is required
7069 case "$prototype" in
7070 "$define") ;;
7071 *)      ansi2knr='ansi2knr'
7072         echo " "
7073         cat <<EOM >&4
7074
7075 $me:  FATAL ERROR:
7076 This version of $package can only be compiled by a compiler that 
7077 understands function prototypes.  Unfortunately, your C compiler 
7078         $cc $ccflags
7079 doesn't seem to understand them.  Sorry about that.
7080
7081 If GNU cc is available for your system, perhaps you could try that instead.  
7082
7083 Eventually, we hope to support building Perl with pre-ANSI compilers.
7084 If you would like to help in that effort, please contact <perlbug@perl.org>.
7085
7086 Aborting Configure now.
7087 EOM
7088         exit 2
7089         ;;
7090 esac
7091
7092 : DTrace support
7093 dflt_dtrace='/usr/sbin/dtrace'
7094 cat <<EOM
7095
7096 Perl can be built to support DTrace on platforms that support it.
7097 DTrace is a diagnosis and performance analysis tool from Sun.
7098
7099 If this doesn't make any sense to you, just accept the default '$dflt'.
7100 EOM
7101
7102 while $test 1 ; do
7103         case "$usedtrace" in
7104         $define|true|[yY]*)
7105                 dflt='y'
7106                 ;;
7107         ?*)
7108                 dflt='y'
7109                 dflt_dtrace=$usedtrace
7110                 ;;
7111         *)
7112                 dflt='n'
7113                 ;;
7114         esac
7115
7116         rp='Support DTrace if available?'
7117         . ./myread
7118         case "$ans" in
7119         y|Y)    val="$define" ;;
7120         *)      val="$undef" ;;
7121         esac
7122         set usedtrace
7123         eval $setvar
7124
7125         test "X$usedtrace" != "X$define" && break
7126
7127         echo " "
7128         rp='Where is the dtrace executable?'
7129         dflt=$dflt_dtrace
7130         . ./getfile
7131         val="$ans"
7132         set dtrace
7133         eval $setvar
7134
7135         if $test -f $dtrace
7136         then
7137                 if $dtrace -h -s ../perldtrace.d \
7138                         -o perldtrace.tmp >/dev/null 2>&1 \
7139                         && rm -f perldtrace.tmp
7140                 then
7141                         echo " "
7142                         echo "Good: your $dtrace knows about the -h flag."
7143                 else
7144                         cat >&2 <<EOM
7145
7146 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7147 ***
7148 *** Your installed dtrace doesn't support the -h switch to compile a D
7149 *** program into a C header. Can't continue.
7150
7151 EOM
7152                         exit 1
7153                 fi
7154                 break;
7155         fi
7156
7157         case "$fastread" in
7158         yes)
7159                 cat >&2 <<EOM
7160
7161 *** $me:  Fatal Error:  $dtrace not found.
7162 *** Can't continue.
7163
7164 EOM
7165                 exit 1
7166                 ;;
7167         *)
7168                 echo "*** $dtrace was not found."
7169                 echo " "
7170                 ;;
7171         esac
7172 done
7173
7174 : See if we want extra modules installed
7175 echo " "
7176 case "$extras" in
7177 '') dflt='n';;
7178 *) dflt='y';;
7179 esac
7180 cat <<EOM
7181 Perl can be built with extra modules or bundles of modules which
7182 will be fetched from the CPAN and installed alongside Perl.
7183
7184 Notice that you will need access to the CPAN; either via the Internet,
7185 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7186 be asked later to configure the CPAN.pm module which will in turn do
7187 the installation of the rest of the extra modules or bundles.)
7188
7189 Notice also that if the modules require any external software such as
7190 libraries and headers (the libz library and the zlib.h header for the
7191 Compress::Zlib module, for example) you MUST have any such software
7192 already installed, this configuration process will NOT install such
7193 things for you.
7194
7195 If this doesn't make any sense to you, just accept the default '$dflt'.
7196 EOM
7197 rp='Install any extra modules (y or n)?'
7198 . ./myread
7199 case "$ans" in
7200 y|Y)
7201         cat <<EOM
7202
7203 Please list any extra modules or bundles to be installed from CPAN,
7204 with spaces between the names.  The names can be in any format the
7205 'install' command of CPAN.pm will understand.  (Answer 'none',
7206 without the quotes, to install no extra modules or bundles.)
7207 EOM
7208         rp='Extras?'
7209         dflt="$extras"
7210         . ./myread
7211         extras="$ans"
7212 esac
7213 case "$extras" in
7214 ''|'none')
7215         val=''
7216         $rm -f ../extras.lst
7217         ;;
7218 *)      echo "(Saving the list of extras for later...)"
7219         echo "$extras" > ../extras.lst
7220         val="'$extras'"
7221         ;;
7222 esac
7223 set extras
7224 eval $setvar
7225 echo " "
7226
7227 : determine where html pages for programs go
7228 set html1dir html1dir none
7229 eval $prefixit
7230 $cat <<EOM
7231
7232 If you wish to install html files for programs in $spackage, indicate
7233 the appropriate directory here.  To skip installing html files,
7234 answer "none".
7235 EOM
7236 case "$html1dir" in
7237 ''|none|$undef|' ') dflt=none ;;
7238 *) dflt=$html1dir ;;
7239 esac
7240 fn=dn+~
7241 rp="Directory for the main $spackage html pages?"
7242 . ./getfile
7243 prefixvar=html1dir
7244 . ./setprefixvar
7245 : Use ' ' for none so value is preserved next time through Configure
7246 $test X"$html1dir" = "X" && html1dir=' '
7247
7248 : determine where html pages for libraries and modules go
7249 set html3dir html3dir none
7250 eval $prefixit
7251 $cat <<EOM
7252
7253 If you wish to install html files for modules associated with $spackage,
7254 indicate the appropriate directory here.  To skip installing html files,
7255 answer "none".
7256 EOM
7257 : There is no obvious default.  If they have specified html1dir, then
7258 : try to key off that, possibly changing .../html1 into .../html3.
7259 case "$html3dir" in
7260 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7261 *) dflt=$html3dir ;;
7262 esac
7263 fn=dn+~
7264 rp="Directory for the $spackage module html pages?"
7265 . ./getfile
7266 prefixvar=html3dir
7267 . ./setprefixvar
7268 : Use ' ' for none so value is preserved next time through Configure
7269 $test X"$html3dir" = "X" && html3dir=' '
7270
7271 : determine whether to install perl also as /usr/bin/perl
7272
7273 echo " "
7274 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7275         $cat <<EOM
7276 Many scripts expect perl to be installed as /usr/bin/perl.
7277
7278 If you want to, I can install the perl you are about to compile
7279 as /usr/bin/perl (in addition to $bin/perl).
7280 EOM
7281         if test -f /usr/bin/perl; then
7282             $cat <<EOM
7283
7284 However, please note that because you already have a /usr/bin/perl,
7285 overwriting that with a new Perl would very probably cause problems.
7286 Therefore I'm assuming you don't want to do that (unless you insist).
7287
7288 EOM
7289             case "$installusrbinperl" in
7290             "$define"|[yY]*)    dflt='y';;
7291             *)                  dflt='n';;
7292             esac
7293         else
7294             $cat <<EOM
7295
7296 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7297
7298 EOM
7299             case "$installusrbinperl" in
7300             "$undef"|[nN]*)     dflt='n';;
7301             *)                  dflt='y';;
7302             esac
7303         fi
7304         rp="Do you want to install perl as /usr/bin/perl?"
7305         . ./myread
7306         case "$ans" in
7307         [yY]*)  val="$define";;
7308         *)      val="$undef" ;;
7309         esac
7310 else
7311         val="$undef"
7312 fi
7313 set installusrbinperl
7314 eval $setvar
7315
7316 : Check if we are using the GNU C library
7317 echo " "
7318 echo "Checking for GNU C Library..." >&4
7319 cat >try.c <<'EOCP'
7320 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7321    alone are insufficient to distinguish different versions, such as
7322    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7323    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7324 */
7325 #include <stdio.h>
7326 int main(void)
7327 {
7328 #ifdef __GLIBC__
7329 #   ifdef __GLIBC_MINOR__
7330 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7331 #           include <gnu/libc-version.h>
7332             printf("%s\n",  gnu_get_libc_version());
7333 #       else
7334             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7335 #       endif
7336 #   else
7337         printf("%d\n",  __GLIBC__);
7338 #   endif
7339     return 0;
7340 #else
7341     return 1;
7342 #endif
7343 }
7344 EOCP
7345 set try
7346 if eval $compile_ok && $run ./try > glibc.ver; then
7347         val="$define"
7348         gnulibc_version=`$cat glibc.ver`
7349         echo "You are using the GNU C Library version $gnulibc_version"
7350 else
7351         val="$undef"
7352         gnulibc_version=''
7353         echo "You are not using the GNU C Library"
7354 fi
7355 $rm_try glibc.ver
7356 set d_gnulibc
7357 eval $setvar
7358
7359 : see if nm is to be used to determine whether a symbol is defined or not
7360 case "$usenm" in
7361 '')
7362         dflt=''
7363         case "$d_gnulibc" in
7364         "$define")
7365                 echo " "
7366                 echo "nm probably won't work on the GNU C Library." >&4
7367                 dflt=n
7368                 ;;
7369         esac
7370         case "$dflt" in
7371         '') 
7372                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7373                         echo " "
7374                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7375                         echo "'nm' won't be sufficient on this sytem." >&4
7376                         dflt=n
7377                 fi
7378                 ;;
7379         esac
7380         case "$dflt" in
7381         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7382                 if $test $dflt -gt 20; then
7383                         dflt=y
7384                 else
7385                         dflt=n
7386                 fi
7387                 ;;
7388         esac
7389         ;;
7390 *)
7391         case "$usenm" in
7392         true|$define) dflt=y;;
7393         *) dflt=n;;
7394         esac
7395         ;;
7396 esac
7397 $cat <<EOM
7398
7399 I can use $nm to extract the symbols from your C libraries. This
7400 is a time consuming task which may generate huge output on the disk (up
7401 to 3 megabytes) but that should make the symbols extraction faster. The
7402 alternative is to skip the 'nm' extraction part and to compile a small
7403 test program instead to determine whether each symbol is present. If
7404 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7405 this may be the best solution.
7406
7407 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7408
7409 EOM
7410 rp="Shall I use $nm to extract C symbols from the libraries?"
7411 . ./myread
7412 case "$ans" in
7413 [Nn]*) usenm=false;;
7414 *) usenm=true;;
7415 esac
7416
7417 runnm=$usenm
7418 case "$reuseval" in
7419 true) runnm=false;;
7420 esac
7421
7422 : nm options which may be necessary
7423 case "$nm_opt" in
7424 '') if $test -f /mach_boot; then
7425                 nm_opt=''       # Mach
7426         elif $test -d /usr/ccs/lib; then
7427                 nm_opt='-p'     # Solaris (and SunOS?)
7428         elif $test -f /dgux; then
7429                 nm_opt='-p'     # DG-UX
7430         elif $test -f /lib64/rld; then
7431                 nm_opt='-p'     # 64-bit Irix
7432         else
7433                 nm_opt=''
7434         fi;;
7435 esac
7436
7437 : nm options which may be necessary for shared libraries but illegal
7438 : for archive libraries.  Thank you, Linux.
7439 case "$nm_so_opt" in
7440 '')     case "$myuname" in
7441         *linux*|gnu*)
7442                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7443                         nm_so_opt='--dynamic'
7444                 fi
7445                 ;;
7446         esac
7447         ;;
7448 esac
7449
7450 : Figure out where the libc is located
7451 case "$runnm" in
7452 true)
7453 : get list of predefined functions in a handy place
7454 echo " "
7455 case "$libc" in
7456 '') libc=unknown
7457         case "$libs" in
7458         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7459         esac
7460         ;;
7461 esac
7462 case "$libs" in
7463 '') ;;
7464 *)  for thislib in $libs; do
7465         case "$thislib" in
7466         -lc|-lc_s)
7467                 : Handle C library specially below.
7468                 ;;
7469         -l*)
7470                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7471                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7472                         :
7473                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7474                         :
7475                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7476                         :
7477                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7478                         :
7479                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7480                         :
7481                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7482                         :
7483                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7484                         :
7485                 else
7486                         try=''
7487                 fi
7488                 libnames="$libnames $try"
7489                 ;;
7490         *) libnames="$libnames $thislib" ;;
7491         esac
7492         done
7493         ;;
7494 esac
7495 xxx=normal
7496 case "$libc" in
7497 unknown)
7498         set /lib/libc.$so
7499         for xxx in $libpth; do
7500                 $test -r $1 || set $xxx/libc.$so
7501                 : The messy sed command sorts on library version numbers.
7502                 $test -r $1 || \
7503                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7504                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7505                                 h
7506                                 s/[0-9][0-9]*/0000&/g
7507                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7508                                 G
7509                                 s/\n/ /' | \
7510                          $sort | $sed -e 's/^.* //'`
7511                 eval set \$$#
7512         done
7513         $test -r $1 || set /usr/ccs/lib/libc.$so
7514         $test -r $1 || set /lib/libsys_s$_a
7515         ;;
7516 *)
7517         set blurfl
7518         ;;
7519 esac
7520 if $test -r "$1"; then
7521         echo "Your (shared) C library seems to be in $1."
7522         libc="$1"
7523 elif $test -r /lib/libc && $test -r /lib/clib; then
7524         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7525         xxx=apollo
7526         libc='/lib/clib /lib/libc'
7527         if $test -r /lib/syslib; then
7528                 echo "(Your math library is in /lib/syslib.)"
7529                 libc="$libc /lib/syslib"
7530         fi
7531 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7532         echo "Your C library seems to be in $libc, as you said before."
7533 elif $test -r $incpath/usr/lib/libc$_a; then
7534         libc=$incpath/usr/lib/libc$_a;
7535         echo "Your C library seems to be in $libc.  That's fine."
7536 elif $test -r /lib/libc$_a; then
7537         libc=/lib/libc$_a;
7538         echo "Your C library seems to be in $libc.  You're normal."
7539 else
7540         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7541                 :
7542         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7543                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7544         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7545                 :
7546         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7547                 :
7548         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7549                 :
7550         else
7551                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7552         fi
7553         if $test -r "$tans"; then
7554                 echo "Your C library seems to be in $tans, of all places."
7555                 libc=$tans
7556         else
7557                 libc='blurfl'
7558         fi
7559 fi
7560 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561         dflt="$libc"
7562         cat <<EOM
7563
7564 If the guess above is wrong (which it might be if you're using a strange
7565 compiler, or your machine supports multiple models), you can override it here.
7566
7567 EOM
7568 else
7569         dflt=''
7570         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7571         cat >&4 <<EOM
7572 I can't seem to find your C library.  I've looked in the following places:
7573
7574 EOM
7575         $sed 's/^/      /' libpath
7576         cat <<EOM
7577
7578 None of these seems to contain your C library. I need to get its name...
7579
7580 EOM
7581 fi
7582 fn=f
7583 rp='Where is your C library?'
7584 . ./getfile
7585 libc="$ans"
7586
7587 echo " "
7588 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7589 set X `cat libnames`
7590 shift
7591 xxx=files
7592 case $# in 1) xxx=file; esac
7593 echo "Extracting names from the following $xxx for later perusal:" >&4
7594 echo " "
7595 $sed 's/^/      /' libnames >&4
7596 echo " "
7597 $echo $n "This may take a while...$c" >&4
7598
7599 for file in $*; do
7600         case $file in
7601         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7602         *) $nm $nm_opt $file 2>/dev/null;;
7603         esac
7604 done >libc.tmp
7605
7606 $echo $n ".$c"
7607 $grep fprintf libc.tmp > libc.ptf
7608 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7609 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7610 xxx='[ADTSIW]'
7611 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7636                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 else
7669         $nm -p $* 2>/dev/null >libc.tmp
7670         $grep fprintf libc.tmp > libc.ptf
7671         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7672                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7673         then
7674                 nm_opt='-p'
7675                 eval $xrun
7676         else
7677                 echo " "
7678                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7679                 com=''
7680                 if $ar t $libc > libc.tmp && \
7681                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7682                 then
7683                         for thisname in $libnames $libc; do
7684                                 $ar t $thisname >>libc.tmp
7685                         done
7686                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7687                         echo "Ok." >&4
7688                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7689                         for thisname in $libnames $libc; do
7690                                 $ar tv $thisname >>libc.tmp
7691                                 emximp -o tmp.imp $thisname \
7692                                     2>/dev/null && \
7693                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7694                                     < tmp.imp >>libc.tmp
7695                                 $rm -f tmp.imp
7696                         done
7697                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7698                         echo "Ok." >&4
7699                 else
7700                         echo "$ar didn't seem to work right." >&4
7701                         echo "Maybe this is a Cray...trying bld instead..." >&4
7702                         if  bld t $libc | \
7703                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7704                                 $test -s libc.list
7705                         then
7706                                 for thisname in $libnames; do
7707                                         bld t $libnames | \
7708                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7709                                         $ar t $thisname >>libc.tmp
7710                                 done
7711                                 echo "Ok." >&4
7712                         else
7713                                 echo "That didn't work either.  Giving up." >&4
7714                                 exit 1
7715                         fi
7716                 fi
7717         fi
7718 fi
7719 nm_extract="$com"
7720 case "$PASE" in
7721 define)
7722     echo " "
7723     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7724     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7725     ;;
7726 *)  if $test -f /lib/syscalls.exp; then
7727         echo " "
7728         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7729         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7730                 /lib/syscalls.exp >>libc.list
7731     fi
7732     ;;
7733 esac
7734 ;;
7735 esac
7736 $rm -f libnames libpath
7737
7738 : see if dld is available
7739 set dld.h i_dld
7740 eval $inhdr
7741
7742 : Check if we are using C++
7743 echo " "
7744 echo "Checking for C++..." >&4
7745 $cat >try.c <<'EOCP'
7746 #include <stdio.h>
7747 int main(void)
7748 {
7749 #ifdef __cplusplus
7750     return 0;
7751 #else
7752     return 1;
7753 #endif
7754 }
7755 EOCP
7756 set try
7757 if eval $compile_ok && $run ./try; then
7758         val="$define"
7759         echo "You are using a C++ compiler."
7760 else
7761         val="$undef"
7762         echo "You are not using a C++ compiler."
7763 fi
7764 $rm_try cplusplus$$
7765 set d_cplusplus
7766 eval $setvar
7767
7768 : is a C symbol defined?
7769 csym='tlook=$1;
7770 case "$3" in
7771 -v) tf=libc.tmp; tdc="";;
7772 -a) tf=libc.tmp; tdc="[]";;
7773 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7774 esac;
7775 tx=yes;
7776 case "$reuseval-$4" in
7777 true-) ;;
7778 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7779 esac;
7780 case "$tx" in
7781 yes)
7782         tval=false;
7783         case "$d_cplusplus" in
7784                 $define) extern_C=\"C\";;
7785         esac;
7786         if $test "$runnm" = true; then
7787                 if $contains $tlook $tf >/dev/null 2>&1; then
7788                         tval=true;
7789                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7790                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7791                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7792                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7793                         $rm_try;
7794                 fi;
7795         else
7796                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7797                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7798                 $rm_try;
7799         fi;
7800         ;;
7801 *)
7802         case "$tval" in
7803         $define) tval=true;;
7804         *) tval=false;;
7805         esac;
7806         ;;
7807 esac;
7808 eval "$2=$tval"'
7809
7810 : define an is-in-libc? function
7811 inlibc='echo " "; td=$define; tu=$undef;
7812 sym=$1; var=$2; eval "was=\$$2";
7813 tx=yes;
7814 case "$reuseval$was" in
7815 true) ;;
7816 true*) tx=no;;
7817 esac;
7818 case "$tx" in
7819 yes)
7820         set $sym tres -f;
7821         eval $csym;
7822         case "$tres" in
7823         true)
7824                 echo "$sym() found." >&4;
7825                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7826         *)
7827                 echo "$sym() NOT found." >&4;
7828                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7829         esac;;
7830 *)
7831         case "$was" in
7832         $define) echo "$sym() found." >&4;;
7833         *) echo "$sym() NOT found." >&4;;
7834         esac;;
7835 esac'
7836
7837 : see if dlopen exists
7838 xxx_runnm="$runnm"
7839 xxx_ccflags="$ccflags"
7840 runnm=false
7841 : with g++ one needs -shared to get is-in-libc to work for dlopen
7842 case "$gccversion" in
7843 '')     ;;
7844 *)      case "$d_cplusplus" in
7845         "$define") ccflags="$ccflags -shared" ;;
7846         esac
7847         ;;
7848 esac
7849 set dlopen d_dlopen
7850 eval $inlibc
7851 runnm="$xxx_runnm"
7852 ccflags="$xxx_ccflags"
7853
7854 : see if this is a unistd.h system
7855 set unistd.h i_unistd
7856 eval $inhdr
7857
7858 : determine which dynamic loading, if any, to compile in
7859 echo " "
7860 dldir="ext/DynaLoader"
7861 case "$usedl" in
7862 $define|y|true)
7863         dflt='y'
7864         usedl="$define"
7865         ;;
7866 $undef|n|false)
7867         dflt='n'
7868         usedl="$undef"
7869         ;;
7870 *)
7871         dflt='n'
7872         case "$d_dlopen" in
7873             $define) dflt='y' ;;
7874         esac
7875         case "$i_dld" in
7876             $define) dflt='y' ;;
7877         esac
7878         : Does a dl_xxx.xs file exist for this operating system
7879         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7880         ;;
7881 esac
7882 rp="Do you wish to use dynamic loading?"
7883 . ./myread
7884 usedl="$ans"
7885 case "$ans" in
7886 y*) usedl="$define"
7887         case "$dlsrc" in
7888         '')
7889                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7890                         dflt="$dldir/dl_${osname}.xs"
7891                 elif $test "$d_dlopen" = "$define" ; then
7892                         dflt="$dldir/dl_dlopen.xs"
7893                 elif $test "$i_dld" = "$define" ; then
7894                         dflt="$dldir/dl_dld.xs"
7895                 else
7896                         dflt=''
7897                 fi
7898                 ;;
7899         *)      dflt="$dldir/$dlsrc"
7900                 ;;
7901         esac
7902     echo "The following dynamic loading files are available:"
7903         : Can not go over to $dldir because getfile has path hard-coded in.
7904         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7905         rp="Source file to use for dynamic loading"
7906         fn="fne"
7907         gfpth="$src"
7908         . ./getfile
7909         usedl="$define"
7910         : emulate basename
7911         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7912
7913         $cat << EOM
7914
7915 Some systems may require passing special flags to $cc -c to
7916 compile modules that will be used to create a shared library.
7917 To use no flags, say "none".
7918
7919 EOM
7920     case "$cccdlflags" in
7921     '') case "$gccversion" in
7922                 '') case "$osname" in
7923                         hpux)   dflt='+z' ;;
7924                         next)   dflt='none' ;;
7925                         irix*)  dflt='-KPIC' ;;
7926                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7927                         sunos)  dflt='-pic' ;;
7928                         *)      dflt='none' ;;
7929                     esac
7930                         ;;
7931                 *)  case "$osname" in
7932                         darwin) dflt='none' ;;
7933                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7934                         *)      dflt='-fpic' ;;
7935                     esac ;;
7936             esac ;;
7937         ' ') dflt='none' ;;
7938     *)  dflt="$cccdlflags" ;;
7939     esac
7940     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7941     . ./myread
7942     case "$ans" in
7943     none) cccdlflags=' ' ;;
7944     *) cccdlflags="$ans" ;;
7945     esac
7946
7947     cat << EOM
7948
7949 Some systems use ld to create libraries that can be dynamically loaded,
7950 while other systems (such as those using ELF) use $cc.
7951
7952 EOM
7953         case "$ld" in
7954         '')     $cat >try.c <<EOM
7955 /* Test for whether ELF binaries are produced */
7956 #include <fcntl.h>
7957 #$i_stdlib I_STDLIB
7958 #ifdef I_STDLIB
7959 #include <stdlib.h>
7960 #endif
7961 #$i_unistd I_UNISTD
7962 #ifdef I_UNISTD
7963 #include <unistd.h>
7964 #endif
7965 int main() {
7966         char b[4];
7967         int i = open("a.out",O_RDONLY);
7968         if(i == -1)
7969                 exit(1); /* fail */
7970         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7971                 exit(0); /* succeed (yes, it's ELF) */
7972         else
7973                 exit(1); /* fail */
7974 }
7975 EOM
7976                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7977                         cat <<EOM
7978 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7979 EOM
7980                         dflt="$cc"
7981                 else
7982                         echo "I'll use ld to build dynamic libraries."
7983                         dflt='ld'
7984                 fi
7985                 $rm_try
7986                 ;;
7987         *)      dflt="$ld"
7988                 ;;
7989         esac
7990
7991     rp="What command should be used to create dynamic libraries?"
7992     . ./myread
7993         ld="$ans"
7994
7995     cat << EOM
7996
7997 Some systems may require passing special flags to $ld to create a
7998 library that can be dynamically loaded.  If your ld flags include
7999 -L/other/path options to locate libraries outside your loader's normal
8000 search path, you may need to specify those -L options here as well.  To
8001 use no flags, say "none".
8002
8003 EOM
8004     case "$lddlflags" in
8005     '') case "$osname" in
8006                         beos) dflt='-nostart' ;;
8007                         hpux) dflt='-b';
8008                               case "$gccversion" in
8009                               '') dflt="$dflt +vnocompatwarnings" ;;
8010                               esac
8011                               ;;
8012                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8013                         next)  dflt='none' ;;
8014                         solaris) dflt='-G' ;;
8015                         sunos) dflt='-assert nodefinitions' ;;
8016                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8017                 *)     dflt='none' ;;
8018                         esac
8019                         ;;
8020     *) dflt="$lddlflags" ;;
8021     esac
8022
8023         : Try to guess additional flags to pick up local libraries.
8024         : Be careful not to append to a plain 'none'
8025         case "$dflt" in
8026         none) dflt='' ;;
8027         esac
8028         for thisflag in $ldflags; do
8029                 case "$thisflag" in
8030                 -L*|-R*|-Wl,-R*)
8031                         case " $dflt " in
8032                         *" $thisflag "*) ;;
8033                         *) dflt="$dflt $thisflag" ;;
8034                         esac
8035                         ;;
8036                 esac
8037         done
8038
8039         case "$dflt" in
8040         ''|' ') dflt='none' ;;
8041         esac
8042
8043         case "$ldflags" in
8044         *-fstack-protector*)
8045             case "$dflt" in
8046                         *-fstack-protector*) ;; # Don't add it again
8047                         *) dflt="$dflt -fstack-protector" ;; 
8048                 esac
8049                 ;;
8050         esac
8051
8052
8053     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8054     . ./myread
8055     case "$ans" in
8056     none) lddlflags=' ' ;;
8057     *) lddlflags="$ans" ;;
8058     esac
8059
8060         cat <<EOM
8061
8062 Some systems may require passing special flags to $cc to indicate that
8063 the resulting executable will use dynamic linking.  To use no flags,
8064 say "none".
8065
8066 EOM
8067     case "$ccdlflags" in
8068     '') case "$osname" in
8069             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8070             next|sunos) dflt='none' ;;
8071             *)          dflt='none' ;;
8072             esac ;;
8073     ' ')  dflt='none' ;;
8074     *)  dflt="$ccdlflags" ;;
8075     esac
8076     rp="Any special flags to pass to $cc to use dynamic linking?"
8077     . ./myread
8078     case "$ans" in
8079     none) ccdlflags=' ' ;;
8080     *) ccdlflags="$ans" ;;
8081     esac
8082     ;;
8083 *)  usedl="$undef"
8084         ld='ld'
8085     dlsrc='dl_none.xs'
8086     lddlflags=''
8087     ccdlflags=''
8088     ;;
8089 esac
8090
8091 : Do we want a shared libperl?
8092 also=''
8093 case "$usedl" in
8094 $undef)
8095         # No dynamic loading being used, so don't bother even to prompt.
8096         useshrplib='false'
8097         ;;
8098 *)      case "$useshrplib" in
8099         '')     case "$osname" in
8100                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8101                         dflt=y
8102                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8103                         ;;
8104                 next*)
8105                         case "$osvers" in
8106                         4*)     dflt=y
8107                                 also='Building a shared libperl is needed for MAB support.'
8108                                 ;;
8109                         *)      dflt=n
8110                                 ;;
8111                         esac
8112                         ;;
8113                 *)      dflt=n
8114                         ;;
8115                 esac
8116                 ;;
8117         $define|true|[Yy]*)
8118                 dflt=y
8119                 ;;
8120         *)      dflt=n
8121                 ;;
8122         esac
8123         $cat << EOM
8124
8125 The perl executable is normally obtained by linking perlmain.c with
8126 libperl${_a}, any static extensions (usually just DynaLoader), and
8127 any other libraries needed on this system (such as -lm, etc.).  Since
8128 your system supports dynamic loading, it is probably possible to build
8129 a shared libperl.$so.  If you will have more than one executable linked
8130 to libperl.$so, this will significantly reduce the size of each
8131 executable, but it may have a noticeable effect on performance.  The
8132 default is probably sensible for your system.
8133 $also
8134
8135 EOM
8136         rp="Build a shared libperl.$so (y/n)"
8137         . ./myread
8138         case "$ans" in
8139         true|$define|[Yy]*)
8140                 useshrplib='true'  ;;
8141         *)      useshrplib='false' ;;
8142         esac
8143         ;;
8144 esac
8145
8146 case "$useshrplib" in
8147 true)
8148         case "$libperl" in
8149         '')
8150                 # Figure out a good name for libperl.so.  Since it gets stored in
8151                 # a version-specific architecture-dependent library, the version
8152                 # number isn't really that important, except for making cc/ld happy.
8153                 #
8154                 # A name such as libperl.so.10.1
8155                 majmin="libperl.$so.$patchlevel.$subversion"
8156                 # A name such as libperl.so.100
8157                 majonly=`echo $patchlevel $subversion |
8158                         $awk '{printf "%d%02d", $1, $2}'`
8159                 majonly=libperl.$so.$majonly
8160                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8161                 # rely on figuring it out from the naming of libc.
8162                 case "${osname}${osvers}" in
8163                 next4*)
8164                         dflt=libperl.5.$so
8165                         # XXX How handle the --version stuff for MAB?
8166                         ;;
8167                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8168                         dflt=libperl.$so
8169                         ;;
8170                 cygwin*) # ld links now against the dll directly
8171                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8172                         majonly=`echo $patchlevel $subversion |
8173                                 $awk '{printf "%03d%03d", $1, $2}'`
8174                         majonly=cygperl5.$majonly.$so
8175                         dflt=$majmin
8176                         ;;
8177                 *)      # Try to guess based on whether libc has major.minor.
8178                         case "$libc" in
8179                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8180                         *libc.$so.[0-9]*) dflt=$majonly ;;
8181                         *)      dflt=libperl.$so ;;
8182                         esac
8183                         ;;
8184                 esac
8185                 ;;
8186         *)      dflt=$libperl
8187                 ;;
8188         esac
8189         cat << EOM
8190
8191 I need to select a good name for the shared libperl.  If your system uses
8192 library names with major and minor numbers, then you might want something
8193 like $majmin.  Alternatively, if your system uses a single version
8194 number for shared libraries, then you might want to use $majonly.
8195 Or, your system might be quite happy with a simple libperl.$so.
8196
8197 Since the shared libperl will get installed into a version-specific
8198 architecture-dependent directory, the version number of the shared perl
8199 library probably isn't important, so the default should be o.k.
8200
8201 EOM
8202         rp='What name do you want to give to the shared libperl?'
8203         . ./myread
8204         libperl=$ans
8205         echo "Ok, I'll use $libperl"
8206         ;;
8207 *)
8208         libperl="libperl${_a}"
8209         ;;
8210 esac
8211
8212 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8213 case "$shrpdir" in
8214 '') ;;
8215 *)      $cat >&4 <<EOM
8216 WARNING:  Use of the shrpdir variable for the installation location of
8217 the shared $libperl is not supported.  It was never documented and
8218 will not work in this version.  Let me (perlbug@perl.org)
8219 know of any problems this may cause.
8220
8221 EOM
8222         case "$shrpdir" in
8223         "$archlibexp/CORE")
8224                 $cat >&4 <<EOM
8225 But your current setting of $shrpdir is
8226 the default anyway, so it's harmless.
8227 EOM
8228                 ;;
8229         *)
8230                 $cat >&4 <<EOM
8231 Further, your current attempted setting of $shrpdir
8232 conflicts with the value of $archlibexp/CORE
8233 that installperl will use.
8234 EOM
8235                 ;;
8236         esac
8237         ;;
8238 esac
8239
8240 # How will the perl executable find the installed shared $libperl?
8241 # Add $xxx to ccdlflags.
8242 # If we can't figure out a command-line option, use $shrpenv to
8243 # set env LD_RUN_PATH.  The main perl makefile uses this.
8244 shrpdir=$archlibexp/CORE
8245 xxx=''
8246 tmp_shrpenv=''
8247 if "$useshrplib"; then
8248     case "$osname" in
8249         aix)
8250                 # We'll set it in Makefile.SH...
8251                 ;;
8252         solaris)
8253                 xxx="-R $shrpdir"
8254                 ;;
8255         freebsd|netbsd|openbsd|interix|dragonfly)
8256                 xxx="-Wl,-R$shrpdir"
8257                 ;;
8258         bsdos|linux|irix*|dec_osf|gnu*)
8259                 xxx="-Wl,-rpath,$shrpdir"
8260                 ;;
8261         next)
8262                 # next doesn't like the default...
8263                 ;;
8264         beos)
8265                 # beos doesn't like the default, either.
8266                 ;;
8267         hpux*)
8268                 # hpux doesn't like the default, either.
8269                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8270                 ;;
8271         cygwin)
8272                 # cygwin needs only ldlibpth
8273                 ;;
8274         *)
8275                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8276                 ;;
8277         esac
8278         case "$xxx" in
8279         '') ;;
8280         *)
8281                 # Only add $xxx if it isn't already in ccdlflags.
8282                 case " $ccdlflags " in
8283                 *" $xxx "*)     ;;
8284                 *)      ccdlflags="$ccdlflags $xxx"
8285                         cat <<EOM >&4
8286
8287 Adding $xxx to the flags
8288 passed to $ld so that the perl executable will find the
8289 installed shared $libperl.
8290
8291 EOM
8292                         ;;
8293                 esac
8294                 ;;
8295         esac
8296 fi
8297 # Fix ccdlflags in AIX for building external extensions.
8298 # (For building Perl itself bare -bE:perl.exp is needed,
8299 #  Makefile.SH takes care of this.)
8300 case "$osname" in
8301 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8302 esac
8303 # Respect a hint or command-line value.
8304 case "$shrpenv" in
8305 '') shrpenv="$tmp_shrpenv" ;;
8306 esac
8307 case "$ldlibpthname" in
8308 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8309 none)   ldlibpthname='' ;;
8310 esac
8311
8312 : determine where manual pages are on this system
8313 echo " "
8314 case "$sysman" in
8315 '') 
8316         syspath='/usr/share/man/man1 /usr/man/man1'
8317         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8318         syspath="$syspath /usr/man/u_man/man1"
8319         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8320         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8321         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8322         sysman=`./loc . /usr/man/man1 $syspath`
8323         ;;
8324 esac
8325 if $test -d "$sysman"; then
8326         echo "System manual is in $sysman." >&4
8327 else
8328         echo "Could not find manual pages in source form." >&4
8329 fi
8330
8331 : determine where manual pages go
8332 set man1dir man1dir none
8333 eval $prefixit
8334 $cat <<EOM
8335
8336 $spackage has manual pages available in source form.
8337 EOM
8338 case "$nroff" in
8339 nroff)
8340         echo "However, you don't have nroff, so they're probably useless to you."
8341         case "$man1dir" in
8342         '') man1dir="none";;
8343         esac;;
8344 esac
8345 echo "If you don't want the manual sources installed, answer 'none'."
8346 case "$man1dir" in
8347 ' ') dflt=none
8348         ;;
8349 '')
8350         lookpath="$prefixexp/share/man/man1"
8351         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8352         lookpath="$lookpath $prefixexp/man/p_man/man1"
8353         lookpath="$lookpath $prefixexp/man/u_man/man1"
8354         lookpath="$lookpath $prefixexp/man/man.1"
8355         case "$sysman" in
8356         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8357         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8358         esac
8359         set dflt
8360         eval $prefixup
8361         ;;
8362 *)  dflt="$man1dir"
8363         ;;
8364 esac
8365 echo " "
8366 fn=dn+~
8367 rp="Where do the main $spackage manual pages (source) go?"
8368 . ./getfile
8369 if $test "X$man1direxp" != "X$ansexp"; then
8370         installman1dir=''
8371 fi
8372 prefixvar=man1dir
8373 . ./setprefixvar
8374
8375 case "$man1dir" in
8376 '')     man1dir=' '
8377         installman1dir='';;
8378 esac
8379
8380 : What suffix to use on installed man pages
8381
8382 case "$man1dir" in
8383 ' ')
8384         man1ext='0'
8385         ;;
8386 *)
8387         rp="What suffix should be used for the main $spackage man pages?"
8388         case "$man1ext" in
8389         '')     case "$man1dir" in
8390                 *1)  dflt=1 ;;
8391                 *1p) dflt=1p ;;
8392                 *1pm) dflt=1pm ;;
8393                 *l) dflt=l;;
8394                 *n) dflt=n;;
8395                 *o) dflt=o;;
8396                 *p) dflt=p;;
8397                 *C) dflt=C;;
8398                 *L) dflt=L;;
8399                 *L1) dflt=L1;;
8400                 *) dflt=1;;
8401                 esac
8402                 ;;
8403         *)      dflt="$man1ext";;
8404         esac
8405         . ./myread
8406         man1ext="$ans"
8407         ;;
8408 esac
8409
8410 : see if we can have long filenames
8411 echo " "
8412 first=123456789abcdef
8413 $rm -f $first
8414 if (echo hi >$first) 2>/dev/null; then
8415         if $test -f 123456789abcde; then
8416                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8417                 val="$undef"
8418         else
8419                 echo 'You can have filenames longer than 14 characters.'>&4
8420                 val="$define"
8421         fi
8422 else
8423         $cat <<'EOM'
8424 You can't have filenames longer than 14 chars.
8425 You can't even think about them!
8426 EOM
8427         val="$undef"
8428 fi
8429 set d_flexfnam
8430 eval $setvar
8431 $rm -rf 123456789abcde*
8432
8433 : determine where library module manual pages go
8434 set man3dir man3dir none
8435 eval $prefixit
8436 $cat <<EOM
8437
8438 $spackage has manual pages for many of the library modules.
8439 EOM
8440
8441 case "$nroff" in
8442 nroff)
8443         $cat <<'EOM'
8444 However, you don't have nroff, so they're probably useless to you.
8445 EOM
8446         case "$man3dir" in
8447         '') man3dir="none";;
8448         esac;;
8449 esac
8450
8451 case "$d_flexfnam" in
8452 undef)
8453         $cat <<'EOM'
8454 However, your system can't handle the long file names like File::Basename.3.
8455 EOM
8456         case "$man3dir" in
8457         '') man3dir="none";;
8458         esac;;
8459 esac
8460
8461 echo "If you don't want the manual sources installed, answer 'none'."
8462 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8463 case "$man3dir" in
8464 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8465         if $test -d "$privlib/man/man3"; then
8466                 cat <<EOM >&4
8467
8468 WARNING:  Previous versions of perl installed man3 pages into
8469 $privlib/man/man3.  This version will suggest a
8470 new default of $dflt.
8471 EOM
8472                 tdflt=$dflt
8473                 dflt='n'
8474                 rp='Do you wish to preserve the old behavior?(y/n)'
8475                 . ./myread
8476                 case "$ans" in
8477                 y*) dflt="$privlib/man/man3" ;;
8478                 *)  dflt=$tdflt ;;
8479                 esac
8480     fi
8481         ;;
8482 *)      dflt="$man3dir" ;;
8483 esac
8484 case "$dflt" in
8485 ' ') dflt=none ;;
8486 esac
8487 echo " "
8488 fn=dn+~
8489 rp="Where do the $package library man pages (source) go?"
8490 . ./getfile
8491 prefixvar=man3dir
8492 . ./setprefixvar
8493
8494 case "$man3dir" in
8495 '')     man3dir=' '
8496         installman3dir='';;
8497 esac
8498
8499 : What suffix to use on installed man pages
8500 case "$man3dir" in
8501 ' ')
8502         man3ext='0'
8503         ;;
8504 *)
8505         rp="What suffix should be used for the $package library man pages?"
8506         case "$man3ext" in
8507         '')     case "$man3dir" in
8508                 *3)  dflt=3 ;;
8509                 *3p) dflt=3p ;;
8510                 *3pm) dflt=3pm ;;
8511                 *l) dflt=l;;
8512                 *n) dflt=n;;
8513                 *o) dflt=o;;
8514                 *p) dflt=p;;
8515                 *C) dflt=C;;
8516                 *L) dflt=L;;
8517                 *L3) dflt=L3;;
8518                 *) dflt=3;;
8519                 esac
8520                 ;;
8521         *)      dflt="$man3ext";;
8522         esac
8523         . ./myread
8524         man3ext="$ans"
8525         ;;
8526 esac
8527
8528 : see if we have to deal with yellow pages, now NIS.
8529 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8530         if $test -f /usr/etc/nibindd; then
8531                 echo " "
8532                 echo "I'm fairly confident you're on a NeXT."
8533                 echo " "
8534                 rp='Do you get the hosts file via NetInfo?'
8535                 dflt=y
8536                 case "$hostcat" in
8537                 nidump*) ;;
8538                 '') ;;
8539                 *) dflt=n;;
8540                 esac
8541                 . ./myread
8542                 case "$ans" in
8543                 y*) hostcat='nidump hosts .';;
8544                 *)      case "$hostcat" in
8545                         nidump*) hostcat='';;
8546                         esac
8547                         ;;
8548                 esac
8549         fi
8550         case "$hostcat" in
8551         nidump*) ;;
8552         *)
8553                 case "$hostcat" in
8554                 *ypcat*) dflt=y;;
8555                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8556                                 dflt=y
8557                         else
8558                                 dflt=n
8559                         fi;;
8560                 *) dflt=n;;
8561                 esac
8562                 echo " "
8563                 rp='Are you getting the hosts file via yellow pages?'
8564                 . ./myread
8565                 case "$ans" in
8566                 y*) hostcat='ypcat hosts';;
8567                 *) hostcat='cat /etc/hosts';;
8568                 esac
8569                 ;;
8570         esac
8571 fi
8572 case "$hostcat" in
8573 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8574 esac
8575 case "$groupcat" in
8576 '') test -f /etc/group && groupcat='cat /etc/group';;
8577 esac
8578 case "$passcat" in
8579 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8580 esac
8581
8582 : now get the host name
8583 echo " "
8584 echo "Figuring out host name..." >&4
8585 case "$myhostname" in
8586 '') cont=true
8587         echo 'Maybe "hostname" will work...'
8588         if tans=`sh -c hostname 2>&1` ; then
8589                 myhostname=$tans
8590                 phostname=hostname
8591                 cont=''
8592         fi
8593         ;;
8594 *) cont='';;
8595 esac
8596 if $test "$cont"; then
8597         if ./xenix; then
8598                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8599                 if tans=`cat /etc/systemid 2>&1` ; then
8600                         myhostname=$tans
8601                         phostname='cat /etc/systemid'
8602                         echo "Whadyaknow.  Xenix always was a bit strange..."
8603                         cont=''
8604                 fi
8605         elif $test -r /etc/systemid; then
8606                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8607         fi
8608 fi
8609 if $test "$cont"; then
8610         echo 'No, maybe "uuname -l" will work...'
8611         if tans=`sh -c 'uuname -l' 2>&1` ; then
8612                 myhostname=$tans
8613                 phostname='uuname -l'
8614         else
8615                 echo 'Strange.  Maybe "uname -n" will work...'
8616                 if tans=`sh -c 'uname -n' 2>&1` ; then
8617                         myhostname=$tans
8618                         phostname='uname -n'
8619                 else
8620                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8621                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8622                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8623                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8624                         else
8625                                 case "$myhostname" in
8626                                 '') echo "Does this machine have an identity crisis or something?"
8627                                         phostname='';;
8628                                 *)
8629                                         echo "Well, you said $myhostname before..."
8630                                         phostname='echo $myhostname';;
8631                                 esac
8632                         fi
8633                 fi
8634         fi
8635 fi
8636 case "$myhostname" in
8637 '') myhostname=noname ;;
8638 esac
8639 : you do not want to know about this
8640 set $myhostname
8641 myhostname=$1
8642
8643 : verify guess
8644 if $test "$myhostname" ; then
8645         dflt=y
8646         rp='Your host name appears to be "'$myhostname'".'" Right?"
8647         . ./myread
8648         case "$ans" in
8649         y*) ;;
8650         *) myhostname='';;
8651         esac
8652 fi
8653
8654 : bad guess or no guess
8655 while $test "X$myhostname" = X ; do
8656         dflt=''
8657         rp="Please type the (one word) name of your host:"
8658         . ./myread
8659         myhostname="$ans"
8660 done
8661
8662 : translate upper to lower if necessary
8663 case "$myhostname" in
8664 *[A-Z]*)
8665         echo "(Normalizing case in your host name)"
8666         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8667         ;;
8668 esac
8669
8670 case "$myhostname" in
8671 *.*)
8672         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8673         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8674         echo "(Trimming domain name from host name--host name is now $myhostname)"
8675         ;;
8676 *) case "$mydomain" in
8677         '')
8678                 {
8679                         test "X$hostcat" = "Xypcat hosts" &&
8680                         ypmatch "$myhostname" hosts 2>/dev/null |\
8681                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8682                         $test -s hosts
8683                 } || {
8684                         test "X$hostcat" != "X" &&
8685                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8686                                         /[       ]$myhostname[  . ]/p" > hosts
8687                 }
8688                 tmp_re="[       . ]"
8689                 if $test -f hosts; then
8690                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8691                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8692                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8693                                 hosts | $sort | $uniq | \
8694                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8695                         case `$echo X$dflt` in
8696                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8697                                 dflt=.
8698                                 ;;
8699                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8700                                 ;;
8701                         esac
8702                 else
8703                         echo "(I cannot locate a hosts database anywhere)"
8704                         dflt=.
8705                 fi
8706                 case "$dflt" in
8707                 .)
8708                         tans=`./loc resolv.conf X /etc /usr/etc`
8709                         if $test -f "$tans"; then
8710                                 echo "(Attempting domain name extraction from $tans)"
8711                                 dflt=.`$sed -n -e 's/   / /g' \
8712                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8713                                   -e 1q 2>/dev/null`
8714                                 case "$dflt" in
8715                                 .) dflt=.`$sed -n -e 's/        / /g' \
8716                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8717                                      -e 1q 2>/dev/null`
8718                                         ;;
8719                                 esac
8720                         fi
8721                         ;;
8722                 esac
8723                 case "$dflt" in
8724                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8725                         dflt=.`sh -c domainname 2>/dev/null`
8726                         case "$dflt" in
8727                         '') dflt='.';;
8728                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8729                         esac
8730                         ;;
8731                 esac
8732                 case "$dflt$osname" in
8733                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8734                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8735                         ;;
8736                 esac
8737                 case "$dflt" in
8738                 .) echo "(Lost all hope -- silly guess then)"
8739                         dflt='.nonet'
8740                         ;;
8741                 esac
8742                 $rm -f hosts
8743                 ;;
8744         *) dflt="$mydomain";;
8745         esac;;
8746 esac
8747 echo " "
8748 rp="What is your domain name?"
8749 . ./myread
8750 tans="$ans"
8751 case "$ans" in
8752 '') ;;
8753 .*) ;;
8754 *) tans=".$tans";;
8755 esac
8756 mydomain="$tans"
8757
8758 : translate upper to lower if necessary
8759 case "$mydomain" in
8760 *[A-Z]*)
8761         echo "(Normalizing case in your domain name)"
8762         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8763         ;;
8764 esac
8765
8766 : a little sanity check here
8767 case "$phostname" in
8768 '') ;;
8769 *)
8770         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8771         $myhostname$mydomain|$myhostname) ;;
8772         *)
8773                 case "$phostname" in
8774                 sed*)
8775                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8776                         ;;
8777                 *)
8778                         echo "(That doesn't agree with your $phostname command, by the way.)"
8779                         ;;
8780                 esac
8781         ;;
8782         esac
8783         ;;
8784 esac
8785
8786 : determine the e-mail address of the user who is running us
8787 $cat <<EOM
8788
8789 I need to get your e-mail address in Internet format if possible, i.e.
8790 something like user@host.domain. Please answer accurately since I have
8791 no easy means to double check it. The default value provided below
8792 is most probably close to reality but may not be valid from outside
8793 your organization...
8794
8795 EOM
8796 cont=x
8797 while test "$cont"; do
8798         case "$cf_email" in
8799         '') dflt="$cf_by@$myhostname$mydomain";;
8800         *) dflt="$cf_email";;
8801         esac
8802         rp='What is your e-mail address?'
8803         . ./myread
8804         cf_email="$ans"
8805         case "$cf_email" in
8806         *@*.*) cont='' ;;
8807         *)
8808                 rp='Address does not look like an Internet one.  Use it anyway?'
8809                 case "$fastread" in
8810                 yes) dflt=y ;;
8811                 *) dflt=n ;;
8812                 esac
8813                 . ./myread
8814                 case "$ans" in
8815                 y*) cont='' ;;
8816                 *) echo " " ;;
8817                 esac
8818                 ;;
8819         esac
8820 done
8821
8822 : Ask e-mail of administrator
8823 $cat <<EOM
8824
8825 If you or somebody else will be maintaining perl at your site, please
8826 fill in the correct e-mail address here so that they may be contacted
8827 if necessary. Currently, the "perlbug" program included with perl
8828 will send mail to this address in addition to perlbug@perl.org. You may
8829 enter "none" for no administrator.
8830
8831 EOM
8832 case "$perladmin" in
8833 '') dflt="$cf_email";;
8834 *) dflt="$perladmin";;
8835 esac
8836 rp='Perl administrator e-mail address'
8837 . ./myread
8838 perladmin="$ans"
8839
8840 : determine whether to only install version-specific parts.
8841 echo " "
8842 $cat <<EOM
8843 Do you want to install only the version-specific parts of the perl
8844 distribution?  Usually you do *not* want to do this.
8845 EOM
8846 case "$versiononly" in
8847 "$define"|[Yy]*|true) dflt='y' ;;
8848 *) dflt='n';
8849 esac
8850 rp="Do you want to install only the version-specific parts of perl?"
8851 . ./myread
8852 case "$ans" in
8853 [yY]*)  val="$define";;
8854 *)      val="$undef" ;;
8855 esac
8856 set versiononly
8857 eval $setvar
8858
8859 case "$versiononly" in
8860 "$define") inc_version_list=''
8861            inc_version_list_init=0
8862            ;;
8863 esac
8864
8865 : figure out how to guarantee perl startup
8866 : XXX Note that this currently takes advantage of the bug that binexp ignores
8867 :     the Configure -Dinstallprefix setting, which in turn means that under
8868 :     relocatable @INC, initialinstalllocation is what binexp started as.
8869 case "$startperl" in
8870 '')
8871         case "$sharpbang" in
8872         *!)
8873                 $cat <<EOH
8874
8875 I can use the #! construct to start perl on your system. This will
8876 make startup of perl scripts faster, but may cause problems if you
8877 want to share those scripts and perl is not in a standard place
8878 ($initialinstalllocation/perl) on all your platforms. The alternative
8879 is to force a shell by starting the script with a single ':' character.
8880
8881 EOH
8882                 case "$versiononly" in
8883                 "$define")      dflt="$initialinstalllocation/perl$version";;
8884                 *)              dflt="$initialinstalllocation/perl";;
8885                 esac
8886                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8887                 . ./myread
8888                 case "$ans" in
8889                 none)   startperl=": # use perl";;
8890                 *)      startperl="#!$ans"
8891                         if $test 30 -lt `echo "$ans" | wc -c`; then
8892                                 $cat >&4 <<EOM
8893
8894 WARNING:  Some systems limit the #! command to 32 characters.
8895 If you experience difficulty running Perl scripts with #!, try
8896 installing Perl in a directory with a shorter pathname.
8897
8898 EOM
8899                         fi ;;
8900                 esac
8901                 ;;
8902         *) startperl=": # use perl"
8903                 ;;
8904         esac
8905         ;;
8906 esac
8907 echo "I'll use $startperl to start perl scripts."
8908
8909 : figure best path for perl in scripts
8910 case "$perlpath" in
8911 '')
8912         case "$versiononly" in
8913         "$define")      perlpath="$initialinstalllocation/perl$version";;
8914         *)              perlpath="$initialinstalllocation/perl";;
8915         esac
8916         case "$startperl" in
8917         *!*) ;;
8918         *)
8919                 $cat <<EOH
8920
8921 I will use the "eval 'exec'" idiom to start Perl on your system.
8922 I can use the full path of your Perl binary for this purpose, but
8923 doing so may cause problems if you want to share those scripts and
8924 Perl is not always in a standard place ($initialinstalllocation/perl).
8925
8926 EOH
8927                 dflt="$initialinstalllocation/perl"
8928                 rp="What path shall I use in \"eval 'exec'\"?"
8929                 . ./myread
8930                 perlpath="$ans"
8931                 ;;
8932         esac
8933         ;;
8934 esac
8935 case "$startperl" in
8936 *!*)    ;;
8937 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8938 esac
8939
8940 : determine where public executable scripts go
8941 set scriptdir scriptdir
8942 eval $prefixit
8943 case "$scriptdir" in
8944 '')
8945         dflt="$bin"
8946         : guess some guesses
8947         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8948         $test -d /usr/share/bin     && dflt=/usr/share/bin
8949         $test -d /usr/local/script  && dflt=/usr/local/script
8950         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8951         $test -d $prefixexp/script  && dflt=$prefixexp/script
8952         set dflt
8953         eval $prefixup
8954         ;;
8955 *)  dflt="$scriptdir"
8956         ;;
8957 esac
8958 $cat <<EOM
8959
8960 Some installations have a separate directory just for executable scripts so
8961 that they can mount it across multiple architectures but keep the scripts in
8962 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8963 Or you might just lump your scripts in with all your other executables.
8964
8965 EOM
8966 fn=d~
8967 rp='Where do you keep publicly executable scripts?'
8968 . ./getfile
8969 if $test "X$ansexp" != "X$scriptdirexp"; then
8970         installscript=''
8971 fi
8972 installscriptdir=''
8973 prefixvar=scriptdir
8974 . ./setprefixvar
8975 : A little fix up for an irregularly named variable.
8976 installscript="$installscriptdir"
8977
8978 : determine where add-on public executables go
8979 case "$sitebin" in
8980 '')     dflt=$siteprefix/bin ;;
8981 *)      dflt=$sitebin ;;
8982 esac
8983 fn=d~
8984 rp='Pathname where the add-on public executables should be installed?'
8985 . ./getfile
8986 prefixvar=sitebin
8987 . ./setprefixvar
8988
8989 : determine where add-on html pages go
8990 : There is no standard location, so try to copy the previously-selected
8991 : directory structure for the core html pages.
8992 case "$sitehtml1dir" in
8993 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8994 *)     dflt=$sitehtml1dir ;;
8995 esac
8996 case "$dflt" in
8997 ''|' ') dflt=none ;;
8998 esac
8999 fn=dn+~
9000 rp='Pathname where the site-specific html pages should be installed?'
9001 . ./getfile
9002 prefixvar=sitehtml1dir
9003 . ./setprefixvar
9004
9005 : determine where add-on library html pages go
9006 : There is no standard location, so try to copy the previously-selected
9007 : directory structure for the core html pages.
9008 case "$sitehtml3dir" in
9009 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9010 *)     dflt=$sitehtml3dir ;;
9011 esac
9012 case "$dflt" in
9013 ''|' ') dflt=none ;;
9014 esac
9015 fn=dn+~
9016 rp='Pathname where the site-specific library html pages should be installed?'
9017 . ./getfile
9018 prefixvar=sitehtml3dir
9019 . ./setprefixvar
9020
9021 : determine where add-on manual pages go
9022 case "$siteman1dir" in
9023 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9024 *)      dflt=$siteman1dir ;;
9025 esac
9026 case "$dflt" in
9027 ''|' ') dflt=none ;;
9028 esac
9029 fn=dn+~
9030 rp='Pathname where the site-specific manual pages should be installed?'
9031 . ./getfile
9032 prefixvar=siteman1dir
9033 . ./setprefixvar
9034
9035 : determine where add-on library man pages go
9036 case "$siteman3dir" in
9037 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9038 *)      dflt=$siteman3dir ;;
9039 esac
9040 case "$dflt" in
9041 ''|' ') dflt=none ;;
9042 esac
9043 fn=dn+~
9044 rp='Pathname where the site-specific library manual pages should be installed?'
9045 . ./getfile
9046 prefixvar=siteman3dir
9047 . ./setprefixvar
9048
9049 : determine where add-on public executable scripts go
9050 case "$sitescript" in
9051 '')     dflt=$siteprefix/script
9052         $test -d $dflt || dflt=$sitebin ;;
9053 *)  dflt="$sitescript" ;;
9054 esac
9055 fn=d~+
9056 rp='Pathname where add-on public executable scripts should be installed?'
9057 . ./getfile
9058 prefixvar=sitescript
9059 . ./setprefixvar
9060
9061 : Check if faststdio is requested and available
9062 case "$usefaststdio" in
9063 $define|true|[yY]*|'')
9064         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9065         case "$xversion" in
9066         [68])   dflt='y' ;;
9067         *)      dflt='n' ;;
9068         esac
9069         ;;
9070 *) dflt='n';;
9071 esac
9072 cat <<EOM
9073
9074 Perl can be built to use 'fast stdio', which means using the stdio
9075 library but also directly manipulating the stdio buffers to enable
9076 faster I/O.  Using stdio is better for backward compatibility (especially
9077 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9078 interface has been preferred instead of stdio.
9079
9080 If this doesn't make any sense to you, just accept the default '$dflt'.
9081 EOM
9082 rp='Use the "fast stdio" if available?'
9083 . ./myread
9084 case "$ans" in
9085 y|Y)    val="$define" ;;
9086 *)      val="$undef" ;;
9087 esac
9088 set usefaststdio
9089 eval $setvar
9090
9091
9092 : define an is-a-typedef? function
9093 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9094 case "$inclist" in
9095 "") inclist="sys/types.h";;
9096 esac;
9097 eval "varval=\$$var";
9098 case "$varval" in
9099 "")
9100         $rm -f temp.c;
9101         for inc in $inclist; do
9102                 echo "#include <$inc>" >>temp.c;
9103         done;
9104         echo "#ifdef $type" >> temp.c;
9105         echo "printf(\"We have $type\");" >> temp.c;
9106         echo "#endif" >> temp.c;
9107         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9108         if $contains $type temp.E >/dev/null 2>&1; then
9109                 eval "$var=\$type";
9110         else
9111                 eval "$var=\$def";
9112         fi;
9113         $rm -f temp.?;;
9114 *) eval "$var=\$varval";;
9115 esac'
9116
9117 : define an is-a-typedef? function that prompts if the type is not available.
9118 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9119 case "$inclist" in
9120 "") inclist="sys/types.h";;
9121 esac;
9122 eval "varval=\$$var";
9123 case "$varval" in
9124 "")
9125         $rm -f temp.c;
9126         for inc in $inclist; do
9127                 echo "#include <$inc>" >>temp.c;
9128         done;
9129         echo "#ifdef $type" >> temp.c;
9130         echo "printf(\"We have $type\");" >> temp.c;
9131         echo "#endif" >> temp.c;
9132         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9133         echo " " ;
9134         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9135         if $contains $type temp.E >/dev/null 2>&1; then
9136                 echo "$type found." >&4;
9137                 eval "$var=\$type";
9138         else
9139                 echo "$type NOT found." >&4;
9140                 dflt="$def";
9141                 . ./myread ;
9142                 eval "$var=\$ans";
9143         fi;
9144         $rm -f temp.?;;
9145 *) eval "$var=\$varval";;
9146 esac'
9147
9148 : see what type lseek is declared as in the kernel
9149 rp="What is the type used for lseek's offset on this system?"
9150 set off_t lseektype long stdio.h sys/types.h
9151 eval $typedef_ask
9152
9153 echo " "
9154 echo "Checking to see how big your file offsets are..." >&4
9155 $cat >try.c <<EOCP
9156 #include <sys/types.h>
9157 #include <stdio.h>
9158 int main()
9159 {
9160     printf("%d\n", (int)sizeof($lseektype));
9161     return(0);
9162 }
9163 EOCP
9164 set try
9165 if eval $compile_ok; then
9166         lseeksize=`$run ./try`
9167         echo "Your file offsets are $lseeksize bytes long."
9168 else
9169         dflt=$longsize
9170         echo " "
9171         echo "(I can't seem to compile the test program.  Guessing...)"
9172         rp="What is the size of your file offsets (in bytes)?"
9173         . ./myread
9174         lseeksize="$ans"
9175 fi
9176 $rm_try
9177
9178 : see what type file positions are declared as in the library
9179 rp="What is the type for file position used by fsetpos()?"
9180 set fpos_t fpostype long stdio.h sys/types.h
9181 eval $typedef_ask
9182
9183 : Check size for Fpos_t
9184 echo " "
9185 case "$fpostype" in
9186 *_t) zzz="$fpostype"    ;;
9187 *)   zzz="fpos_t"       ;;
9188 esac
9189 echo "Checking the size of $zzz..." >&4
9190 cat > try.c <<EOCP
9191 #include <sys/types.h>
9192 #include <stdio.h>
9193 #$i_stdlib I_STDLIB
9194 #ifdef I_STDLIB
9195 #include <stdlib.h>
9196 #endif
9197 int main() {
9198     printf("%d\n", (int)sizeof($fpostype));
9199     exit(0);
9200 }
9201 EOCP
9202 set try
9203 if eval $compile_ok; then
9204         yyy=`$run ./try`
9205         case "$yyy" in
9206         '')     fpossize=4
9207                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9208                 ;;
9209         *)      fpossize=$yyy
9210                 echo "Your $zzz is $fpossize bytes long."
9211                 ;;
9212         esac
9213 else
9214         dflt="$longsize"
9215         echo " " >&4
9216         echo "(I can't compile the test program.  Guessing...)" >&4
9217         rp="What is the size of your file positions (in bytes)?"
9218         . ./myread
9219         fpossize="$ans"
9220 fi
9221
9222 : Check for large file support
9223 # Backward compatibility (uselfs is deprecated).
9224 case "$uselfs" in
9225 "$define"|true|[yY]*)
9226         cat <<EOM >&4
9227
9228 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9229 EOM
9230         uselargefiles="$define"
9231         ;;
9232 esac
9233
9234 case "$lseeksize:$fpossize" in
9235 8:8) cat <<EOM
9236
9237 You can have files larger than 2 gigabytes.
9238 EOM
9239    val="$define" ;;
9240 *)    case "$uselargefiles" in
9241    "$undef"|false|[nN]*) dflt='n' ;;
9242    *)   dflt='y' ;;
9243    esac
9244    cat <<EOM
9245
9246 Perl can be built to understand large files (files larger than 2 gigabytes)
9247 on some systems.  To do so, Configure can be run with -Duselargefiles.
9248
9249 If this doesn't make any sense to you, just accept the default '$dflt'.
9250 EOM
9251    rp='Try to understand large files, if available?'
9252    . ./myread
9253    case "$ans" in
9254    y|Y)         val="$define" ;;
9255    *)           val="$undef"  ;;
9256    esac
9257    ;;
9258 esac
9259 set uselargefiles
9260 eval $setvar
9261 : Look for a hint-file generated 'call-back-unit'.  If the
9262 : user has specified that a large files perl is to be built,
9263 : we may need to set or change some other defaults.
9264 if $test -f uselargefiles.cbu; then
9265         echo "Your platform has some specific hints regarding large file builds, using them..."
9266         . ./uselargefiles.cbu
9267 fi
9268 case "$uselargefiles" in
9269 "$define")
9270         if $test -f uselargefiles.cbu; then
9271                 echo " "
9272                 echo "Rechecking to see how big your file offsets are..." >&4
9273                 $cat >try.c <<EOCP
9274 #include <sys/types.h>
9275 #include <stdio.h>
9276 int main()
9277 {
9278     printf("%d\n", (int)sizeof($lseektype));
9279     return(0);
9280 }
9281 EOCP
9282                 set try
9283                 if eval $compile_ok; then
9284                         lseeksize=`$run ./try`
9285                         $echo "Your file offsets are now $lseeksize bytes long."
9286                 else
9287                         dflt="$lseeksize"
9288                         echo " "
9289                         echo "(I can't seem to compile the test program.  Guessing...)"
9290                         rp="What is the size of your file offsets (in bytes)?"
9291                         . ./myread
9292                         lseeksize="$ans"
9293                 fi
9294                 case "$fpostype" in
9295                 *_t) zzz="$fpostype"    ;;
9296                 *)   zzz="fpos_t"       ;;
9297                 esac
9298                 $echo $n "Rechecking the size of $zzz...$c" >&4
9299                 $cat > try.c <<EOCP
9300 #include <sys/types.h>
9301 #include <stdio.h>
9302 #$i_stdlib I_STDLIB
9303 #ifdef I_STDLIB
9304 #include <stdlib.h>
9305 #endif
9306 int main() {
9307     printf("%d\n", (int)sizeof($fpostype));
9308     return(0);
9309 }
9310 EOCP
9311                 set try
9312                 if eval $compile_ok; then
9313                         yyy=`$run ./try`
9314                         dflt="$lseeksize"
9315                         case "$yyy" in
9316                         '')     echo " "
9317                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9318                                 ;;
9319                         *)      fpossize=$yyy
9320                                 echo " $fpossize bytes." >&4
9321                                 ;;
9322                         esac
9323                 else
9324                         dflt="$fpossize"
9325                         echo " "
9326                         echo "(I can't compile the test program.  Guessing...)" >&4
9327                         rp="What is the size of your file positions (in bytes)?"
9328                         . ./myread
9329                         fpossize="$ans"
9330                 fi
9331                 $rm_try
9332         fi
9333         ;;
9334 esac
9335
9336 : Set the vendorbin variables
9337 case "$vendorprefix" in
9338 '')     d_vendorbin="$undef"
9339         vendorbin=''
9340         vendorbinexp=''
9341         ;;
9342 *)      d_vendorbin="$define"
9343         : determine where vendor-supplied executables go.
9344         case "$vendorbin" in
9345         '') dflt=$vendorprefix/bin ;;
9346         *)      dflt="$vendorbin" ;;
9347         esac
9348         fn=d~+
9349         rp='Pathname for the vendor-supplied executables directory?'
9350         . ./getfile
9351         vendorbin="$ans"
9352         vendorbinexp="$ansexp"
9353         ;;
9354 esac
9355 prefixvar=vendorbin
9356 . ./installprefix
9357
9358 : Set the vendorhtml1dir variables
9359 case "$vendorprefix" in
9360 '')     vendorhtml1dir=''
9361         vendorhtml1direxp=''
9362         ;;
9363 *)      : determine where vendor-supplied html pages go.
9364         : There is no standard location, so try to copy the previously-selected
9365         : directory structure for the core html pages.
9366         : XXX Better default suggestions would be welcome.
9367         case "$vendorhtml1dir" in
9368         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9369         *)      dflt=$vendorhtml1dir ;;
9370         esac
9371         case "$dflt" in
9372         ''|' ') dflt=none ;;
9373         esac
9374         fn=dn+~
9375         rp='Pathname for the vendor-supplied html pages?'
9376         . ./getfile
9377         vendorhtml1dir="$ans"
9378         vendorhtml1direxp="$ansexp"
9379         ;;
9380 esac
9381 : Use ' ' for none so value is preserved next time through Configure
9382 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9383 prefixvar=vendorhtml1dir
9384 . ./installprefix
9385
9386 : Set the vendorhtml3dir variables
9387 case "$vendorprefix" in
9388 '')     vendorhtml3dir=''
9389         vendorhtml3direxp=''
9390         ;;
9391 *)      : determine where vendor-supplied module html pages go.
9392         : There is no standard location, so try to copy the previously-selected
9393         : directory structure for the core html pages.
9394         : XXX Better default suggestions would be welcome.
9395         case "$vendorhtml3dir" in
9396         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9397         *)      dflt=$vendorhtml3dir ;;
9398         esac
9399         case "$dflt" in
9400         ''|' ') dflt=none ;;
9401         esac
9402         fn=dn+~
9403         rp='Pathname for the vendor-supplied html pages?'
9404         . ./getfile
9405         vendorhtml3dir="$ans"
9406         vendorhtml3direxp="$ansexp"
9407         ;;
9408 esac
9409 : Use ' ' for none so value is preserved next time through Configure
9410 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9411 prefixvar=vendorhtml3dir
9412 . ./installprefix
9413
9414 : Set the vendorman1dir variables
9415 case "$vendorprefix" in
9416 '')     vendorman1dir=''
9417         vendorman1direxp=''
9418         ;;
9419 *)      : determine where vendor-supplied manual pages go.
9420         case "$vendorman1dir" in
9421         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9422         *)      dflt=$vendorman1dir ;;
9423         esac
9424         case "$dflt" in
9425         ''|' ') dflt=none ;;
9426         esac
9427         fn=nd~+
9428         rp='Pathname for the vendor-supplied manual section 1 pages?'
9429         . ./getfile
9430         vendorman1dir="$ans"
9431         vendorman1direxp="$ansexp"
9432         ;;
9433 esac
9434 : Use ' ' for none so value is preserved next time through Configure
9435 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9436 prefixvar=vendorman1dir
9437 . ./installprefix
9438
9439 : Set the vendorman3dir variables
9440 case "$vendorprefix" in
9441 '')     vendorman3dir=''
9442         vendorman3direxp=''
9443         ;;
9444 *)      : determine where vendor-supplied module manual pages go.
9445         case "$vendorman3dir" in
9446         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9447         *)      dflt=$vendorman3dir ;;
9448         esac
9449         case "$dflt" in
9450         ''|' ') dflt=none ;;
9451         esac
9452         fn=nd~+
9453         rp='Pathname for the vendor-supplied manual section 3 pages?'
9454         . ./getfile
9455         vendorman3dir="$ans"
9456         vendorman3direxp="$ansexp"
9457         ;;
9458 esac
9459 : Use ' ' for none so value is preserved next time through Configure
9460 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9461 prefixvar=vendorman3dir
9462 . ./installprefix
9463
9464 : Set the vendorscript variables
9465 case "$vendorprefix" in
9466 '')     d_vendorscript="$undef"
9467         vendorscript=''
9468         vendorscriptexp=''
9469         ;;
9470 *)      d_vendorscript="$define"
9471         : determine where vendor-supplied scripts go.
9472         case "$vendorscript" in
9473         '')     dflt=$vendorprefix/script
9474                 $test -d $dflt || dflt=$vendorbin ;;
9475         *)  dflt="$vendorscript" ;;
9476         esac
9477         $cat <<EOM
9478
9479 The installation process will create a directory for
9480 vendor-supplied scripts.
9481
9482 EOM
9483         fn=d~+
9484         rp='Pathname for the vendor-supplied scripts directory?'
9485         . ./getfile
9486         vendorscript="$ans"
9487         vendorscriptexp="$ansexp"
9488         ;;
9489 esac
9490 prefixvar=vendorscript
9491 . ./installprefix
9492
9493 : see if qgcvt exists
9494 set qgcvt d_qgcvt
9495 eval $inlibc
9496
9497 : Check print/scan long double stuff
9498 echo " "
9499
9500 if $test X"$d_longdbl" = X"$define"; then
9501
9502 echo "Checking how to print long doubles..." >&4
9503
9504 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9505         $cat >try.c <<'EOCP'
9506 #include <sys/types.h>
9507 #include <stdio.h>
9508 int main() {
9509   double d = 123.456;
9510   printf("%.3f\n", d);
9511 }
9512 EOCP
9513         set try
9514         if eval $compile; then
9515                 yyy=`$run ./try`
9516                 case "$yyy" in
9517                 123.456)
9518                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9519                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9520                         echo "We will use %f."
9521                         ;;
9522                 esac
9523         fi
9524 fi
9525
9526 if $test X"$sPRIfldbl" = X; then
9527         $cat >try.c <<'EOCP'
9528 #include <sys/types.h>
9529 #include <stdio.h>
9530 int main() {
9531   long double d = 123.456;
9532   printf("%.3Lf\n", d);
9533 }
9534 EOCP
9535         set try
9536         if eval $compile; then
9537                 yyy=`$run ./try`
9538                 case "$yyy" in
9539                 123.456)
9540                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9541                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9542                         echo "We will use %Lf."
9543                         ;;
9544                 esac
9545         fi
9546 fi
9547
9548 if $test X"$sPRIfldbl" = X; then
9549         $cat >try.c <<'EOCP'
9550 #include <sys/types.h>
9551 #include <stdio.h>
9552 int main() {
9553   long double d = 123.456;
9554   printf("%.3llf\n", d);
9555 }
9556 EOCP
9557         set try
9558         if eval $compile; then
9559                 yyy=`$run ./try`
9560                 case "$yyy" in
9561                 123.456)
9562                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9563                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9564                         echo "We will use %llf."
9565                         ;;
9566                 esac
9567         fi
9568 fi
9569
9570 if $test X"$sPRIfldbl" = X; then
9571         $cat >try.c <<'EOCP'
9572 #include <sys/types.h>
9573 #include <stdio.h>
9574 int main() {
9575   long double d = 123.456;
9576   printf("%.3lf\n", d);
9577 }
9578 EOCP
9579         set try
9580         if eval $compile; then
9581                 yyy=`$run ./try`
9582                 case "$yyy" in
9583                 123.456)
9584                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9585                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9586                         echo "We will use %lf."
9587                         ;;
9588                 esac
9589         fi
9590 fi
9591
9592 if $test X"$sPRIfldbl" = X; then
9593         echo "Cannot figure out how to print long doubles." >&4
9594 else
9595         sSCNfldbl=$sPRIfldbl    # expect consistency
9596 fi
9597
9598 $rm_try
9599
9600 fi # d_longdbl
9601
9602 case "$sPRIfldbl" in
9603 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9604         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9605         d_SCNfldbl="$undef";
9606         ;;
9607 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9608         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9609         d_SCNfldbl="$define";
9610         ;;
9611 esac
9612
9613 : Check how to convert floats to strings.
9614
9615 if test "X$d_Gconvert" = X; then
9616
9617 echo " "
9618 echo "Checking for an efficient way to convert floats to strings."
9619 echo " " > try.c
9620 case "$uselongdouble" in
9621 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9622 esac
9623 case "$d_longdbl" in
9624 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9625 esac
9626 case "$d_PRIgldbl" in
9627 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9628 esac
9629 $cat >>try.c <<EOP
9630 #ifdef TRY_gconvert
9631 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9632 char *myname = "gconvert";
9633 #endif
9634 #ifdef TRY_gcvt
9635 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9636 char *myname = "gcvt";
9637 #endif
9638 #ifdef TRY_qgcvt
9639 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9640 char *myname = "qgcvt";
9641 #define DOUBLETYPE long double
9642 #endif
9643 #ifdef TRY_sprintf
9644 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9645 #ifdef HAS_PRIgldbl
9646 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9647 #else
9648 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9649 #endif
9650 #else
9651 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9652 #endif
9653 char *myname = "sprintf";
9654 #endif
9655
9656 #ifndef DOUBLETYPE
9657 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9658 #define DOUBLETYPE long double
9659 #else
9660 #define DOUBLETYPE double
9661 #endif
9662 #endif
9663
9664 #include <stdio.h>
9665
9666 #define I_STDLIB $i_stdlib
9667 #ifdef I_STDLIB
9668 #include <stdlib.h>
9669 #endif
9670
9671 int
9672 checkit(expect, got)
9673 char *expect;
9674 char *got;
9675 {
9676     if (strcmp(expect, got)) {
9677                 printf("%s oddity:  Expected %s, got %s\n",
9678                         myname, expect, got);
9679                 exit(1);
9680         }
9681 }
9682
9683 int main()
9684 {
9685         char buf[64];
9686         buf[63] = '\0';
9687
9688         /* This must be 1st test on (which?) platform */
9689         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9690         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9691         checkit("0.1", buf);
9692
9693         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9694         checkit("0.01", buf);
9695
9696         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9697         checkit("0.001", buf);
9698
9699         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9700         checkit("0.0001", buf);
9701
9702         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9703         if (strlen(buf) > 5)
9704             checkit("9e-005", buf); /* for Microsoft ?? */
9705         else
9706             checkit("9e-05", buf);
9707
9708         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9709         checkit("1", buf);
9710
9711         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9712         checkit("1.1", buf);
9713
9714         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9715         checkit("1.01", buf);
9716
9717         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9718         checkit("1.001", buf);
9719
9720         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9721         checkit("1.0001", buf);
9722
9723         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9724         checkit("1.00001", buf);
9725
9726         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9727         checkit("1.000001", buf);
9728
9729         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9730         checkit("0", buf);
9731
9732         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9733         checkit("-1", buf);
9734
9735         /* Some Linux gcvt's give 1.e+5 here. */
9736         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9737         checkit("100000", buf);
9738
9739         /* Some Linux gcvt's give -1.e+5 here. */
9740         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9741         checkit("-100000", buf);
9742
9743         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9744         checkit("123.456", buf);
9745
9746         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9747         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9748         /* 34 should be enough to scare even long double
9749          * places into using the e notation. */
9750         if (strlen(buf) > 5)
9751             checkit("1e+034", buf); /* for Microsoft */
9752         else
9753             checkit("1e+34", buf);
9754
9755         /* For Perl, if you add additional tests here, also add them to
9756          * t/base/num.t for benefit of platforms not using Configure or
9757          * overriding d_Gconvert */
9758
9759         exit(0);
9760 }
9761 EOP
9762 : first add preferred functions to our list
9763 xxx_list=""
9764 for xxx_convert in $gconvert_preference; do
9765     case $xxx_convert in
9766     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9767     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9768     esac
9769 done
9770 : then add any others
9771 for xxx_convert in gconvert gcvt sprintf; do
9772     case "$xxx_list" in
9773     *$xxx_convert*) ;;
9774     *) xxx_list="$xxx_list $xxx_convert" ;;
9775     esac
9776 done
9777
9778 case "$d_longdbl$uselongdouble" in
9779 "$define$define")
9780     : again, add prefered functions to our list first
9781     xxx_ld_list=""
9782     for xxx_convert in $gconvert_ld_preference; do
9783         case $xxx_convert in
9784         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9785         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9786         esac
9787     done
9788     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9789     for xxx_convert in qgcvt sprintf $xxx_list; do
9790         case "$xxx_ld_list" in
9791         $xxx_convert*|*" $xxx_convert"*) ;;
9792         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9793         esac
9794     done
9795     : if sprintf cannot do long doubles, move it to the end
9796     if test "$d_PRIgldbl" != "$define"; then
9797         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9798     fi
9799     : if no qgcvt, remove it
9800     if test "$d_qgcvt" != "$define"; then
9801         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9802     fi
9803     : use the ld_list
9804     xxx_list="$xxx_ld_list"
9805     ;;
9806 esac
9807
9808 for xxx_convert in $xxx_list; do
9809         echo "Trying $xxx_convert..."
9810         $rm -f try try$_o core
9811         set try -DTRY_$xxx_convert
9812         if eval $compile; then
9813                 echo "$xxx_convert() found." >&4
9814                 if $run ./try; then
9815                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9816                         break;
9817                 else
9818                         echo "...But $xxx_convert didn't work as I expected."
9819                         xxx_convert=''
9820                 fi
9821         else
9822                 echo "$xxx_convert NOT found." >&4
9823         fi
9824 done
9825
9826 if test X$xxx_convert = X; then
9827     echo "*** WHOA THERE!!! ***" >&4
9828     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9829     xxx_convert=sprintf
9830 fi
9831
9832 case "$xxx_convert" in
9833 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9834 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9835 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9836 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9837    "$define$define$define")
9838       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9839    "$define$define$undef")
9840       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9841    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9842    esac
9843    ;;
9844 esac
9845
9846 fi
9847 $rm_try
9848
9849 : see if _fwalk exists
9850 set fwalk d__fwalk
9851 eval $inlibc
9852
9853 : Initialize h_fcntl
9854 h_fcntl=false
9855
9856 : Initialize h_sysfile
9857 h_sysfile=false
9858
9859 : access call always available on UNIX
9860 set access d_access
9861 eval $inlibc
9862
9863 : locate the flags for 'access()'
9864 case "$d_access" in
9865 "$define")
9866         echo " "
9867         $cat >access.c <<EOCP
9868 #include <sys/types.h>
9869 #ifdef I_FCNTL
9870 #include <fcntl.h>
9871 #endif
9872 #ifdef I_SYS_FILE
9873 #include <sys/file.h>
9874 #endif
9875 #ifdef I_UNISTD
9876 #include <unistd.h>
9877 #endif
9878 #$i_stdlib I_STDLIB
9879 #ifdef I_STDLIB
9880 #include <stdlib.h>
9881 #endif
9882 int main() {
9883         exit(R_OK);
9884 }
9885 EOCP
9886         : check sys/file.h first, no particular reason here
9887         if $test `./findhdr sys/file.h` && \
9888                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9889                 h_sysfile=true;
9890                 echo "<sys/file.h> defines the *_OK access constants." >&4
9891         elif $test `./findhdr fcntl.h` && \
9892                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9893                 h_fcntl=true;
9894                 echo "<fcntl.h> defines the *_OK access constants." >&4
9895         elif $test `./findhdr unistd.h` && \
9896                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9897                 echo "<unistd.h> defines the *_OK access constants." >&4
9898         else
9899                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9900         fi
9901         ;;
9902 esac
9903 $rm -f access*
9904
9905 : see if accessx exists
9906 set accessx d_accessx
9907 eval $inlibc
9908
9909 : see if aintl exists
9910 set aintl d_aintl
9911 eval $inlibc
9912
9913 : see if alarm exists
9914 set alarm d_alarm
9915 eval $inlibc
9916
9917 : see if POSIX threads are available
9918 set pthread.h i_pthread
9919 eval $inhdr
9920
9921 : define a fucntion to check prototypes
9922 $cat > protochk <<EOSH
9923 $startsh
9924 cc="$cc"
9925 optimize="$optimize"
9926 ccflags="$ccflags"
9927 prototype="$prototype"
9928 define="$define"
9929 rm_try="$rm_try"
9930 usethreads=$usethreads
9931 i_pthread=$i_pthread
9932 pthread_h_first=$pthread_h_first
9933 EOSH
9934
9935 $cat >> protochk <<'EOSH'
9936
9937 $rm_try
9938 foo="$1"
9939 shift
9940 while test $# -ge 2; do
9941         case "$1" in
9942                 $define) echo "#include <$2>" >> try.c ;;
9943                 literal) echo "$2" >> try.c ;;
9944         esac
9945     # Extra magic for the benefit of systems that need pthread.h
9946     # to be included early to correctly detect threadsafe functions.
9947     # Such functions must guarantee themselves, though, that the usethreads
9948     # and i_pthread have been defined, before calling protochk.
9949     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9950         echo "#include <pthread.h>" >> try.c
9951         pthread_h_done=yes
9952     fi
9953     shift 2
9954 done
9955 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9956 cat >> try.c <<'EOCP'
9957 #ifdef CAN_PROTOTYPE
9958 #define _(args) args
9959 #else
9960 #define _(args) ()
9961 #endif
9962 EOCP
9963 echo "$foo" >> try.c
9964 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9965 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9966 status=$?
9967 $rm_try
9968 exit $status
9969 EOSH
9970 chmod +x protochk
9971 $eunicefix protochk
9972
9973 : Define hasproto macro for Configure internal use
9974 hasproto='varname=$1; func=$2; shift; shift;
9975 while $test $# -ge 2; do
9976         case "$1" in
9977         $define) echo "#include <$2>";;
9978         esac ;
9979     shift 2;
9980 done > try.c;
9981 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9982 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9983         echo "$func() prototype found.";
9984         val="$define";
9985 else
9986         echo "$func() prototype NOT found.";
9987         val="$undef";
9988 fi;
9989 set $varname;
9990 eval $setvar;
9991 $rm_try tryout.c'
9992
9993 : see if sys/types.h has to be included
9994 set sys/types.h i_systypes
9995 eval $inhdr
9996
9997 : see if sys/select.h has to be included
9998 set sys/select.h i_sysselct
9999 eval $inhdr
10000
10001 : Define hasfield macro for Configure internal use
10002 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10003 while $test $# -ge 2; do
10004         case "$1" in
10005         $define) echo "#include <$2>";;
10006         esac ;
10007     shift 2;
10008 done > try.c;
10009 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10010 set try;
10011 if eval $compile; then
10012         val="$define";
10013 else
10014         val="$undef";
10015 fi;
10016 set $varname;
10017 eval $setvar;
10018 $rm_try'
10019
10020 : see if we should include time.h, sys/time.h, or both
10021 echo " "
10022 if test "X$timeincl" = X; then
10023         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10024         $echo $n "I'm now running the test program...$c"
10025         $cat >try.c <<EOCP
10026 #include <sys/types.h>
10027 #ifdef I_TIME
10028 #include <time.h>
10029 #endif
10030 #ifdef I_SYSTIME
10031 #ifdef SYSTIMEKERNEL
10032 #define KERNEL
10033 #endif
10034 #include <sys/time.h>
10035 #endif
10036 #ifdef I_SYSSELECT
10037 #include <sys/select.h>
10038 #endif
10039 #$i_stdlib I_STDLIB
10040 #ifdef I_STDLIB
10041 #include <stdlib.h>
10042 #endif
10043 int main()
10044 {
10045         struct tm foo;
10046 #ifdef S_TIMEVAL
10047         struct timeval bar;
10048 #endif
10049 #ifdef S_TIMEZONE
10050         struct timezone tzp;
10051 #endif
10052         if (foo.tm_sec == foo.tm_sec)
10053                 exit(0);
10054 #ifdef S_TIMEVAL
10055         if (bar.tv_sec == bar.tv_sec)
10056                 exit(0);
10057 #endif
10058         exit(1);
10059 }
10060 EOCP
10061         flags=''
10062         for s_timezone in '-DS_TIMEZONE' ''; do
10063         sysselect=''
10064         for s_timeval in '-DS_TIMEVAL' ''; do
10065         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10066         for i_time in '' '-DI_TIME'; do
10067         for i_systime in '-DI_SYSTIME' ''; do
10068                 case "$flags" in
10069                 '') $echo $n ".$c"
10070                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10071                         if eval $compile; then
10072                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10073                                 shift
10074                                 flags="$*"
10075                                 echo " "
10076                                 $echo $n "Succeeded with $flags$c"
10077                         fi
10078                         ;;
10079                 esac
10080         done
10081         done
10082         done
10083         done
10084         done
10085         timeincl=''
10086         echo " "
10087         case "$flags" in
10088         *SYSTIMEKERNEL*) i_systimek="$define"
10089                 timeincl=`./findhdr sys/time.h`
10090                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10091         *) i_systimek="$undef";;
10092         esac
10093         case "$flags" in
10094         *I_TIME*) i_time="$define"
10095                 timeincl=`./findhdr time.h`" $timeincl"
10096                 echo "We'll include <time.h>." >&4;;
10097         *) i_time="$undef";;
10098         esac
10099         case "$flags" in
10100         *I_SYSTIME*) i_systime="$define"
10101                 timeincl=`./findhdr sys/time.h`" $timeincl"
10102                 echo "We'll include <sys/time.h>." >&4;;
10103         *) i_systime="$undef";;
10104         esac
10105         $rm_try
10106 fi
10107 : see if struct tm knows about tm_zone
10108 case "$i_systime$i_time" in
10109 *$define*)
10110         echo " "
10111         echo "Checking to see if your struct tm has tm_zone field..." >&4
10112         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10113         eval $hasfield
10114         ;;
10115 *)      val="$undef"
10116         set d_tm_tm_zone
10117         eval $setvar
10118         ;;
10119 esac
10120 case "$d_tm_tm_zone" in
10121 "$define")      echo "Yes, it does."   ;;
10122 *)              echo "No, it doesn't." ;;
10123 esac
10124 : see if struct tm knows about tm_gmtoff
10125 case "$i_systime$i_time" in
10126 *$define*)
10127         echo " "
10128         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10129         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10130         eval $hasfield
10131         ;;
10132 *)      val="$undef"
10133         set d_tm_tm_gmtoff
10134         eval $setvar
10135         ;;
10136 esac
10137 case "$d_tm_tm_gmtoff" in
10138 "$define")      echo "Yes, it does."   ;;
10139 *)              echo "No, it doesn't." ;;
10140 esac
10141
10142 : see if asctime_r exists
10143 set asctime_r d_asctime_r
10144 eval $inlibc
10145 case "$d_asctime_r" in
10146 "$define")
10147         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10148         case "$d_asctime_r_proto:$usethreads" in
10149         ":define")      d_asctime_r_proto=define
10150                 set d_asctime_r_proto asctime_r $hdrs
10151                 eval $hasproto ;;
10152         *)      ;;
10153         esac
10154         case "$d_asctime_r_proto" in
10155         define)
10156         case "$asctime_r_proto" in
10157         ''|0) try='char* asctime_r(const struct tm*, char*);'
10158         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10159         esac
10160         case "$asctime_r_proto" in
10161         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10162         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10163         esac
10164         case "$asctime_r_proto" in
10165         ''|0) try='int asctime_r(const struct tm*, char*);'
10166         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10167         esac
10168         case "$asctime_r_proto" in
10169         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10170         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10171         esac
10172         case "$asctime_r_proto" in
10173         ''|0)   d_asctime_r=undef
10174                 asctime_r_proto=0
10175                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10176         * )     case "$asctime_r_proto" in
10177                 REENTRANT_PROTO*) ;;
10178                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10179                 esac
10180                 echo "Prototype: $try" ;;
10181         esac
10182         ;;
10183         *)      case "$usethreads" in
10184                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10185                 esac
10186                 d_asctime_r=undef
10187                 asctime_r_proto=0
10188                 ;;
10189         esac
10190         ;;
10191 *)      asctime_r_proto=0
10192         ;;
10193 esac
10194
10195 : see if atolf exists
10196 set atolf d_atolf
10197 eval $inlibc
10198
10199 : see if atoll exists
10200 set atoll d_atoll
10201 eval $inlibc
10202
10203 : Look for GCC-style attribute format
10204 case "$d_attribute_format" in
10205 '')
10206 echo " "
10207 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10208 $cat >attrib.c <<'EOCP'
10209 #include <stdio.h>
10210 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10211 EOCP
10212 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10213         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10214                 echo "Your C compiler doesn't support __attribute__((format))."
10215                 val="$undef"
10216         else
10217                 echo "Your C compiler supports __attribute__((format))."
10218                 val="$define"
10219         fi
10220 else
10221         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10222         val="$undef"
10223 fi
10224 ;;
10225 *) val="$d_attribute_format" ;;
10226 esac
10227 set d_attribute_format
10228 eval $setvar
10229 $rm -f attrib*
10230
10231 : Look for GCC-style attribute format with null format allowed
10232 case "$d_printf_format_null" in
10233 '') case "$d_attribute_format" in
10234     $define)
10235         echo " "
10236         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10237 $cat >attrib.c <<EOCP
10238 #include <stdio.h>
10239 #$i_stdlib I_STDLIB
10240 #ifdef I_STDLIB
10241 #include <stdlib.h>
10242 #endif
10243 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10244 int null_printf (char* pat,...) { return (int)pat; }
10245 int main () { exit(null_printf(NULL)); }
10246 EOCP
10247         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10248             : run the executable in case it produces a run-time warning
10249             if $run ./attrib >>attrib.out 2>&1; then
10250                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10251                     echo "Your C compiler doesn't allow __printf__ format to be null."
10252                     val="$undef"
10253                 else
10254                     echo "Your C compiler allows __printf__ format to be null."
10255                     val="$define"
10256                 fi
10257             else
10258             echo "Your C compiler executable failed with __printf__ format null."
10259             val="$undef"
10260         fi
10261     else
10262         echo "Your C compiler fails with __printf__ format null."
10263         val="$undef"
10264     fi
10265     ;;
10266     *)  val="$undef" ;;
10267     esac
10268 ;;
10269 *)  val="$d_printf_format_null" ;;
10270 esac
10271 set d_printf_format_null
10272 eval $setvar
10273 $rm -f attrib*
10274
10275 : Look for GCC-style attribute malloc
10276 case "$d_attribute_malloc" in
10277 '')
10278 echo " "
10279 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10280 $cat >attrib.c <<'EOCP'
10281 #include <stdio.h>
10282 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10283 EOCP
10284 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10285         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10286                 echo "Your C compiler doesn't support __attribute__((malloc))."
10287                 val="$undef"
10288         else
10289                 echo "Your C compiler supports __attribute__((malloc))."
10290                 val="$define"
10291         fi
10292 else
10293         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10294         val="$undef"
10295 fi
10296 ;;
10297 *) val="$d_attribute_malloc" ;;
10298 esac
10299 set d_attribute_malloc
10300 eval $setvar
10301 $rm -f attrib*
10302
10303 : Look for GCC-style attribute nonnull
10304 case "$d_attribute_nonnull" in
10305 '')
10306 echo " "
10307 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10308 $cat >attrib.c <<'EOCP'
10309 #include <stdio.h>
10310 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10311 EOCP
10312 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10313         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10314                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10315                 val="$undef"
10316         else
10317                 echo "Your C compiler supports __attribute__((nonnull))."
10318                 val="$define"
10319         fi
10320 else
10321         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10322         val="$undef"
10323 fi
10324 ;;
10325 *) val="$d_attribute_nonnull" ;;
10326 esac
10327 set d_attribute_nonnull
10328 eval $setvar
10329 $rm -f attrib*
10330
10331 : Look for GCC-style attribute noreturn
10332 case "$d_attribute_noreturn" in
10333 '')
10334 echo " "
10335 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10336 $cat >attrib.c <<'EOCP'
10337 #include <stdio.h>
10338 void fall_over_dead( void ) __attribute__((noreturn));
10339 EOCP
10340 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10341         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10342                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10343                 val="$undef"
10344         else
10345                 echo "Your C compiler supports __attribute__((noreturn))."
10346                 val="$define"
10347         fi
10348 else
10349         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10350         val="$undef"
10351 fi
10352 ;;
10353 *) val="$d_attribute_noreturn" ;;
10354 esac
10355 set d_attribute_noreturn
10356 eval $setvar
10357 $rm -f attrib*
10358
10359 : Look for GCC-style attribute pure
10360 case "$d_attribute_pure" in
10361 '')
10362 echo " "
10363 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10364 $cat >attrib.c <<'EOCP'
10365 #include <stdio.h>
10366 int square( int n ) __attribute__((pure));
10367 EOCP
10368 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10369         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10370                 echo "Your C compiler doesn't support __attribute__((pure))."
10371                 val="$undef"
10372         else
10373                 echo "Your C compiler supports __attribute__((pure))."
10374                 val="$define"
10375         fi
10376 else
10377         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10378         val="$undef"
10379 fi
10380 ;;
10381 *) val="$d_attribute_pure" ;;
10382 esac
10383 set d_attribute_pure
10384 eval $setvar
10385 $rm -f attrib*
10386
10387 : Look for GCC-style attribute unused
10388 case "$d_attribute_unused" in
10389 '')
10390 echo " "
10391 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10392 $cat >attrib.c <<'EOCP'
10393 #include <stdio.h>
10394 int do_something( int dummy __attribute__((unused)), int n );
10395 EOCP
10396 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10397         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10398                 echo "Your C compiler doesn't support __attribute__((unused))."
10399                 val="$undef"
10400         else
10401                 echo "Your C compiler supports __attribute__((unused))."
10402                 val="$define"
10403         fi
10404 else
10405         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10406         val="$undef"
10407 fi
10408 ;;
10409 *) val="$d_attribute_unused" ;;
10410 esac
10411 set d_attribute_unused
10412 eval $setvar
10413 $rm -f attrib*
10414
10415 : Look for GCC-style attribute warn_unused_result
10416 case "$d_attribute_warn_unused_result" in
10417 '')
10418 echo " "
10419 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10420 $cat >attrib.c <<'EOCP'
10421 #include <stdio.h>
10422 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10423 EOCP
10424 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10425         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10426                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10427                 val="$undef"
10428         else
10429                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10430                 val="$define"
10431         fi
10432 else
10433         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10434         val="$undef"
10435 fi
10436 ;;
10437 *) val="$d_attribute_warn_unused_result" ;;
10438 esac
10439 set d_attribute_warn_unused_result
10440 eval $setvar
10441 $rm -f attrib*
10442
10443 : see if bcmp exists
10444 set bcmp d_bcmp
10445 eval $inlibc
10446
10447 : see if bcopy exists
10448 set bcopy d_bcopy
10449 eval $inlibc
10450
10451 : see if getpgrp exists
10452 set getpgrp d_getpgrp
10453 eval $inlibc
10454
10455 case "$d_getpgrp" in
10456 "$define")
10457         echo " "
10458         echo "Checking to see which flavor of getpgrp is in use..."
10459         $cat >try.c <<EOP
10460 #$i_unistd I_UNISTD
10461 #include <sys/types.h>
10462 #ifdef I_UNISTD
10463 #  include <unistd.h>
10464 #endif
10465 #$i_stdlib I_STDLIB
10466 #ifdef I_STDLIB
10467 #include <stdlib.h>
10468 #endif
10469 int main()
10470 {
10471         if (getuid() == 0) {
10472                 printf("(I see you are running Configure as super-user...)\n");
10473                 setuid(1);
10474         }
10475 #ifdef TRY_BSD_PGRP
10476         if (getpgrp(1) == 0)
10477                 exit(0);
10478 #else
10479         if (getpgrp() > 0)
10480                 exit(0);
10481 #endif
10482         exit(1);
10483 }
10484 EOP
10485         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10486                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10487                 val="$define"
10488         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10489                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10490                 val="$undef"
10491         else
10492                 echo "I can't seem to compile and run the test program."
10493                 if ./usg; then
10494                         xxx="a USG one, i.e. you use getpgrp()."
10495                 else
10496                         # SVR4 systems can appear rather BSD-ish.
10497                         case "$i_unistd" in
10498                         $undef)
10499                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10500                                 val="$define"
10501                                 ;;
10502                         $define)
10503                                 xxx="probably a USG one, i.e. you use getpgrp()."
10504                                 val="$undef"
10505                                 ;;
10506                         esac
10507                 fi
10508                 echo "Assuming your getpgrp is $xxx" >&4
10509         fi
10510         ;;
10511 *) val="$undef";;
10512 esac
10513 set d_bsdgetpgrp
10514 eval $setvar
10515 $rm_try
10516
10517 : see if setpgrp exists
10518 set setpgrp d_setpgrp
10519 eval $inlibc
10520
10521 case "$d_setpgrp" in
10522 "$define")
10523         echo " "
10524         echo "Checking to see which flavor of setpgrp is in use..."
10525         $cat >try.c <<EOP
10526 #$i_unistd I_UNISTD
10527 #include <sys/types.h>
10528 #ifdef I_UNISTD
10529 #  include <unistd.h>
10530 #endif
10531 #$i_stdlib I_STDLIB
10532 #ifdef I_STDLIB
10533 #include <stdlib.h>
10534 #endif
10535 int main()
10536 {
10537         if (getuid() == 0) {
10538                 printf("(I see you are running Configure as super-user...)\n");
10539                 setuid(1);
10540         }
10541 #ifdef TRY_BSD_PGRP
10542         if (-1 == setpgrp(1, 1))
10543                 exit(0);
10544 #else
10545         if (setpgrp() != -1)
10546                 exit(0);
10547 #endif
10548         exit(1);
10549 }
10550 EOP
10551         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10552                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10553                 val="$define"
10554         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10555                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10556                 val="$undef"
10557         else
10558                 echo "(I can't seem to compile and run the test program.)"
10559                 if ./usg; then
10560                         xxx="a USG one, i.e. you use setpgrp()."
10561                 else
10562                         # SVR4 systems can appear rather BSD-ish.
10563                         case "$i_unistd" in
10564                         $undef)
10565                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10566                                 val="$define"
10567                                 ;;
10568                         $define)
10569                                 xxx="probably a USG one, i.e. you use setpgrp()."
10570                                 val="$undef"
10571                                 ;;
10572                         esac
10573                 fi
10574                 echo "Assuming your setpgrp is $xxx" >&4
10575         fi
10576         ;;
10577 *) val="$undef";;
10578 esac
10579 set d_bsdsetpgrp
10580 eval $setvar
10581 $rm_try
10582
10583 : Look for GCC-style __builtin_choose_expr
10584 case "$d_builtin_choose_expr" in
10585 '')
10586     echo " "
10587     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10588     $cat >try.c <<'EOCP'
10589 #include <assert.h>
10590 #include <stdlib.h>
10591 #include <stdio.h>
10592
10593 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10594
10595 int main(void) {
10596     assert( SYRINX(1) == 2112 );
10597     assert( SYRINX(1) != 5150 );
10598     assert( SYRINX(0) == 5150 );
10599     assert( SYRINX(0) != 2112 );
10600     puts( "All good!" );
10601     exit(0);
10602 }
10603
10604 EOCP
10605     set try
10606     if eval $compile && $run ./try; then
10607         echo "Your C compiler supports __builtin_choose_expr."
10608         val="$define"
10609     else
10610         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10611         val="$undef"
10612     fi
10613 ;;
10614 *) val="$d_builtin_choose_expr" ;;
10615 esac
10616
10617 set d_builtin_choose_expr
10618 eval $setvar
10619 $rm_try
10620
10621 : Look for GCC-style __builtin_expect
10622 case "$d_builtin_expect" in
10623 '')
10624     echo " "
10625     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10626     $cat >try.c <<'EOCP'
10627 int main(void) {
10628     int n = 50;
10629     if ( __builtin_expect(n, 0) ) n = 1;
10630     /* Remember shell exit code truth is 0, C truth is non-zero */
10631     return !(n == 1);
10632 }
10633 EOCP
10634     set try
10635     if eval $compile && $run ./try; then
10636         echo "Your C compiler supports __builtin_expect."
10637         val="$define"
10638     else
10639         echo "Your C compiler doesn't seem to understand __builtin_expect."
10640         val="$undef"
10641     fi
10642     ;;
10643 *) val="$d_builtin_expect" ;;
10644 esac
10645
10646 set d_builtin_expect
10647 eval $setvar
10648 $rm_try
10649
10650 : see if bzero exists
10651 set bzero d_bzero
10652 eval $inlibc
10653
10654 : see if stdarg is available
10655 echo " "
10656 if $test `./findhdr stdarg.h`; then
10657         echo "<stdarg.h> found." >&4
10658         valstd="$define"
10659 else
10660         echo "<stdarg.h> NOT found." >&4
10661         valstd="$undef"
10662 fi
10663
10664 : see if varags is available
10665 echo " "
10666 if $test `./findhdr varargs.h`; then
10667         echo "<varargs.h> found." >&4
10668 else
10669         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10670 fi
10671
10672 : set up the varargs testing programs
10673 $cat > varargs.c <<EOP
10674 #ifdef I_STDARG
10675 #include <stdarg.h>
10676 #endif
10677 #ifdef I_VARARGS
10678 #include <varargs.h>
10679 #endif
10680
10681 #ifdef I_STDARG
10682 int f(char *p, ...)
10683 #else
10684 int f(va_alist)
10685 va_dcl
10686 #endif
10687 {
10688         va_list ap;
10689 #ifndef I_STDARG
10690         char *p;
10691 #endif
10692 #ifdef I_STDARG
10693         va_start(ap,p);
10694 #else
10695         va_start(ap);
10696         p = va_arg(ap, char *);
10697 #endif
10698         va_end(ap);
10699         return 0;
10700 }
10701 EOP
10702 $cat > varargs <<EOP
10703 $startsh
10704 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10705         echo "true"
10706 else
10707         echo "false"
10708 fi
10709 $rm -f varargs$_o
10710 EOP
10711 chmod +x varargs
10712
10713 : now check which varargs header should be included
10714 echo " "
10715 i_varhdr=''
10716 case "$valstd" in
10717 "$define")
10718         if `./varargs I_STDARG`; then
10719                 val='stdarg.h'
10720         elif `./varargs I_VARARGS`; then
10721                 val='varargs.h'
10722         fi
10723         ;;
10724 *)
10725         if `./varargs I_VARARGS`; then
10726                 val='varargs.h'
10727         fi
10728         ;;
10729 esac
10730 case "$val" in
10731 '')
10732 echo "I could not find the definition for va_dcl... You have problems..." >&4
10733         val="$undef"; set i_stdarg; eval $setvar
10734         val="$undef"; set i_varargs; eval $setvar
10735         ;;
10736 *)
10737         set i_varhdr
10738         eval $setvar
10739         case "$i_varhdr" in
10740         stdarg.h)
10741                 val="$define"; set i_stdarg; eval $setvar
10742                 val="$undef"; set i_varargs; eval $setvar
10743                 ;;
10744         varargs.h)
10745                 val="$undef"; set i_stdarg; eval $setvar
10746                 val="$define"; set i_varargs; eval $setvar
10747                 ;;
10748         esac
10749         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10750 esac
10751 $rm -f varargs*
10752
10753 : see if the Compiler supports C99 variadic macros
10754 case "$i_stdarg$i_stdlib" in
10755     "$define$define")
10756     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10757     $cat >try.c <<EOCP
10758 #include <stdio.h>
10759 #include <stdarg.h>
10760
10761 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10762
10763 int main() {
10764   char buf[20];
10765   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10766   puts(buf);
10767   return 0;
10768 }
10769 EOCP
10770     set try
10771     if eval $compile && $run ./try 2>&1 >/dev/null; then
10772         case "`$run ./try`" in
10773             "123 456 789")
10774             echo "You have C99 variadic macros." >&4
10775             d_c99_variadic_macros="$define"
10776             ;;
10777             *)
10778             echo "You don't have functional C99 variadic macros." >&4
10779             d_c99_variadic_macros="$undef"
10780             ;;
10781         esac
10782     else
10783         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10784         d_c99_variadic_macros="$undef"
10785     fi
10786     $rm_try
10787     ;;
10788     *)
10789     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10790     d_c99_variadic_macros="$undef"
10791     ;;
10792 esac
10793
10794 : see if signal is declared as pointer to function returning int or void
10795 echo " "
10796 xxx=`./findhdr signal.h`
10797 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10798 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10799         echo "You have int (*signal())() instead of void." >&4
10800         val="$undef"
10801 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10802         echo "You have void (*signal())()." >&4
10803         val="$define"
10804 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10805         echo "You have int (*signal())() instead of void." >&4
10806         val="$undef"
10807 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10808         echo "You have void (*signal())()." >&4
10809         val="$define"
10810 else
10811         case "$d_voidsig" in
10812         '')
10813         echo "I can't determine whether signal handler returns void or int..." >&4
10814                 dflt=void
10815                 rp="What type does your signal handler return?"
10816                 . ./myread
10817                 case "$ans" in
10818                 v*) val="$define";;
10819                 *) val="$undef";;
10820                 esac;;
10821         "$define")
10822                 echo "As you already told me, signal handler returns void." >&4
10823                 val="$define"
10824                 ;;
10825         *)      echo "As you already told me, signal handler returns int." >&4
10826                 val="$undef"
10827                 ;;
10828         esac
10829 fi
10830 set d_voidsig
10831 eval $setvar
10832 case "$d_voidsig" in
10833 "$define") signal_t="void";;
10834 *) signal_t="int";;
10835 esac
10836 $rm -f $$.tmp
10837
10838 : check for ability to cast large floats to 32-bit ints.
10839 echo " "
10840 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10841 if $test "$intsize" -ge 4; then
10842         xxx=int
10843 else
10844         xxx=long
10845 fi
10846 $cat >try.c <<EOCP
10847 #include <stdio.h>
10848 #$i_stdlib I_STDLIB
10849 #ifdef I_STDLIB
10850 #include <stdlib.h>
10851 #endif
10852 #include <sys/types.h>
10853 #include <signal.h>
10854 $signal_t blech(int s) { exit(3); }
10855 int main()
10856 {
10857         $xxx i32;
10858         double f, g;
10859         int result = 0;
10860         char str[16];
10861         signal(SIGFPE, blech);
10862
10863         /* Don't let compiler optimize the test away.  Store the number
10864            in a writable string for gcc to pass to sscanf under HP/UX.
10865         */
10866         sprintf(str, "2147483647");
10867         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10868         g = 10 * f;
10869         i32  = ($xxx) g;
10870
10871         /* x86 processors will probably give 0x8000 0000, which is a
10872            sign change.  We don't want that.  We want to mimic SPARC
10873            behavior here, which is to preserve the sign and give
10874            back 0x7fff ffff.
10875         */
10876         if (i32 != ($xxx) f)
10877                 result |= 1;
10878         exit(result);
10879 }
10880 EOCP
10881 set try
10882 if eval $compile_ok; then
10883         $run ./try
10884         yyy=$?
10885 else
10886         echo "(I can't seem to compile the test program--assuming it can't)"
10887         yyy=1
10888 fi
10889 case "$yyy" in
10890 0)      val="$define"
10891         echo "Yup, it can."
10892         ;;
10893 *)      val="$undef"
10894         echo "Nope, it can't."
10895         ;;
10896 esac
10897 set d_casti32
10898 eval $setvar
10899 $rm_try
10900
10901 : check for ability to cast negative floats to unsigned
10902 echo " "
10903 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10904 $cat >try.c <<EOCP
10905 #include <stdio.h>
10906 #$i_stdlib I_STDLIB
10907 #ifdef I_STDLIB
10908 #include <stdlib.h>
10909 #endif
10910 #include <sys/types.h>
10911 #include <signal.h>
10912 $signal_t blech(int s) { exit(7); }
10913 $signal_t blech_in_list(int s) { exit(4); }
10914 unsigned long dummy_long(unsigned long p) { return p; }
10915 unsigned int dummy_int(unsigned int p) { return p; }
10916 unsigned short dummy_short(unsigned short p) { return p; }
10917 int main()
10918 {
10919         double f;
10920         unsigned long along;
10921         unsigned int aint;
10922         unsigned short ashort;
10923         int result = 0;
10924         char str[16];
10925
10926         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10927            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10928            optimized the whole file away
10929         */
10930         /* Store the number in a writable string for gcc to pass to
10931            sscanf under HP/UX.
10932         */
10933         sprintf(str, "-123");
10934         sscanf(str, "%lf", &f);  /* f = -123.; */
10935
10936         signal(SIGFPE, blech);
10937         along = (unsigned long)f;
10938         aint = (unsigned int)f;
10939         ashort = (unsigned short)f;
10940         if (along != (unsigned long)-123)
10941                 result |= 1;
10942         if (aint != (unsigned int)-123)
10943                 result |= 1;
10944         if (ashort != (unsigned short)-123)
10945                 result |= 1;
10946         sprintf(str, "1073741824.");
10947         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10948         f = f + f;
10949         along = 0;
10950         along = (unsigned long)f;
10951         if (along != 0x80000000)
10952                 result |= 2;
10953         f -= 1.;
10954         along = 0;
10955         along = (unsigned long)f;
10956         if (along != 0x7fffffff)
10957                 result |= 1;
10958         f += 2.;
10959         along = 0;
10960         along = (unsigned long)f;
10961         if (along != 0x80000001)
10962                 result |= 2;
10963         if (result)
10964                 exit(result);
10965         signal(SIGFPE, blech_in_list);
10966         sprintf(str, "123.");
10967         sscanf(str, "%lf", &f);  /* f = 123.; */
10968         along = dummy_long((unsigned long)f);
10969         aint = dummy_int((unsigned int)f);
10970         ashort = dummy_short((unsigned short)f);
10971         if (along != (unsigned long)123)
10972                 result |= 4;
10973         if (aint != (unsigned int)123)
10974                 result |= 4;
10975         if (ashort != (unsigned short)123)
10976                 result |= 4;
10977         exit(result);
10978
10979 }
10980 EOCP
10981 set try
10982 if eval $compile_ok; then
10983         $run ./try
10984         castflags=$?
10985 else
10986         echo "(I can't seem to compile the test program--assuming it can't)"
10987         castflags=7
10988 fi
10989 case "$castflags" in
10990 0)      val="$define"
10991         echo "Yup, it can."
10992         ;;
10993 *)      val="$undef"
10994         echo "Nope, it can't."
10995         ;;
10996 esac
10997 set d_castneg
10998 eval $setvar
10999 $rm_try
11000
11001 : see if vprintf exists
11002 echo " "
11003 if set vprintf val -f d_vprintf; eval $csym; $val; then
11004         echo 'vprintf() found.' >&4
11005         val="$define"
11006         $cat >try.c <<EOF
11007 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11008 #$i_varargs I_VARARGS
11009
11010 #$i_stdlib I_STDLIB
11011 #$i_unistd I_UNISTD
11012
11013 #ifdef I_STDARG
11014 #  include <stdarg.h>
11015 #else /* I_VARARGS */
11016 #  include <varargs.h>
11017 #endif
11018
11019 #ifdef I_UNISTD
11020 #  include <unistd.h>
11021 #endif
11022
11023 #ifdef I_STDLIB
11024 #  include <stdlib.h>
11025 #endif
11026
11027 #include <stdio.h> /* vsprintf prototype */
11028
11029 #ifdef I_STDARG
11030 void xxx(int n, ...)
11031 {
11032     va_list args;
11033     char buf[10];
11034     va_start(args, n);
11035     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11036 }
11037 int main() { xxx(1, "foo"); }
11038
11039 #else /* I_VARARGS */
11040
11041 xxx(va_alist)
11042 va_dcl
11043 {
11044     va_list args;
11045     char buf[10];
11046     va_start(args);
11047     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11048 }
11049 int main() { xxx("foo"); }
11050
11051 #endif
11052
11053 EOF
11054         set try
11055         if eval $compile_ok; then
11056                 if $run ./try; then
11057                         echo "Your vsprintf() returns (int)." >&4
11058                         val2="$undef"
11059                 else
11060                         echo "Your vsprintf() returns (char*)." >&4
11061                         val2="$define"
11062                 fi
11063         else
11064                 echo 'I am unable to compile the vsprintf() test program.' >&4
11065                 # We shouldn't get here.  If we do, assume the standard signature,
11066                 # not the old BSD one.
11067                 echo 'Guessing that vsprintf() returns (int).' >&4
11068                 val2="$undef"
11069         fi
11070 else
11071         echo 'vprintf() NOT found.' >&4
11072         val="$undef"
11073         val2="$undef"
11074 fi
11075 $rm_try
11076 set d_vprintf
11077 eval $setvar
11078 val=$val2
11079 set d_charvspr
11080 eval $setvar
11081
11082 : see if chown exists
11083 set chown d_chown
11084 eval $inlibc
11085
11086 : see if chroot exists
11087 set chroot d_chroot
11088 eval $inlibc
11089
11090 : see if chsize exists
11091 set chsize d_chsize
11092 eval $inlibc
11093
11094 : see if class exists
11095 set class d_class
11096 eval $inlibc
11097
11098 : see if clearenv exists
11099 set clearenv d_clearenv
11100 eval $inlibc
11101
11102 : Define hasstruct macro for Configure internal use
11103 hasstruct='varname=$1; struct=$2; shift; shift;
11104 while $test $# -ge 2; do
11105         case "$1" in
11106         $define) echo "#include <$2>";;
11107         esac ;
11108     shift 2;
11109 done > try.c;
11110 echo "int main () { struct $struct foo; }" >> try.c;
11111 set try;
11112 if eval $compile; then
11113         val="$define";
11114 else
11115         val="$undef";
11116 fi;
11117 set $varname;
11118 eval $setvar;
11119 $rm_try'
11120
11121 : see whether socket exists
11122 socketlib=''
11123 sockethdr=''
11124 echo " "
11125 $echo $n "Hmm... $c" >&4
11126 if set socket val -f d_socket; eval $csym; $val; then
11127         echo "Looks like you have Berkeley networking support." >&4
11128         d_socket="$define"
11129         if set setsockopt val -f; eval $csym; $val; then
11130                 d_oldsock="$undef"
11131         else
11132                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11133                 d_oldsock="$define"
11134         fi
11135 else
11136         if $contains socklib libc.list >/dev/null 2>&1; then
11137                 echo "Looks like you have Berkeley networking support." >&4
11138                 d_socket="$define"
11139                 : we will have to assume that it supports the 4.2 BSD interface
11140                 d_oldsock="$undef"
11141         else
11142                 echo "You don't have Berkeley networking in libc$_a..." >&4
11143                 if test "X$d_socket" = "X$define"; then
11144                    echo "...but you seem to believe that you have sockets." >&4
11145                 else
11146                         for net in net socket
11147                         do
11148                                 if test -f /usr/lib/lib$net$_a; then
11149                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11150                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11151                                         if $contains socket libc.list >/dev/null 2>&1; then
11152                                                 d_socket="$define"
11153                                                 socketlib="-l$net"
11154                                                 case "$net" in
11155                                                 net)
11156                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11157                                                         sockethdr="-I/usr/netinclude"
11158                                                         ;;
11159                                                 esac
11160                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11161                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11162                                                         d_oldsock="$undef"
11163                                                 else
11164                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11165                                                         d_oldsock="$define"
11166                                                 fi
11167                                                 break
11168                                         fi
11169                                 fi
11170                         done
11171                         if test "X$d_socket" != "X$define"; then
11172                            echo "or anywhere else I see." >&4
11173                            d_socket="$undef"
11174                            d_oldsock="$undef"
11175                         fi
11176                 fi
11177         fi
11178 fi
11179
11180 : see if socketpair exists
11181 set socketpair d_sockpair
11182 eval $inlibc
11183
11184
11185 echo " "
11186 echo "Checking the availability of certain socket constants..." >&4
11187 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11188         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11189         $cat >try.c <<EOF
11190 #include <sys/types.h>
11191 #include <sys/socket.h>
11192 int main() {
11193     int i = $ENUM;
11194 }
11195 EOF
11196         val="$undef"
11197         set try; if eval $compile; then
11198                 val="$define"
11199         fi
11200         set d_${enum}; eval $setvar
11201         $rm_try
11202 done
11203
11204 : see if this is a sys/uio.h system
11205 set sys/uio.h i_sysuio
11206 eval $inhdr
11207
11208 : Check for cmsghdr support
11209 echo " "
11210 echo "Checking to see if your system supports struct cmsghdr..." >&4
11211 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11212 eval $hasstruct
11213 case "$d_cmsghdr_s" in
11214 "$define")      echo "Yes, it does."   ;;
11215 *)              echo "No, it doesn't." ;;
11216 esac
11217
11218
11219 : check for const keyword
11220 echo " "
11221 echo 'Checking to see if your C compiler knows about "const"...' >&4
11222 $cat >const.c <<'EOCP'
11223 typedef struct spug { int drokk; } spug;
11224 int main()
11225 {
11226         const char *foo;
11227         const spug y = { 0 };
11228 }
11229 EOCP
11230 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11231         val="$define"
11232         echo "Yup, it does."
11233 else
11234         val="$undef"
11235         echo "Nope, it doesn't."
11236 fi
11237 set d_const
11238 eval $setvar
11239
11240 : see if copysignl exists
11241 set copysignl d_copysignl
11242 eval $inlibc
11243
11244 : see if crypt exists
11245 echo " "
11246 set crypt d_crypt
11247 eval $inlibc
11248 case "$d_crypt" in
11249 $define) cryptlib='' ;;
11250 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11251                 echo 'crypt() found.' >&4
11252                 val="$define"
11253                 cryptlib=''
11254         else
11255                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11256                 if $test -z "$cryptlib"; then
11257                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11258                 else
11259                         cryptlib=-lcrypt
11260                 fi
11261                 if $test -z "$cryptlib"; then
11262                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11263                 else
11264                         cryptlib=-lcrypt
11265                 fi
11266                 if $test -z "$cryptlib"; then
11267                         cryptlib=`./loc libcrypt$_a "" $libpth`
11268                 else
11269                         cryptlib=-lcrypt
11270                 fi
11271                 if $test -z "$cryptlib"; then
11272                         echo 'crypt() NOT found.' >&4
11273                         val="$undef"
11274                 else
11275                         val="$define"
11276                 fi
11277         fi
11278         set d_crypt
11279         eval $setvar
11280         ;;
11281 esac
11282
11283 : see if this is a crypt.h system
11284 set crypt.h i_crypt
11285 eval $inhdr
11286
11287 : see if crypt_r exists
11288 set crypt_r d_crypt_r
11289 eval $inlibc
11290 case "$d_crypt_r" in
11291 "$define")
11292         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11293         case "$d_crypt_r_proto:$usethreads" in
11294         ":define")      d_crypt_r_proto=define
11295                 set d_crypt_r_proto crypt_r $hdrs
11296                 eval $hasproto ;;
11297         *)      ;;
11298         esac
11299         case "$d_crypt_r_proto" in
11300         define)
11301         case "$crypt_r_proto" in
11302         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11303         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11304         esac
11305         case "$crypt_r_proto" in
11306         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11307         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11308         esac
11309         case "$crypt_r_proto" in
11310         ''|0)   d_crypt_r=undef
11311                 crypt_r_proto=0
11312                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11313         * )     case "$crypt_r_proto" in
11314                 REENTRANT_PROTO*) ;;
11315                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11316                 esac
11317                 echo "Prototype: $try" ;;
11318         esac
11319         ;;
11320         *)      case "$usethreads" in
11321                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11322                 esac
11323                 d_crypt_r=undef
11324                 crypt_r_proto=0
11325                 ;;
11326         esac
11327         ;;
11328 *)      crypt_r_proto=0
11329         ;;
11330 esac
11331
11332 : get csh whereabouts
11333 case "$csh" in
11334 'csh') val="$undef" ;;
11335 *) val="$define" ;;
11336 esac
11337 set d_csh
11338 eval $setvar
11339 : Respect a hint or command line value for full_csh.
11340 case "$full_csh" in
11341 '') full_csh=$csh ;;
11342 esac
11343
11344 : see if ctermid exists
11345 set ctermid d_ctermid
11346 eval $inlibc
11347
11348 : see if ctermid_r exists
11349 set ctermid_r d_ctermid_r
11350 eval $inlibc
11351 case "$d_ctermid_r" in
11352 "$define")
11353         hdrs="$i_systypes sys/types.h define stdio.h "
11354         case "$d_ctermid_r_proto:$usethreads" in
11355         ":define")      d_ctermid_r_proto=define
11356                 set d_ctermid_r_proto ctermid_r $hdrs
11357                 eval $hasproto ;;
11358         *)      ;;
11359         esac
11360         case "$d_ctermid_r_proto" in
11361         define)
11362         case "$ctermid_r_proto" in
11363         ''|0) try='char* ctermid_r(char*);'
11364         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11365         esac
11366         case "$ctermid_r_proto" in
11367         ''|0)   d_ctermid_r=undef
11368                 ctermid_r_proto=0
11369                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11370         * )     case "$ctermid_r_proto" in
11371                 REENTRANT_PROTO*) ;;
11372                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11373                 esac
11374                 echo "Prototype: $try" ;;
11375         esac
11376         ;;
11377         *)      case "$usethreads" in
11378                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11379                 esac
11380                 d_ctermid_r=undef
11381                 ctermid_r_proto=0
11382                 ;;
11383         esac
11384         ;;
11385 *)      ctermid_r_proto=0
11386         ;;
11387 esac
11388
11389 : see if ctime_r exists
11390 set ctime_r d_ctime_r
11391 eval $inlibc
11392 case "$d_ctime_r" in
11393 "$define")
11394         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11395         case "$d_ctime_r_proto:$usethreads" in
11396         ":define")      d_ctime_r_proto=define
11397                 set d_ctime_r_proto ctime_r $hdrs
11398                 eval $hasproto ;;
11399         *)      ;;
11400         esac
11401         case "$d_ctime_r_proto" in
11402         define)
11403         case "$ctime_r_proto" in
11404         ''|0) try='char* ctime_r(const time_t*, char*);'
11405         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11406         esac
11407         case "$ctime_r_proto" in
11408         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11409         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11410         esac
11411         case "$ctime_r_proto" in
11412         ''|0) try='int ctime_r(const time_t*, char*);'
11413         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11414         esac
11415         case "$ctime_r_proto" in
11416         ''|0) try='int ctime_r(const time_t*, char*, int);'
11417         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11418         esac
11419         case "$ctime_r_proto" in
11420         ''|0)   d_ctime_r=undef
11421                 ctime_r_proto=0
11422                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11423         * )     case "$ctime_r_proto" in
11424                 REENTRANT_PROTO*) ;;
11425                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11426                 esac
11427                 echo "Prototype: $try" ;;
11428         esac
11429         ;;
11430         *)      case "$usethreads" in
11431                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11432                 esac
11433                 d_ctime_r=undef
11434                 ctime_r_proto=0
11435                 ;;
11436         esac
11437         ;;
11438 *)      ctime_r_proto=0
11439         ;;
11440 esac
11441
11442 : see if cuserid exists
11443 set cuserid d_cuserid
11444 eval $inlibc
11445
11446 : see if this is a limits.h system
11447 set limits.h i_limits
11448 eval $inhdr
11449
11450 : see if this is a float.h system
11451 set float.h i_float
11452 eval $inhdr
11453
11454 : See if number of significant digits in a double precision number is known
11455 echo " "
11456 $cat >dbl_dig.c <<EOM
11457 #$i_limits I_LIMITS
11458 #$i_float I_FLOAT
11459 #ifdef I_LIMITS
11460 #include <limits.h>
11461 #endif
11462 #ifdef I_FLOAT
11463 #include <float.h>
11464 #endif
11465 #ifdef DBL_DIG
11466 printf("Contains DBL_DIG");
11467 #endif
11468 EOM
11469 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11470 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11471         echo "DBL_DIG found." >&4
11472         val="$define"
11473 else
11474         echo "DBL_DIG NOT found." >&4
11475         val="$undef"
11476 fi
11477 $rm -f dbl_dig.?
11478 set d_dbl_dig
11479 eval $setvar
11480
11481 : see if dbm.h is available
11482 : see if dbmclose exists
11483 set dbmclose d_dbmclose
11484 eval $inlibc
11485
11486 case "$d_dbmclose" in
11487 $define)
11488         set dbm.h i_dbm
11489         eval $inhdr
11490         case "$i_dbm" in
11491         $define)
11492                 val="$undef"
11493                 set i_rpcsvcdbm
11494                 eval $setvar
11495                 ;;
11496         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11497                 eval $inhdr
11498                 ;;
11499         esac
11500         ;;
11501 *)      echo "We won't be including <dbm.h>"
11502         val="$undef"
11503         set i_dbm
11504         eval $setvar
11505         val="$undef"
11506         set i_rpcsvcdbm
11507         eval $setvar
11508         ;;
11509 esac
11510
11511 : see if prototype for dbminit is available
11512 echo " "
11513 set d_dbminitproto dbminit $i_dbm dbm.h
11514 eval $hasproto
11515
11516 : see if difftime exists
11517 set difftime d_difftime
11518 eval $inlibc
11519
11520 : see if this is a dirent system
11521 echo " "
11522 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11523         val="$define"
11524         echo "<dirent.h> found." >&4
11525 else
11526         val="$undef"
11527         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11528                 echo "<sys/dir.h> found." >&4
11529                 echo " "
11530         else
11531                 xinc=`./findhdr sys/ndir.h`
11532         fi
11533         echo "<dirent.h> NOT found." >&4
11534 fi
11535 set i_dirent
11536 eval $setvar
11537
11538 : Look for type of directory structure.
11539 echo " "
11540 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11541
11542 case "$direntrytype" in
11543 ''|' ')
11544         case "$i_dirent" in
11545         $define) guess1='struct dirent' ;;
11546         *) guess1='struct direct'  ;;
11547         esac
11548         ;;
11549 *)      guess1="$direntrytype"
11550         ;;
11551 esac
11552
11553 case "$guess1" in
11554 'struct dirent') guess2='struct direct' ;;
11555 *) guess2='struct dirent' ;;
11556 esac
11557
11558 if $contains "$guess1" try.c >/dev/null 2>&1; then
11559         direntrytype="$guess1"
11560         echo "Your directory entries are $direntrytype." >&4
11561 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11562         direntrytype="$guess2"
11563         echo "Your directory entries seem to be $direntrytype." >&4
11564 else
11565         echo "I don't recognize your system's directory entries." >&4
11566         rp="What type is used for directory entries on this system?"
11567         dflt="$guess1"
11568         . ./myread
11569         direntrytype="$ans"
11570 fi
11571 $rm_try
11572
11573 : see if the directory entry stores field length
11574 echo " "
11575 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11576 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11577         echo "Good, your directory entry keeps length information in d_namlen." >&4
11578         val="$define"
11579 else
11580         echo "Your directory entry does not know about the d_namlen field." >&4
11581         val="$undef"
11582 fi
11583 set d_dirnamlen
11584 eval $setvar
11585 $rm_try
11586
11587 : Look for DIR.dd_fd
11588 case "$i_dirent" in
11589 "$define")
11590     echo "Checking to see if DIR has a dd_fd member variable" >&4
11591     $cat >try.c <<EOCP
11592 #$i_stdlib I_STDLIB
11593 #ifdef I_STDLIB
11594 #include <stdlib.h>
11595 #endif
11596 #include <dirent.h>
11597
11598 int main() {
11599     DIR dir;
11600     dir.dd_fd = 1;
11601     return 0;
11602 }
11603 EOCP
11604     val=$undef
11605     set try
11606     if eval $compile; then
11607         echo "Yes, it does."
11608         val="$define"
11609     else
11610         echo "No, it does not."
11611         val="$undef"
11612     fi
11613     ;;
11614 *)
11615     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11616     val="$undef"
11617     ;;
11618 esac
11619 set d_dir_dd_fd
11620 eval $setvar
11621 $rm_try
11622
11623 : see if this is an sysdir system
11624 set sys/dir.h i_sysdir
11625 eval $inhdr
11626
11627 : see if this is an sysndir system
11628 set sys/ndir.h i_sysndir
11629 eval $inhdr
11630
11631 : Look for dirfd
11632 echo " "
11633 $cat >dirfd.c <<EOM
11634 #include <stdio.h>
11635 #$i_stdlib I_STDLIB
11636 #ifdef I_STDLIB
11637 #include <stdlib.h>
11638 #endif
11639 #$i_dirent I_DIRENT             /**/
11640 #$i_sysdir I_SYS_DIR            /**/
11641 #$i_sysndir I_SYS_NDIR          /**/
11642 #$i_systypes I_SYS_TYPES        /**/
11643 #if defined(I_SYS_TYPES)
11644 #include <sys/types.h>
11645 #endif
11646 #if defined(I_DIRENT)
11647 #include <dirent.h>
11648 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11649 #include <sys/dir.h>
11650 #endif
11651 #else
11652 #ifdef I_SYS_NDIR
11653 #include <sys/ndir.h>
11654 #else
11655 #ifdef I_SYS_DIR
11656 #ifdef hp9000s500
11657 #include <ndir.h>       /* may be wrong in the future */
11658 #else
11659 #include <sys/dir.h>
11660 #endif
11661 #endif
11662 #endif
11663 #endif 
11664 int main() {
11665         DIR *dirp = opendir(".");
11666         if (dirfd(dirp) >= 0)
11667                 exit(0);
11668         else
11669                 exit(1);
11670 }
11671 EOM
11672 val=$undef
11673 set dirfd
11674 if eval $compile; then
11675         val="$define"
11676 fi
11677 case "$val" in
11678 $define)        echo "dirfd() found." >&4       ;;
11679 *)              echo "dirfd() NOT found." >&4   ;;
11680 esac
11681 set d_dirfd
11682 eval $setvar
11683 $rm -f dirfd*
11684
11685 : see if dlerror exists
11686 xxx_runnm="$runnm"
11687 runnm=false
11688 set dlerror d_dlerror
11689 eval $inlibc
11690 runnm="$xxx_runnm"
11691
11692 : see if dlfcn is available
11693 set dlfcn.h i_dlfcn
11694 eval $inhdr
11695
11696 : Check what extension to use for shared libs
11697 case "$usedl" in
11698 $define|y|true)
11699         $cat << EOM
11700
11701 On a few systems, the dynamically loaded modules that perl generates and uses
11702 will need a different extension than shared libs. The default will probably
11703 be appropriate.
11704
11705 EOM
11706         case "$dlext" in
11707         '')     dflt="$so" ;;
11708         *)      dflt="$dlext" ;;
11709         esac
11710         rp='What is the extension of dynamically loaded modules'
11711         . ./myread
11712         dlext="$ans"
11713         ;;
11714 *)
11715         dlext="none"
11716         ;;
11717 esac
11718
11719 : Check if dlsym need a leading underscore
11720 echo " "
11721 val="$undef"
11722
11723 case "$dlsrc" in
11724 dl_dlopen.xs)
11725         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11726         $cat >dyna.c <<'EOM'
11727 fred () { }
11728 EOM
11729
11730 $cat >fred.c<<EOM
11731
11732 #include <stdio.h>
11733 #$i_stdlib I_STDLIB
11734 #ifdef I_STDLIB
11735 #include <stdlib.h>
11736 #endif
11737 #$i_dlfcn I_DLFCN
11738 #ifdef I_DLFCN
11739 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11740 #else
11741 #include <sys/types.h>
11742 #include <nlist.h>
11743 #include <link.h>
11744 #endif
11745
11746 extern int fred() ;
11747
11748 int main()
11749 {
11750     void * handle ;
11751     void * symbol ;
11752 #ifndef RTLD_LAZY
11753     int mode = 1 ;
11754 #else
11755     int mode = RTLD_LAZY ;
11756 #endif
11757     handle = dlopen("./dyna.$dlext", mode) ;
11758     if (handle == NULL) {
11759         printf ("1\n") ;
11760         fflush (stdout) ;
11761         exit(0);
11762     }
11763     symbol = dlsym(handle, "fred") ;
11764     if (symbol == NULL) {
11765         /* try putting a leading underscore */
11766         symbol = dlsym(handle, "_fred") ;
11767         if (symbol == NULL) {
11768             printf ("2\n") ;
11769             fflush (stdout) ;
11770             exit(0);
11771         }
11772         printf ("3\n") ;
11773     }
11774     else
11775         printf ("4\n") ;
11776     fflush (stdout) ;
11777     exit(0);
11778 }
11779 EOM
11780         : Call the object file tmp-dyna.o in case dlext=o.
11781         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11782                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11783                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11784                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11785                 xxx=`$run ./fred`
11786                 case $xxx in
11787                 1)      echo "Test program failed using dlopen." >&4
11788                         echo "Perhaps you should not use dynamic loading." >&4;;
11789                 2)      echo "Test program failed using dlsym." >&4
11790                         echo "Perhaps you should not use dynamic loading." >&4;;
11791                 3)      echo "dlsym needs a leading underscore" >&4
11792                         val="$define" ;;
11793                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11794                 esac
11795         else
11796                 echo "I can't compile and run the test program." >&4
11797                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11798         fi
11799         ;;
11800 esac
11801
11802 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11803
11804 set d_dlsymun
11805 eval $setvar
11806
11807 : see if drand48_r exists
11808 set drand48_r d_drand48_r
11809 eval $inlibc
11810 case "$d_drand48_r" in
11811 "$define")
11812         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11813         case "$d_drand48_r_proto:$usethreads" in
11814         ":define")      d_drand48_r_proto=define
11815                 set d_drand48_r_proto drand48_r $hdrs
11816                 eval $hasproto ;;
11817         *)      ;;
11818         esac
11819         case "$d_drand48_r_proto" in
11820         define)
11821         case "$drand48_r_proto" in
11822         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11823         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11824         esac
11825         case "$drand48_r_proto" in
11826         ''|0)   d_drand48_r=undef
11827                 drand48_r_proto=0
11828                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11829         * )     case "$drand48_r_proto" in
11830                 REENTRANT_PROTO*) ;;
11831                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11832                 esac
11833                 echo "Prototype: $try" ;;
11834         esac
11835         ;;
11836         *)      case "$usethreads" in
11837                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11838                 esac
11839                 d_drand48_r=undef
11840                 drand48_r_proto=0
11841                 ;;
11842         esac
11843         ;;
11844 *)      drand48_r_proto=0
11845         ;;
11846 esac
11847
11848 : see if prototype for drand48 is available
11849 echo " "
11850 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11851 eval $hasproto
11852
11853 : see if dup2 exists
11854 set dup2 d_dup2
11855 eval $inlibc
11856
11857 : see if eaccess exists
11858 set eaccess d_eaccess
11859 eval $inlibc
11860
11861 : see if endgrent exists
11862 set endgrent d_endgrent
11863 eval $inlibc
11864
11865 : see if this is an grp system
11866 set grp.h i_grp
11867 eval $inhdr
11868
11869 case "$i_grp" in
11870 $define)
11871         xxx=`./findhdr grp.h`
11872         $cppstdin $cppflags $cppminus < $xxx >$$.h
11873
11874         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11875                 val="$define"
11876         else
11877                 val="$undef"
11878         fi
11879         set d_grpasswd
11880         eval $setvar
11881
11882         $rm -f $$.h
11883         ;;
11884 *)
11885         val="$undef";
11886         set d_grpasswd; eval $setvar
11887         ;;
11888 esac
11889
11890 : see if endgrent_r exists
11891 set endgrent_r d_endgrent_r
11892 eval $inlibc
11893 case "$d_endgrent_r" in
11894 "$define")
11895         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11896         case "$d_endgrent_r_proto:$usethreads" in
11897         ":define")      d_endgrent_r_proto=define
11898                 set d_endgrent_r_proto endgrent_r $hdrs
11899                 eval $hasproto ;;
11900         *)      ;;
11901         esac
11902         case "$d_endgrent_r_proto" in
11903         define)
11904         case "$endgrent_r_proto" in
11905         ''|0) try='int endgrent_r(FILE**);'
11906         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11907         esac
11908         case "$endgrent_r_proto" in
11909         ''|0) try='void endgrent_r(FILE**);'
11910         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11911         esac
11912         case "$endgrent_r_proto" in
11913         ''|0)   d_endgrent_r=undef
11914                 endgrent_r_proto=0
11915                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11916         * )     case "$endgrent_r_proto" in
11917                 REENTRANT_PROTO*) ;;
11918                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11919                 esac
11920                 echo "Prototype: $try" ;;
11921         esac
11922         ;;
11923         *)      case "$usethreads" in
11924                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11925                 esac
11926                 d_endgrent_r=undef
11927                 endgrent_r_proto=0
11928                 ;;
11929         esac
11930         ;;
11931 *)      endgrent_r_proto=0
11932         ;;
11933 esac
11934
11935 : see if endhostent exists
11936 set endhostent d_endhent
11937 eval $inlibc
11938
11939 : see if this is a netdb.h system
11940 set netdb.h i_netdb
11941 eval $inhdr
11942
11943 : see if endhostent_r exists
11944 set endhostent_r d_endhostent_r
11945 eval $inlibc
11946 case "$d_endhostent_r" in
11947 "$define")
11948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11949         case "$d_endhostent_r_proto:$usethreads" in
11950         ":define")      d_endhostent_r_proto=define
11951                 set d_endhostent_r_proto endhostent_r $hdrs
11952                 eval $hasproto ;;
11953         *)      ;;
11954         esac
11955         case "$d_endhostent_r_proto" in
11956         define)
11957         case "$endhostent_r_proto" in
11958         ''|0) try='int endhostent_r(struct hostent_data*);'
11959         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11960         esac
11961         case "$endhostent_r_proto" in
11962         ''|0) try='void endhostent_r(struct hostent_data*);'
11963         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11964         esac
11965         case "$endhostent_r_proto" in
11966         ''|0)   d_endhostent_r=undef
11967                 endhostent_r_proto=0
11968                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11969         * )     case "$endhostent_r_proto" in
11970                 REENTRANT_PROTO*) ;;
11971                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11972                 esac
11973                 echo "Prototype: $try" ;;
11974         esac
11975         ;;
11976         *)      case "$usethreads" in
11977                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11978                 esac
11979                 d_endhostent_r=undef
11980                 endhostent_r_proto=0
11981                 ;;
11982         esac
11983         ;;
11984 *)      endhostent_r_proto=0
11985         ;;
11986 esac
11987
11988 : see if endnetent exists
11989 set endnetent d_endnent
11990 eval $inlibc
11991
11992 : see if endnetent_r exists
11993 set endnetent_r d_endnetent_r
11994 eval $inlibc
11995 case "$d_endnetent_r" in
11996 "$define")
11997         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11998         case "$d_endnetent_r_proto:$usethreads" in
11999         ":define")      d_endnetent_r_proto=define
12000                 set d_endnetent_r_proto endnetent_r $hdrs
12001                 eval $hasproto ;;
12002         *)      ;;
12003         esac
12004         case "$d_endnetent_r_proto" in
12005         define)
12006         case "$endnetent_r_proto" in
12007         ''|0) try='int endnetent_r(struct netent_data*);'
12008         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
12009         esac
12010         case "$endnetent_r_proto" in
12011         ''|0) try='void endnetent_r(struct netent_data*);'
12012         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12013         esac
12014         case "$endnetent_r_proto" in
12015         ''|0)   d_endnetent_r=undef
12016                 endnetent_r_proto=0
12017                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12018         * )     case "$endnetent_r_proto" in
12019                 REENTRANT_PROTO*) ;;
12020                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12021                 esac
12022                 echo "Prototype: $try" ;;
12023         esac
12024         ;;
12025         *)      case "$usethreads" in
12026                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12027                 esac
12028                 d_endnetent_r=undef
12029                 endnetent_r_proto=0
12030                 ;;
12031         esac
12032         ;;
12033 *)      endnetent_r_proto=0
12034         ;;
12035 esac
12036
12037 : see if endprotoent exists
12038 set endprotoent d_endpent
12039 eval $inlibc
12040
12041 : see if endprotoent_r exists
12042 set endprotoent_r d_endprotoent_r
12043 eval $inlibc
12044 case "$d_endprotoent_r" in
12045 "$define")
12046         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12047         case "$d_endprotoent_r_proto:$usethreads" in
12048         ":define")      d_endprotoent_r_proto=define
12049                 set d_endprotoent_r_proto endprotoent_r $hdrs
12050                 eval $hasproto ;;
12051         *)      ;;
12052         esac
12053         case "$d_endprotoent_r_proto" in
12054         define)
12055         case "$endprotoent_r_proto" in
12056         ''|0) try='int endprotoent_r(struct protoent_data*);'
12057         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12058         esac
12059         case "$endprotoent_r_proto" in
12060         ''|0) try='void endprotoent_r(struct protoent_data*);'
12061         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12062         esac
12063         case "$endprotoent_r_proto" in
12064         ''|0)   d_endprotoent_r=undef
12065                 endprotoent_r_proto=0
12066                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12067         * )     case "$endprotoent_r_proto" in
12068                 REENTRANT_PROTO*) ;;
12069                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12070                 esac
12071                 echo "Prototype: $try" ;;
12072         esac
12073         ;;
12074         *)      case "$usethreads" in
12075                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12076                 esac
12077                 d_endprotoent_r=undef
12078                 endprotoent_r_proto=0
12079                 ;;
12080         esac
12081         ;;
12082 *)      endprotoent_r_proto=0
12083         ;;
12084 esac
12085
12086 : see if endpwent exists
12087 set endpwent d_endpwent
12088 eval $inlibc
12089
12090 : see if this is a pwd.h system
12091 set pwd.h i_pwd
12092 eval $inhdr
12093
12094 case "$i_pwd" in
12095 $define)
12096         xxx=`./findhdr pwd.h`
12097         $cppstdin $cppflags $cppminus < $xxx >$$.h
12098
12099         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12100                 val="$define"
12101         else
12102                 val="$undef"
12103         fi
12104         set d_pwquota
12105         eval $setvar
12106
12107         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12108                 val="$define"
12109         else
12110                 val="$undef"
12111         fi
12112         set d_pwage
12113         eval $setvar
12114
12115         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12116                 val="$define"
12117         else
12118                 val="$undef"
12119         fi
12120         set d_pwchange
12121         eval $setvar
12122
12123         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12124                 val="$define"
12125         else
12126                 val="$undef"
12127         fi
12128         set d_pwclass
12129         eval $setvar
12130
12131         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12132                 val="$define"
12133         else
12134                 val="$undef"
12135         fi
12136         set d_pwexpire
12137         eval $setvar
12138
12139         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12140                 val="$define"
12141         else
12142                 val="$undef"
12143         fi
12144         set d_pwcomment
12145         eval $setvar
12146
12147         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12148                 val="$define"
12149         else
12150                 val="$undef"
12151         fi
12152         set d_pwgecos
12153         eval $setvar
12154
12155         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12156                 val="$define"
12157         else
12158                 val="$undef"
12159         fi
12160         set d_pwpasswd
12161         eval $setvar
12162
12163         $rm -f $$.h
12164         ;;
12165 *)
12166         val="$undef"; 
12167         set d_pwquota; eval $setvar
12168         set d_pwage; eval $setvar
12169         set d_pwchange; eval $setvar
12170         set d_pwclass; eval $setvar
12171         set d_pwexpire; eval $setvar
12172         set d_pwcomment; eval $setvar
12173         set d_pwgecos; eval $setvar
12174         set d_pwpasswd; eval $setvar
12175         ;;
12176 esac
12177
12178 : see if endpwent_r exists
12179 set endpwent_r d_endpwent_r
12180 eval $inlibc
12181 case "$d_endpwent_r" in
12182 "$define")
12183         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12184         case "$d_endpwent_r_proto:$usethreads" in
12185         ":define")      d_endpwent_r_proto=define
12186                 set d_endpwent_r_proto endpwent_r $hdrs
12187                 eval $hasproto ;;
12188         *)      ;;
12189         esac
12190         case "$d_endpwent_r_proto" in
12191         define)
12192         case "$endpwent_r_proto" in
12193         ''|0) try='int endpwent_r(FILE**);'
12194         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12195         esac
12196         case "$endpwent_r_proto" in
12197         ''|0) try='void endpwent_r(FILE**);'
12198         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12199         esac
12200         case "$endpwent_r_proto" in
12201         ''|0)   d_endpwent_r=undef
12202                 endpwent_r_proto=0
12203                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12204         * )     case "$endpwent_r_proto" in
12205                 REENTRANT_PROTO*) ;;
12206                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12207                 esac
12208                 echo "Prototype: $try" ;;
12209         esac
12210         ;;
12211         *)      case "$usethreads" in
12212                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12213                 esac
12214                 d_endpwent_r=undef
12215                 endpwent_r_proto=0
12216                 ;;
12217         esac
12218         ;;
12219 *)      endpwent_r_proto=0
12220         ;;
12221 esac
12222
12223 : see if endservent exists
12224 set endservent d_endsent
12225 eval $inlibc
12226
12227 : see if endservent_r exists
12228 set endservent_r d_endservent_r
12229 eval $inlibc
12230 case "$d_endservent_r" in
12231 "$define")
12232         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12233         case "$d_endservent_r_proto:$usethreads" in
12234         ":define")      d_endservent_r_proto=define
12235                 set d_endservent_r_proto endservent_r $hdrs
12236                 eval $hasproto ;;
12237         *)      ;;
12238         esac
12239         case "$d_endservent_r_proto" in
12240         define)
12241         case "$endservent_r_proto" in
12242         ''|0) try='int endservent_r(struct servent_data*);'
12243         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12244         esac
12245         case "$endservent_r_proto" in
12246         ''|0) try='void endservent_r(struct servent_data*);'
12247         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12248         esac
12249         case "$endservent_r_proto" in
12250         ''|0)   d_endservent_r=undef
12251                 endservent_r_proto=0
12252                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12253         * )     case "$endservent_r_proto" in
12254                 REENTRANT_PROTO*) ;;
12255                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12256                 esac
12257                 echo "Prototype: $try" ;;
12258         esac
12259         ;;
12260         *)      case "$usethreads" in
12261                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12262                 esac
12263                 d_endservent_r=undef
12264                 endservent_r_proto=0
12265                 ;;
12266         esac
12267         ;;
12268 *)      endservent_r_proto=0
12269         ;;
12270 esac
12271
12272 : Locate the flags for 'open()'
12273 echo " "
12274 $cat >try.c <<EOCP
12275 #include <sys/types.h>
12276 #ifdef I_FCNTL
12277 #include <fcntl.h>
12278 #endif
12279 #ifdef I_SYS_FILE
12280 #include <sys/file.h>
12281 #endif
12282 #$i_stdlib I_STDLIB
12283 #ifdef I_STDLIB
12284 #include <stdlib.h>
12285 #endif
12286 int main() {
12287         if(O_RDONLY);
12288 #ifdef O_TRUNC
12289         exit(0);
12290 #else
12291         exit(1);
12292 #endif
12293 }
12294 EOCP
12295 : check sys/file.h first to get FREAD on Sun
12296 if $test `./findhdr sys/file.h` && \
12297                 set try -DI_SYS_FILE && eval $compile; then
12298         h_sysfile=true;
12299         echo "<sys/file.h> defines the O_* constants..." >&4
12300         if $run ./try; then
12301                 echo "and you have the 3 argument form of open()." >&4
12302                 val="$define"
12303         else
12304                 echo "but not the 3 argument form of open().  Oh, well." >&4
12305                 val="$undef"
12306         fi
12307 elif $test `./findhdr fcntl.h` && \
12308                 set try -DI_FCNTL && eval $compile; then
12309         h_fcntl=true;
12310         echo "<fcntl.h> defines the O_* constants..." >&4
12311         if $run ./try; then
12312                 echo "and you have the 3 argument form of open()." >&4
12313                 val="$define"
12314         else
12315                 echo "but not the 3 argument form of open().  Oh, well." >&4
12316                 val="$undef"
12317         fi
12318 else
12319         val="$undef"
12320         echo "I can't find the O_* constant definitions!  You got problems." >&4
12321 fi
12322 set d_open3
12323 eval $setvar
12324 $rm_try
12325
12326 : script used to emit important warnings
12327 cat >warn <<EOS
12328 $startsh
12329 if test \$# -gt 0; then
12330         echo "\$@" >msg
12331 else
12332         cat >msg
12333 fi
12334 echo "*** WARNING:" >&4
12335 sed -e 's/^/*** /' <msg >&4
12336 echo "*** " >&4
12337 cat msg >>config.msg
12338 echo " " >>config.msg
12339 rm -f msg
12340 EOS
12341 chmod +x warn
12342 $eunicefix warn
12343
12344 : see which of string.h or strings.h is needed
12345 echo " "
12346 strings=`./findhdr string.h`
12347 if $test "$strings" && $test -r "$strings"; then
12348         echo "Using <string.h> instead of <strings.h>." >&4
12349         val="$define"
12350 else
12351         val="$undef"
12352         strings=`./findhdr strings.h`
12353         if $test "$strings" && $test -r "$strings"; then
12354                 echo "Using <strings.h> instead of <string.h>." >&4
12355         else
12356                 ./warn "No string header found -- You'll surely have problems."
12357         fi
12358 fi
12359 set i_string
12360 eval $setvar
12361 case "$i_string" in
12362 "$undef") strings=`./findhdr strings.h`;;
12363 *)        strings=`./findhdr string.h`;;
12364 esac
12365
12366 : see if this is a sys/file.h system
12367 val=''
12368 set sys/file.h val
12369 eval $inhdr
12370
12371 : do we need to include sys/file.h ?
12372 case "$val" in
12373 "$define")
12374         echo " "
12375         if $h_sysfile; then
12376                 val="$define"
12377                 echo "We'll be including <sys/file.h>." >&4
12378         else
12379                 val="$undef"
12380                 echo "We won't be including <sys/file.h>." >&4
12381         fi
12382         ;;
12383 *)
12384         h_sysfile=false
12385         ;;
12386 esac
12387 set i_sysfile
12388 eval $setvar
12389
12390 : see if fcntl.h is there
12391 val=''
12392 set fcntl.h val
12393 eval $inhdr
12394
12395 : see if we can include fcntl.h
12396 case "$val" in
12397 "$define")
12398         echo " "
12399         if $h_fcntl; then
12400                 val="$define"
12401                 echo "We'll be including <fcntl.h>." >&4
12402         else
12403                 val="$undef"
12404                 if $h_sysfile; then
12405         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12406                 else
12407                         echo "We won't be including <fcntl.h>." >&4
12408                 fi
12409         fi
12410         ;;
12411 *)
12412         h_fcntl=false
12413         val="$undef"
12414         ;;
12415 esac
12416 set i_fcntl
12417 eval $setvar
12418
12419 : see if fork exists
12420 set fork d_fork
12421 eval $inlibc
12422
12423 : see if pipe exists
12424 set pipe d_pipe
12425 eval $inlibc
12426
12427 : check for non-blocking I/O stuff
12428 case "$h_sysfile" in
12429 true) echo "#include <sys/file.h>" > head.c;;
12430 *)
12431        case "$h_fcntl" in
12432        true) echo "#include <fcntl.h>" > head.c;;
12433        *) echo "#include <sys/fcntl.h>" > head.c;;
12434        esac
12435        ;;
12436 esac
12437 echo " "
12438 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12439 case "$o_nonblock" in
12440 '')
12441         $cat head.c > try.c
12442         $cat >>try.c <<EOCP
12443 #include <stdio.h>
12444 #$i_stdlib I_STDLIB
12445 #ifdef I_STDLIB
12446 #include <stdlib.h>
12447 #endif
12448 #$i_fcntl I_FCNTL
12449 #ifdef I_FCNTL
12450 #include <fcntl.h>
12451 #endif
12452 int main() {
12453 #ifdef O_NONBLOCK
12454         printf("O_NONBLOCK\n");
12455         exit(0);
12456 #endif
12457 #ifdef O_NDELAY
12458         printf("O_NDELAY\n");
12459         exit(0);
12460 #endif
12461 #ifdef FNDELAY
12462         printf("FNDELAY\n");
12463         exit(0);
12464 #endif
12465         exit(0);
12466 }
12467 EOCP
12468         set try
12469         if eval $compile_ok; then
12470                 o_nonblock=`$run ./try`
12471                 case "$o_nonblock" in
12472                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12473                 *) echo "Seems like we can use $o_nonblock.";;
12474                 esac
12475         else
12476                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12477         fi
12478         ;;
12479 *) echo "Using $hint value $o_nonblock.";;
12480 esac
12481 $rm_try
12482
12483 echo " "
12484 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12485 case "$eagain" in
12486 '')
12487         case "$d_fork:$d_pipe" in
12488         define:define)
12489         $cat head.c > try.c
12490         $cat >>try.c <<EOCP
12491 #include <errno.h>
12492 #include <sys/types.h>
12493 #include <signal.h>
12494 #include <stdio.h>
12495 #$i_stdlib I_STDLIB
12496 #ifdef I_STDLIB
12497 #include <stdlib.h>
12498 #endif
12499 #$i_fcntl I_FCNTL
12500 #ifdef I_FCNTL
12501 #include <fcntl.h>
12502 #endif
12503 #define MY_O_NONBLOCK $o_nonblock
12504 #ifndef errno  /* XXX need better Configure test */
12505 extern int errno;
12506 #endif
12507 #$i_unistd I_UNISTD
12508 #ifdef I_UNISTD
12509 #include <unistd.h>
12510 #endif
12511 #$i_string I_STRING
12512 #ifdef I_STRING
12513 #include <string.h>
12514 #else
12515 #include <strings.h>
12516 #endif
12517 $signal_t blech(int x) { exit(3); }
12518 EOCP
12519         $cat >> try.c <<'EOCP'
12520 int main()
12521 {
12522         int pd[2];
12523         int pu[2];
12524         char buf[1];
12525         char string[100];
12526
12527         pipe(pd);       /* Down: child -> parent */
12528         pipe(pu);       /* Up: parent -> child */
12529         if (0 != fork()) {
12530                 int ret;
12531                 close(pd[1]);   /* Parent reads from pd[0] */
12532                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12533 #ifdef F_SETFL
12534                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12535                         exit(1);
12536 #else
12537                 exit(4);
12538 #endif
12539                 signal(SIGALRM, blech);
12540                 alarm(5);
12541                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12542                         exit(2);
12543                 sprintf(string, "%d\n", ret);
12544                 write(2, string, strlen(string));
12545                 alarm(0);
12546 #ifdef EAGAIN
12547                 if (errno == EAGAIN) {
12548                         printf("EAGAIN\n");
12549                         goto ok;
12550                 }
12551 #endif
12552 #ifdef EWOULDBLOCK
12553                 if (errno == EWOULDBLOCK)
12554                         printf("EWOULDBLOCK\n");
12555 #endif
12556         ok:
12557                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12558                 sleep(2);                               /* Give it time to close our pipe */
12559                 alarm(5);
12560                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12561                 alarm(0);
12562                 sprintf(string, "%d\n", ret);
12563                 write(4, string, strlen(string));
12564                 exit(0);
12565         }
12566
12567         close(pd[0]);                   /* We write to pd[1] */
12568         close(pu[1]);                   /* We read from pu[0] */
12569         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12570         close(pd[1]);                   /* Pipe pd is now fully closed! */
12571         exit(0);                                /* Bye bye, thank you for playing! */
12572 }
12573 EOCP
12574         set try
12575         if eval $compile_ok; then
12576                 echo "$startsh" >mtry
12577                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12578                 chmod +x mtry
12579                 ./mtry >/dev/null 2>&1
12580                 case $? in
12581                 0) eagain=`$cat try.out`;;
12582                 1) echo "Could not perform non-blocking setting!";;
12583                 2) echo "I did a successful read() for something that was not there!";;
12584                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12585                 4) echo "Could not find F_SETFL!";;
12586                 *) echo "Something terribly wrong happened during testing.";;
12587                 esac
12588                 rd_nodata=`$cat try.ret`
12589                 echo "A read() system call with no data present returns $rd_nodata."
12590                 case "$rd_nodata" in
12591                 0|-1) ;;
12592                 *)
12593                         echo "(That's peculiar, fixing that to be -1.)"
12594                         rd_nodata=-1
12595                         ;;
12596                 esac
12597                 case "$eagain" in
12598                 '')
12599                         echo "Forcing errno EAGAIN on read() with no data available."
12600                         eagain=EAGAIN
12601                         ;;
12602                 *)
12603                         echo "Your read() sets errno to $eagain when no data is available."
12604                         ;;
12605                 esac
12606                 status=`$cat try.err`
12607                 case "$status" in
12608                 0) echo "And it correctly returns 0 to signal EOF.";;
12609                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12610                 *) echo "However, your read() returns '$status' on EOF??";;
12611                 esac
12612                 val="$define"
12613                 if test "$status" = "$rd_nodata"; then
12614                         echo "WARNING: you can't distinguish between EOF and no data!"
12615                         val="$undef"
12616                 fi
12617         else
12618                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12619                 eagain=EAGAIN
12620         fi
12621         ;;
12622         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12623                 eagain=EAGAIN
12624                 val="$define"
12625                 ;;
12626         esac
12627         set d_eofnblk
12628         eval $setvar
12629         ;;
12630 *)
12631         echo "Using $hint value $eagain."
12632         echo "Your read() returns $rd_nodata when no data is present."
12633         case "$d_eofnblk" in
12634         "$define") echo "And you can see EOF because read() returns 0.";;
12635         "$undef") echo "But you can't see EOF status from read() returned value.";;
12636         *)
12637                 echo "(Assuming you can't see EOF status from read anyway.)"
12638                 d_eofnblk=$undef
12639                 ;;
12640         esac
12641         ;;
12642 esac
12643 $rm_try head.c mtry
12644
12645 : see if _ptr and _cnt from stdio act std
12646 echo " "
12647
12648 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12649         echo "(Looks like you have stdio.h from BSD.)"
12650         case "$stdio_ptr" in
12651         '') stdio_ptr='((fp)->_p)'
12652                 ptr_lval=$define
12653                 ;;
12654         *)      ptr_lval=$d_stdio_ptr_lval;;
12655         esac
12656         case "$stdio_cnt" in
12657         '') stdio_cnt='((fp)->_r)'
12658                 cnt_lval=$define
12659                 ;;
12660         *)      cnt_lval=$d_stdio_cnt_lval;;
12661         esac
12662         case "$stdio_base" in
12663         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12664         esac
12665         case "$stdio_bufsiz" in
12666         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12667         esac
12668 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12669         echo "(Looks like you have stdio.h from Linux.)"
12670         case "$stdio_ptr" in
12671         '') stdio_ptr='((fp)->_IO_read_ptr)'
12672                 ptr_lval=$define
12673                 ;;
12674         *)      ptr_lval=$d_stdio_ptr_lval;;
12675         esac
12676         case "$stdio_cnt" in
12677         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12678                 cnt_lval=$undef
12679                 ;;
12680         *)      cnt_lval=$d_stdio_cnt_lval;;
12681         esac
12682         case "$stdio_base" in
12683         '') stdio_base='((fp)->_IO_read_base)';;
12684         esac
12685         case "$stdio_bufsiz" in
12686         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12687         esac
12688 else
12689         case "$stdio_ptr" in
12690         '') stdio_ptr='((fp)->_ptr)'
12691                 ptr_lval=$define
12692                 ;;
12693         *)      ptr_lval=$d_stdio_ptr_lval;;
12694         esac
12695         case "$stdio_cnt" in
12696         '') stdio_cnt='((fp)->_cnt)'
12697                 cnt_lval=$define
12698                 ;;
12699         *)      cnt_lval=$d_stdio_cnt_lval;;
12700         esac
12701         case "$stdio_base" in
12702         '') stdio_base='((fp)->_base)';;
12703         esac
12704         case "$stdio_bufsiz" in
12705         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12706         esac
12707 fi
12708
12709 : test whether _ptr and _cnt really work
12710 echo "Checking how std your stdio is..." >&4
12711 $cat >try.c <<EOP
12712 #include <stdio.h>
12713 #$i_stdlib I_STDLIB
12714 #ifdef I_STDLIB
12715 #include <stdlib.h>
12716 #endif
12717 #define FILE_ptr(fp)    $stdio_ptr
12718 #define FILE_cnt(fp)    $stdio_cnt
12719 int main() {
12720         FILE *fp = fopen("try.c", "r");
12721         char c = getc(fp);
12722         if (
12723                 18 <= FILE_cnt(fp) &&
12724                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12725         )
12726                 exit(0);
12727         exit(1);
12728 }
12729 EOP
12730 val="$undef"
12731 set try
12732 if eval $compile && $to try.c; then
12733         if $run ./try; then
12734                 echo "Your stdio acts pretty std."
12735                 val="$define"
12736         else
12737                 echo "Your stdio isn't very std."
12738         fi
12739 else
12740         echo "Your stdio doesn't appear very std."
12741 fi
12742 $rm_try
12743
12744 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12745 # direct buffer manipulation no longer works.  The Configure tests
12746 # should be changed to correctly detect this, but until then,
12747 # the following check should at least let perl compile and run.
12748 # (This quick fix should be updated before 5.8.1.)
12749 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12750 # A. Dougherty, June 3, 2002.
12751 case "$d_gnulibc" in
12752 $define)
12753         case "$gnulibc_version" in
12754         2.[01]*)  ;;
12755         2.2) ;;
12756         2.2.[0-9]) ;;
12757         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12758                 val="$undef"
12759                 ;;
12760         esac
12761         ;;
12762 esac
12763 set d_stdstdio
12764 eval $setvar
12765
12766 : Can _ptr be used as an lvalue?
12767 case "$d_stdstdio$ptr_lval" in
12768 $define$define) val=$define ;;
12769 *) val=$undef ;;
12770 esac
12771 set d_stdio_ptr_lval
12772 eval $setvar
12773
12774 : Can _cnt be used as an lvalue?
12775 case "$d_stdstdio$cnt_lval" in
12776 $define$define) val=$define ;;
12777 *) val=$undef ;;
12778 esac
12779 set d_stdio_cnt_lval
12780 eval $setvar
12781
12782
12783 : test whether setting _ptr sets _cnt as a side effect
12784 d_stdio_ptr_lval_sets_cnt="$undef"
12785 d_stdio_ptr_lval_nochange_cnt="$undef"
12786 case "$d_stdio_ptr_lval$d_stdstdio" in
12787 $define$define)
12788         echo "Checking to see what happens if we set the stdio ptr..." >&4
12789 $cat >try.c <<EOP
12790 #include <stdio.h>
12791 /* Can we scream? */
12792 /* Eat dust sed :-) */
12793 /* In the buffer space, no one can hear you scream. */
12794 #$i_stdlib I_STDLIB
12795 #ifdef I_STDLIB
12796 #include <stdlib.h>
12797 #endif
12798 #define FILE_ptr(fp)    $stdio_ptr
12799 #define FILE_cnt(fp)    $stdio_cnt
12800 #include <sys/types.h>
12801 int main() {
12802         FILE *fp = fopen("try.c", "r");
12803         int c;
12804         char *ptr;
12805         size_t cnt;
12806         if (!fp) {
12807             puts("Fail even to read");
12808             exit(1);
12809         }
12810         c = getc(fp); /* Read away the first # */
12811         if (c == EOF) {
12812             puts("Fail even to read");
12813             exit(1);
12814         }
12815         if (!(
12816                 18 <= FILE_cnt(fp) &&
12817                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12818         )) {
12819                 puts("Fail even to read");
12820                 exit (1);
12821         }
12822         ptr = (char*) FILE_ptr(fp);
12823         cnt = (size_t)FILE_cnt(fp);
12824
12825         FILE_ptr(fp) += 42;
12826
12827         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12828                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12829                 exit (1);
12830         }
12831         if (FILE_cnt(fp) <= 20) {
12832                 printf ("Fail (<20 chars to test)");
12833                 exit (1);
12834         }
12835         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12836                 puts("Fail compare");
12837                 exit (1);
12838         }
12839         if (cnt == FILE_cnt(fp)) {
12840                 puts("Pass_unchanged");
12841                 exit (0);
12842         }
12843         if (FILE_cnt(fp) == (cnt - 42)) {
12844                 puts("Pass_changed");
12845                 exit (0);
12846         }
12847         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12848         return 1;
12849
12850 }
12851 EOP
12852         set try
12853         if eval $compile && $to try.c; then
12854                 case `$run ./try` in
12855                 Pass_changed)
12856                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12857                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12858                 Pass_unchanged)
12859                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12860                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12861                 Fail*)
12862                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12863                 *)
12864                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12865         esac
12866         else
12867                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12868         fi
12869         $rm_try
12870         ;;
12871 esac
12872
12873 : see if _base is also standard
12874 val="$undef"
12875 case "$d_stdstdio" in
12876 $define)
12877         $cat >try.c <<EOP
12878 #include <stdio.h>
12879 #$i_stdlib I_STDLIB
12880 #ifdef I_STDLIB
12881 #include <stdlib.h>
12882 #endif
12883 #define FILE_base(fp)   $stdio_base
12884 #define FILE_bufsiz(fp) $stdio_bufsiz
12885 int main() {
12886         FILE *fp = fopen("try.c", "r");
12887         char c = getc(fp);
12888         if (
12889                 19 <= FILE_bufsiz(fp) &&
12890                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12891         )
12892                 exit(0);
12893         exit(1);
12894 }
12895 EOP
12896         set try
12897         if eval $compile && $to try.c; then
12898                 if $run ./try; then
12899                         echo "And its _base field acts std."
12900                         val="$define"
12901                 else
12902                         echo "But its _base field isn't std."
12903                 fi
12904         else
12905                 echo "However, it seems to be lacking the _base field."
12906         fi
12907         $rm_try
12908         ;;
12909 esac
12910 set d_stdiobase
12911 eval $setvar
12912
12913 : see if fast_stdio exists
12914 val="$undef"
12915 case "$d_stdstdio:$d_stdio_ptr_lval" in
12916 "$define:$define")
12917         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12918         *$define*)
12919                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12920                 val="$define"
12921                 ;;
12922         esac
12923         ;;
12924 esac
12925 set d_faststdio
12926 eval $setvar
12927
12928
12929
12930 : see if fchdir exists
12931 set fchdir d_fchdir
12932 eval $inlibc
12933
12934 : see if fchmod exists
12935 set fchmod d_fchmod
12936 eval $inlibc
12937
12938 : see if fchown exists
12939 set fchown d_fchown
12940 eval $inlibc
12941
12942 : see if this is an fcntl system
12943 set fcntl d_fcntl
12944 eval $inlibc
12945
12946 : See if fcntl-based locking works.
12947 echo " "
12948 $cat >try.c <<EOCP
12949 #$i_stdlib I_STDLIB
12950 #ifdef I_STDLIB
12951 #include <stdlib.h>
12952 #endif
12953 #include <unistd.h>
12954 #include <fcntl.h>
12955 #include <signal.h>
12956 $signal_t blech(int x) { exit(3); }
12957 int main() {
12958 #if defined(F_SETLK) && defined(F_SETLKW)
12959      struct flock flock;
12960      int retval, fd;
12961      fd = open("try.c", O_RDONLY);
12962      flock.l_type = F_RDLCK;
12963      flock.l_whence = SEEK_SET;
12964      flock.l_start = flock.l_len = 0;
12965      signal(SIGALRM, blech);
12966      alarm(10);
12967      retval = fcntl(fd, F_SETLK, &flock);
12968      close(fd);
12969      (retval < 0 ? exit(2) : exit(0));
12970 #else
12971      exit(2);
12972 #endif
12973 }
12974 EOCP
12975 echo "Checking if fcntl-based file locking works... "
12976 case "$d_fcntl" in
12977 "$define")
12978         set try
12979         if eval $compile_ok; then
12980                 if $run ./try; then
12981                         echo "Yes, it seems to work."
12982                         val="$define"
12983                 else
12984                         echo "Nope, it didn't work."
12985                         val="$undef"
12986                         case "$?" in
12987                         3) $cat >&4 <<EOM
12988 ***
12989 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12990 *** This is (almost) impossible.
12991 *** If your NFS lock daemons are not feeling well, something like
12992 *** this may happen, please investigate.  Cannot continue, aborting.
12993 ***
12994 EOM
12995                                 exit 1
12996                                 ;;
12997                         esac
12998                 fi
12999         else
13000                 echo "I'm unable to compile the test program, so I'll assume not."
13001                 val="$undef"
13002         fi
13003         ;;
13004 *) val="$undef";
13005         echo "Nope, since you don't even have fcntl()."
13006         ;;
13007 esac
13008 set d_fcntl_can_lock
13009 eval $setvar
13010 $rm_try
13011
13012 : check for fd_set items
13013 $cat <<EOM
13014
13015 Checking to see how well your C compiler handles fd_set and friends ...
13016 EOM
13017 $cat >try.c <<EOCP
13018 #$i_stdlib I_STDLIB
13019 #ifdef I_STDLIB
13020 #include <stdlib.h>
13021 #endif
13022 #$i_systime I_SYS_TIME
13023 #$i_sysselct I_SYS_SELECT
13024 #$d_socket HAS_SOCKET
13025 #include <sys/types.h>
13026 #ifdef HAS_SOCKET
13027 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13028 #endif
13029 #ifdef I_SYS_TIME
13030 #include <sys/time.h>
13031 #endif
13032 #ifdef I_SYS_SELECT
13033 #include <sys/select.h>
13034 #endif
13035 int main() {
13036         fd_set fds;
13037
13038 #ifdef TRYBITS
13039         if(fds.fds_bits);
13040 #endif
13041
13042 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13043         exit(0);
13044 #else
13045         exit(1);
13046 #endif
13047 }
13048 EOCP
13049 set try -DTRYBITS
13050 if eval $compile; then
13051         d_fds_bits="$define"
13052         d_fd_set="$define"
13053         echo "Well, your system knows about the normal fd_set typedef..." >&4
13054         if $run ./try; then
13055                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13056                 d_fd_macros="$define"
13057         else
13058                 $cat >&4 <<'EOM'
13059 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13060 EOM
13061                 d_fd_macros="$undef"
13062         fi
13063 else
13064         $cat <<'EOM'
13065 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13066 EOM
13067         set try
13068         if eval $compile; then
13069                 d_fds_bits="$undef"
13070                 d_fd_set="$define"
13071                 echo "Well, your system has some sort of fd_set available..." >&4
13072                 if $run ./try; then
13073                         echo "and you have the normal fd_set macros." >&4
13074                         d_fd_macros="$define"
13075                 else
13076                         $cat <<'EOM'
13077 but not the normal fd_set macros!  Gross!  More work for me...
13078 EOM
13079                         d_fd_macros="$undef"
13080                 fi
13081         else
13082         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13083                 d_fd_set="$undef"
13084                 d_fds_bits="$undef"
13085                 d_fd_macros="$undef"
13086         fi
13087 fi
13088 $rm_try
13089
13090 : see if fgetpos exists
13091 set fgetpos d_fgetpos
13092 eval $inlibc
13093
13094 : see if finite exists
13095 set finite d_finite
13096 eval $inlibc
13097
13098 : see if finitel exists
13099 set finitel d_finitel
13100 eval $inlibc
13101
13102 : see if flock exists
13103 set flock d_flock
13104 eval $inlibc
13105
13106 : see if prototype for flock is available
13107 echo " "
13108 set d_flockproto flock $i_sysfile sys/file.h
13109 eval $hasproto
13110
13111 : see if fp_class exists
13112 set fp_class d_fp_class
13113 eval $inlibc
13114
13115 : see if pathconf exists
13116 set pathconf d_pathconf
13117 eval $inlibc
13118
13119 : see if fpathconf exists
13120 set fpathconf d_fpathconf
13121 eval $inlibc
13122
13123 : see if fpclass exists
13124 set fpclass d_fpclass
13125 eval $inlibc
13126
13127 : see if fpclassify exists
13128 set fpclassify d_fpclassify
13129 eval $inlibc
13130
13131 : see if fpclassl exists
13132 set fpclassl d_fpclassl
13133 eval $inlibc
13134
13135 : check for fpos64_t
13136 echo " "
13137 echo "Checking to see if you have fpos64_t..." >&4
13138 $cat >try.c <<EOCP
13139 #include <stdio.h>
13140 int main() { fpos64_t x = 7; }
13141 EOCP
13142 set try
13143 if eval $compile; then
13144         val="$define"
13145         echo "You have fpos64_t."
13146 else
13147         val="$undef"
13148         echo "You do not have fpos64_t."
13149         case "$fpossize" in
13150         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13151         esac
13152 fi
13153 $rm_try
13154 set d_fpos64_t
13155 eval $setvar
13156
13157 : see if frexpl exists
13158 set frexpl d_frexpl
13159 eval $inlibc
13160
13161 : see if this is a sys/param system
13162 set sys/param.h i_sysparam
13163 eval $inhdr
13164
13165 : see if this is a sys/mount.h system
13166 set sys/mount.h i_sysmount
13167 eval $inhdr
13168
13169 : Check for fs_data_s
13170 echo " "
13171 echo "Checking to see if your system supports struct fs_data..." >&4
13172 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13173 eval $hasstruct
13174 case "$d_fs_data_s" in
13175 "$define")      echo "Yes, it does."   ;;
13176 *)              echo "No, it doesn't." ;;
13177 esac
13178
13179 : see if fseeko exists
13180 set fseeko d_fseeko
13181 eval $inlibc
13182 case "$longsize" in
13183 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13184 esac
13185
13186 : see if fsetpos exists
13187 set fsetpos d_fsetpos
13188 eval $inlibc
13189
13190 : see if fstatfs exists
13191 set fstatfs d_fstatfs
13192 eval $inlibc
13193
13194 : see if statvfs exists
13195 set statvfs d_statvfs
13196 eval $inlibc
13197
13198 : see if fstatvfs exists
13199 set fstatvfs d_fstatvfs
13200 eval $inlibc
13201
13202
13203 : see if fsync exists
13204 set fsync d_fsync
13205 eval $inlibc
13206
13207 : see if ftello exists
13208 set ftello d_ftello
13209 eval $inlibc
13210 case "$longsize" in
13211 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13212 esac
13213
13214 : check for a working futimes
13215 d_futimes="$undef"
13216 echo " "
13217 echo "Checking if you have a working futimes()" >&4
13218 $cat >try.c <<EOCP
13219 #include <stdio.h>
13220 #include <sys/time.h>
13221 #include <errno.h>
13222 #include <fcntl.h>
13223
13224 int main ()
13225 {
13226     int fd, rv;
13227     fd = open ("try.c", O_RDWR);
13228     if (-1 == fd) exit (1);
13229     rv = futimes (fd, NULL);
13230     exit (rv == -1 ? errno : 0);
13231 }
13232 EOCP
13233 set try
13234 if eval $compile; then
13235     `$run ./try`
13236     rc=$?
13237     case "$rc" in
13238         0)  echo "Yes, you have" >&4
13239             d_futimes="$define"
13240             ;;
13241         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13242             ;;
13243     esac
13244 else
13245     echo "No, it does not (probably harmless)" >&4
13246 fi
13247 $rm_try
13248
13249 : see if getcwd exists
13250 set getcwd d_getcwd
13251 eval $inlibc
13252
13253 : see if getespwnam exists
13254 set getespwnam d_getespwnam
13255 eval $inlibc
13256
13257 : see if getfsstat exists
13258 set getfsstat d_getfsstat
13259 eval $inlibc
13260
13261 : see if getgrent exists
13262 set getgrent d_getgrent
13263 eval $inlibc
13264
13265 : see if getgrent_r exists
13266 set getgrent_r d_getgrent_r
13267 eval $inlibc
13268 case "$d_getgrent_r" in
13269 "$define")
13270         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13271         case "$d_getgrent_r_proto:$usethreads" in
13272         ":define")      d_getgrent_r_proto=define
13273                 set d_getgrent_r_proto getgrent_r $hdrs
13274                 eval $hasproto ;;
13275         *)      ;;
13276         esac
13277         case "$d_getgrent_r_proto" in
13278         define)
13279         case "$getgrent_r_proto" in
13280         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13281         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13282         esac
13283         case "$getgrent_r_proto" in
13284         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13285         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13286         esac
13287         case "$getgrent_r_proto" in
13288         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13289         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13290         esac
13291         case "$getgrent_r_proto" in
13292         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13293         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13294         esac
13295         case "$getgrent_r_proto" in
13296         ''|0) try='int getgrent_r(struct group*, char*, int);'
13297         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13298         esac
13299         case "$getgrent_r_proto" in
13300         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13301         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13302         esac
13303         case "$getgrent_r_proto" in
13304         ''|0)   d_getgrent_r=undef
13305                 getgrent_r_proto=0
13306                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13307         * )     case "$getgrent_r_proto" in
13308                 REENTRANT_PROTO*) ;;
13309                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13310                 esac
13311                 echo "Prototype: $try" ;;
13312         esac
13313         ;;
13314         *)      case "$usethreads" in
13315                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13316                 esac
13317                 d_getgrent_r=undef
13318                 getgrent_r_proto=0
13319                 ;;
13320         esac
13321         ;;
13322 *)      getgrent_r_proto=0
13323         ;;
13324 esac
13325
13326 : see if getgrgid_r exists
13327 set getgrgid_r d_getgrgid_r
13328 eval $inlibc
13329 case "$d_getgrgid_r" in
13330 "$define")
13331         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13332         case "$d_getgrgid_r_proto:$usethreads" in
13333         ":define")      d_getgrgid_r_proto=define
13334                 set d_getgrgid_r_proto getgrgid_r $hdrs
13335                 eval $hasproto ;;
13336         *)      ;;
13337         esac
13338         case "$d_getgrgid_r_proto" in
13339         define)
13340         case "$getgrgid_r_proto" in
13341         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13342         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13343         esac
13344         case "$getgrgid_r_proto" in
13345         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13346         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13347         esac
13348         case "$getgrgid_r_proto" in
13349         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13350         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13351         esac
13352         case "$getgrgid_r_proto" in
13353         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13354         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13355         esac
13356         case "$getgrgid_r_proto" in
13357         ''|0)   d_getgrgid_r=undef
13358                 getgrgid_r_proto=0
13359                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13360         * )     case "$getgrgid_r_proto" in
13361                 REENTRANT_PROTO*) ;;
13362                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13363                 esac
13364                 echo "Prototype: $try" ;;
13365         esac
13366         ;;
13367         *)      case "$usethreads" in
13368                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13369                 esac
13370                 d_getgrgid_r=undef
13371                 getgrgid_r_proto=0
13372                 ;;
13373         esac
13374         ;;
13375 *)      getgrgid_r_proto=0
13376         ;;
13377 esac
13378
13379 : see if getgrnam_r exists
13380 set getgrnam_r d_getgrnam_r
13381 eval $inlibc
13382 case "$d_getgrnam_r" in
13383 "$define")
13384         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13385         case "$d_getgrnam_r_proto:$usethreads" in
13386         ":define")      d_getgrnam_r_proto=define
13387                 set d_getgrnam_r_proto getgrnam_r $hdrs
13388                 eval $hasproto ;;
13389         *)      ;;
13390         esac
13391         case "$d_getgrnam_r_proto" in
13392         define)
13393         case "$getgrnam_r_proto" in
13394         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13395         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13396         esac
13397         case "$getgrnam_r_proto" in
13398         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13399         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13400         esac
13401         case "$getgrnam_r_proto" in
13402         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13403         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13404         esac
13405         case "$getgrnam_r_proto" in
13406         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13407         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13408         esac
13409         case "$getgrnam_r_proto" in
13410         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13411         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13412         esac
13413         case "$getgrnam_r_proto" in
13414         ''|0)   d_getgrnam_r=undef
13415                 getgrnam_r_proto=0
13416                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13417         * )     case "$getgrnam_r_proto" in
13418                 REENTRANT_PROTO*) ;;
13419                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13420                 esac
13421                 echo "Prototype: $try" ;;
13422         esac
13423         ;;
13424         *)      case "$usethreads" in
13425                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13426                 esac
13427                 d_getgrnam_r=undef
13428                 getgrnam_r_proto=0
13429                 ;;
13430         esac
13431         ;;
13432 *)      getgrnam_r_proto=0
13433         ;;
13434 esac
13435
13436 : see if gethostbyaddr exists
13437 set gethostbyaddr d_gethbyaddr
13438 eval $inlibc
13439
13440 : see if gethostbyname exists
13441 set gethostbyname d_gethbyname
13442 eval $inlibc
13443
13444 : see if gethostent exists
13445 set gethostent d_gethent
13446 eval $inlibc
13447
13448 : see how we will look up host name
13449 echo " "
13450 call=''
13451 if set gethostname val -f d_gethname; eval $csym; $val; then
13452         echo 'gethostname() found.' >&4
13453         d_gethname="$define"
13454         call=gethostname
13455 fi
13456 if set uname val -f d_uname; eval $csym; $val; then
13457         if ./xenix; then
13458                 $cat <<'EOM'
13459 uname() was found, but you're running xenix, and older versions of xenix
13460 have a broken uname(). If you don't really know whether your xenix is old
13461 enough to have a broken system call, use the default answer.
13462
13463 EOM
13464                 dflt=y
13465                 case "$d_uname" in
13466                 "$define") dflt=n;;
13467                 esac
13468                 rp='Is your uname() broken?'
13469                 . ./myread
13470                 case "$ans" in
13471                 n*) d_uname="$define"; call=uname;;
13472                 esac
13473         else
13474                 echo 'uname() found.' >&4
13475                 d_uname="$define"
13476                 case "$call" in
13477                 '') call=uname ;;
13478                 esac
13479         fi
13480 fi
13481 case "$d_gethname" in
13482 '') d_gethname="$undef";;
13483 esac
13484 case "$d_uname" in
13485 '') d_uname="$undef";;
13486 esac
13487 case "$d_uname$d_gethname" in
13488 *define*)
13489         dflt=n
13490         cat <<EOM
13491
13492 Every now and then someone has a $call() that lies about the hostname
13493 but can't be fixed for political or economic reasons.  If you wish, I can
13494 pretend $call() isn't there and maybe compute hostname at run-time
13495 thanks to the '$phostname' command.
13496
13497 EOM
13498         rp="Shall I ignore $call() from now on?"
13499         . ./myread
13500         case "$ans" in
13501         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13502         esac;;
13503 esac
13504 case "$phostname" in
13505 '') aphostname='';;
13506 *) case "$aphostname" in
13507         /*) ;;
13508         *) set X $phostname
13509                 shift
13510                 file=$1
13511                 shift
13512                 file=`./loc $file $file $pth`
13513                 aphostname=`echo $file $*`
13514                 ;;
13515         esac
13516         ;;
13517 esac
13518 case "$d_uname$d_gethname" in
13519 *define*) ;;
13520 *)
13521         case "$phostname" in
13522         '')
13523                 echo "There will be no way for $package to get your hostname." >&4;;
13524         *)
13525         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13526                 ;;
13527         esac;;
13528 esac
13529 case "$d_phostname" in
13530 '') d_phostname="$undef";;
13531 esac
13532
13533 : see if gethostbyaddr_r exists
13534 set gethostbyaddr_r d_gethostbyaddr_r
13535 eval $inlibc
13536 case "$d_gethostbyaddr_r" in
13537 "$define")
13538         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13539         case "$d_gethostbyaddr_r_proto:$usethreads" in
13540         ":define")      d_gethostbyaddr_r_proto=define
13541                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13542                 eval $hasproto ;;
13543         *)      ;;
13544         esac
13545         case "$d_gethostbyaddr_r_proto" in
13546         define)
13547         case "$gethostbyaddr_r_proto" in
13548         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13549         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13550         esac
13551         case "$gethostbyaddr_r_proto" in
13552         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13553         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13554         esac
13555         case "$gethostbyaddr_r_proto" in
13556         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13557         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13558         esac
13559         case "$gethostbyaddr_r_proto" in
13560         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13561         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13562         esac
13563         case "$gethostbyaddr_r_proto" in
13564         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13565         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13566         esac
13567         case "$gethostbyaddr_r_proto" in
13568         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13569         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13570         esac
13571         case "$gethostbyaddr_r_proto" in
13572         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13573         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13574         esac
13575         case "$gethostbyaddr_r_proto" in
13576         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13577         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13578         esac
13579         case "$gethostbyaddr_r_proto" in
13580         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13581         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13582         esac
13583         case "$gethostbyaddr_r_proto" in
13584         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13585         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13586         esac
13587         case "$gethostbyaddr_r_proto" in
13588         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13589         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13590         esac
13591         case "$gethostbyaddr_r_proto" in
13592         ''|0)   d_gethostbyaddr_r=undef
13593                 gethostbyaddr_r_proto=0
13594                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13595         * )     case "$gethostbyaddr_r_proto" in
13596                 REENTRANT_PROTO*) ;;
13597                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13598                 esac
13599                 echo "Prototype: $try" ;;
13600         esac
13601         ;;
13602         *)      case "$usethreads" in
13603                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13604                 esac
13605                 d_gethostbyaddr_r=undef
13606                 gethostbyaddr_r_proto=0
13607                 ;;
13608         esac
13609         ;;
13610 *)      gethostbyaddr_r_proto=0
13611         ;;
13612 esac
13613
13614 : see if gethostbyname_r exists
13615 set gethostbyname_r d_gethostbyname_r
13616 eval $inlibc
13617 case "$d_gethostbyname_r" in
13618 "$define")
13619         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13620         case "$d_gethostbyname_r_proto:$usethreads" in
13621         ":define")      d_gethostbyname_r_proto=define
13622                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13623                 eval $hasproto ;;
13624         *)      ;;
13625         esac
13626         case "$d_gethostbyname_r_proto" in
13627         define)
13628         case "$gethostbyname_r_proto" in
13629         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13630         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13631         esac
13632         case "$gethostbyname_r_proto" in
13633         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13634         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13635         esac
13636         case "$gethostbyname_r_proto" in
13637         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13638         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13639         esac
13640         case "$gethostbyname_r_proto" in
13641         ''|0)   d_gethostbyname_r=undef
13642                 gethostbyname_r_proto=0
13643                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13644         * )     case "$gethostbyname_r_proto" in
13645                 REENTRANT_PROTO*) ;;
13646                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13647                 esac
13648                 echo "Prototype: $try" ;;
13649         esac
13650         ;;
13651         *)      case "$usethreads" in
13652                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13653                 esac
13654                 d_gethostbyname_r=undef
13655                 gethostbyname_r_proto=0
13656                 ;;
13657         esac
13658         ;;
13659 *)      gethostbyname_r_proto=0
13660         ;;
13661 esac
13662
13663 : see if gethostent_r exists
13664 set gethostent_r d_gethostent_r
13665 eval $inlibc
13666 case "$d_gethostent_r" in
13667 "$define")
13668         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13669         case "$d_gethostent_r_proto:$usethreads" in
13670         ":define")      d_gethostent_r_proto=define
13671                 set d_gethostent_r_proto gethostent_r $hdrs
13672                 eval $hasproto ;;
13673         *)      ;;
13674         esac
13675         case "$d_gethostent_r_proto" in
13676         define)
13677         case "$gethostent_r_proto" in
13678         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13679         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13680         esac
13681         case "$gethostent_r_proto" in
13682         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13683         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13684         esac
13685         case "$gethostent_r_proto" in
13686         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13687         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13688         esac
13689         case "$gethostent_r_proto" in
13690         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13691         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13692         esac
13693         case "$gethostent_r_proto" in
13694         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13695         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13696         esac
13697         case "$gethostent_r_proto" in
13698         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13699         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13700         esac
13701         case "$gethostent_r_proto" in
13702         ''|0)   d_gethostent_r=undef
13703                 gethostent_r_proto=0
13704                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13705         * )     case "$gethostent_r_proto" in
13706                 REENTRANT_PROTO*) ;;
13707                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13708                 esac
13709                 echo "Prototype: $try" ;;
13710         esac
13711         ;;
13712         *)      case "$usethreads" in
13713                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13714                 esac
13715                 d_gethostent_r=undef
13716                 gethostent_r_proto=0
13717                 ;;
13718         esac
13719         ;;
13720 *)      gethostent_r_proto=0
13721         ;;
13722 esac
13723
13724 : see if prototypes for various gethostxxx netdb.h functions are available
13725 echo " "
13726 set d_gethostprotos gethostent $i_netdb netdb.h
13727 eval $hasproto
13728
13729 : see if getitimer exists
13730 set getitimer d_getitimer
13731 eval $inlibc
13732
13733 : see if getlogin exists
13734 set getlogin d_getlogin
13735 eval $inlibc
13736
13737 : see if getlogin_r exists
13738 set getlogin_r d_getlogin_r
13739 eval $inlibc
13740 case "$d_getlogin_r" in
13741 "$define")
13742         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13743         case "$d_getlogin_r_proto:$usethreads" in
13744         ":define")      d_getlogin_r_proto=define
13745                 set d_getlogin_r_proto getlogin_r $hdrs
13746                 eval $hasproto ;;
13747         *)      ;;
13748         esac
13749         case "$d_getlogin_r_proto" in
13750         define)
13751         case "$getlogin_r_proto" in
13752         ''|0) try='int getlogin_r(char*, size_t);'
13753         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13754         esac
13755         case "$getlogin_r_proto" in
13756         ''|0) try='int getlogin_r(char*, int);'
13757         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13758         esac
13759         case "$getlogin_r_proto" in
13760         ''|0) try='char* getlogin_r(char*, size_t);'
13761         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13762         esac
13763         case "$getlogin_r_proto" in
13764         ''|0) try='char* getlogin_r(char*, int);'
13765         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13766         esac
13767         case "$getlogin_r_proto" in
13768         ''|0)   d_getlogin_r=undef
13769                 getlogin_r_proto=0
13770                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13771         * )     case "$getlogin_r_proto" in
13772                 REENTRANT_PROTO*) ;;
13773                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13774                 esac
13775                 echo "Prototype: $try" ;;
13776         esac
13777         ;;
13778         *)      case "$usethreads" in
13779                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13780                 esac
13781                 d_getlogin_r=undef
13782                 getlogin_r_proto=0
13783                 ;;
13784         esac
13785         ;;
13786 *)      getlogin_r_proto=0
13787         ;;
13788 esac
13789
13790 : see if getmnt exists
13791 set getmnt d_getmnt
13792 eval $inlibc
13793
13794 : see if getmntent exists
13795 set getmntent d_getmntent
13796 eval $inlibc
13797
13798 : see if getnetbyaddr exists
13799 set getnetbyaddr d_getnbyaddr
13800 eval $inlibc
13801
13802 : see if getnetbyname exists
13803 set getnetbyname d_getnbyname
13804 eval $inlibc
13805
13806 : see if getnetent exists
13807 set getnetent d_getnent
13808 eval $inlibc
13809
13810 : see if getnetbyaddr_r exists
13811 set getnetbyaddr_r d_getnetbyaddr_r
13812 eval $inlibc
13813 case "$d_getnetbyaddr_r" in
13814 "$define")
13815         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13816         case "$d_getnetbyaddr_r_proto:$usethreads" in
13817         ":define")      d_getnetbyaddr_r_proto=define
13818                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13819                 eval $hasproto ;;
13820         *)      ;;
13821         esac
13822         case "$d_getnetbyaddr_r_proto" in
13823         define)
13824         case "$getnetbyaddr_r_proto" in
13825         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13826         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13827         esac
13828         case "$getnetbyaddr_r_proto" in
13829         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13830         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13831         esac
13832         case "$getnetbyaddr_r_proto" in
13833         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13834         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13835         esac
13836         case "$getnetbyaddr_r_proto" in
13837         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13838         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13839         esac
13840         case "$getnetbyaddr_r_proto" in
13841         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13842         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13843         esac
13844         case "$getnetbyaddr_r_proto" in
13845         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13846         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13847         esac
13848         case "$getnetbyaddr_r_proto" in
13849         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13850         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13851         esac
13852         case "$getnetbyaddr_r_proto" in
13853         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13854         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13855         esac
13856         case "$getnetbyaddr_r_proto" in
13857         ''|0)   d_getnetbyaddr_r=undef
13858                 getnetbyaddr_r_proto=0
13859                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13860         * )     case "$getnetbyaddr_r_proto" in
13861                 REENTRANT_PROTO*) ;;
13862                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13863                 esac
13864                 echo "Prototype: $try" ;;
13865         esac
13866         ;;
13867         *)      case "$usethreads" in
13868                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13869                 esac
13870                 d_getnetbyaddr_r=undef
13871                 getnetbyaddr_r_proto=0
13872                 ;;
13873         esac
13874         ;;
13875 *)      getnetbyaddr_r_proto=0
13876         ;;
13877 esac
13878
13879 : see if getnetbyname_r exists
13880 set getnetbyname_r d_getnetbyname_r
13881 eval $inlibc
13882 case "$d_getnetbyname_r" in
13883 "$define")
13884         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13885         case "$d_getnetbyname_r_proto:$usethreads" in
13886         ":define")      d_getnetbyname_r_proto=define
13887                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13888                 eval $hasproto ;;
13889         *)      ;;
13890         esac
13891         case "$d_getnetbyname_r_proto" in
13892         define)
13893         case "$getnetbyname_r_proto" in
13894         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13895         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13896         esac
13897         case "$getnetbyname_r_proto" in
13898         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13899         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13900         esac
13901         case "$getnetbyname_r_proto" in
13902         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13903         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13904         esac
13905         case "$getnetbyname_r_proto" in
13906         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13907         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13908         esac
13909         case "$getnetbyname_r_proto" in
13910         ''|0)   d_getnetbyname_r=undef
13911                 getnetbyname_r_proto=0
13912                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13913         * )     case "$getnetbyname_r_proto" in
13914                 REENTRANT_PROTO*) ;;
13915                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13916                 esac
13917                 echo "Prototype: $try" ;;
13918         esac
13919         ;;
13920         *)      case "$usethreads" in
13921                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13922                 esac
13923                 d_getnetbyname_r=undef
13924                 getnetbyname_r_proto=0
13925                 ;;
13926         esac
13927         ;;
13928 *)      getnetbyname_r_proto=0
13929         ;;
13930 esac
13931
13932 : see if getnetent_r exists
13933 set getnetent_r d_getnetent_r
13934 eval $inlibc
13935 case "$d_getnetent_r" in
13936 "$define")
13937         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13938         case "$d_getnetent_r_proto:$usethreads" in
13939         ":define")      d_getnetent_r_proto=define
13940                 set d_getnetent_r_proto getnetent_r $hdrs
13941                 eval $hasproto ;;
13942         *)      ;;
13943         esac
13944         case "$d_getnetent_r_proto" in
13945         define)
13946         case "$getnetent_r_proto" in
13947         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13948         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13949         esac
13950         case "$getnetent_r_proto" in
13951         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13952         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13953         esac
13954         case "$getnetent_r_proto" in
13955         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13956         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13957         esac
13958         case "$getnetent_r_proto" in
13959         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13960         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13961         esac
13962         case "$getnetent_r_proto" in
13963         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13964         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13965         esac
13966         case "$getnetent_r_proto" in
13967         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13968         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13969         esac
13970         case "$getnetent_r_proto" in
13971         ''|0)   d_getnetent_r=undef
13972                 getnetent_r_proto=0
13973                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13974         * )     case "$getnetent_r_proto" in
13975                 REENTRANT_PROTO*) ;;
13976                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13977                 esac
13978                 echo "Prototype: $try" ;;
13979         esac
13980         ;;
13981         *)      case "$usethreads" in
13982                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13983                 esac
13984                 d_getnetent_r=undef
13985                 getnetent_r_proto=0
13986                 ;;
13987         esac
13988         ;;
13989 *)      getnetent_r_proto=0
13990         ;;
13991 esac
13992
13993 : see if prototypes for various getnetxxx netdb.h functions are available
13994 echo " "
13995 set d_getnetprotos getnetent $i_netdb netdb.h
13996 eval $hasproto
13997
13998 : see if getpagesize exists
13999 set getpagesize d_getpagsz
14000 eval $inlibc
14001
14002 : Optional checks for getprotobyname and getprotobynumber
14003
14004 : see if getprotobyname exists
14005 set getprotobyname d_getpbyname
14006 eval $inlibc
14007
14008 : see if getprotobynumber exists
14009 set getprotobynumber d_getpbynumber
14010 eval $inlibc
14011
14012 : see if getprotoent exists
14013 set getprotoent d_getpent
14014 eval $inlibc
14015
14016 : see if getpgid exists
14017 set getpgid d_getpgid
14018 eval $inlibc
14019
14020 : see if getpgrp2 exists
14021 set getpgrp2 d_getpgrp2
14022 eval $inlibc
14023
14024 : see if getppid exists
14025 set getppid d_getppid
14026 eval $inlibc
14027
14028 : see if getpriority exists
14029 set getpriority d_getprior
14030 eval $inlibc
14031
14032 : see if getprotobyname_r exists
14033 set getprotobyname_r d_getprotobyname_r
14034 eval $inlibc
14035 case "$d_getprotobyname_r" in
14036 "$define")
14037         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14038         case "$d_getprotobyname_r_proto:$usethreads" in
14039         ":define")      d_getprotobyname_r_proto=define
14040                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14041                 eval $hasproto ;;
14042         *)      ;;
14043         esac
14044         case "$d_getprotobyname_r_proto" in
14045         define)
14046         case "$getprotobyname_r_proto" in
14047         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14048         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14049         esac
14050         case "$getprotobyname_r_proto" in
14051         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14052         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14053         esac
14054         case "$getprotobyname_r_proto" in
14055         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14056         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14057         esac
14058         case "$getprotobyname_r_proto" in
14059         ''|0)   d_getprotobyname_r=undef
14060                 getprotobyname_r_proto=0
14061                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14062         * )     case "$getprotobyname_r_proto" in
14063                 REENTRANT_PROTO*) ;;
14064                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14065                 esac
14066                 echo "Prototype: $try" ;;
14067         esac
14068         ;;
14069         *)      case "$usethreads" in
14070                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14071                 esac
14072                 d_getprotobyname_r=undef
14073                 getprotobyname_r_proto=0
14074                 ;;
14075         esac
14076         ;;
14077 *)      getprotobyname_r_proto=0
14078         ;;
14079 esac
14080
14081 : see if getprotobynumber_r exists
14082 set getprotobynumber_r d_getprotobynumber_r
14083 eval $inlibc
14084 case "$d_getprotobynumber_r" in
14085 "$define")
14086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14087         case "$d_getprotobynumber_r_proto:$usethreads" in
14088         ":define")      d_getprotobynumber_r_proto=define
14089                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14090                 eval $hasproto ;;
14091         *)      ;;
14092         esac
14093         case "$d_getprotobynumber_r_proto" in
14094         define)
14095         case "$getprotobynumber_r_proto" in
14096         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14097         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14098         esac
14099         case "$getprotobynumber_r_proto" in
14100         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14101         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14102         esac
14103         case "$getprotobynumber_r_proto" in
14104         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14105         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14106         esac
14107         case "$getprotobynumber_r_proto" in
14108         ''|0)   d_getprotobynumber_r=undef
14109                 getprotobynumber_r_proto=0
14110                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14111         * )     case "$getprotobynumber_r_proto" in
14112                 REENTRANT_PROTO*) ;;
14113                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14114                 esac
14115                 echo "Prototype: $try" ;;
14116         esac
14117         ;;
14118         *)      case "$usethreads" in
14119                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14120                 esac
14121                 d_getprotobynumber_r=undef
14122                 getprotobynumber_r_proto=0
14123                 ;;
14124         esac
14125         ;;
14126 *)      getprotobynumber_r_proto=0
14127         ;;
14128 esac
14129
14130 : see if getprotoent_r exists
14131 set getprotoent_r d_getprotoent_r
14132 eval $inlibc
14133 case "$d_getprotoent_r" in
14134 "$define")
14135         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14136         case "$d_getprotoent_r_proto:$usethreads" in
14137         ":define")      d_getprotoent_r_proto=define
14138                 set d_getprotoent_r_proto getprotoent_r $hdrs
14139                 eval $hasproto ;;
14140         *)      ;;
14141         esac
14142         case "$d_getprotoent_r_proto" in
14143         define)
14144         case "$getprotoent_r_proto" in
14145         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14146         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14147         esac
14148         case "$getprotoent_r_proto" in
14149         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14150         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14151         esac
14152         case "$getprotoent_r_proto" in
14153         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14154         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14155         esac
14156         case "$getprotoent_r_proto" in
14157         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14158         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14159         esac
14160         case "$getprotoent_r_proto" in
14161         ''|0)   d_getprotoent_r=undef
14162                 getprotoent_r_proto=0
14163                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14164         * )     case "$getprotoent_r_proto" in
14165                 REENTRANT_PROTO*) ;;
14166                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14167                 esac
14168                 echo "Prototype: $try" ;;
14169         esac
14170         ;;
14171         *)      case "$usethreads" in
14172                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14173                 esac
14174                 d_getprotoent_r=undef
14175                 getprotoent_r_proto=0
14176                 ;;
14177         esac
14178         ;;
14179 *)      getprotoent_r_proto=0
14180         ;;
14181 esac
14182
14183 : see if prototypes for various getprotoxxx netdb.h functions are available
14184 echo " "
14185 set d_getprotoprotos getprotoent $i_netdb netdb.h
14186 eval $hasproto
14187
14188 : see if getprpwnam exists
14189 set getprpwnam d_getprpwnam
14190 eval $inlibc
14191
14192 : see if getpwent exists
14193 set getpwent d_getpwent
14194 eval $inlibc
14195
14196 : see if getpwent_r exists
14197 set getpwent_r d_getpwent_r
14198 eval $inlibc
14199 case "$d_getpwent_r" in
14200 "$define")
14201         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14202         case "$d_getpwent_r_proto:$usethreads" in
14203         ":define")      d_getpwent_r_proto=define
14204                 set d_getpwent_r_proto getpwent_r $hdrs
14205                 eval $hasproto ;;
14206         *)      ;;
14207         esac
14208         case "$d_getpwent_r_proto" in
14209         define)
14210         case "$getpwent_r_proto" in
14211         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14212         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14213         esac
14214         case "$getpwent_r_proto" in
14215         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14216         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14217         esac
14218         case "$getpwent_r_proto" in
14219         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14220         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14221         esac
14222         case "$getpwent_r_proto" in
14223         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14224         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14225         esac
14226         case "$getpwent_r_proto" in
14227         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14228         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14229         esac
14230         case "$getpwent_r_proto" in
14231         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14232         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14233         esac
14234         case "$getpwent_r_proto" in
14235         ''|0)   d_getpwent_r=undef
14236                 getpwent_r_proto=0
14237                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14238         * )     case "$getpwent_r_proto" in
14239                 REENTRANT_PROTO*) ;;
14240                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14241                 esac
14242                 echo "Prototype: $try" ;;
14243         esac
14244         ;;
14245         *)      case "$usethreads" in
14246                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14247                 esac
14248                 d_getpwent_r=undef
14249                 getpwent_r_proto=0
14250                 ;;
14251         esac
14252         ;;
14253 *)      getpwent_r_proto=0
14254         ;;
14255 esac
14256
14257 : see if getpwnam_r exists
14258 set getpwnam_r d_getpwnam_r
14259 eval $inlibc
14260 case "$d_getpwnam_r" in
14261 "$define")
14262         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14263         case "$d_getpwnam_r_proto:$usethreads" in
14264         ":define")      d_getpwnam_r_proto=define
14265                 set d_getpwnam_r_proto getpwnam_r $hdrs
14266                 eval $hasproto ;;
14267         *)      ;;
14268         esac
14269         case "$d_getpwnam_r_proto" in
14270         define)
14271         case "$getpwnam_r_proto" in
14272         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14273         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14274         esac
14275         case "$getpwnam_r_proto" in
14276         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14277         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14278         esac
14279         case "$getpwnam_r_proto" in
14280         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14281         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14282         esac
14283         case "$getpwnam_r_proto" in
14284         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14285         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14286         esac
14287         case "$getpwnam_r_proto" in
14288         ''|0)   d_getpwnam_r=undef
14289                 getpwnam_r_proto=0
14290                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14291         * )     case "$getpwnam_r_proto" in
14292                 REENTRANT_PROTO*) ;;
14293                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14294                 esac
14295                 echo "Prototype: $try" ;;
14296         esac
14297         ;;
14298         *)      case "$usethreads" in
14299                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14300                 esac
14301                 d_getpwnam_r=undef
14302                 getpwnam_r_proto=0
14303                 ;;
14304         esac
14305         ;;
14306 *)      getpwnam_r_proto=0
14307         ;;
14308 esac
14309
14310 : see if getpwuid_r exists
14311 set getpwuid_r d_getpwuid_r
14312 eval $inlibc
14313 case "$d_getpwuid_r" in
14314 "$define")
14315         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14316         case "$d_getpwuid_r_proto:$usethreads" in
14317         ":define")      d_getpwuid_r_proto=define
14318                 set d_getpwuid_r_proto getpwuid_r $hdrs
14319                 eval $hasproto ;;
14320         *)      ;;
14321         esac
14322         case "$d_getpwuid_r_proto" in
14323         define)
14324         case "$getpwuid_r_proto" in
14325         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14326         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14327         esac
14328         case "$getpwuid_r_proto" in
14329         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14330         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14331         esac
14332         case "$getpwuid_r_proto" in
14333         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14334         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14335         esac
14336         case "$getpwuid_r_proto" in
14337         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14338         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14339         esac
14340         case "$getpwuid_r_proto" in
14341         ''|0)   d_getpwuid_r=undef
14342                 getpwuid_r_proto=0
14343                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14344         * )     case "$getpwuid_r_proto" in
14345                 REENTRANT_PROTO*) ;;
14346                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14347                 esac
14348                 echo "Prototype: $try" ;;
14349         esac
14350         ;;
14351         *)      case "$usethreads" in
14352                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14353                 esac
14354                 d_getpwuid_r=undef
14355                 getpwuid_r_proto=0
14356                 ;;
14357         esac
14358         ;;
14359 *)      getpwuid_r_proto=0
14360         ;;
14361 esac
14362
14363 : Optional checks for getsbyname and getsbyport
14364
14365 : see if getservbyname exists
14366 set getservbyname d_getsbyname
14367 eval $inlibc
14368
14369 : see if getservbyport exists
14370 set getservbyport d_getsbyport
14371 eval $inlibc
14372
14373 : see if getservent exists
14374 set getservent d_getsent
14375 eval $inlibc
14376
14377 : see if getservbyname_r exists
14378 set getservbyname_r d_getservbyname_r
14379 eval $inlibc
14380 case "$d_getservbyname_r" in
14381 "$define")
14382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14383         case "$d_getservbyname_r_proto:$usethreads" in
14384         ":define")      d_getservbyname_r_proto=define
14385                 set d_getservbyname_r_proto getservbyname_r $hdrs
14386                 eval $hasproto ;;
14387         *)      ;;
14388         esac
14389         case "$d_getservbyname_r_proto" in
14390         define)
14391         case "$getservbyname_r_proto" in
14392         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14393         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14394         esac
14395         case "$getservbyname_r_proto" in
14396         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14397         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14398         esac
14399         case "$getservbyname_r_proto" in
14400         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14401         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14402         esac
14403         case "$getservbyname_r_proto" in
14404         ''|0)   d_getservbyname_r=undef
14405                 getservbyname_r_proto=0
14406                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14407         * )     case "$getservbyname_r_proto" in
14408                 REENTRANT_PROTO*) ;;
14409                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14410                 esac
14411                 echo "Prototype: $try" ;;
14412         esac
14413         ;;
14414         *)      case "$usethreads" in
14415                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14416                 esac
14417                 d_getservbyname_r=undef
14418                 getservbyname_r_proto=0
14419                 ;;
14420         esac
14421         ;;
14422 *)      getservbyname_r_proto=0
14423         ;;
14424 esac
14425
14426 : see if getservbyport_r exists
14427 set getservbyport_r d_getservbyport_r
14428 eval $inlibc
14429 case "$d_getservbyport_r" in
14430 "$define")
14431         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14432         case "$d_getservbyport_r_proto:$usethreads" in
14433         ":define")      d_getservbyport_r_proto=define
14434                 set d_getservbyport_r_proto getservbyport_r $hdrs
14435                 eval $hasproto ;;
14436         *)      ;;
14437         esac
14438         case "$d_getservbyport_r_proto" in
14439         define)
14440         case "$getservbyport_r_proto" in
14441         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14442         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14443         esac
14444         case "$getservbyport_r_proto" in
14445         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14446         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14447         esac
14448         case "$getservbyport_r_proto" in
14449         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14450         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14451         esac
14452         case "$getservbyport_r_proto" in
14453         ''|0)   d_getservbyport_r=undef
14454                 getservbyport_r_proto=0
14455                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14456         * )     case "$getservbyport_r_proto" in
14457                 REENTRANT_PROTO*) ;;
14458                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14459                 esac
14460                 echo "Prototype: $try" ;;
14461         esac
14462         ;;
14463         *)      case "$usethreads" in
14464                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14465                 esac
14466                 d_getservbyport_r=undef
14467                 getservbyport_r_proto=0
14468                 ;;
14469         esac
14470         ;;
14471 *)      getservbyport_r_proto=0
14472         ;;
14473 esac
14474
14475 : see if getservent_r exists
14476 set getservent_r d_getservent_r
14477 eval $inlibc
14478 case "$d_getservent_r" in
14479 "$define")
14480         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14481         case "$d_getservent_r_proto:$usethreads" in
14482         ":define")      d_getservent_r_proto=define
14483                 set d_getservent_r_proto getservent_r $hdrs
14484                 eval $hasproto ;;
14485         *)      ;;
14486         esac
14487         case "$d_getservent_r_proto" in
14488         define)
14489         case "$getservent_r_proto" in
14490         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14491         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14492         esac
14493         case "$getservent_r_proto" in
14494         ''|0) try='int getservent_r(struct servent*, char*, int);'
14495         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14496         esac
14497         case "$getservent_r_proto" in
14498         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14499         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14500         esac
14501         case "$getservent_r_proto" in
14502         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14503         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14504         esac
14505         case "$getservent_r_proto" in
14506         ''|0)   d_getservent_r=undef
14507                 getservent_r_proto=0
14508                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14509         * )     case "$getservent_r_proto" in
14510                 REENTRANT_PROTO*) ;;
14511                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14512                 esac
14513                 echo "Prototype: $try" ;;
14514         esac
14515         ;;
14516         *)      case "$usethreads" in
14517                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14518                 esac
14519                 d_getservent_r=undef
14520                 getservent_r_proto=0
14521                 ;;
14522         esac
14523         ;;
14524 *)      getservent_r_proto=0
14525         ;;
14526 esac
14527
14528 : see if prototypes for various getservxxx netdb.h functions are available
14529 echo " "
14530 set d_getservprotos getservent $i_netdb netdb.h
14531 eval $hasproto
14532
14533 : see if getspnam exists
14534 set getspnam d_getspnam
14535 eval $inlibc
14536
14537 : see if this is a shadow.h system
14538 set shadow.h i_shadow
14539 eval $inhdr
14540
14541 : see if getspnam_r exists
14542 set getspnam_r d_getspnam_r
14543 eval $inlibc
14544 case "$d_getspnam_r" in
14545 "$define")
14546         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14547         case "$d_getspnam_r_proto:$usethreads" in
14548         ":define")      d_getspnam_r_proto=define
14549                 set d_getspnam_r_proto getspnam_r $hdrs
14550                 eval $hasproto ;;
14551         *)      ;;
14552         esac
14553         case "$d_getspnam_r_proto" in
14554         define)
14555         case "$getspnam_r_proto" in
14556         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14557         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14558         esac
14559         case "$getspnam_r_proto" in
14560         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14561         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14562         esac
14563         case "$getspnam_r_proto" in
14564         ''|0)   d_getspnam_r=undef
14565                 getspnam_r_proto=0
14566                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14567         * )     case "$getspnam_r_proto" in
14568                 REENTRANT_PROTO*) ;;
14569                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14570                 esac
14571                 echo "Prototype: $try" ;;
14572         esac
14573         ;;
14574         *)      case "$usethreads" in
14575                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14576                 esac
14577                 d_getspnam_r=undef
14578                 getspnam_r_proto=0
14579                 ;;
14580         esac
14581         ;;
14582 *)      getspnam_r_proto=0
14583         ;;
14584 esac
14585
14586 : see if gettimeofday or ftime exists
14587 set gettimeofday d_gettimeod
14588 eval $inlibc
14589 case "$d_gettimeod" in
14590 "$undef")
14591         set ftime d_ftime 
14592         eval $inlibc
14593         ;;
14594 *)
14595         val="$undef"; set d_ftime; eval $setvar
14596         ;;
14597 esac
14598 case "$d_gettimeod$d_ftime" in
14599 "$undef$undef")
14600         echo " "
14601         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14602         ;;
14603 esac
14604
14605 : see if gmtime_r exists
14606 set gmtime_r d_gmtime_r
14607 eval $inlibc
14608 case "$d_gmtime_r" in
14609 "$define")
14610         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14611         case "$d_gmtime_r_proto:$usethreads" in
14612         ":define")      d_gmtime_r_proto=define
14613                 set d_gmtime_r_proto gmtime_r $hdrs
14614                 eval $hasproto ;;
14615         *)      ;;
14616         esac
14617         case "$d_gmtime_r_proto" in
14618         define)
14619         case "$gmtime_r_proto" in
14620         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14621         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14622         esac
14623         case "$gmtime_r_proto" in
14624         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14625         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14626         esac
14627         case "$gmtime_r_proto" in
14628         ''|0)   d_gmtime_r=undef
14629                 gmtime_r_proto=0
14630                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14631         * )     case "$gmtime_r_proto" in
14632                 REENTRANT_PROTO*) ;;
14633                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14634                 esac
14635                 echo "Prototype: $try" ;;
14636         esac
14637         ;;
14638         *)      case "$usethreads" in
14639                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14640                 esac
14641                 d_gmtime_r=undef
14642                 gmtime_r_proto=0
14643                 ;;
14644         esac
14645         ;;
14646 *)      gmtime_r_proto=0
14647         ;;
14648 esac
14649
14650 : see if hasmntopt exists
14651 set hasmntopt d_hasmntopt
14652 eval $inlibc
14653
14654 : see if this is a netinet/in.h or sys/in.h system
14655 set netinet/in.h i_niin sys/in.h i_sysin
14656 eval $inhdr
14657
14658 : see if arpa/inet.h has to be included
14659 set arpa/inet.h i_arpainet
14660 eval $inhdr
14661
14662 : see if htonl --and friends-- exists
14663 val=''
14664 set htonl val
14665 eval $inlibc
14666
14667 : Maybe they are macros.
14668 case "$val" in
14669 $undef)
14670         $cat >htonl.c <<EOM
14671 #include <stdio.h>
14672 #include <sys/types.h>
14673 #$i_niin I_NETINET_IN
14674 #$i_sysin I_SYS_IN
14675 #$i_arpainet I_ARPA_INET
14676 #ifdef I_NETINET_IN
14677 #include <netinet/in.h>
14678 #endif
14679 #ifdef I_SYS_IN
14680 #include <sys/in.h>
14681 #endif
14682 #ifdef I_ARPA_INET
14683 #include <arpa/inet.h>
14684 #endif
14685 #ifdef htonl
14686 printf("Defined as a macro.");
14687 #endif
14688 EOM
14689         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14690         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14691                 val="$define"
14692                 echo "But it seems to be defined as a macro." >&4
14693         fi
14694         $rm -f htonl.?
14695         ;;
14696 esac
14697 set d_htonl
14698 eval $setvar
14699
14700 : see if ilogbl exists
14701 set ilogbl d_ilogbl
14702 eval $inlibc
14703
14704 : index or strchr
14705 echo " "
14706 if set index val -f; eval $csym; $val; then
14707         if set strchr val -f d_strchr; eval $csym; $val; then
14708                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14709                         val="$define"
14710                         vali="$undef"
14711                         echo "strchr() found." >&4
14712                 else
14713                         val="$undef"
14714                         vali="$define"
14715                         echo "index() found." >&4
14716                 fi
14717         else
14718                 val="$undef"
14719                 vali="$define"
14720                 echo "index() found." >&4
14721         fi
14722 else
14723         if set strchr val -f d_strchr; eval $csym; $val; then
14724                 val="$define"
14725                 vali="$undef"
14726                 echo "strchr() found." >&4
14727         else
14728                 echo "No index() or strchr() found!" >&4
14729                 val="$undef"
14730                 vali="$undef"
14731         fi
14732 fi
14733 set d_strchr; eval $setvar
14734 val="$vali"
14735 set d_index; eval $setvar
14736
14737 : check whether inet_aton exists
14738 set inet_aton d_inetaton
14739 eval $inlibc
14740
14741 : Look for isascii
14742 echo " "
14743 $cat >isascii.c <<EOCP
14744 #include <stdio.h>
14745 #include <ctype.h>
14746 #$i_stdlib I_STDLIB
14747 #ifdef I_STDLIB
14748 #include <stdlib.h>
14749 #endif
14750 int main() {
14751         int c = 'A';
14752         if (isascii(c))
14753                 exit(0);
14754         else
14755                 exit(1);
14756 }
14757 EOCP
14758 set isascii
14759 if eval $compile; then
14760         echo "isascii() found." >&4
14761         val="$define"
14762 else
14763         echo "isascii() NOT found." >&4
14764         val="$undef"
14765 fi
14766 set d_isascii
14767 eval $setvar
14768 $rm -f isascii*
14769
14770 : see if isfinite exists
14771 set isfinite d_isfinite
14772 eval $inlibc
14773
14774 : see if isinf exists
14775 set isinf d_isinf
14776 eval $inlibc
14777
14778 : see if isnan exists
14779 set isnan d_isnan
14780 eval $inlibc
14781
14782 : see if isnanl exists
14783 set isnanl d_isnanl
14784 eval $inlibc
14785
14786 : see if killpg exists
14787 set killpg d_killpg
14788 eval $inlibc
14789
14790 : see if lchown exists
14791 echo " "
14792 $cat > try.c <<'EOCP'
14793 /* System header to define __stub macros and hopefully few prototypes,
14794     which can conflict with char lchown(); below.  */
14795 #include <assert.h>
14796 /* Override any gcc2 internal prototype to avoid an error.  */
14797 /* We use char because int might match the return type of a gcc2
14798    builtin and then its argument prototype would still apply.  */
14799 char lchown();
14800 int main() {
14801     /*  The GNU C library defines this for functions which it implements
14802         to always fail with ENOSYS.  Some functions are actually named
14803         something starting with __ and the normal name is an alias.  */
14804 #if defined (__stub_lchown) || defined (__stub___lchown)
14805 choke me
14806 #else
14807 lchown();
14808 #endif
14809 ; return 0; }
14810 EOCP
14811 set try
14812 if eval $compile; then
14813     $echo "lchown() found." >&4
14814     val="$define"
14815 else
14816     $echo "lchown() NOT found." >&4
14817     val="$undef"
14818 fi
14819 set d_lchown
14820 eval $setvar
14821
14822 : See if number of significant digits in a double precision number is known
14823 echo " "
14824 $cat >ldbl_dig.c <<EOM
14825 #$i_limits I_LIMITS
14826 #$i_float I_FLOAT
14827 #ifdef I_LIMITS
14828 #include <limits.h>
14829 #endif
14830 #ifdef I_FLOAT
14831 #include <float.h>
14832 #endif
14833 #ifdef LDBL_DIG
14834 printf("Contains LDBL_DIG");
14835 #endif
14836 EOM
14837 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14838 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14839         echo "LDBL_DIG found." >&4
14840         val="$define"
14841 else
14842         echo "LDBL_DIG NOT found." >&4
14843         val="$undef"
14844 fi
14845 $rm -f ldbl_dig.?
14846 set d_ldbl_dig
14847 eval $setvar
14848
14849 : see if this is a math.h system
14850 set math.h i_math
14851 eval $inhdr
14852
14853 : check to see if math.h defines _LIB_VERSION
14854 d_libm_lib_version="$undef"
14855 case $i_math in
14856     $define)
14857         echo " "
14858         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14859         $cat >try.c <<EOCP
14860 #include <unistd.h>
14861 #include <math.h>
14862 int main (int argc, char *argv[])
14863 {
14864     printf ("%d\n", _LIB_VERSION);
14865     return (0);
14866     } /* main */
14867 EOCP
14868         set try
14869         if eval $compile; then
14870             foo=`$run ./try`
14871             echo "Yes, it does ($foo)" >&4
14872             d_libm_lib_version="$define"
14873         else
14874             echo "No, it does not (probably harmless)" >&4
14875             fi
14876         $rm_try
14877         ;;
14878
14879     esac
14880
14881 : see if link exists
14882 set link d_link
14883 eval $inlibc
14884
14885 : see if localtime_r exists
14886 set localtime_r d_localtime_r
14887 eval $inlibc
14888 case "$d_localtime_r" in
14889 "$define")
14890         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14891         case "$d_localtime_r_proto:$usethreads" in
14892         ":define")      d_localtime_r_proto=define
14893                 set d_localtime_r_proto localtime_r $hdrs
14894                 eval $hasproto ;;
14895         *)      ;;
14896         esac
14897         case "$d_localtime_r_proto" in
14898         define)
14899         case "$localtime_r_proto" in
14900         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14901         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14902         esac
14903         case "$localtime_r_proto" in
14904         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14905         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14906         esac
14907         case "$localtime_r_proto" in
14908         ''|0)   d_localtime_r=undef
14909                 localtime_r_proto=0
14910                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14911         * )     case "$localtime_r_proto" in
14912                 REENTRANT_PROTO*) ;;
14913                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14914                 esac
14915                 echo "Prototype: $try" ;;
14916         esac
14917         ;;
14918         *)      case "$usethreads" in
14919                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14920                 esac
14921                 d_localtime_r=undef
14922                 localtime_r_proto=0
14923                 ;;
14924         esac
14925         ;;
14926 *)      localtime_r_proto=0
14927         ;;
14928 esac
14929
14930 : see if localtime_r calls tzset
14931 case "$localtime_r_proto" in
14932 REENTRANT_PROTO*)
14933         $cat >try.c <<EOCP
14934 /*  Does our libc's localtime_r call tzset ?
14935  *  return 0 if so, 1 otherwise.
14936  */
14937 #include <sys/types.h>
14938 #include <unistd.h>
14939 #include <time.h>
14940 #include <string.h>
14941 #include <malloc.h>
14942 int main()
14943 {
14944     time_t t = time(0L);
14945     char w_tz[]="TZ" "=GMT+5",
14946          e_tz[]="TZ" "=GMT-5",
14947         *tz_e = (char*)malloc(16),
14948         *tz_w = (char*)malloc(16);
14949     struct tm tm_e, tm_w;
14950     memset(&tm_e,'\0',sizeof(struct tm));
14951     memset(&tm_w,'\0',sizeof(struct tm));
14952     strcpy(tz_e,e_tz);
14953     strcpy(tz_w,w_tz);
14954
14955     putenv(tz_e);
14956     localtime_r(&t, &tm_e);
14957
14958     putenv(tz_w);
14959     localtime_r(&t, &tm_w);
14960
14961     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14962         return 1;
14963     return 0;
14964 }
14965 EOCP
14966         set try
14967         if eval $compile; then
14968             if $run ./try; then
14969                 d_localtime_r_needs_tzset=undef;
14970             else
14971                 d_localtime_r_needs_tzset=define;
14972             fi;
14973         else
14974             d_localtime_r_needs_tzset=undef;
14975         fi;
14976      ;;
14977   *)
14978      d_localtime_r_needs_tzset=undef;
14979      ;;
14980 esac
14981 $rm_try
14982
14983 : see if localeconv exists
14984 set localeconv d_locconv
14985 eval $inlibc
14986
14987 : see if lockf exists
14988 set lockf d_lockf
14989 eval $inlibc
14990
14991 : see if prototype for lseek is available
14992 echo " "
14993 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14994 eval $hasproto
14995
14996 : see if lstat exists
14997 set lstat d_lstat
14998 eval $inlibc
14999
15000 : see if madvise exists
15001 set madvise d_madvise
15002 eval $inlibc
15003
15004 : see if malloc_size exists
15005 set malloc_size d_malloc_size
15006 eval $inlibc
15007
15008 : see if malloc_size_good exists
15009 set malloc_good_size d_malloc_good_size
15010 eval $inlibc
15011
15012 : see if mblen exists
15013 set mblen d_mblen
15014 eval $inlibc
15015
15016 : see if mbstowcs exists
15017 set mbstowcs d_mbstowcs
15018 eval $inlibc
15019
15020 : see if mbtowc exists
15021 set mbtowc d_mbtowc
15022 eval $inlibc
15023
15024 : see if memchr exists
15025 set memchr d_memchr
15026 eval $inlibc
15027
15028 : see if memcmp exists
15029 set memcmp d_memcmp
15030 eval $inlibc
15031
15032 : see if memcpy exists
15033 set memcpy d_memcpy
15034 eval $inlibc
15035
15036 : see if memmove exists
15037 set memmove d_memmove
15038 eval $inlibc
15039
15040 : see if memset exists
15041 set memset d_memset
15042 eval $inlibc
15043
15044 : see if mkdir exists
15045 set mkdir d_mkdir
15046 eval $inlibc
15047
15048 : see if mkdtemp exists
15049 set mkdtemp d_mkdtemp
15050 eval $inlibc
15051
15052 : see if mkfifo exists
15053 set mkfifo d_mkfifo
15054 eval $inlibc
15055
15056 : see if mkstemp exists
15057 set mkstemp d_mkstemp
15058 eval $inlibc
15059
15060 : see if mkstemps exists
15061 set mkstemps d_mkstemps
15062 eval $inlibc
15063
15064 : see if mktime exists
15065 set mktime d_mktime
15066 eval $inlibc
15067
15068 : see if this is a sys/mman.h system
15069 set sys/mman.h i_sysmman
15070 eval $inhdr
15071
15072 : see if mmap exists
15073 set mmap d_mmap
15074 eval $inlibc
15075 : see what shmat returns
15076 : default to something harmless
15077 mmaptype='void *'
15078 case "$i_sysmman$d_mmap" in
15079 "$define$define")
15080         $cat >mmap.c <<'END'
15081 #include <sys/mman.h>
15082 void *mmap();
15083 END
15084         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15085                 mmaptype='void *'
15086         else
15087                 mmaptype='caddr_t'
15088         fi
15089         echo "and it returns ($mmaptype)." >&4
15090         ;;
15091 esac
15092
15093
15094
15095 : see if sqrtl exists
15096 set sqrtl d_sqrtl
15097 eval $inlibc
15098
15099 : see if scalbnl exists
15100 set scalbnl d_scalbnl
15101 eval $inlibc
15102
15103 : see if modfl exists
15104 set modfl d_modfl
15105 eval $inlibc
15106
15107 : see if prototype for modfl is available
15108 echo " "
15109 set d_modflproto modfl $i_math math.h
15110 eval $hasproto
15111
15112 d_modfl_pow32_bug="$undef"
15113
15114 case "$d_longdbl$d_modfl" in
15115 $define$define)
15116         $cat <<EOM
15117 Checking to see whether your modfl() is okay for large values...
15118 EOM
15119 $cat >try.c <<EOCP
15120 #include <math.h>
15121 #include <stdio.h>
15122 EOCP
15123 if $test "X$d_modflproto" != "X$define"; then
15124         $cat >>try.c <<EOCP
15125 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15126 long double modfl (long double, long double *);
15127 EOCP
15128 fi
15129 $cat >>try.c <<EOCP
15130 int main() {
15131     long double nv = 4294967303.15;
15132     long double v, w;
15133     v = modfl(nv, &w);
15134 #ifdef __GLIBC__
15135     printf("glibc");
15136 #endif
15137     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15138     return 0;
15139 }
15140 EOCP
15141         case "$osname:$gccversion" in
15142         aix:)   saveccflags="$ccflags"
15143                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15144         esac
15145         set try
15146         if eval $compile; then
15147                 foo=`$run ./try`
15148                 case "$foo" in
15149                 *" 4294967303.150000 1.150000 4294967302.000000")
15150                         echo >&4 "Your modfl() is broken for large values."
15151                         d_modfl_pow32_bug="$define"
15152                         case "$foo" in
15153                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15154                         ;;
15155                         esac
15156                         ;;
15157                 *" 4294967303.150000 0.150000 4294967303.000000")
15158                         echo >&4 "Your modfl() seems okay for large values."
15159                         ;;
15160                 *)      echo >&4 "I don't understand your modfl() at all."
15161                         d_modfl="$undef"
15162                         ;;
15163                 esac
15164                 $rm_try
15165         else
15166                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15167                 d_modfl="$undef"
15168         fi
15169         case "$osname:$gccversion" in
15170         aix:)   ccflags="$saveccflags" ;; # restore
15171         esac
15172         ;;
15173 esac
15174
15175 if $test "$uselongdouble" = "$define"; then
15176     message=""
15177     if $test "$d_sqrtl" != "$define"; then
15178         message="$message sqrtl"
15179     fi
15180     if $test "$d_modfl" != "$define"; then
15181         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15182             echo "You have both aintl and copysignl, so I can emulate modfl."
15183         else
15184             message="$message modfl"
15185         fi
15186     fi
15187     if $test "$d_frexpl" != "$define"; then
15188         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15189             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15190         else
15191             message="$message frexpl"
15192         fi
15193     fi
15194
15195     if $test "$message" != ""; then
15196         $cat <<EOM >&4
15197
15198 *** You requested the use of long doubles but you do not seem to have
15199 *** the following mathematical functions needed for long double support:
15200 ***    $message
15201 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15202 *** Cannot continue, aborting.
15203
15204 EOM
15205
15206         exit 1
15207     fi
15208 fi
15209
15210 : see if mprotect exists
15211 set mprotect d_mprotect
15212 eval $inlibc
15213
15214 : see if msgctl exists
15215 set msgctl d_msgctl
15216 eval $inlibc
15217
15218 : see if msgget exists
15219 set msgget d_msgget
15220 eval $inlibc
15221
15222 : see if msgsnd exists
15223 set msgsnd d_msgsnd
15224 eval $inlibc
15225
15226 : see if msgrcv exists
15227 set msgrcv d_msgrcv
15228 eval $inlibc
15229
15230 : see how much of the 'msg*(2)' library is present.
15231 h_msg=true
15232 echo " "
15233 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15234 *"$undef"*) h_msg=false;;
15235 esac
15236 case "$osname" in
15237 freebsd)
15238     case "`ipcs 2>&1`" in
15239     "SVID messages"*"not configured"*)
15240         echo "Your $osname does not have the msg*(2) configured." >&4
15241         h_msg=false
15242         val="$undef"
15243         set msgctl d_msgctl
15244         eval $setvar
15245         set msgget d_msgget
15246         eval $setvar
15247         set msgsnd d_msgsnd
15248         eval $setvar
15249         set msgrcv d_msgrcv
15250         eval $setvar
15251         ;;
15252     esac
15253     ;;
15254 esac
15255 : we could also check for sys/ipc.h ...
15256 if $h_msg && $test `./findhdr sys/msg.h`; then
15257         echo "You have the full msg*(2) library." >&4
15258         val="$define"
15259 else
15260         echo "You don't have the full msg*(2) library." >&4
15261         val="$undef"
15262 fi
15263 set d_msg
15264 eval $setvar
15265
15266 : Check for msghdr_s
15267 echo " "
15268 echo "Checking to see if your system supports struct msghdr..." >&4
15269 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15270 eval $hasstruct
15271 case "$d_msghdr_s" in
15272 "$define")      echo "Yes, it does."   ;;
15273 *)              echo "No, it doesn't." ;;
15274 esac
15275
15276
15277 : see if msync exists
15278 set msync d_msync
15279 eval $inlibc
15280
15281 : see if munmap exists
15282 set munmap d_munmap
15283 eval $inlibc
15284
15285 : see if nice exists
15286 set nice d_nice
15287 eval $inlibc
15288
15289 : see if this is a langinfo.h system
15290 set langinfo.h i_langinfo
15291 eval $inhdr
15292
15293 : see if nl_langinfo exists
15294 set nl_langinfo d_nl_langinfo
15295 eval $inlibc
15296
15297 : check for volatile keyword
15298 echo " "
15299 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15300 $cat >try.c <<'EOCP'
15301 int main()
15302 {
15303         typedef struct _goo_struct goo_struct;
15304         goo_struct * volatile goo = ((goo_struct *)0);
15305         struct _goo_struct {
15306                 long long_int;
15307                 int reg_int;
15308                 char char_var;
15309         };
15310         typedef unsigned short foo_t;
15311         char *volatile foo;
15312         volatile int bar;
15313         volatile foo_t blech;
15314         foo = foo;
15315 }
15316 EOCP
15317 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15318         val="$define"
15319         echo "Yup, it does."
15320 else
15321         val="$undef"
15322         echo "Nope, it doesn't."
15323 fi
15324 set d_volatile
15325 eval $setvar
15326 $rm_try
15327
15328 : Check basic sizes
15329 echo " "
15330 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15331
15332 case "$use64bitint:$d_quad:$quadtype" in
15333 define:define:?*)
15334         ivtype="$quadtype"
15335         uvtype="$uquadtype"
15336         ivsize=8
15337         uvsize=8
15338         ;;
15339 *)      ivtype="long"
15340         uvtype="unsigned long"
15341         ivsize=$longsize
15342         uvsize=$longsize
15343         ;;
15344 esac
15345
15346 case "$uselongdouble:$d_longdbl" in
15347 define:define)
15348         nvtype="long double"
15349         nvsize=$longdblsize
15350         ;;
15351 *)      nvtype=double
15352         nvsize=$doublesize
15353         ;;
15354 esac
15355
15356 $echo "(IV will be "$ivtype", $ivsize bytes)"
15357 $echo "(UV will be "$uvtype", $uvsize bytes)"
15358 $echo "(NV will be "$nvtype", $nvsize bytes)"
15359
15360 $cat >try.c <<EOCP
15361 #$i_inttypes I_INTTYPES
15362 #ifdef I_INTTYPES
15363 #include <inttypes.h>
15364 #endif
15365 #include <stdio.h>
15366 int main() {
15367 #ifdef INT8
15368    int8_t i =  INT8_MAX;
15369   uint8_t u = UINT8_MAX;
15370   printf("int8_t\n");
15371 #endif
15372 #ifdef INT16
15373    int16_t i =  INT16_MAX;
15374   uint16_t i = UINT16_MAX;
15375   printf("int16_t\n");
15376 #endif
15377 #ifdef INT32
15378    int32_t i =  INT32_MAX;
15379   uint32_t u = UINT32_MAX;
15380   printf("int32_t\n");
15381 #endif
15382 }
15383 EOCP
15384
15385 i8type="signed char"
15386 u8type="unsigned char"
15387 i8size=1
15388 u8size=1
15389
15390 case "$i16type" in
15391 '')     case "$shortsize" in
15392         2)      i16type=short
15393                 u16type="unsigned short"
15394                 i16size=$shortsize
15395                 u16size=$shortsize
15396                 ;;
15397         esac
15398         ;;
15399 esac
15400 case "$i16type" in
15401 '')     set try -DINT16
15402         if eval $compile; then
15403                 case "`$run ./try`" in
15404                 int16_t)
15405                         i16type=int16_t
15406                         u16type=uint16_t
15407                         i16size=2
15408                         u16size=2
15409                         ;;
15410                 esac
15411         fi
15412         ;;
15413 esac
15414 case "$i16type" in
15415 '')     if $test $shortsize -ge 2; then
15416                 i16type=short
15417                 u16type="unsigned short"
15418                 i16size=$shortsize
15419                 u16size=$shortsize
15420         fi
15421         ;;
15422 esac
15423
15424 case "$i32type" in
15425 '')     case "$longsize" in
15426         4)      i32type=long
15427                 u32type="unsigned long"
15428                 i32size=$longsize
15429                 u32size=$longsize
15430                 ;;
15431         *)      case "$intsize" in
15432                 4)      i32type=int
15433                         u32type="unsigned int"
15434                         i32size=$intsize
15435                         u32size=$intsize
15436                         ;;
15437                 esac
15438                 ;;
15439         esac
15440         ;;
15441 esac
15442 case "$i32type" in
15443 '')     set try -DINT32
15444         if eval $compile; then
15445                 case "`$run ./try`" in
15446                 int32_t)
15447                         i32type=int32_t
15448                         u32type=uint32_t
15449                         i32size=4
15450                         u32size=4
15451                         ;;
15452                 esac
15453         fi
15454         ;;
15455 esac
15456 case "$i32type" in
15457 '')     if $test $intsize -ge 4; then
15458                 i32type=int
15459                 u32type="unsigned int"
15460                 i32size=$intsize
15461                 u32size=$intsize
15462         fi
15463         ;;
15464 esac
15465
15466 case "$i64type" in
15467 '')     case "$d_quad:$quadtype" in
15468         define:?*)
15469                 i64type="$quadtype"
15470                 u64type="$uquadtype"
15471                 i64size=8
15472                 u64size=8
15473                 ;;
15474         esac
15475         ;;
15476 esac
15477
15478 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15479 : volatile so that the compiler has to store it out to memory.
15480 if test X"$d_volatile" = X"$define"; then
15481         volatile=volatile
15482 fi
15483 $cat <<EOP >try.c
15484 #include <stdio.h>
15485 #$i_stdlib I_STDLIB
15486 #ifdef I_STDLIB
15487 #include <stdlib.h>
15488 #endif
15489 #include <sys/types.h>
15490 #include <signal.h>
15491 #ifdef SIGFPE
15492 $volatile int bletched = 0;
15493 $signal_t blech(int s) { bletched = 1; }
15494 #endif
15495 int main() {
15496     $uvtype u = 0;
15497     $nvtype d;
15498     int     n = 8 * $uvsize;
15499     int     i;
15500 #ifdef SIGFPE
15501     signal(SIGFPE, blech);
15502 #endif
15503
15504     for (i = 0; i < n; i++) {
15505       u = u << 1 | ($uvtype)1;
15506       d = ($nvtype)u;
15507       if (($uvtype)d != u)
15508         break;
15509       if (d <= 0)
15510         break;
15511       d = ($nvtype)(u - 1);
15512       if (($uvtype)d != (u - 1))
15513         break;
15514 #ifdef SIGFPE
15515       if (bletched)
15516         break;
15517 #endif
15518     }
15519     printf("%d\n", ((i == n) ? -n : i));
15520     exit(0);
15521 }
15522 EOP
15523 set try
15524
15525 d_nv_preserves_uv="$undef"
15526 if eval $compile; then
15527         nv_preserves_uv_bits="`$run ./try`"
15528 fi
15529 case "$nv_preserves_uv_bits" in
15530 \-[1-9]*)
15531         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15532         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15533         d_nv_preserves_uv="$define"
15534         ;;
15535 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15536         d_nv_preserves_uv="$undef" ;;
15537 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15538         nv_preserves_uv_bits="0" ;;
15539 esac
15540 $rm_try
15541
15542 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15543 : volatile so that the compiler has to store it out to memory.
15544 if test X"$d_volatile" = X"$define"; then
15545         volatile=volatile
15546 fi
15547 $cat <<EOP >try.c
15548 #include <stdio.h>
15549
15550 typedef $nvtype NV;
15551
15552 int
15553 main() {
15554   NV value = 2;
15555   int count = 1;
15556
15557   while(count < 256) {
15558     $volatile NV up = value + 1.0;
15559     $volatile NV negated = -value;
15560     $volatile NV down = negated - 1.0;
15561     $volatile NV got_up = up - value;
15562     int up_good = got_up == 1.0;
15563     int got_down = down - negated;
15564     int down_good = got_down == -1.0;
15565
15566     if (down_good != up_good) {
15567       fprintf(stderr,
15568               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15569               up_good, (double) got_up, down_good, (double) got_down,
15570               count, (double) value);
15571       return 1;
15572     }
15573     if (!up_good) {
15574       while (1) {
15575         if (count > 8) {
15576           count -= 8;
15577           fputs("256.0", stdout);
15578         } else {
15579           count--;
15580           fputs("2.0", stdout);
15581         }
15582         if (!count) {
15583           puts("");
15584           return 0;
15585         }
15586         fputs("*", stdout);
15587       }
15588     }
15589     value *= 2;
15590     ++count;
15591   }
15592   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15593           count, (double) value);
15594   return 1;
15595 }
15596 EOP
15597 set try
15598
15599 nv_overflows_integers_at='0'
15600 if eval $compile; then
15601     xxx="`$run ./try`"
15602     case "$?" in
15603         0)
15604             case "$xxx" in
15605                 2*)  cat >&4 <<EOM
15606 The largest integer your NVs can preserve is equal to $xxx
15607 EOM
15608                     nv_overflows_integers_at="$xxx"
15609                     ;;
15610                 *)  cat >&4 <<EOM
15611 Cannot determine the largest integer value your NVs can hold, unexpected output
15612 '$xxx'
15613 EOM
15614                     ;;
15615             esac
15616             ;;
15617         *)  cat >&4 <<EOM
15618 Cannot determine the largest integer value your NVs can hold
15619 EOM
15620             ;;
15621     esac
15622 fi
15623 $rm_try
15624
15625 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15626 : volatile so that the compiler has to store it out to memory.
15627 if test X"$d_volatile" = X"$define"; then
15628         volatile=volatile
15629 fi
15630 $cat <<EOP >try.c
15631 #include <stdio.h>
15632 #$i_stdlib I_STDLIB
15633 #ifdef I_STDLIB
15634 #include <stdlib.h>
15635 #endif
15636 #$i_string I_STRING
15637 #ifdef I_STRING
15638 #  include <string.h>
15639 #else
15640 #  include <strings.h>
15641 #endif
15642 #include <sys/types.h>
15643 #include <signal.h>
15644 #ifdef SIGFPE
15645 $volatile int bletched = 0;
15646 $signal_t blech(int s) { bletched = 1; }
15647 #endif
15648
15649 int checkit($nvtype d, char *where) {
15650     unsigned char *p = (char *)&d;
15651     unsigned char *end = p + sizeof(d);
15652     int fail = 0;
15653
15654     while (p < end)
15655         fail += *p++;
15656
15657     if (!fail)
15658         return 0;
15659
15660     p = (char *)&d;
15661     printf("No - %s: 0x", where);
15662     while (p < end)
15663         printf ("%02X", *p++);
15664     printf("\n");
15665     return 1;
15666 }
15667
15668 int main(int argc, char **argv) {
15669     $nvtype d = 0.0;
15670     int fail = 0;
15671     fail += checkit(d, "0.0");
15672
15673     /* The compiler shouldn't be assuming that bletched is 0  */
15674     d = bletched;
15675
15676     fail += checkit(d, "bleched");
15677
15678 #ifdef SIGFPE
15679     signal(SIGFPE, blech);
15680 #endif
15681
15682     /* Paranoia - the compiler should have no way of knowing that ANSI says
15683        that argv[argc] will always be NULL.  Actually, if it did assume this it
15684        would be buggy, as this is C and main() can be called from elsewhere in
15685        the program.  */
15686     d = argv[argc] ? 1 : 0;
15687
15688     if (d) {
15689         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15690     }
15691
15692     fail += checkit(d, "ternary");
15693
15694     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15695
15696     if (d != 0.0) {
15697         printf("No - memset doesn't give 0.0\n");
15698         /* This might just blow up:  */
15699         printf("(gives %g)\n", d);
15700         return 1;
15701     }
15702
15703 #ifdef SIGFPE
15704     if (bletched) {
15705         printf("No - something bleched\n");
15706         return 1;
15707     }
15708 #endif
15709     if (fail) {
15710       printf("No - %d fail(s)\n", fail);
15711       return 1;
15712     }
15713     printf("Yes\n");
15714     return 0;
15715 }
15716 EOP
15717 set try
15718
15719 d_nv_zero_is_allbits_zero="$undef"
15720 if eval $compile; then
15721     xxx="`$run ./try`"
15722     case "$?" in
15723         0)
15724             case "$xxx" in
15725                 Yes)  cat >&4 <<EOM
15726 0.0 is represented as all bits zero in memory
15727 EOM
15728                     d_nv_zero_is_allbits_zero="$define"
15729                     ;;
15730                 *)  cat >&4 <<EOM
15731 0.0 is not represented as all bits zero in memory
15732 EOM
15733                     d_nv_zero_is_allbits_zero="$undef"
15734                     ;;
15735             esac
15736             ;;
15737         *)  cat >&4 <<EOM
15738 0.0 is not represented as all bits zero in memory
15739 EOM
15740             d_nv_zero_is_allbits_zero="$undef"
15741             ;;
15742     esac
15743 fi
15744 $rm_try
15745
15746 : check for off64_t
15747 echo " "
15748 echo "Checking to see if you have off64_t..." >&4
15749 $cat >try.c <<EOCP
15750 #include <sys/types.h>
15751 #include <unistd.h>
15752 int main() { off64_t x = 7; }
15753 EOCP
15754 set try
15755 if eval $compile; then
15756         val="$define"
15757         echo "You have off64_t."
15758 else
15759         val="$undef"
15760         echo "You do not have off64_t."
15761         case "$lseeksize" in
15762         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15763         esac
15764 fi
15765 $rm_try
15766 set d_off64_t
15767 eval $setvar
15768
15769 : how to create joinable pthreads
15770 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15771         echo " "
15772         echo "Checking what constant to use for creating joinable pthreads..." >&4
15773         $cat >try.c <<'EOCP'
15774 #include <pthread.h>
15775 int main() {
15776     int detachstate = JOINABLE;
15777 }
15778 EOCP
15779         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15780         if eval $compile; then
15781                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15782                 val="$undef" # Yes, undef.
15783                 set d_old_pthread_create_joinable
15784                 eval $setvar
15785                 val=""
15786                 set old_pthread_create_joinable
15787                 eval $setvar
15788         else
15789                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15790                 if eval $compile; then
15791                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15792                         val="$define"
15793                         set d_old_pthread_create_joinable
15794                         eval $setvar
15795                         val=PTHREAD_CREATE_UNDETACHED
15796                         set old_pthread_create_joinable
15797                         eval $setvar
15798                 else
15799                         set try -DJOINABLE=__UNDETACHED
15800                         if eval $compile; then
15801                                 echo "You seem to use __UNDETACHED." >&4
15802                                 val="$define"
15803                                 set d_old_pthread_create_joinable
15804                                 eval $setvar
15805                                 val=__UNDETACHED
15806                                 set old_pthread_create_joinable
15807                                 eval $setvar
15808                         else
15809                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15810                                 val="$define"
15811                                 set d_old_pthread_create_joinable
15812                                 eval $setvar
15813                                 val=0
15814                                 set old_pthread_create_joinable
15815                                 eval $setvar
15816                         fi
15817                 fi
15818         fi
15819         $rm_try
15820 else
15821     d_old_pthread_create_joinable="$undef"
15822     old_pthread_create_joinable=""
15823 fi
15824
15825 : see if pause exists
15826 set pause d_pause
15827 eval $inlibc
15828
15829 : see if poll exists
15830 set poll d_poll
15831 eval $inlibc
15832
15833 : see if readlink exists
15834 set readlink d_readlink
15835 eval $inlibc
15836
15837 : Check if exe is symlink to abs path of executing program
15838 echo " "
15839 procselfexe=''
15840 val="$undef"
15841 case "$d_readlink" in
15842 "$define")
15843         if $issymlink /proc/self/exe ; then
15844                 $ls -l /proc/self/exe > reflect
15845                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15846                         echo "You have Linux-like /proc/self/exe."
15847                         procselfexe='"/proc/self/exe"'
15848                         val="$define"
15849                 fi
15850         fi
15851         if $issymlink /proc/curproc/file ; then
15852                 $ls -l /proc/curproc/file > reflect
15853                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15854                         echo "You have BSD-like /proc/curproc/file."
15855                         procselfexe='"/proc/curproc/file"'
15856                         val="$define"
15857                 fi
15858         fi
15859         ;;
15860 esac
15861 $rm -f reflect
15862 set d_procselfexe
15863 eval $setvar
15864
15865 : backward compatibility for d_hvfork
15866 if test X$d_hvfork != X; then
15867         d_vfork="$d_hvfork"
15868         d_hvfork=''
15869 fi
15870 : see if there is a vfork
15871 val=''
15872 set vfork val
15873 eval $inlibc
15874
15875 d_pseudofork=$undef
15876
15877 : Ok, but do we want to use it. vfork is reportedly unreliable in
15878 : perl on Solaris 2.x, and probably elsewhere.
15879 case "$val" in
15880 $define)
15881         echo " "
15882         case "$usevfork" in
15883         false) dflt='n';;
15884         *) dflt='y';;
15885         esac
15886         cat <<'EOM'
15887
15888 Perl can only use a vfork() that doesn't suffer from strict
15889 restrictions on calling functions or modifying global data in
15890 the child.  For example, glibc-2.1 contains such a vfork()
15891 that is unsuitable.  If your system provides a proper fork()
15892 call, chances are that you do NOT want perl to use vfork().
15893
15894 EOM
15895         rp="Do you still want to use vfork()?"
15896         . ./myread
15897         case "$ans" in
15898         y|Y) ;;
15899         *)
15900                 echo "Ok, we won't use vfork()."
15901                 val="$undef"
15902                 ;;
15903         esac
15904         ;;
15905 esac
15906 set d_vfork
15907 eval $setvar
15908 case "$d_vfork" in
15909 $define) usevfork='true';;
15910 *) usevfork='false';;
15911 esac
15912
15913 : see whether the pthread_atfork exists
15914 $cat >try.c <<EOP
15915 #include <pthread.h>
15916 #include <stdio.h>
15917 int main() {
15918 #ifdef  PTHREAD_ATFORK
15919         pthread_atfork(NULL,NULL,NULL);
15920 #endif
15921 }
15922 EOP
15923
15924 : see if pthread_atfork exists
15925 set try -DPTHREAD_ATFORK
15926 if eval $compile; then
15927     val="$define"
15928 else
15929     val="$undef"
15930 fi
15931 case "$usethreads" in
15932 $define)
15933         case "$val" in
15934         $define) echo 'pthread_atfork found.' >&4        ;;
15935         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15936         esac
15937 esac
15938 set d_pthread_atfork
15939 eval $setvar
15940
15941 : see if pthread_attr_setscope exists
15942 set pthread_attr_setscope d_pthread_attr_setscope
15943 eval $inlibc
15944
15945 : see whether the various POSIXish _yields exist
15946 $cat >try.c <<EOP
15947 #include <pthread.h>
15948 #include <stdio.h>
15949 int main() {
15950 #ifdef SCHED_YIELD
15951         sched_yield();
15952 #else
15953 #ifdef PTHREAD_YIELD
15954         pthread_yield();
15955 #else
15956 #ifdef PTHREAD_YIELD_NULL
15957         pthread_yield(NULL);
15958 #endif
15959 #endif
15960 #endif
15961 }
15962 EOP
15963 : see if sched_yield exists
15964 set try -DSCHED_YIELD
15965 if eval $compile; then
15966     val="$define"
15967     sched_yield='sched_yield()'
15968 else
15969     val="$undef"
15970 fi
15971 case "$usethreads" in
15972 $define)
15973         case "$val" in
15974         $define) echo 'sched_yield() found.' >&4        ;;
15975         *)       echo 'sched_yield() NOT found.' >&4    ;;
15976         esac
15977 esac
15978 set d_sched_yield
15979 eval $setvar
15980
15981 : see if pthread_yield exists
15982 set try -DPTHREAD_YIELD
15983 if eval $compile; then
15984     val="$define"
15985     case "$sched_yield" in
15986     '') sched_yield='pthread_yield()' ;;
15987     esac
15988 else
15989     set try -DPTHREAD_YIELD_NULL
15990     if eval $compile; then
15991         val="$define"
15992         case "$sched_yield" in
15993         '') sched_yield='pthread_yield(NULL)' ;;
15994         esac
15995     else
15996         val="$undef"
15997     fi
15998 fi
15999 case "$usethreads" in
16000 $define)
16001         case "$val" in
16002         $define) echo 'pthread_yield() found.' >&4      ;;
16003         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16004         esac
16005         ;;
16006 esac
16007 set d_pthread_yield
16008 eval $setvar
16009 case "$sched_yield" in
16010 '') sched_yield=undef ;;
16011 esac
16012 $rm_try
16013
16014 : see if random_r exists
16015 set random_r d_random_r
16016 eval $inlibc
16017 case "$d_random_r" in
16018 "$define")
16019         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16020         case "$d_random_r_proto:$usethreads" in
16021         ":define")      d_random_r_proto=define
16022                 set d_random_r_proto random_r $hdrs
16023                 eval $hasproto ;;
16024         *)      ;;
16025         esac
16026         case "$d_random_r_proto" in
16027         define)
16028         case "$random_r_proto" in
16029         ''|0) try='int random_r(int*, struct random_data*);'
16030         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16031         esac
16032         case "$random_r_proto" in
16033         ''|0) try='int random_r(long*, struct random_data*);'
16034         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16035         esac
16036         case "$random_r_proto" in
16037         ''|0) try='int random_r(struct random_data*, int32_t*);'
16038         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16039         esac
16040         case "$random_r_proto" in
16041         ''|0)   d_random_r=undef
16042                 random_r_proto=0
16043                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16044         * )     case "$random_r_proto" in
16045                 REENTRANT_PROTO*) ;;
16046                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16047                 esac
16048                 echo "Prototype: $try" ;;
16049         esac
16050         ;;
16051         *)      case "$usethreads" in
16052                 define) echo "random_r has no prototype, not using it." >&4 ;;
16053                 esac
16054                 d_random_r=undef
16055                 random_r_proto=0
16056                 ;;
16057         esac
16058         ;;
16059 *)      random_r_proto=0
16060         ;;
16061 esac
16062
16063 : see if readdir and friends exist
16064 set readdir d_readdir
16065 eval $inlibc
16066 set seekdir d_seekdir
16067 eval $inlibc
16068 set telldir d_telldir
16069 eval $inlibc
16070 set rewinddir d_rewinddir
16071 eval $inlibc
16072
16073 : see if readdir64_r exists
16074 set readdir64_r d_readdir64_r
16075 eval $inlibc
16076 case "$d_readdir64_r" in
16077 "$define")
16078         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16079         case "$d_readdir64_r_proto:$usethreads" in
16080         ":define")      d_readdir64_r_proto=define
16081                 set d_readdir64_r_proto readdir64_r $hdrs
16082                 eval $hasproto ;;
16083         *)      ;;
16084         esac
16085         case "$d_readdir64_r_proto" in
16086         define)
16087         case "$readdir64_r_proto" in
16088         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16089         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16090         esac
16091         case "$readdir64_r_proto" in
16092         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16093         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16094         esac
16095         case "$readdir64_r_proto" in
16096         ''|0)   d_readdir64_r=undef
16097                 readdir64_r_proto=0
16098                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16099         * )     case "$readdir64_r_proto" in
16100                 REENTRANT_PROTO*) ;;
16101                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16102                 esac
16103                 echo "Prototype: $try" ;;
16104         esac
16105         ;;
16106         *)      case "$usethreads" in
16107                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16108                 esac
16109                 d_readdir64_r=undef
16110                 readdir64_r_proto=0
16111                 ;;
16112         esac
16113         ;;
16114 *)      readdir64_r_proto=0
16115         ;;
16116 esac
16117
16118 : see if readdir_r exists
16119 set readdir_r d_readdir_r
16120 eval $inlibc
16121 case "$d_readdir_r" in
16122 "$define")
16123         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16124         case "$d_readdir_r_proto:$usethreads" in
16125         ":define")      d_readdir_r_proto=define
16126                 set d_readdir_r_proto readdir_r $hdrs
16127                 eval $hasproto ;;
16128         *)      ;;
16129         esac
16130         case "$d_readdir_r_proto" in
16131         define)
16132         case "$readdir_r_proto" in
16133         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16134         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16135         esac
16136         case "$readdir_r_proto" in
16137         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16138         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16139         esac
16140         case "$readdir_r_proto" in
16141         ''|0)   d_readdir_r=undef
16142                 readdir_r_proto=0
16143                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16144         * )     case "$readdir_r_proto" in
16145                 REENTRANT_PROTO*) ;;
16146                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16147                 esac
16148                 echo "Prototype: $try" ;;
16149         esac
16150         ;;
16151         *)      case "$usethreads" in
16152                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16153                 esac
16154                 d_readdir_r=undef
16155                 readdir_r_proto=0
16156                 ;;
16157         esac
16158         ;;
16159 *)      readdir_r_proto=0
16160         ;;
16161 esac
16162
16163 : see if readv exists
16164 set readv d_readv
16165 eval $inlibc
16166
16167 : see if recvmsg exists
16168 set recvmsg d_recvmsg
16169 eval $inlibc
16170
16171 : see if rename exists
16172 set rename d_rename
16173 eval $inlibc
16174
16175 : see if rmdir exists
16176 set rmdir d_rmdir
16177 eval $inlibc
16178
16179 : see if memory.h is available.
16180 val=''
16181 set memory.h val
16182 eval $inhdr
16183
16184 : See if it conflicts with string.h
16185 case "$val" in
16186 $define)
16187         case "$strings" in
16188         '') ;;
16189         *)
16190                 $cppstdin $cppflags $cppminus < $strings > mem.h
16191                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16192                         echo " "
16193                         echo "We won't be including <memory.h>."
16194                         val="$undef"
16195                 fi
16196                 $rm -f mem.h
16197                 ;;
16198         esac
16199 esac
16200 set i_memory
16201 eval $setvar
16202
16203 : can bcopy handle overlapping blocks?
16204 echo " "
16205 val="$undef"
16206 case "$d_memmove" in
16207 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16208 *)      case "$d_bcopy" in
16209         "$define")
16210                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16211                 $cat >try.c <<EOCP
16212 #$i_memory I_MEMORY
16213 #$i_stdlib I_STDLIB
16214 #$i_string I_STRING
16215 #$i_unistd I_UNISTD
16216 EOCP
16217         $cat >>try.c <<'EOCP'
16218 #include <stdio.h>
16219 #ifdef I_MEMORY
16220 #  include <memory.h>
16221 #endif
16222 #ifdef I_STDLIB
16223 #  include <stdlib.h>
16224 #endif
16225 #ifdef I_STRING
16226 #  include <string.h>
16227 #else
16228 #  include <strings.h>
16229 #endif
16230 #ifdef I_UNISTD
16231 #  include <unistd.h>  /* Needed for NetBSD */
16232 #endif
16233 int main()
16234 {
16235 char buf[128], abc[128];
16236 char *b;
16237 int len;
16238 int off;
16239 int align;
16240
16241 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16242    try to store the string in read-only memory. */
16243 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16244
16245 for (align = 7; align >= 0; align--) {
16246         for (len = 36; len; len--) {
16247                 b = buf+align;
16248                 bcopy(abc, b, len);
16249                 for (off = 1; off <= len; off++) {
16250                         bcopy(b, b+off, len);
16251                         bcopy(b+off, b, len);
16252                         if (bcmp(b, abc, len))
16253                                 exit(1);
16254                 }
16255         }
16256 }
16257 exit(0);
16258 }
16259 EOCP
16260                 set try
16261                 if eval $compile_ok; then
16262                         if $run ./try 2>/dev/null; then
16263                                 echo "Yes, it can."
16264                                 val="$define"
16265                         else
16266                                 echo "It can't, sorry."
16267                         fi
16268                 else
16269                         echo "(I can't compile the test program, so we'll assume not...)"
16270                 fi
16271                 ;;
16272         esac
16273         $rm_try
16274         ;;
16275 esac
16276 set d_safebcpy
16277 eval $setvar
16278
16279 : can memcpy handle overlapping blocks?
16280 echo " "
16281 val="$undef"
16282 case "$d_memmove" in
16283 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16284 *)      case "$d_memcpy" in
16285         "$define")
16286                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16287                 $cat >try.c <<EOCP
16288 #$i_memory I_MEMORY
16289 #$i_stdlib I_STDLIB
16290 #$i_string I_STRING
16291 #$i_unistd I_UNISTD
16292 EOCP
16293         $cat >>try.c <<'EOCP'
16294 #include <stdio.h>
16295 #ifdef I_MEMORY
16296 #  include <memory.h>
16297 #endif
16298 #ifdef I_STDLIB
16299 #  include <stdlib.h>
16300 #endif
16301 #ifdef I_STRING
16302 #  include <string.h>
16303 #else
16304 #  include <strings.h>
16305 #endif
16306 #ifdef I_UNISTD
16307 #  include <unistd.h>  /* Needed for NetBSD */
16308 #endif
16309 int main()
16310 {
16311 char buf[128], abc[128];
16312 char *b;
16313 int len;
16314 int off;
16315 int align;
16316
16317 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16318    try to store the string in read-only memory. */
16319 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16320
16321 for (align = 7; align >= 0; align--) {
16322         for (len = 36; len; len--) {
16323                 b = buf+align;
16324                 memcpy(b, abc, len);
16325                 for (off = 1; off <= len; off++) {
16326                         memcpy(b+off, b, len);
16327                         memcpy(b, b+off, len);
16328                         if (memcmp(b, abc, len))
16329                                 exit(1);
16330                 }
16331         }
16332 }
16333 exit(0);
16334 }
16335 EOCP
16336                 set try
16337                 if eval $compile_ok; then
16338                         if $run ./try 2>/dev/null; then
16339                                 echo "Yes, it can."
16340                                 val="$define"
16341                         else
16342                                 echo "It can't, sorry."
16343                         fi
16344                 else
16345                         echo "(I can't compile the test program, so we'll assume not...)"
16346                 fi
16347                 ;;
16348         esac
16349         $rm_try
16350         ;;
16351 esac
16352 set d_safemcpy
16353 eval $setvar
16354
16355 : can memcmp be trusted to compare relative magnitude?
16356 val="$undef"
16357 case "$d_memcmp" in
16358 "$define")
16359         echo " "
16360         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16361         $cat >try.c <<EOCP
16362 #$i_memory I_MEMORY
16363 #$i_stdlib I_STDLIB
16364 #$i_string I_STRING
16365 #$i_unistd I_UNISTD
16366 EOCP
16367         $cat >>try.c <<'EOCP'
16368 #include <stdio.h>
16369 #ifdef I_MEMORY
16370 #  include <memory.h>
16371 #endif
16372 #ifdef I_STDLIB
16373 #  include <stdlib.h>
16374 #endif
16375 #ifdef I_STRING
16376 #  include <string.h>
16377 #else
16378 #  include <strings.h>
16379 #endif
16380 #ifdef I_UNISTD
16381 #  include <unistd.h>  /* Needed for NetBSD */
16382 #endif
16383 int main()
16384 {
16385 char a = -1;
16386 char b = 0;
16387 if ((a < b) && memcmp(&a, &b, 1) < 0)
16388         exit(1);
16389 exit(0);
16390 }
16391 EOCP
16392         set try
16393         if eval $compile_ok; then
16394                 if $run ./try 2>/dev/null; then
16395                         echo "Yes, it can."
16396                         val="$define"
16397                 else
16398                         echo "No, it can't (it uses signed chars)."
16399                 fi
16400         else
16401                 echo "(I can't compile the test program, so we'll assume not...)"
16402         fi
16403         ;;
16404 esac
16405 $rm_try
16406 set d_sanemcmp
16407 eval $setvar
16408
16409 : see if prototype for sbrk is available
16410 echo " "
16411 set d_sbrkproto sbrk $i_unistd unistd.h
16412 eval $hasproto
16413
16414 : see if select exists
16415 set select d_select
16416 eval $inlibc
16417
16418 : see if semctl exists
16419 set semctl d_semctl
16420 eval $inlibc
16421
16422 : see if semget exists
16423 set semget d_semget
16424 eval $inlibc
16425
16426 : see if semop exists
16427 set semop d_semop
16428 eval $inlibc
16429
16430 : see how much of the 'sem*(2)' library is present.
16431 h_sem=true
16432 echo " "
16433 case "$d_semctl$d_semget$d_semop" in
16434 *"$undef"*) h_sem=false;;
16435 esac
16436 case "$osname" in
16437 freebsd)
16438     case "`ipcs 2>&1`" in
16439     "SVID messages"*"not configured"*)
16440         echo "Your $osname does not have the sem*(2) configured." >&4
16441         h_sem=false
16442         val="$undef"
16443         set semctl d_semctl
16444         eval $setvar
16445         set semget d_semget
16446         eval $setvar
16447         set semop d_semop
16448         eval $setvar
16449         ;;
16450     esac
16451     ;;
16452 esac
16453 : we could also check for sys/ipc.h ...
16454 if $h_sem && $test `./findhdr sys/sem.h`; then
16455         echo "You have the full sem*(2) library." >&4
16456         val="$define"
16457 else
16458         echo "You don't have the full sem*(2) library." >&4
16459         val="$undef"
16460 fi
16461 set d_sem
16462 eval $setvar
16463
16464 : see whether sys/sem.h defines union semun
16465 echo " "
16466 $cat > try.c <<'END'
16467 #include <sys/types.h>
16468 #include <sys/ipc.h>
16469 #include <sys/sem.h>
16470 int main () { union semun semun; semun.buf = 0; }
16471 END
16472 set try
16473 if eval $compile; then
16474     echo "You have union semun in <sys/sem.h>." >&4
16475     val="$define"
16476 else
16477     echo "You do not have union semun in <sys/sem.h>." >&4
16478     val="$undef"
16479 fi
16480 $rm_try
16481 set d_union_semun
16482 eval $setvar
16483
16484 : see how to do semctl IPC_STAT
16485 case "$d_sem" in
16486 $define)
16487     echo " "
16488     $cat > tryh.h <<END
16489 #ifndef S_IRUSR
16490 #   ifdef S_IREAD
16491 #       define S_IRUSR S_IREAD
16492 #       define S_IWUSR S_IWRITE
16493 #       define S_IXUSR S_IEXEC
16494 #   else
16495 #       define S_IRUSR 0400
16496 #       define S_IWUSR 0200
16497 #       define S_IXUSR 0100
16498 #   endif
16499 #   define S_IRGRP (S_IRUSR>>3)
16500 #   define S_IWGRP (S_IWUSR>>3)
16501 #   define S_IXGRP (S_IXUSR>>3)
16502 #   define S_IROTH (S_IRUSR>>6)
16503 #   define S_IWOTH (S_IWUSR>>6)
16504 #   define S_IXOTH (S_IXUSR>>6)
16505 #endif
16506 #ifndef S_IRWXU
16507 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16508 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16509 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16510 #endif
16511 END
16512     : see whether semctl IPC_STAT can use union semun
16513     case "$d_semctl_semun" in
16514     '')
16515       val="$undef"
16516       $cat > try.c <<END
16517 #include <sys/types.h>
16518 #include <sys/ipc.h>
16519 #include <sys/sem.h>
16520 #include <sys/stat.h>
16521 #include <stdio.h>
16522 #include <errno.h>
16523 #include "tryh.h"
16524 #ifndef errno
16525 extern int errno;
16526 #endif
16527 #$d_union_semun HAS_UNION_SEMUN
16528 int main() {
16529     union semun
16530 #ifndef HAS_UNION_SEMUN
16531     {
16532         int val;
16533         struct semid_ds *buf;
16534         unsigned short *array;
16535     }
16536 #endif
16537     arg;
16538     int sem, st;
16539
16540 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16541     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16542     if (sem > -1) {
16543         struct semid_ds argbuf;
16544         arg.buf = &argbuf;
16545 #       ifdef IPC_STAT
16546         st = semctl(sem, 0, IPC_STAT, arg);
16547         if (st == 0)
16548             printf("semun\n");
16549         else
16550 #       endif /* IPC_STAT */
16551             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16552 #       ifdef IPC_RMID
16553         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16554 #       endif /* IPC_RMID */
16555             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16556     } else
16557 #endif /* IPC_PRIVATE && ... */
16558         printf("semget failed: errno = %d\n", errno);
16559   return 0;
16560 }
16561 END
16562       set try
16563       if eval $compile; then
16564           xxx=`$run ./try`
16565           case "$xxx" in
16566           semun) val="$define" ;;
16567           esac
16568       fi
16569       $rm_try
16570       set d_semctl_semun
16571       eval $setvar
16572       ;;
16573     esac
16574     case "$d_semctl_semun" in
16575     $define)
16576         echo "You can use union semun for semctl IPC_STAT." >&4
16577         also='also'
16578         ;;
16579     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16580         also=''
16581         ;;
16582     esac
16583
16584     : see whether semctl IPC_STAT can use struct semid_ds pointer
16585     case "$d_semctl_semid_ds" in
16586     '')
16587       val="$undef"
16588       $cat > try.c <<'END'
16589 #include <sys/types.h>
16590 #include <sys/ipc.h>
16591 #include <sys/sem.h>
16592 #include <sys/stat.h>
16593 #include "tryh.h"
16594 #include <stdio.h>
16595 #include <errno.h>
16596 #ifndef errno
16597 extern int errno;
16598 #endif
16599 int main() {
16600     struct semid_ds arg;
16601     int sem, st;
16602
16603 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16604     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16605     if (sem > -1) {
16606 #       ifdef IPC_STAT
16607         st = semctl(sem, 0, IPC_STAT, &arg);
16608         if (st == 0)
16609             printf("semid_ds\n");
16610         else
16611 #       endif /* IPC_STAT */
16612             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16613 #       ifdef IPC_RMID
16614         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16615 #       endif /* IPC_RMID */
16616             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16617     } else
16618 #endif /* IPC_PRIVATE && ... */
16619         printf("semget failed: errno = %d\n", errno);
16620
16621     return 0;
16622 }
16623 END
16624       set try
16625       if eval $compile; then
16626           xxx=`$run ./try`
16627           case "$xxx" in
16628           semid_ds) val="$define" ;;
16629           esac
16630       fi
16631       $rm_try
16632       set d_semctl_semid_ds
16633       eval $setvar
16634       ;;
16635     esac
16636     case "$d_semctl_semid_ds" in
16637     $define)
16638         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16639         ;;
16640     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16641         ;;
16642     esac
16643     ;;
16644 *)  val="$undef"
16645
16646     # We do not have the full sem*(2) library, so assume we can not
16647     # use either.
16648
16649     set d_semctl_semun
16650     eval $setvar
16651
16652     set d_semctl_semid_ds
16653     eval $setvar
16654     ;;
16655 esac
16656 $rm_try tryh.h
16657
16658 : see if sendmsg exists
16659 set sendmsg d_sendmsg
16660 eval $inlibc
16661
16662 : see if setegid exists
16663 set setegid d_setegid
16664 eval $inlibc
16665
16666 : see if seteuid exists
16667 set seteuid d_seteuid
16668 eval $inlibc
16669
16670 : see if setgrent exists
16671 set setgrent d_setgrent
16672 eval $inlibc
16673
16674 : see if setgrent_r exists
16675 set setgrent_r d_setgrent_r
16676 eval $inlibc
16677 case "$d_setgrent_r" in
16678 "$define")
16679         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16680         case "$d_setgrent_r_proto:$usethreads" in
16681         ":define")      d_setgrent_r_proto=define
16682                 set d_setgrent_r_proto setgrent_r $hdrs
16683                 eval $hasproto ;;
16684         *)      ;;
16685         esac
16686         case "$d_setgrent_r_proto" in
16687         define)
16688         case "$setgrent_r_proto" in
16689         ''|0) try='int setgrent_r(FILE**);'
16690         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16691         esac
16692         case "$setgrent_r_proto" in
16693         ''|0) try='void setgrent_r(FILE**);'
16694         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16695         esac
16696         case "$setgrent_r_proto" in
16697         ''|0)   d_setgrent_r=undef
16698                 setgrent_r_proto=0
16699                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16700         * )     case "$setgrent_r_proto" in
16701                 REENTRANT_PROTO*) ;;
16702                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16703                 esac
16704                 echo "Prototype: $try" ;;
16705         esac
16706         ;;
16707         *)      case "$usethreads" in
16708                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16709                 esac
16710                 d_setgrent_r=undef
16711                 setgrent_r_proto=0
16712                 ;;
16713         esac
16714         ;;
16715 *)      setgrent_r_proto=0
16716         ;;
16717 esac
16718
16719 : see if sethostent exists
16720 set sethostent d_sethent
16721 eval $inlibc
16722
16723 : see if sethostent_r exists
16724 set sethostent_r d_sethostent_r
16725 eval $inlibc
16726 case "$d_sethostent_r" in
16727 "$define")
16728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16729         case "$d_sethostent_r_proto:$usethreads" in
16730         ":define")      d_sethostent_r_proto=define
16731                 set d_sethostent_r_proto sethostent_r $hdrs
16732                 eval $hasproto ;;
16733         *)      ;;
16734         esac
16735         case "$d_sethostent_r_proto" in
16736         define)
16737         case "$sethostent_r_proto" in
16738         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16739         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16740         esac
16741         case "$sethostent_r_proto" in
16742         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16743         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16744         esac
16745         case "$sethostent_r_proto" in
16746         ''|0)   d_sethostent_r=undef
16747                 sethostent_r_proto=0
16748                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16749         * )     case "$sethostent_r_proto" in
16750                 REENTRANT_PROTO*) ;;
16751                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16752                 esac
16753                 echo "Prototype: $try" ;;
16754         esac
16755         ;;
16756         *)      case "$usethreads" in
16757                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16758                 esac
16759                 d_sethostent_r=undef
16760                 sethostent_r_proto=0
16761                 ;;
16762         esac
16763         ;;
16764 *)      sethostent_r_proto=0
16765         ;;
16766 esac
16767
16768 : see if setitimer exists
16769 set setitimer d_setitimer
16770 eval $inlibc
16771
16772 : see if setlinebuf exists
16773 set setlinebuf d_setlinebuf
16774 eval $inlibc
16775
16776 : see if setlocale exists
16777 set setlocale d_setlocale
16778 eval $inlibc
16779
16780 : see if locale.h is available
16781 set locale.h i_locale
16782 eval $inhdr
16783
16784 : see if setlocale_r exists
16785 set setlocale_r d_setlocale_r
16786 eval $inlibc
16787 case "$d_setlocale_r" in
16788 "$define")
16789         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16790         case "$d_setlocale_r_proto:$usethreads" in
16791         ":define")      d_setlocale_r_proto=define
16792                 set d_setlocale_r_proto setlocale_r $hdrs
16793                 eval $hasproto ;;
16794         *)      ;;
16795         esac
16796         case "$d_setlocale_r_proto" in
16797         define)
16798         case "$setlocale_r_proto" in
16799         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16800         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16801         esac
16802         case "$setlocale_r_proto" in
16803         ''|0)   d_setlocale_r=undef
16804                 setlocale_r_proto=0
16805                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16806         * )     case "$setlocale_r_proto" in
16807                 REENTRANT_PROTO*) ;;
16808                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16809                 esac
16810                 echo "Prototype: $try" ;;
16811         esac
16812         ;;
16813         *)      case "$usethreads" in
16814                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16815                 esac
16816                 d_setlocale_r=undef
16817                 setlocale_r_proto=0
16818                 ;;
16819         esac
16820         ;;
16821 *)      setlocale_r_proto=0
16822         ;;
16823 esac
16824
16825 : see if setnetent exists
16826 set setnetent d_setnent
16827 eval $inlibc
16828
16829 : see if setnetent_r exists
16830 set setnetent_r d_setnetent_r
16831 eval $inlibc
16832 case "$d_setnetent_r" in
16833 "$define")
16834         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16835         case "$d_setnetent_r_proto:$usethreads" in
16836         ":define")      d_setnetent_r_proto=define
16837                 set d_setnetent_r_proto setnetent_r $hdrs
16838                 eval $hasproto ;;
16839         *)      ;;
16840         esac
16841         case "$d_setnetent_r_proto" in
16842         define)
16843         case "$setnetent_r_proto" in
16844         ''|0) try='int setnetent_r(int, struct netent_data*);'
16845         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16846         esac
16847         case "$setnetent_r_proto" in
16848         ''|0) try='void setnetent_r(int, struct netent_data*);'
16849         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16850         esac
16851         case "$setnetent_r_proto" in
16852         ''|0)   d_setnetent_r=undef
16853                 setnetent_r_proto=0
16854                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16855         * )     case "$setnetent_r_proto" in
16856                 REENTRANT_PROTO*) ;;
16857                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16858                 esac
16859                 echo "Prototype: $try" ;;
16860         esac
16861         ;;
16862         *)      case "$usethreads" in
16863                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16864                 esac
16865                 d_setnetent_r=undef
16866                 setnetent_r_proto=0
16867                 ;;
16868         esac
16869         ;;
16870 *)      setnetent_r_proto=0
16871         ;;
16872 esac
16873
16874 : see if setprotoent exists
16875 set setprotoent d_setpent
16876 eval $inlibc
16877
16878 : see if setpgid exists
16879 set setpgid d_setpgid
16880 eval $inlibc
16881
16882 : see if setpgrp2 exists
16883 set setpgrp2 d_setpgrp2
16884 eval $inlibc
16885
16886 : see if setpriority exists
16887 set setpriority d_setprior
16888 eval $inlibc
16889
16890 : see if setproctitle exists
16891 set setproctitle d_setproctitle
16892 eval $inlibc
16893
16894 : see if setprotoent_r exists
16895 set setprotoent_r d_setprotoent_r
16896 eval $inlibc
16897 case "$d_setprotoent_r" in
16898 "$define")
16899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16900         case "$d_setprotoent_r_proto:$usethreads" in
16901         ":define")      d_setprotoent_r_proto=define
16902                 set d_setprotoent_r_proto setprotoent_r $hdrs
16903                 eval $hasproto ;;
16904         *)      ;;
16905         esac
16906         case "$d_setprotoent_r_proto" in
16907         define)
16908         case "$setprotoent_r_proto" in
16909         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16910         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16911         esac
16912         case "$setprotoent_r_proto" in
16913         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16914         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16915         esac
16916         case "$setprotoent_r_proto" in
16917         ''|0)   d_setprotoent_r=undef
16918                 setprotoent_r_proto=0
16919                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16920         * )     case "$setprotoent_r_proto" in
16921                 REENTRANT_PROTO*) ;;
16922                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16923                 esac
16924                 echo "Prototype: $try" ;;
16925         esac
16926         ;;
16927         *)      case "$usethreads" in
16928                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16929                 esac
16930                 d_setprotoent_r=undef
16931                 setprotoent_r_proto=0
16932                 ;;
16933         esac
16934         ;;
16935 *)      setprotoent_r_proto=0
16936         ;;
16937 esac
16938
16939 : see if setpwent exists
16940 set setpwent d_setpwent
16941 eval $inlibc
16942
16943 : see if setpwent_r exists
16944 set setpwent_r d_setpwent_r
16945 eval $inlibc
16946 case "$d_setpwent_r" in
16947 "$define")
16948         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16949         case "$d_setpwent_r_proto:$usethreads" in
16950         ":define")      d_setpwent_r_proto=define
16951                 set d_setpwent_r_proto setpwent_r $hdrs
16952                 eval $hasproto ;;
16953         *)      ;;
16954         esac
16955         case "$d_setpwent_r_proto" in
16956         define)
16957         case "$setpwent_r_proto" in
16958         ''|0) try='int setpwent_r(FILE**);'
16959         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16960         esac
16961         case "$setpwent_r_proto" in
16962         ''|0) try='void setpwent_r(FILE**);'
16963         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16964         esac
16965         case "$setpwent_r_proto" in
16966         ''|0)   d_setpwent_r=undef
16967                 setpwent_r_proto=0
16968                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16969         * )     case "$setpwent_r_proto" in
16970                 REENTRANT_PROTO*) ;;
16971                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16972                 esac
16973                 echo "Prototype: $try" ;;
16974         esac
16975         ;;
16976         *)      case "$usethreads" in
16977                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16978                 esac
16979                 d_setpwent_r=undef
16980                 setpwent_r_proto=0
16981                 ;;
16982         esac
16983         ;;
16984 *)      setpwent_r_proto=0
16985         ;;
16986 esac
16987
16988 : see if setregid exists
16989 set setregid d_setregid
16990 eval $inlibc
16991 set setresgid d_setresgid
16992 eval $inlibc
16993
16994 : see if setreuid exists
16995 set setreuid d_setreuid
16996 eval $inlibc
16997 set setresuid d_setresuid
16998 eval $inlibc
16999
17000 : see if setrgid exists
17001 set setrgid d_setrgid
17002 eval $inlibc
17003
17004 : see if setruid exists
17005 set setruid d_setruid
17006 eval $inlibc
17007
17008 : see if setservent exists
17009 set setservent d_setsent
17010 eval $inlibc
17011
17012 : see if setservent_r exists
17013 set setservent_r d_setservent_r
17014 eval $inlibc
17015 case "$d_setservent_r" in
17016 "$define")
17017         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17018         case "$d_setservent_r_proto:$usethreads" in
17019         ":define")      d_setservent_r_proto=define
17020                 set d_setservent_r_proto setservent_r $hdrs
17021                 eval $hasproto ;;
17022         *)      ;;
17023         esac
17024         case "$d_setservent_r_proto" in
17025         define)
17026         case "$setservent_r_proto" in
17027         ''|0) try='int setservent_r(int, struct servent_data*);'
17028         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17029         esac
17030         case "$setservent_r_proto" in
17031         ''|0) try='void setservent_r(int, struct servent_data*);'
17032         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17033         esac
17034         case "$setservent_r_proto" in
17035         ''|0)   d_setservent_r=undef
17036                 setservent_r_proto=0
17037                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17038         * )     case "$setservent_r_proto" in
17039                 REENTRANT_PROTO*) ;;
17040                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17041                 esac
17042                 echo "Prototype: $try" ;;
17043         esac
17044         ;;
17045         *)      case "$usethreads" in
17046                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17047                 esac
17048                 d_setservent_r=undef
17049                 setservent_r_proto=0
17050                 ;;
17051         esac
17052         ;;
17053 *)      setservent_r_proto=0
17054         ;;
17055 esac
17056
17057 : see if setsid exists
17058 set setsid d_setsid
17059 eval $inlibc
17060
17061 : see if setvbuf exists
17062 set setvbuf d_setvbuf
17063 eval $inlibc
17064
17065 : see if sfio.h is available
17066 set sfio.h i_sfio
17067 eval $inhdr
17068
17069 : see if sfio library is available
17070 case "$i_sfio" in
17071 $define)
17072         val=''
17073         set sfreserve val
17074         eval $inlibc
17075         ;;
17076 *)
17077         val="$undef"
17078         ;;
17079 esac
17080 : Ok, but do we want to use it.
17081 case "$val" in
17082 $define)
17083         case "$usesfio" in
17084         true|$define|[yY]*) dflt='y';;
17085         *) dflt='n';;
17086         esac
17087         echo "$package can use the sfio library, but it is experimental."
17088         case "$useperlio" in
17089         "$undef")
17090             echo "For sfio also the PerlIO abstraction layer is needed."
17091             echo "Earlier you said you wouldn't want that."
17092             ;;
17093         esac
17094         rp="You seem to have sfio available, do you want to try using it?"
17095         . ./myread
17096         case "$ans" in
17097         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17098                 useperlio="$define"
17099                 val="$define"
17100                 ;;
17101         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17102                 val="$undef"
17103                 ;;
17104         esac
17105         ;;
17106 *)      case "$usesfio" in
17107         true|$define|[yY]*)
17108                 echo "Sorry, cannot find sfio on this machine." >&4
17109                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17110                 val="$undef"
17111                 ;;
17112         esac
17113         ;;
17114 esac
17115 set d_sfio
17116 eval $setvar
17117 case "$d_sfio" in
17118 $define) usesfio='true';;
17119 *) usesfio='false';;
17120 esac
17121 case "$d_sfio" in
17122 $define) ;;
17123 *)      : Remove sfio from list of libraries to use
17124         case "$libs" in
17125         *-lsfio*)
17126                 echo "Removing unneeded -lsfio from library list" >&4
17127                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17128                 shift
17129                 libs="$*"
17130                 echo "libs = $libs" >&4
17131                 ;;
17132         esac
17133 ;;
17134 esac
17135
17136
17137 : see if shmctl exists
17138 set shmctl d_shmctl
17139 eval $inlibc
17140
17141 : see if shmget exists
17142 set shmget d_shmget
17143 eval $inlibc
17144
17145 : see if shmat exists
17146 set shmat d_shmat
17147 eval $inlibc
17148 : see what shmat returns
17149 case "$d_shmat" in
17150 "$define")
17151         $cat >shmat.c <<'END'
17152 #include <sys/shm.h>
17153 void *shmat();
17154 END
17155         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17156                 shmattype='void *'
17157         else
17158                 shmattype='char *'
17159         fi
17160         echo "and it returns ($shmattype)." >&4
17161         : see if a prototype for shmat is available
17162         xxx=`./findhdr sys/shm.h`
17163         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17164         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17165                 val="$define"
17166         else
17167                 val="$undef"
17168         fi
17169         $rm -f shmat.[co]
17170         ;;
17171 *)
17172         val="$undef"
17173         ;;
17174 esac
17175 set d_shmatprototype
17176 eval $setvar
17177
17178 : see if shmdt exists
17179 set shmdt d_shmdt
17180 eval $inlibc
17181
17182 : see how much of the 'shm*(2)' library is present.
17183 h_shm=true
17184 echo " "
17185 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17186 *"$undef"*) h_shm=false;;
17187 esac
17188 case "$osname" in
17189 freebsd)
17190     case "`ipcs 2>&1`" in
17191     "SVID shared memory"*"not configured"*)
17192         echo "Your $osname does not have the shm*(2) configured." >&4
17193         h_shm=false
17194         val="$undef"
17195         set shmctl d_shmctl
17196         evat $setvar
17197         set shmget d_shmget
17198         evat $setvar
17199         set shmat d_shmat
17200         evat $setvar
17201         set shmdt d_shmdt
17202         evat $setvar
17203         ;;
17204     esac
17205     ;;
17206 esac
17207 : we could also check for sys/ipc.h ...
17208 if $h_shm && $test `./findhdr sys/shm.h`; then
17209         echo "You have the full shm*(2) library." >&4
17210         val="$define"
17211 else
17212         echo "You don't have the full shm*(2) library." >&4
17213         val="$undef"
17214 fi
17215 set d_shm
17216 eval $setvar
17217
17218 : see if we have sigaction
17219 echo " "
17220 if set sigaction val -f d_sigaction; eval $csym; $val; then
17221         echo 'sigaction() found.' >&4
17222         $cat > try.c <<EOP
17223 #include <stdio.h>
17224 #include <sys/types.h>
17225 #include <signal.h>
17226 #$i_stdlib I_STDLIB
17227 #ifdef I_STDLIB
17228 #include <stdlib.h>
17229 #endif
17230 int main()
17231 {
17232     struct sigaction act, oact;
17233     act.sa_flags = 0;
17234     oact.sa_handler = 0;
17235     /* so that act and oact are used */
17236     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17237 }
17238 EOP
17239         set try
17240         if eval $compile_ok; then
17241                 val="$define"
17242         else
17243                 echo "But you don't seem to have a useable struct sigaction." >&4
17244                 val="$undef"
17245         fi
17246 else
17247         echo 'sigaction NOT found.' >&4
17248         val="$undef"
17249 fi
17250 set d_sigaction; eval $setvar
17251 $rm_try
17252
17253 : see if this is a sunmath.h system
17254 set sunmath.h i_sunmath
17255 eval $inhdr
17256
17257 : see if signbit exists
17258 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17259 $cat >try.c <<EOCP
17260 #$i_math I_MATH
17261 #$i_sunmath I_SUNMATH
17262 #ifdef I_MATH
17263 #  include <math.h>
17264 #endif
17265 #ifdef I_SUNMATH  /* Solaris special math library */
17266 #  include <sunmath.h>
17267 #endif
17268 #define NV $nvtype
17269 int main(int argc, char **argv)
17270 {
17271     NV x = 0.0;
17272     NV y = -0.0;
17273     if ((signbit(x) == 0) && (signbit(y) != 0))
17274         return 0;
17275     else
17276         return 1;
17277 }
17278 EOCP
17279 val="$undef"
17280 set try
17281 if eval $compile; then
17282     if $run ./try; then
17283         $echo "Yes." >&4
17284         val="$define"
17285     else
17286         $echo "Signbit seems to be available, but doesn't work as I expected."
17287         $echo "I won't use it." >&4
17288         val="$undef"
17289     fi
17290 else
17291     $echo "Nope." >&4
17292     dflt="$undef"
17293 fi
17294 set d_signbit
17295 eval $setvar
17296 $rm_try
17297
17298 : see if sigprocmask exists
17299 set sigprocmask d_sigprocmask
17300 eval $inlibc
17301
17302 : see if sigsetjmp exists
17303 echo " "
17304 case "$d_sigsetjmp" in
17305 '')
17306         $cat >try.c <<EOP
17307 #include <setjmp.h>
17308 #$i_stdlib I_STDLIB
17309 #ifdef I_STDLIB
17310 #include <stdlib.h>
17311 #endif
17312 sigjmp_buf env;
17313 int set = 1;
17314 int main()
17315 {
17316         if (sigsetjmp(env,1))
17317                 exit(set);
17318         set = 0;
17319         siglongjmp(env, 1);
17320         exit(1);
17321 }
17322 EOP
17323         set try
17324         if eval $compile; then
17325                 if $run ./try >/dev/null 2>&1; then
17326                         echo "POSIX sigsetjmp found." >&4
17327                         val="$define"
17328                 else
17329                         $cat >&4 <<EOM
17330 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17331 I'll ignore them.
17332 EOM
17333                         val="$undef"
17334                 fi
17335         else
17336                 echo "sigsetjmp not found." >&4
17337                 val="$undef"
17338         fi
17339         ;;
17340 *) val="$d_sigsetjmp"
17341         case "$d_sigsetjmp" in
17342         $define) echo "POSIX sigsetjmp found." >&4;;
17343         $undef) echo "sigsetjmp not found." >&4;;
17344         esac
17345         ;;
17346 esac
17347 set d_sigsetjmp
17348 eval $setvar
17349 $rm_try
17350
17351 : see if snprintf exists
17352 set snprintf d_snprintf
17353 eval $inlibc
17354
17355 : see if vsnprintf exists
17356 set vsnprintf d_vsnprintf
17357 eval $inlibc
17358
17359 case "$d_snprintf-$d_vsnprintf" in
17360 "$define-$define")
17361     $cat <<EOM
17362 Checking whether your snprintf() and vsnprintf() work okay...
17363 EOM
17364     $cat >try.c <<'EOCP'
17365 /* v?snprintf testing logic courtesy of Russ Allbery.
17366  * According to C99:
17367  * - if the buffer is too short it still must be \0-terminated
17368  * - if the buffer is too short the potentially required length
17369  *   must be returned and not -1
17370  * - if the buffer is NULL the potentially required length
17371  *   must be returned and not -1 or core dump
17372  */
17373 #include <stdio.h>
17374 #include <stdarg.h>
17375
17376 char buf[2];
17377
17378 int test (char *format, ...)
17379 {
17380     va_list args;
17381     int count;
17382
17383     va_start (args, format);
17384     count = vsnprintf (buf, sizeof buf, format, args);
17385     va_end (args);
17386     return count;
17387 }
17388
17389 int main ()
17390 {
17391     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17392              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17393 }
17394 EOCP
17395     set try
17396     if eval $compile; then
17397         `$run ./try`
17398         case "$?" in
17399         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17400         *) cat <<EOM >&4
17401 Your snprintf() and snprintf() don't seem to be working okay.
17402 EOM
17403            d_snprintf="$undef"
17404            d_vsnprintf="$undef"
17405            ;;
17406         esac
17407     else
17408         echo "(I can't seem to compile the test program--assuming they don't)"
17409         d_snprintf="$undef"
17410         d_vsnprintf="$undef"
17411     fi
17412     $rm_try
17413     ;;
17414 esac
17415
17416 : see if sockatmark exists
17417 set sockatmark d_sockatmark
17418 eval $inlibc
17419
17420 : see if prototype for sockatmark is available
17421 echo " "
17422 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17423 eval $hasproto
17424
17425 : see if socks5_init exists
17426 set socks5_init d_socks5_init
17427 eval $inlibc
17428
17429 : see if sprintf returns the length of the string in the buffer as per ANSI
17430 $echo "Checking whether sprintf returns the length of the string..." >&4
17431 $cat <<EOP >try.c
17432 #include <stdio.h>
17433 #$i_stdlib I_STDLIB
17434 #ifdef I_STDLIB
17435 #include <stdlib.h>
17436 #endif
17437 #$i_string I_STRING
17438 #ifdef I_STRING
17439 #  include <string.h>
17440 #else
17441 #  include <strings.h>
17442 #endif
17443 #$i_math I_MATH
17444 #ifdef I_MATH
17445 #include <math.h>
17446 #endif
17447
17448 char buffer[256];
17449
17450 int check (size_t expect, int test) {
17451   size_t got = strlen(buffer);
17452   if (expect == got)
17453     return 0;
17454
17455   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17456        test, buffer);
17457   exit (test);
17458 }
17459
17460 int main(int argc, char **argv) {
17461   int test = 0;
17462
17463   check(sprintf(buffer, ""), ++test);
17464   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17465   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17466
17467   return 0;
17468 }
17469 EOP
17470 set try
17471
17472 if eval $compile; then
17473     xxx="`$run ./try`"
17474     case "$?" in
17475         0) cat >&4 <<EOM
17476 sprintf returns the length of the string (as ANSI says it should)
17477 EOM
17478         d_sprintf_returns_strlen="$define"
17479         ;;
17480         *) cat >&4 <<EOM
17481 sprintf does not return the length of the string (how old is this system?)
17482 EOM
17483         d_sprintf_returns_strlen="$undef"
17484         ;;
17485     esac
17486 else
17487     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17488     d_sprintf_returns_strlen="$undef"
17489 fi
17490 $rm_try
17491
17492 : see if srand48_r exists
17493 set srand48_r d_srand48_r
17494 eval $inlibc
17495 case "$d_srand48_r" in
17496 "$define")
17497         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17498         case "$d_srand48_r_proto:$usethreads" in
17499         ":define")      d_srand48_r_proto=define
17500                 set d_srand48_r_proto srand48_r $hdrs
17501                 eval $hasproto ;;
17502         *)      ;;
17503         esac
17504         case "$d_srand48_r_proto" in
17505         define)
17506         case "$srand48_r_proto" in
17507         ''|0) try='int srand48_r(long, struct drand48_data*);'
17508         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17509         esac
17510         case "$srand48_r_proto" in
17511         ''|0)   d_srand48_r=undef
17512                 srand48_r_proto=0
17513                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17514         * )     case "$srand48_r_proto" in
17515                 REENTRANT_PROTO*) ;;
17516                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17517                 esac
17518                 echo "Prototype: $try" ;;
17519         esac
17520         ;;
17521         *)      case "$usethreads" in
17522                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17523                 esac
17524                 d_srand48_r=undef
17525                 srand48_r_proto=0
17526                 ;;
17527         esac
17528         ;;
17529 *)      srand48_r_proto=0
17530         ;;
17531 esac
17532
17533 : see if srandom_r exists
17534 set srandom_r d_srandom_r
17535 eval $inlibc
17536 case "$d_srandom_r" in
17537 "$define")
17538         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17539         case "$d_srandom_r_proto:$usethreads" in
17540         ":define")      d_srandom_r_proto=define
17541                 set d_srandom_r_proto srandom_r $hdrs
17542                 eval $hasproto ;;
17543         *)      ;;
17544         esac
17545         case "$d_srandom_r_proto" in
17546         define)
17547         case "$srandom_r_proto" in
17548         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17549         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17550         esac
17551         case "$srandom_r_proto" in
17552         ''|0)   d_srandom_r=undef
17553                 srandom_r_proto=0
17554                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17555         * )     case "$srandom_r_proto" in
17556                 REENTRANT_PROTO*) ;;
17557                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17558                 esac
17559                 echo "Prototype: $try" ;;
17560         esac
17561         ;;
17562         *)      case "$usethreads" in
17563                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17564                 esac
17565                 d_srandom_r=undef
17566                 srandom_r_proto=0
17567                 ;;
17568         esac
17569         ;;
17570 *)      srandom_r_proto=0
17571         ;;
17572 esac
17573
17574 : see if prototype for setresgid is available
17575 echo " "
17576 set d_sresgproto setresgid $i_unistd unistd.h
17577 eval $hasproto
17578
17579 : see if prototype for setresuid is available
17580 echo " "
17581 set d_sresuproto setresuid $i_unistd unistd.h
17582 eval $hasproto
17583
17584 : see if sys/stat.h is available
17585 set sys/stat.h i_sysstat
17586 eval $inhdr
17587
17588 : see if stat knows about block sizes
17589 echo " "
17590 echo "Checking to see if your struct stat has st_blocks field..." >&4
17591 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17592 eval $hasfield
17593
17594 : see if this is a sys/vfs.h system
17595 set sys/vfs.h i_sysvfs
17596 eval $inhdr
17597
17598 : see if this is a sys/statfs.h system
17599 set sys/statfs.h i_sysstatfs
17600 eval $inhdr
17601
17602 : Check for statfs_s
17603 echo " "
17604 echo "Checking to see if your system supports struct statfs..." >&4
17605 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
17606 eval $hasstruct
17607 case "$d_statfs_s" in
17608 "$define")      echo "Yes, it does."   ;;
17609 *)              echo "No, it doesn't." ;;
17610 esac
17611
17612
17613 : see if struct statfs knows about f_flags
17614 case "$d_statfs_s" in
17615 define)
17616         echo " "
17617         echo "Checking to see if your struct statfs has f_flags field..." >&4
17618         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
17619         eval $hasfield
17620         ;;
17621 *)      val="$undef"
17622         set d_statfs_f_flags
17623         eval $setvar
17624         ;;
17625 esac
17626 case "$d_statfs_f_flags" in
17627 "$define")      echo "Yes, it does."   ;;
17628 *)              echo "No, it doesn't." ;;
17629 esac
17630
17631 : Check stream access
17632 $cat >&4 <<EOM
17633 Checking how to access stdio streams by file descriptor number...
17634 EOM
17635 case "$stdio_stream_array" in
17636 '')     $cat >try.c <<EOCP
17637 #include <stdio.h>
17638 int main() {
17639   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17640     printf("yes\n");
17641 }
17642 EOCP
17643         for s in _iob __iob __sF
17644         do
17645                 set try -DSTDIO_STREAM_ARRAY=$s
17646                 if eval $compile; then
17647                         case "`$run ./try`" in
17648                         yes)    stdio_stream_array=$s; break ;;
17649                         esac
17650                 fi
17651         done
17652         $rm_try
17653 esac
17654 case "$stdio_stream_array" in
17655 '')     $cat >&4 <<EOM
17656 I can't figure out how to access stdio streams by file descriptor number.
17657 EOM
17658         d_stdio_stream_array="$undef"
17659         ;;
17660 *)      $cat >&4 <<EOM
17661 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17662 EOM
17663         d_stdio_stream_array="$define"
17664         ;;
17665 esac
17666
17667 : see if strcoll exists
17668 set strcoll d_strcoll
17669 eval $inlibc
17670
17671 : check for structure copying
17672 echo " "
17673 echo "Checking to see if your C compiler can copy structs..." >&4
17674 $cat >try.c <<'EOCP'
17675 int main()
17676 {
17677         struct blurfl {
17678                 int dyick;
17679         } foo, bar;
17680
17681         foo = bar;
17682 }
17683 EOCP
17684 if $cc -c try.c >/dev/null 2>&1 ; then
17685         val="$define"
17686         echo "Yup, it can."
17687 else
17688         val="$undef"
17689         echo "Nope, it can't."
17690 fi
17691 set d_strctcpy
17692 eval $setvar
17693 $rm_try
17694
17695 : see if strerror and/or sys_errlist[] exist
17696 echo " "
17697 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17698     if set strerror val -f d_strerror; eval $csym; $val; then
17699                 echo 'strerror() found.' >&4
17700                 d_strerror="$define"
17701                 d_strerrm='strerror(e)'
17702                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17703                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17704                         d_syserrlst="$define"
17705                 else
17706                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17707                         d_syserrlst="$undef"
17708                 fi
17709     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17710                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17711                 echo 'strerror() found in string header.' >&4
17712                 d_strerror="$define"
17713                 d_strerrm='strerror(e)'
17714                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17715                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17716                                 d_syserrlst="$define"
17717                 else
17718                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17719                         d_syserrlst="$undef"
17720                 fi
17721     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17722                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17723                 d_strerror="$undef"
17724                 d_syserrlst="$define"
17725                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17726     else
17727                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17728                 d_strerror="$undef"
17729                 d_syserrlst="$undef"
17730                 d_strerrm='"unknown"'
17731     fi
17732 fi
17733
17734 : see if strerror_r exists
17735 set strerror_r d_strerror_r
17736 eval $inlibc
17737 case "$d_strerror_r" in
17738 "$define")
17739         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17740         case "$d_strerror_r_proto:$usethreads" in
17741         ":define")      d_strerror_r_proto=define
17742                 set d_strerror_r_proto strerror_r $hdrs
17743                 eval $hasproto ;;
17744         *)      ;;
17745         esac
17746         case "$d_strerror_r_proto" in
17747         define)
17748         case "$strerror_r_proto" in
17749         ''|0) try='int strerror_r(int, char*, size_t);'
17750         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17751         esac
17752         case "$strerror_r_proto" in
17753         ''|0) try='int strerror_r(int, char*, int);'
17754         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17755         esac
17756         case "$strerror_r_proto" in
17757         ''|0) try='char* strerror_r(int, char*, size_t);'
17758         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17759         esac
17760         case "$strerror_r_proto" in
17761         ''|0)   d_strerror_r=undef
17762                 strerror_r_proto=0
17763                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17764         * )     case "$strerror_r_proto" in
17765                 REENTRANT_PROTO*) ;;
17766                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17767                 esac
17768                 echo "Prototype: $try" ;;
17769         esac
17770         ;;
17771         *)      case "$usethreads" in
17772                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17773                 esac
17774                 d_strerror_r=undef
17775                 strerror_r_proto=0
17776                 ;;
17777         esac
17778         ;;
17779 *)      strerror_r_proto=0
17780         ;;
17781 esac
17782
17783 : see if strftime exists
17784 set strftime d_strftime
17785 eval $inlibc
17786
17787 : see if strlcat exists
17788 set strlcat d_strlcat
17789 eval $inlibc
17790
17791 : see if strlcpy exists
17792 set strlcpy d_strlcpy
17793 eval $inlibc
17794
17795 : see if strtod exists
17796 set strtod d_strtod
17797 eval $inlibc
17798
17799 : see if strtol exists
17800 set strtol d_strtol
17801 eval $inlibc
17802
17803 : see if strtold exists
17804 set strtold d_strtold
17805 eval $inlibc
17806
17807 : see if strtoll exists
17808 set strtoll d_strtoll
17809 eval $inlibc
17810
17811 case "$d_longlong-$d_strtoll" in
17812 "$define-$define")
17813         $cat <<EOM
17814 Checking whether your strtoll() works okay...
17815 EOM
17816         $cat >try.c <<'EOCP'
17817 #include <errno.h>
17818 #ifdef __hpux
17819 #define strtoll __strtoll
17820 #endif
17821 #ifdef __EMX__
17822 #define strtoll _strtoll
17823 #endif
17824 #include <stdio.h>
17825 extern long long int strtoll(char *s, char **, int);
17826 static int bad = 0;
17827 int check(char *s, long long ell, int een) {
17828         long long gll;
17829         errno = 0;
17830         gll = strtoll(s, 0, 10);
17831         if (!((gll == ell) && (errno == een)))
17832                 bad++;
17833 }
17834 int main() {
17835         check(" 1",                                      1LL, 0);
17836         check(" 0",                                      0LL, 0);
17837         check("-1",                                     -1LL, 0);
17838         check("-9223372036854775808", -9223372036854775808LL, 0);
17839         check("-9223372036854775808", -9223372036854775808LL, 0);
17840         check(" 9223372036854775807",  9223372036854775807LL, 0);
17841         check("-9223372036854775808", -9223372036854775808LL, 0);
17842         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17843         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17844         if (!bad)
17845                 printf("ok\n");
17846 }
17847 EOCP
17848         set try
17849         if eval $compile; then
17850                 yyy=`$run ./try`
17851                 case "$yyy" in
17852                 ok) echo "Your strtoll() seems to be working okay." ;;
17853                 *) cat <<EOM >&4
17854 Your strtoll() doesn't seem to be working okay.
17855 EOM
17856                    d_strtoll="$undef"
17857                    ;;
17858                 esac
17859         else
17860                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17861                 d_strtoll="$undef"
17862         fi
17863         ;;
17864 esac
17865
17866 : see if strtoq exists
17867 set strtoq d_strtoq
17868 eval $inlibc
17869
17870 : see if strtoul exists
17871 set strtoul d_strtoul
17872 eval $inlibc
17873
17874 case "$d_strtoul" in
17875 "$define")
17876         $cat <<EOM
17877 Checking whether your strtoul() works okay...
17878 EOM
17879         $cat >try.c <<'EOCP'
17880 #include <errno.h>
17881 #include <stdio.h>
17882 extern unsigned long int strtoul(char *s, char **, int);
17883 static int bad = 0;
17884 void check(char *s, unsigned long eul, int een) {
17885         unsigned long gul;
17886         errno = 0;
17887         gul = strtoul(s, 0, 10);
17888         if (!((gul == eul) && (errno == een)))
17889                 bad++;
17890 }
17891 int main() {
17892         check(" 1", 1L, 0);
17893         check(" 0", 0L, 0);
17894 EOCP
17895         case "$longsize" in
17896         8)
17897             $cat >>try.c <<'EOCP'
17898         check("18446744073709551615", 18446744073709551615UL, 0);
17899         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17900 #if 0 /* strtoul() for /^-/ strings is undefined. */
17901         check("-1", 18446744073709551615UL, 0);
17902         check("-18446744073709551614", 2, 0);
17903         check("-18446744073709551615", 1, 0);
17904         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17905         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17906 #endif
17907 EOCP
17908                 ;;
17909         4)
17910                     $cat >>try.c <<'EOCP'
17911         check("4294967295", 4294967295UL, 0);
17912         check("4294967296", 4294967295UL, ERANGE);
17913 #if 0 /* strtoul() for /^-/ strings is undefined. */
17914         check("-1", 4294967295UL, 0);
17915         check("-4294967294", 2, 0);
17916         check("-4294967295", 1, 0);
17917         check("-4294967296", 4294967295UL, ERANGE);
17918         check("-4294967297", 4294967295UL, ERANGE);
17919 #endif
17920 EOCP
17921                 ;;
17922         *)
17923 : Should we write these tests to be more portable by sprintf-ing
17924 : ~0 and then manipulating that char string as input for strtol?
17925                 ;;
17926         esac
17927         $cat >>try.c <<'EOCP'
17928         if (!bad)
17929                 printf("ok\n");
17930         return 0;
17931 }
17932 EOCP
17933         set try
17934         if eval $compile; then
17935                 case "`$run ./try`" in
17936                 ok) echo "Your strtoul() seems to be working okay." ;;
17937                 *) cat <<EOM >&4
17938 Your strtoul() doesn't seem to be working okay.
17939 EOM
17940                    d_strtoul="$undef"
17941                    ;;
17942                 esac
17943         else
17944                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17945                 d_strtoul="$undef"
17946         fi
17947         ;;
17948 esac
17949
17950 : see if strtoull exists
17951 set strtoull d_strtoull
17952 eval $inlibc
17953
17954 case "$d_longlong-$d_strtoull" in
17955 "$define-$define")
17956         $cat <<EOM
17957 Checking whether your strtoull() works okay...
17958 EOM
17959         $cat >try.c <<'EOCP'
17960 #include <errno.h>
17961 #ifdef __hpux
17962 #define strtoull __strtoull
17963 #endif
17964 #include <stdio.h>
17965 extern unsigned long long int strtoull(char *s, char **, int);
17966 static int bad = 0;
17967 int check(char *s, long long eull, int een) {
17968         long long gull;
17969         errno = 0;
17970         gull = strtoull(s, 0, 10);
17971         if (!((gull == eull) && (errno == een)))
17972                 bad++;
17973 }
17974 int main() {
17975         check(" 1",                                        1LL, 0);
17976         check(" 0",                                        0LL, 0);
17977         check("18446744073709551615",  18446744073709551615ULL, 0);
17978         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17979 #if 0 /* strtoull() for /^-/ strings is undefined. */
17980         check("-1",                    18446744073709551615ULL, 0);
17981         check("-18446744073709551614",                     2LL, 0);
17982         check("-18446744073709551615",                     1LL, 0);
17983         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17984         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17985 #endif
17986         if (!bad)
17987                 printf("ok\n");
17988 }
17989 EOCP
17990         set try
17991         if eval $compile; then
17992                 case "`$run ./try`" in
17993                 ok) echo "Your strtoull() seems to be working okay." ;;
17994                 *) cat <<EOM >&4
17995 Your strtoull() doesn't seem to be working okay.
17996 EOM
17997                    d_strtoull="$undef"
17998                    ;;
17999                 esac
18000         else
18001                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18002                 d_strtoull="$undef"
18003         fi
18004         ;;
18005 esac
18006
18007 : see if strtouq exists
18008 set strtouq d_strtouq
18009 eval $inlibc
18010
18011 case "$d_strtouq" in
18012 "$define")
18013         $cat <<EOM
18014 Checking whether your strtouq() works okay...
18015 EOM
18016         $cat >try.c <<'EOCP'
18017 #include <errno.h>
18018 #include <stdio.h>
18019 extern unsigned long long int strtouq(char *s, char **, int);
18020 static int bad = 0;
18021 void check(char *s, unsigned long long eull, int een) {
18022         unsigned long long gull;
18023         errno = 0;
18024         gull = strtouq(s, 0, 10);
18025         if (!((gull == eull) && (errno == een)))
18026                 bad++;
18027 }
18028 int main() {
18029         check(" 1",                                        1LL, 0);
18030         check(" 0",                                        0LL, 0);
18031         check("18446744073709551615",  18446744073709551615ULL, 0);
18032         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18033 #if 0 /* strtouq() for /^-/ strings is undefined. */
18034         check("-1",                    18446744073709551615ULL, 0);
18035         check("-18446744073709551614",                     2LL, 0);
18036         check("-18446744073709551615",                     1LL, 0);
18037         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18038         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18039 #endif
18040         if (!bad)
18041                 printf("ok\n");
18042         return 0;
18043 }
18044 EOCP
18045         set try
18046         if eval $compile; then
18047                 case "`$run ./try`" in
18048                 ok) echo "Your strtouq() seems to be working okay." ;;
18049                 *) cat <<EOM >&4
18050 Your strtouq() doesn't seem to be working okay.
18051 EOM
18052                    d_strtouq="$undef"
18053                    ;;
18054                 esac
18055         else
18056                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18057                 d_strtouq="$undef"
18058         fi
18059         ;;
18060 esac
18061
18062 : see if strxfrm exists
18063 set strxfrm d_strxfrm
18064 eval $inlibc
18065
18066 : see if symlink exists
18067 set symlink d_symlink
18068 eval $inlibc
18069
18070 : see if syscall exists
18071 set syscall d_syscall
18072 eval $inlibc
18073
18074 : see if prototype for syscall is available
18075 echo " "
18076 set d_syscallproto syscall $i_unistd unistd.h
18077 eval $hasproto
18078
18079 : see if sysconf exists
18080 set sysconf d_sysconf
18081 eval $inlibc
18082
18083 : see if system exists
18084 set system d_system
18085 eval $inlibc
18086
18087 : see if tcgetpgrp exists
18088 set tcgetpgrp d_tcgetpgrp
18089 eval $inlibc
18090
18091 : see if tcsetpgrp exists
18092 set tcsetpgrp d_tcsetpgrp
18093 eval $inlibc
18094
18095 : see if prototype for telldir is available
18096 echo " "
18097 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18098 eval $hasproto
18099
18100 : see if time exists
18101 echo " "
18102 if test "X$d_time" = X -o X"$timetype" = X; then
18103     if set time val -f d_time; eval $csym; $val; then
18104                 echo 'time() found.' >&4
18105                 val="$define"
18106                 rp="What is the type returned by time() on this system?"
18107                 set time_t timetype long stdio.h sys/types.h
18108                 eval $typedef_ask
18109     else
18110                 echo 'time() not found, hope that will do.' >&4
18111                 val="$undef"
18112                 timetype='int';
18113     fi
18114     set d_time
18115     eval $setvar
18116 fi
18117
18118 : see if timegm exists
18119 set timegm d_timegm
18120 eval $inlibc
18121
18122 : see if this is a sys/times.h system
18123 set sys/times.h i_systimes
18124 eval $inhdr
18125
18126 : see if times exists
18127 echo " "
18128 if set times val -f d_times; eval $csym; $val; then
18129         echo 'times() found.' >&4
18130         d_times="$define"
18131         inc=''
18132         case "$i_systimes" in
18133         "$define") inc='sys/times.h';;
18134         esac
18135         rp="What is the type returned by times() on this system?"
18136         set clock_t clocktype long stdio.h sys/types.h $inc
18137         eval $typedef_ask
18138 else
18139         echo 'times() NOT found, hope that will do.' >&4
18140         d_times="$undef"
18141         clocktype='int'
18142 fi
18143
18144 : see if tmpnam_r exists
18145 set tmpnam_r d_tmpnam_r
18146 eval $inlibc
18147 case "$d_tmpnam_r" in
18148 "$define")
18149         hdrs="$i_systypes sys/types.h define stdio.h "
18150         case "$d_tmpnam_r_proto:$usethreads" in
18151         ":define")      d_tmpnam_r_proto=define
18152                 set d_tmpnam_r_proto tmpnam_r $hdrs
18153                 eval $hasproto ;;
18154         *)      ;;
18155         esac
18156         case "$d_tmpnam_r_proto" in
18157         define)
18158         case "$tmpnam_r_proto" in
18159         ''|0) try='char* tmpnam_r(char*);'
18160         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18161         esac
18162         case "$tmpnam_r_proto" in
18163         ''|0)   d_tmpnam_r=undef
18164                 tmpnam_r_proto=0
18165                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18166         * )     case "$tmpnam_r_proto" in
18167                 REENTRANT_PROTO*) ;;
18168                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18169                 esac
18170                 echo "Prototype: $try" ;;
18171         esac
18172         ;;
18173         *)      case "$usethreads" in
18174                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18175                 esac
18176                 d_tmpnam_r=undef
18177                 tmpnam_r_proto=0
18178                 ;;
18179         esac
18180         ;;
18181 *)      tmpnam_r_proto=0
18182         ;;
18183 esac
18184
18185 : see if truncate exists
18186 set truncate d_truncate
18187 eval $inlibc
18188
18189 : see if ttyname_r exists
18190 set ttyname_r d_ttyname_r
18191 eval $inlibc
18192 case "$d_ttyname_r" in
18193 "$define")
18194         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18195         case "$d_ttyname_r_proto:$usethreads" in
18196         ":define")      d_ttyname_r_proto=define
18197                 set d_ttyname_r_proto ttyname_r $hdrs
18198                 eval $hasproto ;;
18199         *)      ;;
18200         esac
18201         case "$d_ttyname_r_proto" in
18202         define)
18203         case "$ttyname_r_proto" in
18204         ''|0) try='int ttyname_r(int, char*, size_t);'
18205         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18206         esac
18207         case "$ttyname_r_proto" in
18208         ''|0) try='int ttyname_r(int, char*, int);'
18209         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18210         esac
18211         case "$ttyname_r_proto" in
18212         ''|0) try='char* ttyname_r(int, char*, int);'
18213         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18214         esac
18215         case "$ttyname_r_proto" in
18216         ''|0)   d_ttyname_r=undef
18217                 ttyname_r_proto=0
18218                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18219         * )     case "$ttyname_r_proto" in
18220                 REENTRANT_PROTO*) ;;
18221                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18222                 esac
18223                 echo "Prototype: $try" ;;
18224         esac
18225         ;;
18226         *)      case "$usethreads" in
18227                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18228                 esac
18229                 d_ttyname_r=undef
18230                 ttyname_r_proto=0
18231                 ;;
18232         esac
18233         ;;
18234 *)      ttyname_r_proto=0
18235         ;;
18236 esac
18237
18238 : see if tzname[] exists
18239 echo " "
18240 if set tzname val -a d_tzname; eval $csym; $val; then
18241         val="$define"
18242         echo 'tzname[] found.' >&4
18243 else
18244         val="$undef"
18245         echo 'tzname[] NOT found.' >&4
18246 fi
18247 set d_tzname
18248 eval $setvar
18249
18250 : Check if is a multiplatform env
18251 case "$osname" in
18252 next|rhapsody|darwin) multiarch="$define" ;;
18253 esac
18254 case "$multiarch" in
18255 ''|[nN]*) multiarch="$undef" ;;
18256 esac
18257
18258 : check for ordering of bytes in a UV
18259 echo " "
18260 case "$usecrosscompile$multiarch" in
18261 *$define*)
18262         $cat <<EOM
18263 You seem to be either cross-compiling or doing a multiarchitecture build,
18264 skipping the byteorder check.
18265
18266 EOM
18267         byteorder='ffff'
18268         ;;
18269 *)
18270         case "$byteorder" in
18271         '')
18272                 $cat <<'EOM'
18273 In the following, larger digits indicate more significance.  A big-endian
18274 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18275 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18276 machines may have weird orders like 3412.  A Cray will report 87654321,
18277 an Alpha will report 12345678. If the test program works the default is
18278 probably right.
18279 I'm now running the test program...
18280 EOM
18281                 $cat >try.c <<EOCP
18282 #include <stdio.h>
18283 #$i_stdlib I_STDLIB
18284 #ifdef I_STDLIB
18285 #include <stdlib.h>
18286 #endif
18287 #include <sys/types.h>
18288 typedef $uvtype UV;
18289 int main()
18290 {
18291         int i;
18292         union {
18293                 UV l;
18294                 char c[$uvsize];
18295         } u;
18296
18297         if ($uvsize > 4)
18298                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18299         else
18300                 u.l = (UV)0x04030201;
18301         for (i = 0; i < $uvsize; i++)
18302                 printf("%c", u.c[i]+'0');
18303         printf("\n");
18304         exit(0);
18305 }
18306 EOCP
18307                 xxx_prompt=y
18308                 set try
18309                 if eval $compile && $run ./try > /dev/null; then
18310                         dflt=`$run ./try`
18311                         case "$dflt" in
18312                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18313                                 echo "(The test program ran ok.)"
18314                                 echo "byteorder=$dflt"
18315                                 xxx_prompt=n
18316                         ;;
18317                         ????|????????) echo "(The test program ran ok.)" ;;
18318                         *) echo "(The test program didn't run right for some reason.)" ;;
18319                         esac
18320                 else
18321                         dflt='4321'
18322                         cat <<'EOM'
18323 (I can't seem to compile the test program.  Guessing big-endian...)
18324 EOM
18325                 fi
18326                 case "$xxx_prompt" in
18327                 y)
18328                         rp="What is the order of bytes in $uvtype?"
18329                         . ./myread
18330                         byteorder="$ans"
18331                         ;;
18332                 *)      byteorder=$dflt
18333                         ;;
18334                 esac
18335                 ;;
18336         esac
18337         $rm_try
18338         ;;
18339 esac
18340
18341 : Checking 32bit aligndness
18342 $cat <<EOM
18343
18344 Checking to see whether you can access character data unalignedly...
18345 EOM
18346 case "$d_u32align" in
18347 '')   $cat >try.c <<EOCP
18348 #include <stdio.h>
18349 #$i_stdlib I_STDLIB
18350 #ifdef I_STDLIB
18351 #include <stdlib.h>
18352 #endif
18353 #define U32 $u32type
18354 #define BYTEORDER 0x$byteorder
18355 #define U8 $u8type
18356 #include <signal.h>
18357 #ifdef SIGBUS
18358 $signal_t bletch(int s) { exit(4); }
18359 #endif
18360 int main() {
18361 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18362     U8 buf[8];
18363     U32 *up;
18364     int i;
18365
18366     if (sizeof(U32) != 4) {
18367         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18368         exit(1);
18369     }
18370
18371     fflush(stdout);
18372
18373 #ifdef SIGBUS
18374     signal(SIGBUS, bletch);
18375 #endif
18376
18377     buf[0] = 0;
18378     buf[1] = 0;
18379     buf[2] = 0;
18380     buf[3] = 1;
18381     buf[4] = 0;
18382     buf[5] = 0;
18383     buf[6] = 0;
18384     buf[7] = 1;
18385
18386     for (i = 0; i < 4; i++) {
18387         up = (U32*)(buf + i);
18388         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18389                (*up == 1 << (8*(3-i)))  /* little-endian */
18390               )
18391            )
18392         {
18393             printf("read failed (%x)\n", *up);
18394             exit(2);
18395         }
18396     }
18397
18398     /* write test */
18399     for (i = 0; i < 4; i++) {
18400         up = (U32*)(buf + i);
18401         *up = 0xBeef;
18402         if (*up != 0xBeef) {
18403             printf("write failed (%x)\n", *up);
18404             exit(3);
18405         }
18406     }
18407
18408     exit(0);
18409 #else
18410     printf("1\n");
18411     exit(1);
18412 #endif
18413     return 0;
18414 }
18415 EOCP
18416 set try
18417 if eval $compile_ok; then
18418         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18419         $run ./try 2>&1 >/dev/null
18420         case "$?" in
18421         0)      cat >&4 <<EOM
18422 You can access character data pretty unalignedly.
18423 EOM
18424                 d_u32align="$undef"
18425                 ;;
18426         *)      cat >&4 <<EOM
18427 It seems that you must access character data in an aligned manner.
18428 EOM
18429                 d_u32align="$define"
18430                 ;;
18431         esac
18432 else
18433         rp='Can you access character data at unaligned addresses?'
18434         dflt='n'
18435         . ./myread
18436         case "$ans" in
18437         [yY]*)  d_u32align="$undef"  ;;
18438         *)      d_u32align="$define" ;;
18439         esac
18440 fi
18441 $rm_try
18442 ;;
18443 esac
18444
18445 : see if ualarm exists
18446 set ualarm d_ualarm
18447 eval $inlibc
18448
18449 : see if umask exists
18450 set umask d_umask
18451 eval $inlibc
18452
18453 : see if unordered exists
18454 set unordered d_unordered
18455 eval $inlibc
18456
18457 : see if unsetenv exists
18458 set unsetenv d_unsetenv
18459 eval $inlibc
18460
18461 : see if usleep exists
18462 set usleep d_usleep
18463 eval $inlibc
18464
18465 : see if prototype for usleep is available
18466 echo " "
18467 set d_usleepproto usleep $i_unistd unistd.h
18468 eval $hasproto
18469
18470 : see if ustat exists
18471 set ustat d_ustat
18472 eval $inlibc
18473
18474 : see if closedir exists
18475 set closedir d_closedir
18476 eval $inlibc
18477
18478 case "$d_closedir" in
18479 "$define")
18480         echo " "
18481         echo "Checking whether closedir() returns a status..." >&4
18482         cat > try.c <<EOM
18483 #$i_dirent I_DIRENT             /**/
18484 #$i_sysdir I_SYS_DIR            /**/
18485 #$i_sysndir I_SYS_NDIR          /**/
18486 #$i_systypes I_SYS_TYPES        /**/
18487
18488 #if defined(I_SYS_TYPES)
18489 #include <sys/types.h>
18490 #endif
18491 #if defined(I_DIRENT)
18492 #include <dirent.h>
18493 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18494 #include <sys/dir.h>
18495 #endif
18496 #else
18497 #ifdef I_SYS_NDIR
18498 #include <sys/ndir.h>
18499 #else
18500 #ifdef I_SYS_DIR
18501 #ifdef hp9000s500
18502 #include <ndir.h>       /* may be wrong in the future */
18503 #else
18504 #include <sys/dir.h>
18505 #endif
18506 #endif
18507 #endif
18508 #endif
18509 int main() { return closedir(opendir(".")); }
18510 EOM
18511         set try
18512         if eval $compile_ok; then
18513                 if $run ./try > /dev/null 2>&1 ; then
18514                         echo "Yes, it does."
18515                         val="$undef"
18516                 else
18517                         echo "No, it doesn't."
18518                         val="$define"
18519                 fi
18520         else
18521                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18522                 val="$define"
18523         fi
18524         ;;
18525 *)
18526         val="$undef";
18527         ;;
18528 esac
18529 set d_void_closedir
18530 eval $setvar
18531 $rm_try
18532
18533 : see if there is a wait4
18534 set wait4 d_wait4
18535 eval $inlibc
18536
18537 : see if waitpid exists
18538 set waitpid d_waitpid
18539 eval $inlibc
18540
18541 : see if wcstombs exists
18542 set wcstombs d_wcstombs
18543 eval $inlibc
18544
18545 : see if wctomb exists
18546 set wctomb d_wctomb
18547 eval $inlibc
18548
18549 : see if writev exists
18550 set writev d_writev
18551 eval $inlibc
18552
18553 : preserve RCS keywords in files with variable substitution, grrr
18554 Date='$Date'
18555 Id='$Id'
18556 Log='$Log'
18557 RCSfile='$RCSfile'
18558 Revision='$Revision'
18559
18560 : check for alignment requirements
18561 echo " "
18562 case "$usecrosscompile$multiarch" in
18563 *$define*)
18564         $cat <<EOM
18565 You seem to be either cross-compiling or doing a multiarchitecture build,
18566 skipping the memory alignment check.
18567
18568 EOM
18569         case "$alignbytes" in
18570         '') alignbytes=8 ;;
18571         esac
18572         ;;
18573 *)
18574         case "$alignbytes" in
18575         '') echo "Checking alignment constraints..." >&4
18576                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18577                         $cat >try.c <<'EOCP'
18578 typedef long double NV;
18579 EOCP
18580                 else
18581                         $cat >try.c <<'EOCP'
18582 typedef double NV;
18583 EOCP
18584                 fi
18585                 $cat >>try.c <<'EOCP'
18586 #include <stdio.h>
18587 struct foobar {
18588         char foo;
18589         NV bar;
18590 } try_algn;
18591 int main()
18592 {
18593     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18594     return(0);
18595 }
18596 EOCP
18597                 set try
18598                 if eval $compile_ok; then
18599                         dflt=`$run ./try`
18600                 else
18601                         dflt='8'
18602                         echo "(I can't seem to compile the test program...)"
18603                 fi
18604                 ;;
18605         *) dflt="$alignbytes"
18606                 ;;
18607         esac
18608         rp="Doubles must be aligned on a how-many-byte boundary?"
18609         . ./myread
18610         alignbytes="$ans"
18611         $rm_try
18612         ;;
18613 esac
18614
18615
18616 : set the base revision
18617 baserev=5.0
18618
18619 : how do we concatenate cpp tokens here?
18620 echo " "
18621 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18622 $cat >cpp_stuff.c <<'EOCP'
18623 #define RCAT(a,b)a/**/b
18624 #define ACAT(a,b)a ## b
18625 RCAT(Rei,ser)
18626 ACAT(Cir,cus)
18627 EOCP
18628 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18629 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18630         echo "Oh!  Smells like ANSI's been here." >&4
18631         echo "We can catify or stringify, separately or together!"
18632         cpp_stuff=42
18633 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18634         echo "Ah, yes!  The good old days!" >&4
18635         echo "However, in the good old days we don't know how to stringify and"
18636         echo "catify at the same time."
18637         cpp_stuff=1
18638 else
18639         $cat >&4 <<EOM
18640 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18641 You're going to have to edit the values of CAT[2-5] in config.h...
18642 EOM
18643         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18644 fi
18645 $rm -f cpp_stuff.*
18646
18647 : see if this is a db.h system
18648 set db.h i_db
18649 eval $inhdr
18650
18651 case "$i_db" in
18652 $define)
18653         : Check db version.
18654         echo " "
18655         echo "Checking Berkeley DB version ..." >&4
18656         $cat >try.c <<EOCP
18657 #$d_const HASCONST
18658 #ifndef HASCONST
18659 #define const
18660 #endif
18661 #include <sys/types.h>
18662 #include <stdio.h>
18663 #$i_stdlib I_STDLIB
18664 #ifdef I_STDLIB
18665 #include <stdlib.h>
18666 #endif
18667 #include <db.h>
18668 int main(int argc, char *argv[])
18669 {
18670 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18671     int Major, Minor, Patch ;
18672     unsigned long Version ;
18673     (void)db_version(&Major, &Minor, &Patch) ;
18674     if (argc == 2) {
18675         printf("%d %d %d %d %d %d\n",
18676                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18677                Major, Minor, Patch);
18678         exit(0);
18679     }
18680     printf("You have Berkeley DB Version 2 or greater.\n");
18681
18682     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18683                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18684     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18685                 Major, Minor, Patch) ;
18686
18687     /* check that db.h & libdb are compatible */
18688     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18689         printf("db.h and libdb are incompatible.\n") ;
18690         exit(3);
18691     }
18692
18693     printf("db.h and libdb are compatible.\n") ;
18694
18695     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18696                 + DB_VERSION_PATCH ;
18697
18698     /* needs to be >= 2.3.4 */
18699     if (Version < 2003004) {
18700     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18701         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18702         exit(2);
18703     }
18704
18705     exit(0);
18706 #else
18707 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18708     if (argc == 2) {
18709         printf("1 0 0\n");
18710         exit(0);
18711     }
18712     printf("You have Berkeley DB Version 1.\n");
18713     exit(0);    /* DB version < 2: the coast is clear. */
18714 #else
18715     exit(1);    /* <db.h> not Berkeley DB? */
18716 #endif
18717 #endif
18718 }
18719 EOCP
18720         set try
18721         if eval $compile_ok && $run ./try; then
18722                 echo 'Looks OK.' >&4
18723                 set `$run ./try 1`
18724                 db_version_major=$1
18725                 db_version_minor=$2
18726                 db_version_patch=$3
18727         else
18728                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18729                 i_db=$undef
18730                 case " $libs " in
18731                 *"-ldb "*)
18732                         : Remove db from list of libraries to use
18733                         echo "Removing unusable -ldb from library list" >&4
18734                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18735                         shift
18736                         libs="$*"
18737                         echo "libs = $libs" >&4
18738                         ;;
18739                 esac
18740         fi
18741         $rm_try
18742         ;;
18743 esac
18744
18745 case "$i_db" in
18746 define)
18747         : Check the return type needed for hash
18748         echo " "
18749         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18750         $cat >try.c <<EOCP
18751 #$d_const HASCONST
18752 #ifndef HASCONST
18753 #define const
18754 #endif
18755 #include <sys/types.h>
18756 #include <db.h>
18757
18758 #ifndef DB_VERSION_MAJOR
18759 u_int32_t hash_cb (ptr, size)
18760 const void *ptr;
18761 size_t size;
18762 {
18763 }
18764 HASHINFO info;
18765 int main()
18766 {
18767         info.hash = hash_cb;
18768 }
18769 #endif
18770 EOCP
18771         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18772                 if $contains warning try.out >>/dev/null 2>&1 ; then
18773                         db_hashtype='int'
18774                 else
18775                         db_hashtype='u_int32_t'
18776                 fi
18777         else
18778                 : XXX Maybe we should just give up here.
18779                 db_hashtype=u_int32_t
18780                 $cat try.out >&4
18781                 echo "Help:  I can't seem to compile the db test program." >&4
18782                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18783         fi
18784         $rm_try
18785         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18786         ;;
18787 *)      db_hashtype=u_int32_t
18788         ;;
18789 esac
18790 case "$i_db" in
18791 define)
18792         : Check the return type needed for prefix
18793         echo " "
18794         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18795         cat >try.c <<EOCP
18796 #$d_const HASCONST
18797 #ifndef HASCONST
18798 #define const
18799 #endif
18800 #include <sys/types.h>
18801 #include <db.h>
18802
18803 #ifndef DB_VERSION_MAJOR
18804 size_t prefix_cb (key1, key2)
18805 const DBT *key1;
18806 const DBT *key2;
18807 {
18808 }
18809 BTREEINFO info;
18810 int main()
18811 {
18812         info.prefix = prefix_cb;
18813 }
18814 #endif
18815 EOCP
18816         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18817                 if $contains warning try.out >>/dev/null 2>&1 ; then
18818                         db_prefixtype='int'
18819                 else
18820                         db_prefixtype='size_t'
18821                 fi
18822         else
18823                 db_prefixtype='size_t'
18824                 : XXX Maybe we should just give up here.
18825                 $cat try.out >&4
18826                 echo "Help:  I can't seem to compile the db test program." >&4
18827                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18828         fi
18829         $rm_try
18830         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18831         ;;
18832 *)      db_prefixtype='size_t'
18833         ;;
18834 esac
18835
18836 : How can we generate normalized random numbers ?
18837 echo " "
18838 echo "Looking for a random number function..." >&4
18839 case "$randfunc" in
18840 '')
18841         if set drand48 val -f; eval $csym; $val; then
18842                 dflt="drand48"
18843                 echo "Good, found drand48()." >&4
18844         elif set random val -f; eval $csym; $val; then
18845                 dflt="random"
18846                 echo "OK, found random()." >&4
18847         else
18848                 dflt="rand"
18849                 echo "Yick, looks like I have to use rand()." >&4
18850         fi
18851         echo " "
18852         ;;
18853 *)
18854         dflt="$randfunc"
18855         ;;
18856 esac
18857 cont=true
18858
18859 case "$ccflags" in
18860 *-Dmy_rand=*|*-Dmy_srand=*)
18861         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18862         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18863         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18864         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18865         ;;
18866 esac
18867
18868 while $test "$cont"; do
18869         rp="Use which function to generate random numbers?"
18870         . ./myread
18871         if $test "$ans" = "$dflt"; then
18872                 : null
18873         else
18874                 randbits=''
18875         fi
18876         randfunc="$ans"
18877         if set $ans val -f; eval $csym; $val; then
18878                 cont=''
18879         else
18880                 dflt=y
18881                 rp="I cannot find function $ans. Use that name anyway?"
18882                 . ./myread
18883                 dflt=rand
18884                 case "$ans" in
18885                         [yY]*) cont='';;
18886                 esac
18887         fi
18888         case "$cont" in
18889         '')
18890                 case "$randfunc" in
18891                 drand48)
18892                         drand01="drand48()"
18893                         seedfunc="srand48"
18894                         randbits=48
18895                         randseedtype=long
18896                         ;;
18897                 rand|random)
18898                         case "$randbits" in
18899                         '')
18900 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18901                                 $cat >try.c <<EOCP
18902 #$i_unistd I_UNISTD
18903 #$i_stdlib I_STDLIB
18904 #include <stdio.h>
18905 #ifdef I_UNISTD
18906 #  include <unistd.h>
18907 #endif
18908 #ifdef I_STDLIB
18909 #  include <stdlib.h>
18910 #endif
18911 int main()
18912 {
18913         register int i;
18914         register unsigned long tmp;
18915         register unsigned long max = 0L;
18916
18917         for (i = 1000; i; i--) {
18918                 tmp = (unsigned long) $randfunc();
18919                 if (tmp > max) max = tmp;
18920         }
18921         for (i = 0; max; i++)
18922                 max /= 2;
18923         printf("%d\n",i);
18924 }
18925 EOCP
18926                                 set try
18927                                 if eval $compile_ok; then
18928                                         dflt=`try`
18929                                 else
18930                                         dflt='?'
18931                                         echo "(I can't seem to compile the test program...)"
18932                                 fi
18933                                 ;;
18934                         *)
18935                                 dflt="$randbits"
18936                                 ;;
18937                         esac
18938                         rp="How many bits does your $randfunc() function produce?"
18939                         . ./myread
18940                         randbits="$ans"
18941                         $rm_try
18942                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18943                         seedfunc="s$randfunc"
18944                         randseedtype=unsigned
18945                         ;;
18946                 *)
18947                         dflt="31"
18948                         rp="How many bits does your $randfunc() function produce?"
18949                         . ./myread
18950                         randbits="$ans"
18951                         seedfunc="s$randfunc"
18952                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18953                         if set $seedfunc val -f; eval $csym; $val; then
18954                                 echo "(Using $seedfunc() to seed random generator)"
18955                         else
18956                                 echo "(Warning: no $seedfunc() to seed random generator)"
18957                                 seedfunc=rand
18958                         fi
18959                         randseedtype=unsigned
18960                         ;;
18961                 esac
18962                 ;;
18963         esac
18964 done
18965
18966 : Determine if this is an EBCDIC system
18967 echo " "
18968 echo "Determining whether or not we are on an EBCDIC system..." >&4
18969 $cat >try.c <<'EOM'
18970 int main()
18971 {
18972   if ('M'==0xd4) return 0;
18973   return 1;
18974 }
18975 EOM
18976
18977 val=$undef
18978 set try
18979 if eval $compile_ok; then
18980         if $run ./try; then
18981                 echo "You seem to speak EBCDIC." >&4
18982                 val="$define"
18983         else
18984                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18985         fi
18986 else
18987         echo "I'm unable to compile the test program." >&4
18988         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18989 fi
18990 $rm_try
18991 set ebcdic
18992 eval $setvar
18993
18994 : Check how to flush
18995 echo " "
18996 $cat >&4 <<EOM
18997 Checking how to flush all pending stdio output...
18998 EOM
18999 # I only know how to find the first 32 possibly open files on SunOS.
19000 # See also hints/sunos_4_1.sh and util.c  --AD
19001 case "$osname" in
19002 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19003 esac
19004 $cat >>try.c <<EOCP
19005 #include <stdio.h>
19006 #$i_stdlib I_STDLIB
19007 #ifdef I_STDLIB
19008 #include <stdlib.h>
19009 #endif
19010 #$i_unistd I_UNISTD
19011 #ifdef I_UNISTD
19012 # include <unistd.h>
19013 #endif
19014 #$d_sysconf HAS_SYSCONF
19015 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19016 #ifdef HAS_STDIO_STREAM_ARRAY
19017 # define STDIO_STREAM_ARRAY $stdio_stream_array
19018 #endif
19019 int main() {
19020   FILE* p;
19021   unlink("try.out");
19022   p = fopen("try.out", "w");
19023 #ifdef TRY_FPUTC
19024   fputc('x', p);
19025 #else
19026 # ifdef TRY_FPRINTF
19027   fprintf(p, "x");
19028 # endif
19029 #endif
19030 #ifdef TRY_FFLUSH_NULL
19031   fflush(NULL);
19032 #endif
19033 #ifdef TRY_FFLUSH_ALL
19034   {
19035     long open_max = -1;
19036 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19037     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19038 # else
19039 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19040     open_max = sysconf(_SC_OPEN_MAX);
19041 #  else
19042 #   ifdef FOPEN_MAX
19043     open_max = FOPEN_MAX;
19044 #   else
19045 #    ifdef OPEN_MAX
19046     open_max = OPEN_MAX;
19047 #    else
19048 #     ifdef _NFILE
19049     open_max = _NFILE;
19050 #     endif
19051 #    endif
19052 #   endif
19053 #  endif
19054 # endif
19055 # ifdef HAS_STDIO_STREAM_ARRAY
19056     if (open_max > 0) {
19057       long i;
19058       for (i = 0; i < open_max; i++)
19059             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19060                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19061                 STDIO_STREAM_ARRAY[i]._flag)
19062                 fflush(&STDIO_STREAM_ARRAY[i]);
19063     }
19064   }
19065 # endif
19066 #endif
19067   _exit(42);
19068 }
19069 EOCP
19070 : first we have to find out how _not_ to flush
19071 $to try.c
19072 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19073     output=''
19074     set try -DTRY_FPUTC
19075     if eval $compile; then
19076             $run ./try 2>/dev/null
19077             code="$?"
19078             $from try.out
19079             if $test ! -s try.out -a "X$code" = X42; then
19080                 output=-DTRY_FPUTC
19081             fi
19082     fi
19083     case "$output" in
19084     '')
19085             set try -DTRY_FPRINTF
19086             if eval $compile; then
19087                     $run ./try 2>/dev/null
19088                     code="$?"
19089                     $from try.out
19090                     if $test ! -s try.out -a "X$code" = X42; then
19091                         output=-DTRY_FPRINTF
19092                     fi
19093             fi
19094         ;;
19095     esac
19096 fi
19097 : check for fflush NULL behaviour
19098 case "$fflushNULL" in
19099 '')     set try -DTRY_FFLUSH_NULL $output
19100         if eval $compile; then
19101                 $run ./try 2>/dev/null
19102                 code="$?"
19103                 $from try.out
19104                 if $test -s try.out -a "X$code" = X42; then
19105                         fflushNULL="`$cat try.out`"
19106                 else
19107                         if $test "X$code" != X42; then
19108                                 $cat >&4 <<EOM
19109 (If this test failed, don't worry, we'll try another method shortly.)
19110 EOM
19111                         fi
19112                 fi
19113         fi
19114         $rm -f core try.core core.try.*
19115         case "$fflushNULL" in
19116         x)      $cat >&4 <<EOM
19117 Your fflush(NULL) works okay for output streams.
19118 Let's see if it clobbers input pipes...
19119 EOM
19120 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19121 # bug that improperly flushes the input end of pipes.  So we avoid the
19122 # autoflush on fork/system/exec support for now. :-(
19123 $cat >tryp.c <<EOCP
19124 #include <stdio.h>
19125 int
19126 main(int argc, char **argv)
19127 {
19128     char buf[1024];
19129     int i;
19130     char *bp = buf;
19131     while (1) {
19132         while ((i = getc(stdin)) != -1
19133                && (*bp++ = i) != '\n'
19134                && bp < &buf[1024])
19135         /* DO NOTHING */ ;
19136         *bp = '\0';
19137         fprintf(stdout, "%s", buf);
19138         fflush(NULL);
19139         if (i == -1)
19140             return 0;
19141         bp = buf;
19142     }
19143 }
19144 EOCP
19145                 fflushNULL="$define"
19146                 set tryp
19147                 if eval $compile; then
19148                     $rm -f tryp.out
19149                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19150                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19151                        $cat >&4 <<EOM
19152 fflush(NULL) seems to behave okay with input streams.
19153 EOM
19154                         fflushNULL="$define"
19155                     else
19156                         $cat >&4 <<EOM
19157 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19158 EOM
19159                         fflushNULL="$undef"
19160                     fi
19161                 fi
19162                 $rm -f core tryp.c tryp.core core.tryp.*
19163                 ;;
19164         '')     $cat >&4 <<EOM
19165 Your fflush(NULL) isn't working (contrary to ANSI C).
19166 EOM
19167                 fflushNULL="$undef"
19168                 ;;
19169         *)      $cat >&4 <<EOM
19170 Cannot figure out whether your fflush(NULL) works or not.
19171 I'm assuming it doesn't (contrary to ANSI C).
19172 EOM
19173                 fflushNULL="$undef"
19174                 ;;
19175         esac
19176         ;;
19177 $define|true|[yY]*)
19178         fflushNULL="$define"
19179         ;;
19180 *)
19181         fflushNULL="$undef"
19182         ;;
19183 esac
19184 : check explicit looping only if NULL did not work, and if the pipe
19185 : bug does not show up on an explicit flush too
19186 case "$fflushNULL" in
19187 "$undef")
19188         $cat >tryp.c <<EOCP
19189 #include <stdio.h>
19190 int
19191 main(int argc, char **argv)
19192 {
19193     char buf[1024];
19194     int i;
19195     char *bp = buf;
19196     while (1) {
19197         while ((i = getc(stdin)) != -1
19198                && (*bp++ = i) != '\n'
19199                && bp < &buf[1024])
19200         /* DO NOTHING */ ;
19201         *bp = '\0';
19202         fprintf(stdout, "%s", buf);
19203         fflush(stdin);
19204         if (i == -1)
19205             return 0;
19206         bp = buf;
19207     }
19208 }
19209 EOCP
19210         set tryp
19211         if eval $compile; then
19212             $rm -f tryp.out
19213             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19214             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19215                $cat >&4 <<EOM
19216 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19217 EOM
19218                 : now check for fflushall behaviour
19219                 case "$fflushall" in
19220                 '')     set try -DTRY_FFLUSH_ALL $output
19221                         if eval $compile; then
19222                                 $cat >&4 <<EOM
19223 (Now testing the other method--but note that this also may fail.)
19224 EOM
19225                                 $run ./try 2>/dev/null
19226                                 code=$?
19227                                 $from try.out
19228                                 if $test -s try.out -a "X$code" = X42; then
19229                                         fflushall="`$cat try.out`"
19230                                 fi
19231                         fi
19232                         $rm_try
19233                         case "$fflushall" in
19234                         x)      $cat >&4 <<EOM
19235 Whew. Flushing explicitly all the stdio streams works.
19236 EOM
19237                                 fflushall="$define"
19238                                 ;;
19239                         '')     $cat >&4 <<EOM
19240 Sigh. Flushing explicitly all the stdio streams doesn't work.
19241 EOM
19242                                 fflushall="$undef"
19243                                 ;;
19244                         *)      $cat >&4 <<EOM
19245 Cannot figure out whether flushing stdio streams explicitly works or not.
19246 I'm assuming it doesn't.
19247 EOM
19248                                 fflushall="$undef"
19249                                 ;;
19250                         esac
19251                         ;;
19252                 "$define"|true|[yY]*)
19253                         fflushall="$define"
19254                         ;;
19255                 *)
19256                         fflushall="$undef"
19257                         ;;
19258                 esac
19259             else
19260                 $cat >&4 <<EOM
19261 All is futile.  Even fflush(stdin) clobbers input pipes!
19262 EOM
19263                 fflushall="$undef"
19264             fi
19265         else
19266             fflushall="$undef"
19267         fi
19268         $rm -f core tryp.c tryp.core core.tryp.*
19269         ;;
19270 *)      fflushall="$undef"
19271         ;;
19272 esac
19273
19274 case "$fflushNULL$fflushall" in
19275 undefundef)
19276         $cat <<EOM
19277 OK, I give up.  I cannot figure out how to flush pending stdio output.
19278 We won't be flushing handles at all before fork/exec/popen.
19279 EOM
19280         ;;
19281 esac
19282 $rm_try tryp
19283
19284 : Store the full pathname to the ar program for use in the C program
19285 : Respect a hint or command line value for full_ar.
19286 case "$full_ar" in
19287 '') full_ar=$ar ;;
19288 esac
19289
19290 : Store the full pathname to the sed program for use in the C program
19291 full_sed=$sed
19292
19293 : see what type gids are declared as in the kernel
19294 echo " "
19295 echo "Looking for the type for group ids returned by getgid()."
19296 set gid_t gidtype xxx stdio.h sys/types.h
19297 eval $typedef
19298 case "$gidtype" in
19299 xxx)
19300         xxx=`./findhdr sys/user.h`
19301         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19302         case $1 in
19303         unsigned) dflt="$1 $2" ;;
19304         *) dflt="$1" ;;
19305         esac
19306         ;;
19307 *) dflt="$gidtype";;
19308 esac
19309 case "$gidtype" in
19310 gid_t) echo "gid_t found." ;;
19311 *)      rp="What is the type for group ids returned by getgid()?"
19312         . ./myread
19313         gidtype="$ans"
19314         ;;
19315 esac
19316
19317 : Check the size of GID
19318 echo " "
19319 case "$gidtype" in
19320 *_t) zzz="$gidtype"     ;;
19321 *)   zzz="gid"          ;;
19322 esac
19323 echo "Checking the size of $zzz..." >&4
19324 cat > try.c <<EOCP
19325 #include <sys/types.h>
19326 #include <stdio.h>
19327 #$i_stdlib I_STDLIB
19328 #ifdef I_STDLIB
19329 #include <stdlib.h>
19330 #endif
19331 int main() {
19332     printf("%d\n", (int)sizeof($gidtype));
19333     exit(0);
19334 }
19335 EOCP
19336 set try
19337 if eval $compile_ok; then
19338         yyy=`$run ./try`
19339         case "$yyy" in
19340         '')     gidsize=4
19341                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19342                 ;;
19343         *)      gidsize=$yyy
19344                 echo "Your $zzz is $gidsize bytes long."
19345                 ;;
19346         esac
19347 else
19348         gidsize=4
19349         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19350 fi
19351
19352
19353 : Check if GID is signed
19354 echo " "
19355 case "$gidtype" in
19356 *_t) zzz="$gidtype"     ;;
19357 *)   zzz="gid"          ;;
19358 esac
19359 echo "Checking the sign of $zzz..." >&4
19360 cat > try.c <<EOCP
19361 #include <sys/types.h>
19362 #include <stdio.h>
19363 int main() {
19364         $gidtype foo = -1;
19365         if (foo < 0)
19366                 printf("-1\n");
19367         else
19368                 printf("1\n");
19369 }
19370 EOCP
19371 set try
19372 if eval $compile; then
19373         yyy=`$run ./try`
19374         case "$yyy" in
19375         '')     gidsign=1
19376                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19377                 ;;
19378         *)      gidsign=$yyy
19379                 case "$gidsign" in
19380                  1) echo "Your $zzz is unsigned." ;;
19381                 -1) echo "Your $zzz is signed."   ;;
19382                 esac
19383                 ;;
19384         esac
19385 else
19386         gidsign=1
19387         echo "(I can't compile the test program--guessing unsigned.)" >&4
19388 fi
19389
19390
19391 : Check 64bit sizes
19392 echo " "
19393
19394 if $test X"$quadtype" != X; then
19395
19396 echo "Checking how to print 64-bit integers..." >&4
19397
19398 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19399         $cat >try.c <<'EOCP'
19400 #include <sys/types.h>
19401 #include <stdio.h>
19402 int main() {
19403   int q = 12345678901;
19404   printf("%ld\n", q);
19405 }
19406 EOCP
19407         set try
19408         if eval $compile; then
19409                 yyy=`$run ./try`
19410                 case "$yyy" in
19411                 12345678901)
19412                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19413                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19414                         echo "We will use %d."
19415                         ;;
19416                 esac
19417         fi
19418 fi
19419
19420 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19421         $cat >try.c <<'EOCP'
19422 #include <sys/types.h>
19423 #include <stdio.h>
19424 int main() {
19425   long q = 12345678901;
19426   printf("%ld\n", q);
19427 }
19428 EOCP
19429         set try
19430         if eval $compile; then
19431                 yyy=`$run ./try`
19432                 case "$yyy" in
19433                 12345678901)
19434                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19435                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19436                         echo "We will use %ld."
19437                         ;;
19438                 esac
19439         fi
19440 fi
19441
19442 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19443         $cat >try.c <<'EOCP'
19444 #include <sys/types.h>
19445 #include <inttypes.h>
19446 #include <stdio.h>
19447 int main() {
19448   int64_t q = 12345678901;
19449   printf("%" PRId64 "\n", q);
19450 }
19451 EOCP
19452         set try
19453         if eval $compile; then
19454                 yyy=`$run ./try`
19455                 case "$yyy" in
19456                 12345678901)
19457                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19458                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19459                         echo "We will use the C9X style."
19460                         ;;
19461                 esac
19462         fi
19463 fi
19464
19465 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19466         $cat >try.c <<EOCP
19467 #include <sys/types.h>
19468 #include <stdio.h>
19469 int main() {
19470   $quadtype q = 12345678901;
19471   printf("%Ld\n", q);
19472 }
19473 EOCP
19474         set try
19475         if eval $compile; then
19476                 yyy=`$run ./try`
19477                 case "$yyy" in
19478                 12345678901)
19479                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19480                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19481                         echo "We will use %Ld."
19482                         ;;
19483                 esac
19484         fi
19485 fi
19486
19487 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19488         $cat >try.c <<'EOCP'
19489 #include <sys/types.h>
19490 #include <stdio.h>
19491 int main() {
19492   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19493   printf("%lld\n", q);
19494 }
19495 EOCP
19496         set try
19497         if eval $compile; then
19498                 yyy=`$run ./try`
19499                 case "$yyy" in
19500                 12345678901)
19501                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19502                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19503                         echo "We will use the %lld style."
19504                         ;;
19505                 esac
19506         fi
19507 fi
19508
19509 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19510         $cat >try.c <<EOCP
19511 #include <sys/types.h>
19512 #include <stdio.h>
19513 int main() {
19514   $quadtype q = 12345678901;
19515   printf("%qd\n", q);
19516 }
19517 EOCP
19518         set try
19519         if eval $compile; then
19520                 yyy=`$run ./try`
19521                 case "$yyy" in
19522                 12345678901)
19523                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19524                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19525                         echo "We will use %qd."
19526                         ;;
19527                 esac
19528         fi
19529 fi
19530
19531 if $test X"$sPRId64" = X; then
19532         echo "Cannot figure out how to print 64-bit integers." >&4
19533 fi
19534 $rm_try
19535
19536 fi
19537
19538 case "$sPRId64" in
19539 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19540         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19541         ;;
19542 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19543         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19544         ;;
19545 esac
19546
19547 : Check format strings for internal types
19548 echo " "
19549 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19550
19551 if $test X"$ivsize" = X8; then
19552         ivdformat="$sPRId64"
19553         uvuformat="$sPRIu64"
19554         uvoformat="$sPRIo64"
19555         uvxformat="$sPRIx64"
19556         uvXUformat="$sPRIXU64"
19557 else
19558         if $test X"$ivsize" = X"$longsize"; then
19559                 ivdformat='"ld"'
19560                 uvuformat='"lu"'
19561                 uvoformat='"lo"'
19562                 uvxformat='"lx"'
19563                 uvXUformat='"lX"'
19564         else
19565                 if $test X"$ivsize" = X"$intsize"; then
19566                         ivdformat='"d"'
19567                         uvuformat='"u"'
19568                         uvoformat='"o"'
19569                         uvxformat='"x"'
19570                         uvXUformat='"X"'
19571                 else
19572                         : far out
19573                         if $test X"$ivsize" = X"$shortsize"; then
19574                                 ivdformat='"hd"'
19575                                 uvuformat='"hu"'
19576                                 uvoformat='"ho"'
19577                                 uvxformat='"hx"'
19578                                 uvXUformat='"hX"'
19579                         fi
19580                 fi
19581         fi
19582 fi
19583
19584 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19585         nveformat="$sPRIeldbl"
19586         nvfformat="$sPRIfldbl"
19587         nvgformat="$sPRIgldbl"
19588         nvEUformat="$sPRIEUldbl"
19589         nvFUformat="$sPRIFUldbl"
19590         nvGUformat="$sPRIGUldbl"
19591 else
19592         nveformat='"e"'
19593         nvfformat='"f"'
19594         nvgformat='"g"'
19595         nvEUformat='"E"'
19596         nvFUformat='"F"'
19597         nvGUformat='"G"'
19598 fi
19599
19600 case "$ivdformat" in
19601 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19602     exit 1
19603     ;;
19604 esac
19605
19606 : Check format string for GID
19607
19608 echo " "
19609 $echo "Checking the format string to be used for gids..." >&4
19610
19611 case "$gidsign" in
19612 -1)     if $test X"$gidsize" = X"$ivsize"; then
19613                 gidformat="$ivdformat"
19614         else
19615                 if $test X"$gidsize" = X"$longsize"; then
19616                         gidformat='"ld"'
19617                 else
19618                         if $test X"$gidsize" = X"$intsize"; then
19619                                 gidformat='"d"'
19620                         else
19621                                 if $test X"$gidsize" = X"$shortsize"; then
19622                                         gidformat='"hd"'
19623                                 fi
19624                         fi
19625                 fi
19626         fi
19627         ;;
19628 *)      if $test X"$gidsize" = X"$uvsize"; then
19629                 gidformat="$uvuformat"
19630         else
19631                 if $test X"$gidsize" = X"$longsize"; then
19632                         gidformat='"lu"'
19633                 else
19634                         if $test X"$gidsize" = X"$intsize"; then
19635                                 gidformat='"u"'
19636                         else
19637                                 if $test X"$gidsize" = X"$shortsize"; then
19638                                         gidformat='"hu"'
19639                                 fi
19640                         fi
19641                 fi
19642         fi
19643         ;;
19644 esac
19645
19646 : see if getgroups exists
19647 set getgroups d_getgrps
19648 eval $inlibc
19649
19650 : see if setgroups exists
19651 set setgroups d_setgrps
19652 eval $inlibc
19653
19654 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19655 echo " "
19656 case "$d_getgrps$d_setgrps" in
19657 *define*)
19658         case "$groupstype" in
19659         '') dflt="$gidtype" ;;
19660         *)  dflt="$groupstype" ;;
19661         esac
19662         $cat <<EOM
19663 What type of pointer is the second argument to getgroups() and setgroups()?
19664 Usually this is the same as group ids, $gidtype, but not always.
19665
19666 EOM
19667         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19668         . ./myread
19669         groupstype="$ans"
19670         ;;
19671 *)  groupstype="$gidtype";;
19672 esac
19673
19674 : MAD = Misc Attribute Definition
19675
19676 if $test $patchlevel -lt 9; then
19677 : MAD is not available in 5.8.x or earlier.
19678     ans=n;
19679 else
19680     case "$mad" in
19681     $define|true|[yY]*) dflt='y' ;;
19682     *)                  dflt='n' ;;
19683     esac
19684     cat <<EOM
19685
19686 Would you like to build with Misc Attribute Decoration? This is development
19687 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19688 overhead on the interpreter.
19689
19690 If this doesn't make any sense to you, just accept the default '$dflt'.
19691 EOM
19692     rp='Build Perl with MAD?'
19693     . ./myread
19694 fi
19695 case "$ans" in
19696 y|Y)    val="$define"
19697         madlyh='madly.h madly.act madly.tab'
19698         madlysrc='madly.c'
19699         madlyobj="madly$_o" ;;
19700 *)      val="$undef"
19701         madlyh=''
19702         madlysrc=''
19703         madlyobj='' ;;
19704 esac
19705 set mad
19706 eval $setvar
19707
19708 : check whether make sets MAKE
19709 echo " "
19710 echo "Checking if your $make program sets \$(MAKE)..." >&4
19711 case "$make_set_make" in
19712 '')
19713         $sed 's/^X //' > testmake.mak << 'EOF'
19714 Xall:
19715 X       @echo 'maketemp="$(MAKE)"'
19716 EOF
19717         case "`$make -f testmake.mak 2>/dev/null`" in
19718         *maketemp=*) make_set_make='#' ;;
19719         *)      make_set_make="MAKE=$make" ;;
19720         esac
19721         $rm -f testmake.mak
19722         ;;
19723 esac
19724 case "$make_set_make" in
19725 '#') echo "Yup, it does.";;
19726 *) echo "Nope, it doesn't.";;
19727 esac
19728
19729 : see what type is used for mode_t
19730 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19731 set mode_t modetype int stdio.h sys/types.h
19732 eval $typedef_ask
19733
19734 : see if we need va_copy
19735 echo " "
19736 case "$i_stdarg" in
19737 "$define")
19738         $cat >try.c <<EOCP
19739 #include <stdarg.h>
19740 #include <stdio.h>
19741 #$i_stdlib I_STDLIB
19742 #ifdef I_STDLIB
19743 #include <stdlib.h>
19744 #endif
19745 #include <signal.h>
19746
19747 int
19748 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19749 {
19750   return vfprintf(f, fmt, *valp);
19751 }
19752
19753 int
19754 myvfprintf(FILE *f, const  char *fmt, va_list val)
19755 {
19756   return ivfprintf(f, fmt, &val);
19757 }
19758
19759 int
19760 myprintf(char *fmt, ...)
19761 {
19762   va_list val;
19763   va_start(val, fmt);
19764   return myvfprintf(stdout, fmt, val);
19765 }
19766
19767 int
19768 main(int ac, char **av)
19769 {
19770   signal(SIGSEGV, exit);
19771
19772   myprintf("%s%cs all right, then\n", "that", '\'');
19773   exit(0);
19774 }
19775 EOCP
19776         set try
19777         if eval $compile && $run ./try 2>&1 >/dev/null; then
19778                 case "`$run ./try`" in
19779                 "that's all right, then")
19780                         okay=yes
19781                         ;;
19782                 esac
19783         fi
19784         case "$okay" in
19785         yes)    echo "It seems that you don't need va_copy()." >&4
19786                 need_va_copy="$undef"
19787                 ;;
19788         *)      echo "It seems that va_copy() or similar will be needed." >&4
19789                 need_va_copy="$define"
19790                 ;;
19791         esac
19792         $rm_try
19793         ;;
19794 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19795         ;;
19796 esac
19797
19798 : see what type is used for size_t
19799 rp="What is the type used for the length parameter for string functions?"
19800 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19801 eval $typedef_ask
19802
19803 : check for type of arguments to gethostbyaddr. 
19804 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19805         case "$d_gethbyaddr" in
19806         $define)
19807                 $cat <<EOM
19808
19809 Checking to see what type of arguments are accepted by gethostbyaddr().
19810 EOM
19811                 hdrs="$define sys/types.h
19812                         $d_socket sys/socket.h 
19813                         $i_niin netinet/in.h 
19814                         $i_netdb netdb.h
19815                         $i_unistd unistd.h"
19816                 : The first arg can 'char *' or 'void *'
19817                 : The second arg is some of integral type
19818                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19819                         for yyy in size_t long int; do
19820                                 case "$netdb_host_type" in
19821                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19822                                         if ./protochk "$try" $hdrs; then
19823                                                 echo "Your system accepts $xxx for the first arg."
19824                                                 echo "...and $yyy for the second arg."
19825                                                 netdb_host_type="$xxx"
19826                                                 netdb_hlen_type="$yyy"
19827                                         fi
19828                                         ;;
19829                                 esac
19830                         done
19831                 done
19832                 : In case none of those worked, prompt the user.
19833                 case "$netdb_host_type" in
19834                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19835                         dflt='char *'
19836                         . ./myread
19837                         netdb_host_type=$ans
19838                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19839                         dflt="$sizetype"
19840                         . ./myread
19841                         netdb_hlen_type=$ans
19842                         ;;
19843                 esac
19844                 ;;
19845         *)      : no gethostbyaddr, so pick harmless defaults
19846                 netdb_host_type='char *'
19847                 netdb_hlen_type="$sizetype"
19848                 ;;
19849         esac
19850         # Remove the "const" if needed. -- but then we'll have a 
19851         # prototype clash!
19852         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19853 fi
19854
19855 : check for type of argument to gethostbyname. 
19856 if test "X$netdb_name_type" = X ; then
19857         case "$d_gethbyname" in
19858         $define)
19859                 $cat <<EOM
19860
19861 Checking to see what type of argument is accepted by gethostbyname().
19862 EOM
19863                 hdrs="$define sys/types.h
19864                         $d_socket sys/socket.h 
19865                         $i_niin netinet/in.h 
19866                         $i_netdb netdb.h
19867                         $i_unistd unistd.h"
19868                 for xxx in "const char *" "char *"; do
19869                         case "$netdb_name_type" in
19870                         '')     try="extern struct hostent *gethostbyname($xxx);"
19871                                 if ./protochk "$try" $hdrs; then
19872                                         echo "Your system accepts $xxx."
19873                                         netdb_name_type="$xxx"
19874                                 fi
19875                                 ;;
19876                         esac
19877                 done
19878                 : In case none of those worked, prompt the user.
19879                 case "$netdb_name_type" in
19880                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19881                         dflt='char *'
19882                         . ./myread
19883                         netdb_name_type=$ans
19884                         ;;
19885                 esac
19886                 ;;
19887         *)      : no gethostbyname, so pick harmless default
19888                 netdb_name_type='char *'
19889                 ;;
19890         esac
19891 fi
19892
19893 : check for type of 1st argument to getnetbyaddr. 
19894 if test "X$netdb_net_type" = X ; then
19895         case "$d_getnbyaddr" in
19896         $define)
19897                 $cat <<EOM
19898
19899 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19900 EOM
19901                 hdrs="$define sys/types.h
19902                         $d_socket sys/socket.h 
19903                         $i_niin netinet/in.h 
19904                         $i_netdb netdb.h
19905                         $i_unistd unistd.h"
19906                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19907                         case "$netdb_net_type" in
19908                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19909                                 if ./protochk "$try" $hdrs; then
19910                                         echo "Your system accepts $xxx."
19911                                         netdb_net_type="$xxx"
19912                                 fi
19913                                 ;;
19914                         esac
19915                 done
19916                 : In case none of those worked, prompt the user.
19917                 case "$netdb_net_type" in
19918                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19919                         dflt='long'
19920                         . ./myread
19921                         netdb_net_type=$ans
19922                         ;;
19923                 esac
19924                 ;;
19925         *)      : no getnetbyaddr, so pick harmless default
19926                 netdb_net_type='long'
19927                 ;;
19928         esac
19929 fi
19930 : locate the preferred pager for this system
19931 fn=f/
19932 case "$pager" in
19933 '')
19934         dflt=''
19935         case "$pg" in
19936         /*) dflt=$pg;;
19937         [a-zA-Z]:/*) dflt=$pg;;
19938         esac
19939         case "$more" in
19940         /*) dflt=$more;;
19941         [a-zA-Z]:/*) dflt=$more;;
19942         esac
19943         case "$less" in
19944         /*) dflt=$less;;
19945         [a-zA-Z]:/*) dflt=$less;;
19946         esac
19947         case "$dflt" in
19948         '') dflt=/usr/ucb/more;;
19949         esac
19950         ;;
19951 *)      dflt="$pager"
19952         fn="f/($pager)"
19953         ;;
19954 esac
19955 echo " "
19956 rp='What pager is used on your system?'
19957 . ./getfile
19958 pager="$ans"
19959
19960 : see what type pids are declared as in the kernel
19961 rp="What is the type of process ids on this system?"
19962 set pid_t pidtype int stdio.h sys/types.h
19963 eval $typedef_ask
19964
19965 : see if ar generates random libraries by itself
19966 echo " "
19967 echo "Checking how to generate random libraries on your machine..." >&4
19968 echo 'int bar1() { return bar2(); }' > bar1.c
19969 echo 'int bar2() { return 2; }' > bar2.c
19970 $cat > foo.c <<EOP
19971 #$i_stdlib I_STDLIB
19972 #ifdef I_STDLIB
19973 #include <stdlib.h>
19974 #endif
19975 int main() { printf("%d\n", bar1()); exit(0); }
19976 EOP
19977 $cc $ccflags -c bar1.c >/dev/null 2>&1
19978 $cc $ccflags -c bar2.c >/dev/null 2>&1
19979 $cc $ccflags -c foo.c >/dev/null 2>&1
19980 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19981 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19982         $run ./foobar >/dev/null 2>&1; then
19983         echo "$ar appears to generate random libraries itself."
19984         orderlib=false
19985         if [ "X$ranlib" = "X" ]; then
19986             ranlib=":"
19987         fi
19988 elif $ar s bar$_a >/dev/null 2>&1 &&
19989         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19990         $run ./foobar >/dev/null 2>&1; then
19991                 echo "a table of contents needs to be added with '$ar s'."
19992                 orderlib=false
19993                 ranlib="$ar s"
19994 elif $ar ts bar$_a >/dev/null 2>&1 &&
19995         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19996         $run ./foobar >/dev/null 2>&1; then
19997                 echo "a table of contents needs to be added with '$ar ts'."
19998                 orderlib=false
19999                 ranlib="$ar ts"
20000 else
20001         case "$ranlib" in
20002         :) ranlib='';;
20003         '')
20004                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20005                 $test -f $ranlib || ranlib=''
20006                 ;;
20007         esac
20008         if $test -n "$ranlib"; then
20009                 echo "your system has '$ranlib'; we'll use that."
20010                 orderlib=false
20011         else
20012                 echo "your system doesn't seem to support random libraries"
20013                 echo "so we'll use lorder and tsort to order the libraries."
20014                 orderlib=true
20015                 ranlib=":"
20016         fi
20017 fi
20018 $rm -f foo* bar*
20019
20020 : see if this is a values.h system
20021 set values.h i_values
20022 eval $inhdr
20023
20024 : Check the max offset that gmtime accepts
20025 echo "Checking max offsets that gmtime () accepts"
20026
20027 case $i_values in
20028     define) yyy="#include <values.h>" ;;
20029     *)      yyy="" ;;
20030     esac
20031
20032 $cat >try.c <<EOCP
20033 #include <sys/types.h>
20034 #include <stdio.h>
20035 #include <time.h>
20036 $yyy
20037
20038 int i;
20039 struct tm *tmp;
20040 time_t pt;
20041
20042 void gm_check (time_t t)
20043 {
20044     tmp = gmtime (&t);
20045     if (tmp == NULL || tmp->tm_year < -1900)
20046         tmp = NULL;
20047     else
20048         pt = t;
20049     } /* gm_check */
20050
20051 int check_max ()
20052 {
20053   tmp = NULL;
20054   pt  = 0;
20055 #ifdef MAXLONG
20056   gm_check (MAXLONG);
20057 #endif
20058   if (tmp == NULL || tmp->tm_year < 0) {
20059     for (i = 63; i >= 0; i--) {
20060       time_t x = pt | ((time_t)1 << i);
20061       if (x < 0) continue;
20062       gm_check (x);
20063       }
20064     }
20065   printf ("sGMTIME_max=%ld\n", pt);
20066   return (0);
20067   }
20068
20069 int check_min ()
20070 {
20071   tmp = NULL;
20072   pt  = 0;
20073 #ifdef MINLONG
20074   gm_check (MINLONG);
20075 #endif
20076   if (tmp == NULL) {
20077     for (i = 36; i >= 0; i--) {
20078       time_t x = pt - ((time_t)1 << i);
20079       if (x > 0) continue;
20080       gm_check (x);
20081       }
20082     }
20083   printf ("sGMTIME_min=%ld\n", pt);
20084   return (0);
20085   }
20086
20087 int main (int argc, char *argv[])
20088 {
20089   fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20090   check_max ();
20091   check_min ();
20092   return (0);
20093   } /* main */
20094 EOCP
20095 set try
20096 if eval $compile; then
20097     yyy=`$run ./try`
20098     eval $yyy
20099 else
20100     echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20101     fi
20102 $rm_try
20103
20104 : check for type of arguments to select.
20105 case "$selecttype" in
20106 '') case "$d_select" in
20107         $define)
20108                 echo " "
20109                 $cat <<EOM
20110 Checking to see what type of arguments are accepted by select().
20111 EOM
20112                 hdrs="$define sys/types.h
20113                         $i_systime sys/time.h
20114                         $i_sysselct sys/select.h
20115                         $d_socket sys/socket.h"
20116                 : The first arg can be int, unsigned, or size_t
20117                 : The last arg may or may not be 'const'
20118                 val=''
20119                 : void pointer has been seen but using that
20120                 : breaks the selectminbits test
20121                 for xxx in 'fd_set *' 'int *'; do
20122                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20123                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20124                                         case "$val" in
20125                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20126                                                 if ./protochk "$try" $hdrs; then
20127                                                         echo "Your system accepts $xxx."
20128                                                         val="$xxx"
20129                                                 fi
20130                                                 ;;
20131                                         esac
20132                                 done
20133                         done
20134                 done
20135                 case "$val" in
20136                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20137                         case "$d_fd_set" in
20138                                 $define) dflt="fd_set *" ;;
20139                                 *)              dflt="int *" ;;
20140                         esac
20141                         . ./myread
20142                         val=$ans
20143                         ;;
20144                 esac
20145                 selecttype="$val"
20146                 ;;
20147         *)      : no select, so pick a harmless default
20148                 selecttype='int *'
20149                 ;;
20150         esac
20151         ;;
20152 esac
20153
20154 : check for the select 'width'
20155 case "$selectminbits" in
20156 '') safebits=`expr $ptrsize \* 8`
20157     case "$d_select" in
20158         $define)
20159                 $cat <<EOM
20160
20161 Checking to see on how many bits at a time your select() operates...
20162 EOM
20163                 $cat >try.c <<EOCP
20164 #include <sys/types.h>
20165 #$i_time I_TIME
20166 #$i_systime I_SYS_TIME
20167 #$i_systimek I_SYS_TIME_KERNEL
20168 #ifdef I_TIME
20169 #   include <time.h>
20170 #endif
20171 #ifdef I_SYS_TIME
20172 #   ifdef I_SYS_TIME_KERNEL
20173 #       define KERNEL
20174 #   endif
20175 #   include <sys/time.h>
20176 #   ifdef I_SYS_TIME_KERNEL
20177 #       undef KERNEL
20178 #   endif
20179 #endif
20180 #$i_sysselct I_SYS_SELECT
20181 #ifdef I_SYS_SELECT
20182 #include <sys/select.h>
20183 #endif
20184 #$d_socket HAS_SOCKET
20185 #ifdef HAS_SOCKET
20186 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20187 #endif
20188 #include <stdio.h>
20189 #$i_stdlib I_STDLIB
20190 #ifdef I_STDLIB
20191 #include <stdlib.h>
20192 #endif
20193 $selecttype b;
20194 #define S sizeof(*(b))
20195 #define MINBITS 64
20196 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20197 #define NBITS  (NBYTES * 8)
20198 int main() {
20199     char *s = (char *)malloc(NBYTES);
20200     struct timeval t;
20201     int i;
20202     FILE* fp;
20203     int fd;
20204
20205     if (!s)
20206         exit(1);
20207     fclose(stdin);
20208     fp = fopen("try.c", "r");
20209     if (fp == 0)
20210       exit(2);
20211     fd = fileno(fp);
20212     if (fd < 0)
20213       exit(3);
20214     b = ($selecttype)s;
20215     for (i = 0; i < NBITS; i++)
20216         FD_SET(i, b);
20217     t.tv_sec  = 0;
20218     t.tv_usec = 0;
20219     select(fd + 1, b, 0, 0, &t);
20220     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20221     free(s);
20222     printf("%d\n", i + 1);
20223     return 0;
20224 }
20225 EOCP
20226                 set try
20227                 if eval $compile_ok; then
20228                         selectminbits=`$run ./try`
20229                         case "$selectminbits" in
20230                         '')     cat >&4 <<EOM
20231 Cannot figure out on how many bits at a time your select() operates.
20232 I'll play safe and guess it is $safebits bits.
20233 EOM
20234                                 selectminbits=$safebits
20235                                 bits="$safebits bits"
20236                                 ;;
20237                         1)      bits="1 bit" ;;
20238                         *)      bits="$selectminbits bits" ;;
20239                         esac
20240                         echo "Your select() operates on $bits at a time." >&4
20241                 else
20242                         rp='What is the minimum number of bits your select() operates on?'
20243                         case "$byteorder" in
20244                         12345678)       dflt=64 ;;
20245                         1234)           dflt=32 ;;
20246                         *)              dflt=1  ;;
20247                         esac
20248                         . ./myread
20249                         val=$ans
20250                         selectminbits="$val"
20251                 fi
20252                 $rm_try
20253                 ;;
20254         *)      : no select, so pick a harmless default
20255                 selectminbits=$safebits
20256                 ;;
20257         esac
20258         ;;
20259 esac
20260
20261 : Trace out the files included by signal.h, then look for SIGxxx names.
20262 if [ "X$fieldn" = X ]; then
20263         : Just make some guesses.  We check them later.
20264         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20265 else
20266         xxx=`echo '#include <signal.h>' |
20267         $cppstdin $cppminus $cppflags 2>/dev/null |
20268         $grep '^[       ]*#.*include' |
20269         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20270                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20271 fi
20272 xxxfiles=''
20273 for xx in $xxx /dev/null ; do
20274         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20275 done
20276 case "$xxxfiles" in
20277 '')     xxxfiles=`./findhdr signal.h` ;;
20278 esac
20279 xxx=`awk '
20280 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20281         print substr($2, 4, 20)
20282 }
20283 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20284         print substr($3, 4, 20)
20285 }' $xxxfiles`
20286 : Append some common names just in case the awk scan failed.
20287 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20288 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20289 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20290 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20291 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20292
20293 : generate a few handy files for later
20294 $cat > signal.c <<EOCP
20295 #include <sys/types.h>
20296 #include <signal.h>
20297 #$i_stdlib I_STDLIB
20298 #ifdef I_STDLIB
20299 #include <stdlib.h>
20300 #endif
20301 #include <stdio.h>
20302 int main() {
20303
20304 /* Strange style to avoid deeply-nested #if/#else/#endif */
20305 #ifndef NSIG
20306 #  ifdef _NSIG
20307 #    define NSIG (_NSIG)
20308 #  endif
20309 #endif
20310
20311 #ifndef NSIG
20312 #  ifdef SIGMAX
20313 #    define NSIG (SIGMAX+1)
20314 #  endif
20315 #endif
20316
20317 #ifndef NSIG
20318 #  ifdef SIG_MAX
20319 #    define NSIG (SIG_MAX+1)
20320 #  endif
20321 #endif
20322
20323 #ifndef NSIG
20324 #  ifdef _SIG_MAX
20325 #    define NSIG (_SIG_MAX+1)
20326 #  endif
20327 #endif
20328
20329 #ifndef NSIG
20330 #  ifdef MAXSIG
20331 #    define NSIG (MAXSIG+1)
20332 #  endif
20333 #endif
20334
20335 #ifndef NSIG
20336 #  ifdef MAX_SIG
20337 #    define NSIG (MAX_SIG+1)
20338 #  endif
20339 #endif
20340
20341 #ifndef NSIG
20342 #  ifdef SIGARRAYSIZE
20343 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20344 #  endif
20345 #endif
20346
20347 #ifndef NSIG
20348 #  ifdef _sys_nsig
20349 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20350 #  endif
20351 #endif
20352
20353 /* Default to some arbitrary number that's big enough to get most
20354    of the common signals.
20355 */
20356 #ifndef NSIG
20357 #    define NSIG 50
20358 #endif
20359
20360 printf("NSIG %d\n", NSIG);
20361
20362 #ifndef JUST_NSIG
20363
20364 EOCP
20365
20366 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20367 {
20368         printf "#ifdef SIG"; printf $1; printf "\n"
20369         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20370         printf $1; printf ");\n"
20371         printf "#endif\n"
20372 }
20373 END {
20374         printf "#endif /* JUST_NSIG */\n";
20375         printf "exit(0);\n}\n";
20376 }
20377 ' >>signal.c
20378 $cat >signal.awk <<'EOP'
20379 BEGIN { ndups = 0 }
20380 $1 ~ /^NSIG$/ { nsig = $2 }
20381 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20382     if ($2 > maxsig) { maxsig = $2 }
20383     if (sig_name[$2]) {
20384         dup_name[ndups] = $1
20385         dup_num[ndups] = $2
20386         ndups++
20387     }
20388     else {
20389         sig_name[$2] = $1
20390         sig_num[$2] = $2
20391     }
20392 }
20393 END {
20394     if (nsig == 0) {
20395         nsig = maxsig + 1
20396     }
20397     printf("NSIG %d\n", nsig);
20398     for (n = 1; n < nsig; n++) {
20399         if (sig_name[n]) {
20400             printf("%s %d\n", sig_name[n], sig_num[n])
20401         }
20402         else {
20403             printf("NUM%d %d\n", n, n)
20404         }
20405     }
20406     for (n = 0; n < ndups; n++) {
20407         printf("%s %d\n", dup_name[n], dup_num[n])
20408     }
20409 }
20410 EOP
20411 $cat >signal_cmd <<EOS
20412 $startsh
20413 if $test -s signal.lst; then
20414     echo "Using your existing signal.lst file"
20415         exit 0
20416 fi
20417 xxx="$xxx"
20418 EOS
20419 $cat >>signal_cmd <<'EOS'
20420
20421 set signal
20422 if eval $compile_ok; then
20423         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20424                 $uniq | $awk -f signal.awk >signal.lst
20425 else
20426         echo "(I can't seem be able to compile the whole test program)" >&4
20427         echo "(I'll try it in little pieces.)" >&4
20428         set signal -DJUST_NSIG
20429         if eval $compile_ok; then
20430                 $run ./signal$_exe > signal.nsg
20431                 $cat signal.nsg
20432         else
20433                 echo "I can't seem to figure out how many signals you have." >&4
20434                 echo "Guessing 50." >&4
20435                 echo 'NSIG 50' > signal.nsg
20436         fi
20437         : Now look at all the signal names, one at a time.
20438         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20439                 $cat > signal.c <<EOCP
20440 #include <sys/types.h>
20441 #include <signal.h>
20442 #include <stdio.h>
20443 int main() {
20444 printf("$xx %d\n", SIG${xx});
20445 return 0;
20446 }
20447 EOCP
20448                 set signal
20449                 if eval $compile; then
20450                         echo "SIG${xx} found."
20451                         $run ./signal$_exe  >> signal.ls1
20452                 else
20453                         echo "SIG${xx} NOT found."
20454                 fi
20455         done
20456         if $test -s signal.ls1; then
20457                 $cat signal.nsg signal.ls1 |
20458                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20459         fi
20460
20461 fi
20462 if $test -s signal.lst; then
20463         :
20464 else
20465         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20466         echo 'kill -l' >signal
20467         set X `csh -f <signal`
20468         $rm -f signal
20469         shift
20470         case $# in
20471         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20472         esac
20473         echo $@ | $tr ' ' $trnl | \
20474             $awk '{ printf "%s %d\n", $1, ++s; }
20475                   END { printf "NSIG %d\n", ++s }' >signal.lst
20476 fi
20477 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20478 EOS
20479 chmod a+x signal_cmd
20480 $eunicefix signal_cmd
20481
20482 : generate list of signal names
20483 echo " "
20484 case "$sig_name_init" in
20485 '') doinit=yes ;;
20486 *)  case "$sig_num_init" in
20487     ''|*,*) doinit=yes ;;
20488     esac ;;
20489 esac
20490 case "$doinit" in
20491 yes)
20492         echo "Generating a list of signal names and numbers..." >&4
20493         . ./signal_cmd
20494         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20495         sig_name=`$awk 'BEGIN { printf "ZERO " }
20496                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20497         sig_num=`$awk  'BEGIN { printf "0 " }
20498                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20499         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20500                              !/^NSIG/   { printf "\"%s\", ", $1 }
20501                              END        { printf "0\n" }' signal.lst`
20502         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20503                              !/^NSIG/   { printf "%d, ", $2}
20504                              END        { printf "0\n"}' signal.lst`
20505         ;;
20506 esac
20507 echo "The following $sig_count signals are available:"
20508 echo " "
20509 echo $sig_name | $awk \
20510 'BEGIN { linelen = 0 }
20511 {
20512         for (i = 1; i <= NF; i++) {
20513                 name = "SIG" $i " "
20514                 linelen = linelen + length(name)
20515                 if (linelen > 70) {
20516                         printf "\n"
20517                         linelen = length(name)
20518                 }
20519                 printf "%s", name
20520         }
20521         printf "\n"
20522 }'
20523 sig_size=`echo $sig_name | awk '{print NF}'`
20524 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20525
20526 : Check size of size
20527 echo " "
20528 case "$sizetype" in
20529 *_t) zzz="$sizetype"    ;;
20530 *)   zzz="filesize"     ;;
20531 esac
20532 echo "Checking the size of $zzz..." >&4
20533 cat > try.c <<EOCP
20534 #include <sys/types.h>
20535 #include <stdio.h>
20536 #$i_stdlib I_STDLIB
20537 #ifdef I_STDLIB
20538 #include <stdlib.h>
20539 #endif
20540 int main() {
20541     printf("%d\n", (int)sizeof($sizetype));
20542     exit(0);
20543 }
20544 EOCP
20545 set try
20546 if eval $compile_ok; then
20547         yyy=`$run ./try`
20548         case "$yyy" in
20549         '')     sizesize=4
20550                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20551                 ;;
20552         *)      sizesize=$yyy
20553                 echo "Your $zzz size is $sizesize bytes."
20554                 ;;
20555         esac
20556 else
20557         sizesize=4
20558         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20559 fi
20560
20561
20562 : check for socklen_t
20563 echo " "
20564 echo "Checking to see if you have socklen_t..." >&4
20565 $cat >try.c <<EOCP
20566 #include <sys/types.h>
20567 #$d_socket HAS_SOCKET
20568 #ifdef HAS_SOCKET
20569 #include <sys/socket.h>
20570 #endif
20571 int main() { socklen_t x = 16; }
20572 EOCP
20573 set try
20574 if eval $compile; then
20575         val="$define"
20576         echo "You have socklen_t."
20577 else
20578         val="$undef"
20579         echo "You do not have socklen_t."
20580         case "$sizetype" in
20581         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20582         esac
20583 fi
20584 $rm_try
20585 set d_socklen_t
20586 eval $setvar
20587
20588 : see if this is a socks.h system
20589 set socks.h i_socks
20590 eval $inhdr
20591
20592 : check for type of the size argument to socket calls
20593 case "$d_socket" in
20594 "$define")
20595         $cat <<EOM
20596
20597 Checking to see what type is the last argument of accept().
20598 EOM
20599         yyy=''
20600         case "$d_socklen_t" in
20601         "$define") yyy="$yyy socklen_t"
20602         esac
20603         yyy="$yyy $sizetype int long unsigned"
20604         for xxx in $yyy; do
20605                 case "$socksizetype" in
20606                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20607                         case "$usesocks" in
20608                         "$define")
20609                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20610                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20611                                         socksizetype="$xxx"
20612                                 fi
20613                                 ;;
20614                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20615                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20616                                         socksizetype="$xxx"
20617                                 fi
20618                                 ;;
20619                         esac
20620                         ;;
20621                 esac
20622         done
20623 : In case none of those worked, prompt the user.
20624         case "$socksizetype" in
20625         '')     rp='What is the type for socket address structure sizes?'
20626                 dflt='int'
20627                 . ./myread
20628                 socksizetype=$ans
20629                 ;;
20630         esac
20631         ;;
20632 *)      : no sockets, so pick relatively harmless default
20633         socksizetype='int'
20634         ;;
20635 esac
20636
20637 : see what type is used for signed size_t
20638 set ssize_t ssizetype int stdio.h sys/types.h
20639 eval $typedef
20640 dflt="$ssizetype"
20641 $cat > try.c <<EOM
20642 #include <stdio.h>
20643 #$i_stdlib I_STDLIB
20644 #ifdef I_STDLIB
20645 #include <stdlib.h>
20646 #endif
20647 #include <sys/types.h>
20648 #define Size_t $sizetype
20649 #define SSize_t $dflt
20650 int main()
20651 {
20652         if (sizeof(Size_t) == sizeof(SSize_t))
20653                 printf("$dflt\n");
20654         else if (sizeof(Size_t) == sizeof(int))
20655                 printf("int\n");
20656         else
20657                 printf("long\n");
20658         exit(0);
20659 }
20660 EOM
20661 echo " "
20662 set try
20663 if eval $compile_ok && $run ./try > /dev/null; then
20664         ssizetype=`$run ./try`
20665         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20666 else
20667         $cat >&4 <<EOM
20668 Help! I can't compile and run the ssize_t test program: please enlighten me!
20669 (This is probably a misconfiguration in your system or libraries, and
20670 you really ought to fix it.  Still, I'll try anyway.)
20671
20672 I need a type that is the same size as $sizetype, but is guaranteed to
20673 be signed.  Common values are ssize_t, int and long.
20674
20675 EOM
20676         rp="What signed type is the same size as $sizetype?"
20677         . ./myread
20678         ssizetype="$ans"
20679 fi
20680 $rm_try
20681
20682 : see what type of char stdio uses.
20683 echo " "
20684 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20685 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20686         echo "Your stdio uses unsigned chars." >&4
20687         stdchar="unsigned char"
20688 else
20689         echo "Your stdio uses signed chars." >&4
20690         stdchar="char"
20691 fi
20692 $rm -f stdioh
20693
20694 : see what type uids are declared as in the kernel
20695 echo " "
20696 echo "Looking for the type for user ids returned by getuid()."
20697 set uid_t uidtype xxx stdio.h sys/types.h
20698 eval $typedef
20699 case "$uidtype" in
20700 xxx)
20701         xxx=`./findhdr sys/user.h`
20702         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20703         case $1 in
20704         unsigned) dflt="$1 $2" ;;
20705         *) dflt="$1" ;;
20706         esac
20707         ;;
20708 *) dflt="$uidtype";;
20709 esac
20710 case "$uidtype" in
20711 uid_t)  echo "uid_t found." ;;
20712 *)      rp="What is the type for user ids returned by getuid()?"
20713         . ./myread
20714         uidtype="$ans"
20715         ;;
20716 esac
20717
20718 : Check size of UID
20719 echo " "
20720 case "$uidtype" in
20721 *_t) zzz="$uidtype"     ;;
20722 *)   zzz="uid"          ;;
20723 esac
20724 echo "Checking the size of $zzz..." >&4
20725 cat > try.c <<EOCP
20726 #include <sys/types.h>
20727 #include <stdio.h>
20728 #$i_stdlib I_STDLIB
20729 #ifdef I_STDLIB
20730 #include <stdlib.h>
20731 #endif
20732 int main() {
20733     printf("%d\n", (int)sizeof($uidtype));
20734     exit(0);
20735 }
20736 EOCP
20737 set try
20738 if eval $compile_ok; then
20739         yyy=`$run ./try`
20740         case "$yyy" in
20741         '')     uidsize=4
20742                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20743                 ;;
20744         *)      uidsize=$yyy
20745                 echo "Your $zzz is $uidsize bytes long."
20746                 ;;
20747         esac
20748 else
20749         uidsize=4
20750         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20751 fi
20752
20753 : Check if UID is signed
20754 echo " "
20755 case "$uidtype" in
20756 *_t) zzz="$uidtype"     ;;
20757 *)   zzz="uid"          ;;
20758 esac
20759 echo "Checking the sign of $zzz..." >&4
20760 cat > try.c <<EOCP
20761 #include <sys/types.h>
20762 #include <stdio.h>
20763 int main() {
20764         $uidtype foo = -1;
20765         if (foo < 0)
20766                 printf("-1\n");
20767         else
20768                 printf("1\n");
20769 }
20770 EOCP
20771 set try
20772 if eval $compile; then
20773         yyy=`$run ./try`
20774         case "$yyy" in
20775         '')     uidsign=1
20776                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20777                 ;;
20778         *)      uidsign=$yyy
20779                 case "$uidsign" in
20780                  1) echo "Your $zzz is unsigned." ;;
20781                 -1) echo "Your $zzz is signed."   ;;
20782                 esac
20783                 ;;
20784         esac
20785 else
20786         uidsign=1
20787         echo "(I can't compile the test program--guessing unsigned.)" >&4
20788 fi
20789
20790
20791 : Check format string for UID
20792 echo " "
20793 $echo "Checking the format string to be used for uids..." >&4
20794
20795 case "$uidsign" in
20796 -1)     if $test X"$uidsize" = X"$ivsize"; then
20797                 uidformat="$ivdformat"
20798         else
20799                 if $test X"$uidsize" = X"$longsize"; then
20800                         uidformat='"ld"'
20801                 else
20802                         if $test X"$uidsize" = X"$intsize"; then
20803                                 uidformat='"d"'
20804                         else
20805                                 if $test X"$uidsize" = X"$shortsize"; then
20806                                         uidformat='"hd"'
20807                                 fi
20808                         fi
20809                 fi
20810         fi
20811         ;;
20812 *)      if $test X"$uidsize" = X"$uvsize"; then
20813                 uidformat="$uvuformat"
20814         else
20815                 if $test X"$uidsize" = X"$longsize"; then
20816                         uidformat='"lu"'
20817                 else
20818                         if $test X"$uidsize" = X"$intsize"; then
20819                                 uidformat='"u"'
20820                         else
20821                                 if $test X"$uidsize" = X"$shortsize"; then
20822                                         uidformat='"hu"'
20823                                 fi
20824                         fi
20825                 fi
20826         fi
20827         ;;
20828 esac
20829
20830 : Check if site customization support was requested
20831 case "$usesitecustomize" in
20832     $define|true|[Yy]*)
20833         usesitecustomize="$define"
20834         ;;
20835     *)
20836         usesitecustomize="$undef"
20837         ;;
20838     esac
20839
20840 : determine compiler compiler
20841 case "$yacc" in
20842 '')
20843         dflt=yacc;;
20844 *)
20845         dflt="$yacc";;
20846 esac
20847 echo " "
20848 comp='yacc'
20849 if $test -f "$byacc$_exe"; then
20850         dflt="$byacc"
20851         comp="byacc or $comp"
20852 fi
20853 if $test -f "$bison$_exe"; then
20854         comp="$comp or bison -y"
20855 fi
20856 rp="Which compiler compiler ($comp) shall I use?"
20857 . ./myread
20858 yacc="$ans"
20859 case "$yacc" in
20860 *bis*)
20861         case "$yacc" in
20862         *-y*) ;;
20863         *)
20864                 yacc="$yacc -y"
20865                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20866                 ;;
20867         esac
20868         ;;
20869 esac
20870
20871 : see if this is a assert.h system
20872 set assert.h i_assert
20873 eval $inhdr
20874
20875 : see if this is a fp.h system
20876 set fp.h i_fp
20877 eval $inhdr
20878
20879 : see if this is a fp_class.h system
20880 set fp_class.h i_fp_class
20881 eval $inhdr
20882
20883 : see if gdbm.h is available
20884 set gdbm.h t_gdbm
20885 eval $inhdr
20886 case "$t_gdbm" in
20887 $define)
20888         : see if gdbm_open exists
20889         set gdbm_open d_gdbm_open
20890         eval $inlibc
20891         case "$d_gdbm_open" in
20892         $undef)
20893                 t_gdbm="$undef"
20894                 echo "We won't be including <gdbm.h>"
20895                 ;;
20896         esac
20897         ;;
20898 esac
20899 val="$t_gdbm"
20900 set i_gdbm
20901 eval $setvar
20902
20903 : see if ndbm.h is available
20904 set ndbm.h i_ndbm
20905 eval $inhdr
20906 : Compatibility location for RedHat 7.1
20907 set gdbm/ndbm.h i_gdbmndbm
20908 eval $inhdr
20909 : Compatibility location for Debian 4.0
20910 set gdbm-ndbm.h i_gdbm_ndbm
20911 eval $inhdr
20912
20913 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20914         : see if dbm_open exists
20915         set dbm_open d_dbm_open
20916         eval $inlibc
20917         case "$d_dbm_open" in
20918         $undef)
20919                 i_ndbm="$undef"
20920                 i_gdbmndbm="$undef"
20921                 i_gdbm_ndbm="$undef"
20922                 echo "We won't be including <ndbm.h>"
20923             val="$undef"
20924                 ;;
20925         *) val="$define"
20926            ;;
20927         esac
20928 fi
20929 set d_ndbm
20930 eval $setvar
20931
20932 : see if this is a ieeefp.h system
20933 case "$i_ieeefp" in
20934 '' ) set ieeefp.h i_ieeefp
20935      eval $inhdr
20936      ;;
20937 esac
20938
20939 : see if this is a libutil.h system
20940 set libutil.h i_libutil
20941 eval $inhdr
20942
20943 : see if mach cthreads are available
20944 if test "X$usethreads" = "X$define"; then
20945         set mach/cthreads.h i_machcthr
20946         eval $inhdr
20947 else
20948         i_machcthr="$undef"
20949 fi
20950
20951 : see if this is a mntent.h system
20952 set mntent.h i_mntent
20953 eval $inhdr
20954
20955 : see if net/errno.h is available
20956 val=''
20957 set net/errno.h val
20958 eval $inhdr
20959
20960 : Unfortunately, it causes problems on some systems.  Arrgh.
20961 case "$val" in
20962 $define)
20963         cat > try.c <<'EOM'
20964 #include <stdio.h>
20965 #include <errno.h>
20966 #include <net/errno.h>
20967 int func()
20968 {
20969         return ENOTSOCK;
20970 }
20971 EOM
20972         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20973                 echo "We'll be including <net/errno.h>." >&4
20974         else
20975                 echo "We won't be including <net/errno.h>." >&4
20976                 val="$undef"
20977         fi
20978         $rm_try
20979         ;;
20980 esac
20981 set i_neterrno
20982 eval $setvar
20983
20984 : see if netinet/tcp.h is available
20985 set netinet/tcp.h i_netinettcp
20986 eval $inhdr
20987
20988 : see if this is a poll.h system
20989 set poll.h i_poll
20990 eval $inhdr
20991
20992 : see if this is a prot.h system
20993 set prot.h i_prot
20994 eval $inhdr
20995
20996 : Preprocessor symbols
20997 echo " "
20998 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20999 $cat <<'EOSH' > Cppsym.know
21000 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21001 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21002 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21003 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21004 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21005 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21006 bull c cadmus clipper CMU COFF COMPILER_VERSION
21007 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21008 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21009 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21010 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21011 GLIBC GLIBC_MINOR
21012 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21013 H3050R H3050RX hbullx20 hcx host_mips
21014 hp200 hp300 hp700 HP700 hp800 hp9000
21015 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21016 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21017 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21018 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21019 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21020 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21021 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21022 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21023 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21024 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21025 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21026 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21027 MATH_HAS_NO_SIDE_EFFECTS
21028 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21029 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21030 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21031 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21032 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21033 NetBSD news1500 news1700 news1800 news1900 news3700
21034 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21035 ns32016 ns32332 ns32k nsc32000
21036 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21037 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21038 pc532 pdp11 PGC PIC plexus PORTAR posix
21039 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21040 POSIX_C_SOURCE POSIX_SOURCE POWER
21041 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21042 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21043 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21044 sony sony_news sonyrisc sparc sparclite spectrum
21045 stardent stdc STDC_EXT stratos sun sun3 sun386
21046 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21047 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21048 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21049 sysV68 sysV88 Tek4132 Tek4300 titan
21050 TM3200 TM5400 TM5600
21051 tower tower32 tower32_200 tower32_600 tower32_700
21052 tower32_800 tower32_850 tss
21053 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21054 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21055 unix UNIX95 UNIX99 unixpc unos
21056 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21057 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21058 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21059 USGr4 USGr4_2
21060 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21061 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21062 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21063 z8000
21064 EOSH
21065 # Maybe put other stuff here too.
21066 cat <<EOSH >>Cppsym.know
21067 $osname
21068 EOSH
21069 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21070 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21071 $cat Cppsym.know > Cppsym.c
21072 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21073 $rm -f Cppsym.a Cppsym.b Cppsym.c
21074 cat <<EOSH > Cppsym
21075 $startsh
21076 if $test \$# -gt 0; then
21077     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21078     if $test -s Cppsym.got; then
21079         $rm -f Cppsym.got
21080         exit 0
21081     fi
21082     $rm -f Cppsym.got
21083     exit 1
21084 else
21085     $tr " " "$trnl" | ./Cppsym.try
21086     exit 0
21087 fi
21088 EOSH
21089 chmod +x Cppsym
21090 $eunicefix Cppsym
21091 cat <<EOSH > Cppsym.try
21092 $startsh
21093 cat <<'EOCP' > try.c
21094 #include <stdio.h>
21095 #if cpp_stuff == 1
21096 #define STRINGIFY(a)    "a"
21097 #endif
21098 #if cpp_stuff == 42
21099 #define StGiFy(a)  #a
21100 #define STRINGIFY(a)    StGiFy(a)
21101 #endif
21102 #if $cpp_stuff != 1 && $cpp_stuff != 42
21103 #   include "Bletch: How does this C preprocessor stringify macros?"
21104 #endif
21105 int main() {
21106 EOCP
21107 $awk \\
21108 EOSH
21109 cat <<'EOSH' >> Cppsym.try
21110 'length($1) > 0 {
21111     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21112     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21113     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21114     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21115 }'       >> try.c
21116 echo 'return 0;}' >> try.c
21117 EOSH
21118 cat <<EOSH >> Cppsym.try
21119 ccflags="$ccflags"
21120 case "$osname-$gccversion" in
21121 irix-) ccflags="\$ccflags -woff 1178" ;;
21122 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21123 esac
21124 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21125 EOSH
21126 chmod +x Cppsym.try
21127 $eunicefix Cppsym.try
21128 ./Cppsym < Cppsym.know > Cppsym.true
21129 : Add in any linux cpp "predefined macros":
21130 case "$osname::$gccversion" in
21131   *linux*::*.*)
21132     tHdrH=_tmpHdr
21133     rm -f $tHdrH'.h' $tHdrH
21134     touch $tHdrH'.h'
21135     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21136        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21137        if [ -s $tHdrH'_cppsym.real' ]; then
21138           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21139        fi
21140     fi
21141     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21142   ;;
21143 esac
21144 : now check the C compiler for additional symbols
21145 postprocess_cc_v=''
21146 case "$osname" in
21147 aix) postprocess_cc_v="|$tr , ' '" ;;
21148 esac
21149 $cat >ccsym <<EOS
21150 $startsh
21151 $cat >tmp.c <<EOF
21152 extern int foo;
21153 EOF
21154 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21155 do
21156         case "\$i" in
21157         -D*) echo "\$i" | $sed 's/^-D//';;
21158         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21159         esac
21160 done
21161 $rm_try
21162 EOS
21163 postprocess_cc_v=''
21164 chmod +x ccsym
21165 $eunicefix ccsym
21166 ./ccsym > ccsym1.raw
21167 if $test -s ccsym1.raw; then
21168        $sort ccsym1.raw | $uniq >ccsym.raw
21169 else
21170        mv ccsym1.raw ccsym.raw
21171 fi
21172
21173 $awk '/\=/ { print $0; next }
21174         { print $0"=1" }' ccsym.raw >ccsym.list
21175 $comm -13 Cppsym.true ccsym.list >ccsym.own
21176 $comm -12 Cppsym.true ccsym.list >ccsym.com
21177 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21178 also=''
21179 if $test -z ccsym.raw; then
21180         echo "Your C compiler doesn't seem to define any symbols!" >&4
21181         echo " "
21182         echo "However, your C preprocessor defines the following symbols:"
21183         $cat Cppsym.true
21184         ccsymbols=''
21185         cppsymbols=`$cat Cppsym.true`
21186         cppsymbols=`echo $cppsymbols`
21187         cppccsymbols="$cppsymbols"
21188 else
21189         if $test -s ccsym.com; then
21190                 echo "Your C compiler and pre-processor define these symbols:"
21191                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21192                 also='also '
21193                 symbols='ones'
21194                 cppccsymbols=`$cat ccsym.com`
21195                 cppccsymbols=`echo $cppccsymbols`
21196                 $test "$silent" || sleep 1
21197         fi
21198         if $test -s ccsym.cpp; then
21199                 $test "$also" && echo " "
21200                 echo "Your C pre-processor ${also}defines the following symbols:"
21201                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21202                 also='further '
21203                 cppsymbols=`$cat ccsym.cpp`
21204                 cppsymbols=`echo $cppsymbols`
21205                 $test "$silent" || sleep 1
21206         fi
21207         if $test -s ccsym.own; then
21208                 $test "$also" && echo " "
21209                 echo "Your C compiler ${also}defines the following cpp symbols:"
21210                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21211                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21212                 ccsymbols=`$cat ccsym.own`
21213                 ccsymbols=`echo $ccsymbols`
21214                 $test "$silent" || sleep 1
21215         fi
21216 fi
21217
21218 : see if this is a termio system
21219 val="$undef"
21220 val2="$undef"
21221 val3="$undef"
21222 if $test `./findhdr termios.h`; then
21223         set tcsetattr i_termios
21224         eval $inlibc
21225         val3="$i_termios"
21226 fi
21227 echo " "
21228 case "$val3" in
21229 "$define") echo "You have POSIX termios.h... good!" >&4;;
21230 *) if ./Cppsym pyr; then
21231                 case "`/bin/universe`" in
21232                 ucb) if $test `./findhdr sgtty.h`; then
21233                                 val2="$define"
21234                                 echo "<sgtty.h> found." >&4
21235                         else
21236                                 echo "System is pyramid with BSD universe."
21237                                 ./warn "<sgtty.h> not found--you could have problems."
21238                         fi;;
21239                 *) if $test `./findhdr termio.h`; then
21240                                 val="$define"
21241                                 echo "<termio.h> found." >&4
21242                         else
21243                                 echo "System is pyramid with USG universe."
21244                                 ./warn "<termio.h> not found--you could have problems."
21245                         fi;;
21246                 esac
21247         elif ./usg; then
21248                 if $test `./findhdr termio.h`; then
21249                         echo "<termio.h> found." >&4
21250                         val="$define"
21251                 elif $test `./findhdr sgtty.h`; then
21252                         echo "<sgtty.h> found." >&4
21253                         val2="$define"
21254                 else
21255                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21256                 fi
21257         else
21258                 if $test `./findhdr sgtty.h`; then
21259                         echo "<sgtty.h> found." >&4
21260                         val2="$define"
21261                 elif $test `./findhdr termio.h`; then
21262                         echo "<termio.h> found." >&4
21263                         val="$define"
21264                 else
21265                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21266                 fi
21267         fi;;
21268 esac
21269 set i_termio; eval $setvar
21270 val=$val2; set i_sgtty; eval $setvar
21271 val=$val3; set i_termios; eval $setvar
21272
21273 : see if stddef is available
21274 set stddef.h i_stddef
21275 eval $inhdr
21276
21277 : see if sys/access.h is available
21278 set sys/access.h i_sysaccess
21279 eval $inhdr
21280
21281 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21282 set sys/filio.h i_sysfilio
21283 eval $inhdr
21284 echo " "
21285 if $test `./findhdr sys/ioctl.h`; then
21286         val="$define"
21287         echo '<sys/ioctl.h> found.' >&4
21288 else
21289         val="$undef"
21290         if $test $i_sysfilio = "$define"; then
21291             echo '<sys/ioctl.h> NOT found.' >&4
21292         else
21293                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21294                 $test $i_termio = "$define" && xxx="termio.h"
21295                 $test $i_termios = "$define" && xxx="termios.h"
21296 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21297         fi
21298 fi
21299 set i_sysioctl
21300 eval $setvar
21301
21302 : see if socket ioctl defs are in sys/sockio.h
21303 echo " "
21304 xxx=`./findhdr sys/sockio.h`
21305 if $test "$xxx"; then
21306         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21307                 val="$define"
21308                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21309         else
21310                 val="$undef"
21311                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21312         fi
21313 else
21314         val="$undef"
21315         $cat <<EOM
21316 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21317 EOM
21318 fi
21319 set i_syssockio
21320 eval $setvar
21321
21322 : see if this is a syslog.h system
21323 set syslog.h i_syslog
21324 eval $inhdr
21325
21326 : see if this is a sys/mode.h system
21327 set sys/mode.h i_sysmode
21328 eval $inhdr
21329
21330 : see if there is a sys/poll.h file
21331 set sys/poll.h i_syspoll
21332 eval $inhdr
21333
21334 : see if sys/resource.h has to be included
21335 set sys/resource.h i_sysresrc
21336 eval $inhdr
21337
21338 : see if sys/security.h is available
21339 set sys/security.h i_syssecrt
21340 eval $inhdr
21341
21342 : see if this is a sys/statvfs.h system
21343 set sys/statvfs.h i_sysstatvfs
21344 eval $inhdr
21345
21346 : see if this is a sys/un.h system
21347 set sys/un.h i_sysun
21348 eval $inhdr
21349
21350 : see if this is a sys/utsname.h system
21351 set sys/utsname.h i_sysutsname
21352 eval $inhdr
21353
21354 : see if this is a syswait system
21355 set sys/wait.h i_syswait
21356 eval $inhdr
21357
21358 : see if this is a ustat.h system
21359 set ustat.h i_ustat
21360 eval $inhdr
21361
21362 : see if this is an utime system
21363 set utime.h i_utime
21364 eval $inhdr
21365
21366 : see if this is a vfork system
21367 case "$d_vfork" in
21368 "$define")
21369         set vfork.h i_vfork
21370         eval $inhdr
21371         ;;
21372 *)
21373         i_vfork="$undef"
21374         ;;
21375 esac
21376
21377 : Check extensions
21378 echo " "
21379 echo "Looking for extensions..." >&4
21380 : If we are using the old config.sh, known_extensions may contain
21381 : old or inaccurate or duplicate values.
21382 known_extensions=''
21383 nonxs_extensions=''
21384 : We do not use find because it might not be available.
21385 : We do not just use MANIFEST because the user may have dropped
21386 : some additional extensions into the source tree and expect them
21387 : to be built.
21388
21389 : Function to recursively find available extensions, ignoring DynaLoader
21390 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21391 find_extensions='
21392     for xxx in *; do
21393         case "$xxx" in
21394             DynaLoader|dynaload) ;;
21395             *)
21396             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21397                 known_extensions="$known_extensions $1$xxx";
21398             elif $test -f $xxx/Makefile.PL; then
21399                 nonxs_extensions="$nonxs_extensions $1$xxx";
21400             else
21401                 if $test -d $xxx -a $# -lt 10; then
21402                     set $1$xxx/ $*;
21403                     cd "$xxx";
21404                     eval $find_extensions;
21405                     cd ..;
21406                     shift;
21407                 fi;
21408             fi
21409             ;;
21410         esac;
21411     done'
21412 tdir=`pwd`
21413 cd "$rsrc/ext"
21414 set X
21415 shift
21416 eval $find_extensions
21417 # Special case:  Add in modules that nest beyond the first level.
21418 # Currently threads/shared and Hash/Util/FieldHash, since they are
21419 # not picked up by the recursive find above (and adding in general
21420 # recursive finding breaks SDBM_File/sdbm).
21421 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21422 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21423 set X $known_extensions
21424 shift
21425 known_extensions="$*"
21426 set X $nonxs_extensions
21427 shift
21428 nonxs_extensions="$*"
21429 cd "$tdir"
21430
21431 : Now see which are supported on this system.
21432 avail_ext=''
21433 for xxx in $known_extensions ; do
21434         case "$xxx" in
21435         DB_File|db_file)
21436                 case "$i_db" in
21437                 $define) avail_ext="$avail_ext $xxx" ;;
21438                 esac
21439                 ;;
21440         GDBM_File|gdbm_fil)
21441                 case "$i_gdbm" in
21442                 $define) avail_ext="$avail_ext $xxx" ;;
21443                 esac
21444                 ;;
21445         I18N/Langinfo|i18n_lan)
21446                 case "$i_langinfo$d_nl_langinfo" in
21447                 $define$define) avail_ext="$avail_ext $xxx" ;;
21448                 esac
21449                 ;;
21450         IPC/SysV|ipc/sysv)
21451                 : XXX Do we need a useipcsysv variable here
21452                 case "${d_msg}${d_sem}${d_shm}" in
21453                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21454                 esac
21455                 ;;
21456         NDBM_File|ndbm_fil)
21457                 case "$i_ndbm" in
21458                 $define)
21459                     case "$osname-$use64bitint" in
21460                     hpux-define)
21461                         case "$libs" in
21462                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21463                         esac
21464                         ;;
21465                     *) avail_ext="$avail_ext $xxx" ;;
21466                     esac
21467                     ;;
21468                 esac
21469                 ;;
21470         ODBM_File|odbm_fil)
21471                 case "${i_dbm}${i_rpcsvcdbm}" in
21472                 *"${define}"*)
21473                     case "$d_cplusplus" in
21474                     define) ;; # delete as a function name will not work
21475                     *)  case "$osname-$use64bitint" in
21476                         hpux-define)
21477                             case "$libs" in
21478                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21479                             esac
21480                             ;;
21481                         *) avail_ext="$avail_ext $xxx" ;;
21482                         esac
21483                         ;;
21484                     esac
21485                     ;;
21486                 esac
21487                 ;;
21488         Opcode|opcode)
21489                 case "$useopcode" in
21490                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21491                 esac
21492                 ;;
21493         POSIX|posix)
21494                 case "$useposix" in
21495                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21496                 esac
21497                 ;;
21498         Socket|socket)
21499                 case "$d_socket" in
21500                 true|$define|y)
21501                     case "$osname" in
21502                     beos) ;; # not unless BONE
21503                     *) avail_ext="$avail_ext $xxx" ;;
21504                     esac
21505                     ;;
21506                 esac
21507                 ;;
21508         Sys/Syslog|sys/syslog)
21509                 : XXX syslog requires socket
21510                 case "$d_socket" in
21511                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21512                 esac
21513                 ;;
21514         Thread|thread)
21515                 case "$usethreads" in
21516                 true|$define|y)
21517                         case "$use5005threads" in
21518                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21519                         esac
21520                 esac
21521                 ;;
21522         threads|threads/shared)
21523                 # threads and threads::shared are special cases.
21524                 # To stop people from asking "Perl 5.8.0 was supposed
21525                 # to have this new fancy threads implementation but my
21526                 # perl doesn't have it" and from people trying to
21527                 # (re)install the threads module using CPAN.pm and
21528                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21529                 # the threads.pm and threads/shared.pm will always be
21530                 # there, croaking informatively ("you need to rebuild
21531                 # all of Perl with threads, sorry") when threads haven't
21532                 # been compiled in.
21533                 # --jhi
21534                 avail_ext="$avail_ext $xxx"
21535                 ;;
21536         Win32*)
21537                 case "$osname" in
21538                 cygwin) avail_ext="$avail_ext $xxx" ;;
21539                 esac
21540                 ;;
21541         XS/APItest|xs/apitest)
21542                 # This is just for testing.  Skip it unless we have dynamic loading.
21543
21544                 case "$usedl" in
21545                 $define) avail_ext="$avail_ext $xxx" ;;
21546                 esac
21547                 ;;
21548         XS/Typemap|xs/typemap)
21549                 # This is just for testing.  Skip it unless we have dynamic loading.
21550                 case "$usedl" in
21551                 $define) avail_ext="$avail_ext $xxx" ;;
21552                 esac
21553                 ;;
21554         *)      avail_ext="$avail_ext $xxx"
21555                 ;;
21556         esac
21557 done
21558
21559 set X $avail_ext
21560 shift
21561 avail_ext="$*"
21562
21563 case "$onlyextensions" in
21564 '') ;;
21565 *)  keepextensions=''
21566     echo "You have requested that only certains extensions be included..." >&4
21567     for i in $onlyextensions; do
21568         case " $avail_ext " in
21569         *" $i "*)
21570             echo "Keeping extension $i."
21571             keepextensions="$keepextensions $i"
21572             ;;
21573         *) echo "Ignoring extension $i." ;;
21574         esac
21575     done
21576     avail_ext="$keepextensions"
21577     ;;
21578 esac
21579
21580 case "$noextensions" in
21581 '') ;;
21582 *)  keepextensions=''
21583     echo "You have requested that certain extensions be ignored..." >&4
21584     for i in $avail_ext; do
21585         case " $noextensions " in
21586         *" $i "*) echo "Ignoring extension $i." ;;
21587         *) echo "Keeping extension $i.";
21588            keepextensions="$keepextensions $i"
21589            ;;
21590         esac
21591     done
21592     avail_ext="$keepextensions"
21593     ;;
21594 esac
21595
21596 : Now see which nonxs extensions are supported on this system.
21597 : For now assume all are.
21598 nonxs_ext=''
21599 for xxx in $nonxs_extensions ; do
21600         case "$xxx" in
21601         *)      nonxs_ext="$nonxs_ext $xxx"
21602                 ;;
21603         esac
21604 done
21605
21606 set X $nonxs_ext
21607 shift
21608 nonxs_ext="$*"
21609
21610 case $usedl in
21611 $define)
21612         $cat <<EOM
21613 A number of extensions are supplied with $package.  You may choose to
21614 compile these extensions for dynamic loading (the default), compile
21615 them into the $package executable (static loading), or not include
21616 them at all.  Answer "none" to include no extensions.
21617 Note that DynaLoader is always built and need not be mentioned here.
21618
21619 EOM
21620         case "$dynamic_ext" in
21621         '')
21622                 : Exclude those listed in static_ext
21623                 dflt=''
21624                 for xxx in $avail_ext; do
21625                         case " $static_ext " in
21626                         *" $xxx "*) ;;
21627                         *) dflt="$dflt $xxx" ;;
21628                         esac
21629                 done
21630                 set X $dflt
21631                 shift
21632                 dflt="$*"
21633                 ;;
21634         *)      dflt="$dynamic_ext"
21635                 # Perhaps we are reusing an old out-of-date config.sh.
21636                 case "$hint" in
21637                 previous)
21638                         if test X"$dynamic_ext" != X"$avail_ext"; then
21639                                 $cat <<EOM
21640 NOTICE:  Your previous config.sh list may be incorrect.
21641 The extensions now available to you are
21642         ${avail_ext}
21643 but the default list from your previous config.sh is
21644         ${dynamic_ext}
21645
21646 EOM
21647                         fi
21648                         ;;
21649                 esac
21650                 ;;
21651         esac
21652         case "$dflt" in
21653         '')     dflt=none;;
21654         esac
21655         rp="What extensions do you wish to load dynamically?"
21656         . ./myread
21657         case "$ans" in
21658         none) dynamic_ext=' ' ;;
21659         *) dynamic_ext="$ans" ;;
21660         esac
21661
21662         case "$static_ext" in
21663         '')
21664                 : Exclude those already listed in dynamic linking
21665                 dflt=''
21666                 for xxx in $avail_ext; do
21667                         case " $dynamic_ext " in
21668                         *" $xxx "*) ;;
21669                         *) dflt="$dflt $xxx" ;;
21670                         esac
21671                 done
21672                 set X $dflt
21673                 shift
21674                 dflt="$*"
21675                 ;;
21676         *)  dflt="$static_ext"
21677                 ;;
21678         esac
21679
21680         case "$dflt" in
21681         '')     dflt=none;;
21682         esac
21683         rp="What extensions do you wish to load statically?"
21684         . ./myread
21685         case "$ans" in
21686         none) static_ext=' ' ;;
21687         *) static_ext="$ans" ;;
21688         esac
21689         ;;
21690 *)
21691         $cat <<EOM
21692 A number of extensions are supplied with $package.  Answer "none"
21693 to include no extensions.
21694 Note that DynaLoader is always built and need not be mentioned here.
21695
21696 EOM
21697         case "$static_ext" in
21698         '') dflt="$avail_ext" ;;
21699         *)      dflt="$static_ext"
21700                 # Perhaps we are reusing an old out-of-date config.sh.
21701                 case "$hint" in
21702                 previous)
21703                         if test X"$static_ext" != X"$avail_ext"; then
21704                                 $cat <<EOM
21705 NOTICE:  Your previous config.sh list may be incorrect.
21706 The extensions now available to you are
21707         ${avail_ext}
21708 but the default list from your previous config.sh is
21709         ${static_ext}
21710
21711 EOM
21712                         fi
21713                         ;;
21714                 esac
21715                 ;;
21716         esac
21717         : Exclude those that are not xs extensions
21718         case "$dflt" in
21719         '')     dflt=none;;
21720         esac
21721         rp="What extensions do you wish to include?"
21722         . ./myread
21723         case "$ans" in
21724         none) static_ext=' ' ;;
21725         *) static_ext="$ans" ;;
21726         esac
21727         ;;
21728 esac
21729 #
21730 # Encode is a special case.  If we are building Encode as a static
21731 # extension, we need to explicitly list its subextensions as well.
21732 # For other nested extensions, this is handled automatically by
21733 # the appropriate Makefile.PL.
21734 case " $static_ext " in
21735         *" Encode "*) # Add the subextensions of Encode
21736         cd "$rsrc/ext"
21737         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21738                 static_ext="$static_ext Encode/$xxx"
21739         done
21740         cd "$tdir"
21741         ;;
21742 esac
21743
21744 set X $dynamic_ext $static_ext $nonxs_ext
21745 shift
21746 extensions="$*"
21747
21748 # Sanity check:  We require an extension suitable for use with
21749 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21750 # should show up as failures in the test suite, but it's helpful to
21751 # catch them now.) The 'extensions' list is normally sorted
21752 # alphabetically, so we need to accept either
21753 #    DB_File ... Fcntl ... IO  ....
21754 # or something like
21755 #    Fcntl ... NDBM_File ... IO  ....
21756 case " $extensions"  in
21757 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21758 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21759 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21760 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21761    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21762    ;;
21763 esac
21764
21765 : Remove libraries needed only for extensions
21766 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21767 : The exception is SunOS 4.x, which needs them.
21768 case "${osname}X${osvers}" in
21769 sunos*X4*)
21770     perllibs="$libs"
21771     ;;
21772 *) case "$usedl" in
21773     $define|true|[yY]*)
21774             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21775             shift
21776             perllibs="$*"
21777             ;;
21778     *)  perllibs="$libs"
21779             ;;
21780     esac
21781     ;;
21782 esac
21783
21784 : Remove build directory name from cppstdin so it can be used from
21785 : either the present location or the final installed location.
21786 echo " "
21787 : Get out of the UU directory to get correct path name.
21788 cd ..
21789 case "$cppstdin" in
21790 `pwd`/cppstdin)
21791         echo "Stripping down cppstdin path name"
21792         cppstdin=cppstdin
21793         ;;
21794 esac
21795 cd UU
21796
21797 : end of configuration questions
21798 echo " "
21799 echo "End of configuration questions."
21800 echo " "
21801
21802 : back to where it started
21803 if test -d ../UU; then
21804         cd ..
21805 fi
21806
21807 : configuration may be unconditionally patched via a 'config.arch' file
21808 if $test -f config.arch; then
21809         echo "I see a config.arch file, loading it." >&4
21810         . ./config.arch
21811 fi
21812
21813 : configuration may be patched via a 'config.over' file
21814 if $test -f config.over; then
21815         echo " "
21816         dflt=y
21817         rp='I see a config.over file.  Do you wish to load it?'
21818         . UU/myread
21819         case "$ans" in
21820         n*) echo "OK, I'll ignore it.";;
21821         *)      . ./config.over
21822                 echo "Configuration override changes have been loaded."
21823                 ;;
21824         esac
21825 fi
21826
21827 : in case they want portability, strip down executable paths
21828 case "$d_portable" in
21829 "$define")
21830         echo " "
21831         echo "Stripping down executable paths..." >&4
21832         for file in $loclist $trylist; do
21833                 eval temp=\$$file
21834                 eval $file=`basename $temp`
21835         done
21836         ;;
21837 esac
21838
21839 : create config.sh file
21840 echo " "
21841 echo "Creating config.sh..." >&4
21842 $spitshell <<EOT >config.sh
21843 $startsh
21844 #
21845 # This file was produced by running the Configure script. It holds all the
21846 # definitions figured out by Configure. Should you modify one of these values,
21847 # do not forget to propagate your changes by running "Configure -der". You may
21848 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21849 #
21850
21851 # Package name      : $package
21852 # Source directory  : $src
21853 # Configuration time: $cf_time
21854 # Configured by     : $cf_by
21855 # Target system     : $myuname
21856
21857 EOT
21858 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21859 $spitshell <<EOT >>config.sh
21860
21861 Author='$Author'
21862 Date='$Date'
21863 Header='$Header'
21864 Id='$Id'
21865 Locker='$Locker'
21866 Log='$Log'
21867 RCSfile='$RCSfile'
21868 Revision='$Revision'
21869 Source='$Source'
21870 State='$State'
21871 _a='$_a'
21872 _exe='$_exe'
21873 _o='$_o'
21874 afs='$afs'
21875 afsroot='$afsroot'
21876 alignbytes='$alignbytes'
21877 ansi2knr='$ansi2knr'
21878 aphostname='$aphostname'
21879 api_revision='$api_revision'
21880 api_subversion='$api_subversion'
21881 api_version='$api_version'
21882 api_versionstring='$api_versionstring'
21883 ar='$ar'
21884 archlib='$archlib'
21885 archlibexp='$archlibexp'
21886 archname64='$archname64'
21887 archname='$archname'
21888 archobjs='$archobjs'
21889 asctime_r_proto='$asctime_r_proto'
21890 awk='$awk'
21891 baserev='$baserev'
21892 bash='$bash'
21893 bin='$bin'
21894 binexp='$binexp'
21895 bison='$bison'
21896 byacc='$byacc'
21897 byteorder='$byteorder'
21898 c='$c'
21899 castflags='$castflags'
21900 cat='$cat'
21901 cc='$cc'
21902 cccdlflags='$cccdlflags'
21903 ccdlflags='$ccdlflags'
21904 ccflags='$ccflags'
21905 ccflags_uselargefiles='$ccflags_uselargefiles'
21906 ccname='$ccname'
21907 ccsymbols='$ccsymbols'
21908 ccversion='$ccversion'
21909 cf_by='$cf_by'
21910 cf_email='$cf_email'
21911 cf_time='$cf_time'
21912 chgrp='$chgrp'
21913 chmod='$chmod'
21914 chown='$chown'
21915 clocktype='$clocktype'
21916 comm='$comm'
21917 compress='$compress'
21918 contains='$contains'
21919 cp='$cp'
21920 cpio='$cpio'
21921 cpp='$cpp'
21922 cpp_stuff='$cpp_stuff'
21923 cppccsymbols='$cppccsymbols'
21924 cppflags='$cppflags'
21925 cpplast='$cpplast'
21926 cppminus='$cppminus'
21927 cpprun='$cpprun'
21928 cppstdin='$cppstdin'
21929 cppsymbols='$cppsymbols'
21930 crypt_r_proto='$crypt_r_proto'
21931 cryptlib='$cryptlib'
21932 csh='$csh'
21933 ctermid_r_proto='$ctermid_r_proto'
21934 ctime_r_proto='$ctime_r_proto'
21935 d_Gconvert='$d_Gconvert'
21936 d_PRIEUldbl='$d_PRIEUldbl'
21937 d_PRIFUldbl='$d_PRIFUldbl'
21938 d_PRIGUldbl='$d_PRIGUldbl'
21939 d_PRIXU64='$d_PRIXU64'
21940 d_PRId64='$d_PRId64'
21941 d_PRIeldbl='$d_PRIeldbl'
21942 d_PRIfldbl='$d_PRIfldbl'
21943 d_PRIgldbl='$d_PRIgldbl'
21944 d_PRIi64='$d_PRIi64'
21945 d_PRIo64='$d_PRIo64'
21946 d_PRIu64='$d_PRIu64'
21947 d_PRIx64='$d_PRIx64'
21948 d_SCNfldbl='$d_SCNfldbl'
21949 d__fwalk='$d__fwalk'
21950 d_access='$d_access'
21951 d_accessx='$d_accessx'
21952 d_aintl='$d_aintl'
21953 d_alarm='$d_alarm'
21954 d_archlib='$d_archlib'
21955 d_asctime_r='$d_asctime_r'
21956 d_atolf='$d_atolf'
21957 d_atoll='$d_atoll'
21958 d_attribute_format='$d_attribute_format'
21959 d_attribute_malloc='$d_attribute_malloc'
21960 d_attribute_nonnull='$d_attribute_nonnull'
21961 d_attribute_noreturn='$d_attribute_noreturn'
21962 d_attribute_pure='$d_attribute_pure'
21963 d_attribute_unused='$d_attribute_unused'
21964 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21965 d_bcmp='$d_bcmp'
21966 d_bcopy='$d_bcopy'
21967 d_bsd='$d_bsd'
21968 d_bsdgetpgrp='$d_bsdgetpgrp'
21969 d_bsdsetpgrp='$d_bsdsetpgrp'
21970 d_builtin_choose_expr='$d_builtin_choose_expr'
21971 d_builtin_expect='$d_builtin_expect'
21972 d_bzero='$d_bzero'
21973 d_c99_variadic_macros='$d_c99_variadic_macros'
21974 d_casti32='$d_casti32'
21975 d_castneg='$d_castneg'
21976 d_charvspr='$d_charvspr'
21977 d_chown='$d_chown'
21978 d_chroot='$d_chroot'
21979 d_chsize='$d_chsize'
21980 d_class='$d_class'
21981 d_clearenv='$d_clearenv'
21982 d_closedir='$d_closedir'
21983 d_cmsghdr_s='$d_cmsghdr_s'
21984 d_const='$d_const'
21985 d_copysignl='$d_copysignl'
21986 d_cplusplus='$d_cplusplus'
21987 d_crypt='$d_crypt'
21988 d_crypt_r='$d_crypt_r'
21989 d_csh='$d_csh'
21990 d_ctermid='$d_ctermid'
21991 d_ctermid_r='$d_ctermid_r'
21992 d_ctime_r='$d_ctime_r'
21993 d_cuserid='$d_cuserid'
21994 d_dbl_dig='$d_dbl_dig'
21995 d_dbminitproto='$d_dbminitproto'
21996 d_difftime='$d_difftime'
21997 d_dir_dd_fd='$d_dir_dd_fd'
21998 d_dirfd='$d_dirfd'
21999 d_dirnamlen='$d_dirnamlen'
22000 d_dlerror='$d_dlerror'
22001 d_dlopen='$d_dlopen'
22002 d_dlsymun='$d_dlsymun'
22003 d_dosuid='$d_dosuid'
22004 d_drand48_r='$d_drand48_r'
22005 d_drand48proto='$d_drand48proto'
22006 d_dup2='$d_dup2'
22007 d_eaccess='$d_eaccess'
22008 d_endgrent='$d_endgrent'
22009 d_endgrent_r='$d_endgrent_r'
22010 d_endhent='$d_endhent'
22011 d_endhostent_r='$d_endhostent_r'
22012 d_endnent='$d_endnent'
22013 d_endnetent_r='$d_endnetent_r'
22014 d_endpent='$d_endpent'
22015 d_endprotoent_r='$d_endprotoent_r'
22016 d_endpwent='$d_endpwent'
22017 d_endpwent_r='$d_endpwent_r'
22018 d_endsent='$d_endsent'
22019 d_endservent_r='$d_endservent_r'
22020 d_eofnblk='$d_eofnblk'
22021 d_eunice='$d_eunice'
22022 d_faststdio='$d_faststdio'
22023 d_fchdir='$d_fchdir'
22024 d_fchmod='$d_fchmod'
22025 d_fchown='$d_fchown'
22026 d_fcntl='$d_fcntl'
22027 d_fcntl_can_lock='$d_fcntl_can_lock'
22028 d_fd_macros='$d_fd_macros'
22029 d_fd_set='$d_fd_set'
22030 d_fds_bits='$d_fds_bits'
22031 d_fgetpos='$d_fgetpos'
22032 d_finite='$d_finite'
22033 d_finitel='$d_finitel'
22034 d_flexfnam='$d_flexfnam'
22035 d_flock='$d_flock'
22036 d_flockproto='$d_flockproto'
22037 d_fork='$d_fork'
22038 d_fp_class='$d_fp_class'
22039 d_fpathconf='$d_fpathconf'
22040 d_fpclass='$d_fpclass'
22041 d_fpclassify='$d_fpclassify'
22042 d_fpclassl='$d_fpclassl'
22043 d_fpos64_t='$d_fpos64_t'
22044 d_frexpl='$d_frexpl'
22045 d_fs_data_s='$d_fs_data_s'
22046 d_fseeko='$d_fseeko'
22047 d_fsetpos='$d_fsetpos'
22048 d_fstatfs='$d_fstatfs'
22049 d_fstatvfs='$d_fstatvfs'
22050 d_fsync='$d_fsync'
22051 d_ftello='$d_ftello'
22052 d_ftime='$d_ftime'
22053 d_futimes='$d_futimes'
22054 d_getcwd='$d_getcwd'
22055 d_getespwnam='$d_getespwnam'
22056 d_getfsstat='$d_getfsstat'
22057 d_getgrent='$d_getgrent'
22058 d_getgrent_r='$d_getgrent_r'
22059 d_getgrgid_r='$d_getgrgid_r'
22060 d_getgrnam_r='$d_getgrnam_r'
22061 d_getgrps='$d_getgrps'
22062 d_gethbyaddr='$d_gethbyaddr'
22063 d_gethbyname='$d_gethbyname'
22064 d_gethent='$d_gethent'
22065 d_gethname='$d_gethname'
22066 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22067 d_gethostbyname_r='$d_gethostbyname_r'
22068 d_gethostent_r='$d_gethostent_r'
22069 d_gethostprotos='$d_gethostprotos'
22070 d_getitimer='$d_getitimer'
22071 d_getlogin='$d_getlogin'
22072 d_getlogin_r='$d_getlogin_r'
22073 d_getmnt='$d_getmnt'
22074 d_getmntent='$d_getmntent'
22075 d_getnbyaddr='$d_getnbyaddr'
22076 d_getnbyname='$d_getnbyname'
22077 d_getnent='$d_getnent'
22078 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22079 d_getnetbyname_r='$d_getnetbyname_r'
22080 d_getnetent_r='$d_getnetent_r'
22081 d_getnetprotos='$d_getnetprotos'
22082 d_getpagsz='$d_getpagsz'
22083 d_getpbyname='$d_getpbyname'
22084 d_getpbynumber='$d_getpbynumber'
22085 d_getpent='$d_getpent'
22086 d_getpgid='$d_getpgid'
22087 d_getpgrp2='$d_getpgrp2'
22088 d_getpgrp='$d_getpgrp'
22089 d_getppid='$d_getppid'
22090 d_getprior='$d_getprior'
22091 d_getprotobyname_r='$d_getprotobyname_r'
22092 d_getprotobynumber_r='$d_getprotobynumber_r'
22093 d_getprotoent_r='$d_getprotoent_r'
22094 d_getprotoprotos='$d_getprotoprotos'
22095 d_getprpwnam='$d_getprpwnam'
22096 d_getpwent='$d_getpwent'
22097 d_getpwent_r='$d_getpwent_r'
22098 d_getpwnam_r='$d_getpwnam_r'
22099 d_getpwuid_r='$d_getpwuid_r'
22100 d_getsbyname='$d_getsbyname'
22101 d_getsbyport='$d_getsbyport'
22102 d_getsent='$d_getsent'
22103 d_getservbyname_r='$d_getservbyname_r'
22104 d_getservbyport_r='$d_getservbyport_r'
22105 d_getservent_r='$d_getservent_r'
22106 d_getservprotos='$d_getservprotos'
22107 d_getspnam='$d_getspnam'
22108 d_getspnam_r='$d_getspnam_r'
22109 d_gettimeod='$d_gettimeod'
22110 d_gmtime_r='$d_gmtime_r'
22111 d_gnulibc='$d_gnulibc'
22112 d_grpasswd='$d_grpasswd'
22113 d_hasmntopt='$d_hasmntopt'
22114 d_htonl='$d_htonl'
22115 d_ilogbl='$d_ilogbl'
22116 d_inc_version_list='$d_inc_version_list'
22117 d_index='$d_index'
22118 d_inetaton='$d_inetaton'
22119 d_int64_t='$d_int64_t'
22120 d_isascii='$d_isascii'
22121 d_isfinite='$d_isfinite'
22122 d_isinf='$d_isinf'
22123 d_isnan='$d_isnan'
22124 d_isnanl='$d_isnanl'
22125 d_killpg='$d_killpg'
22126 d_lchown='$d_lchown'
22127 d_ldbl_dig='$d_ldbl_dig'
22128 d_libm_lib_version='$d_libm_lib_version'
22129 d_link='$d_link'
22130 d_localtime_r='$d_localtime_r'
22131 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22132 d_locconv='$d_locconv'
22133 d_lockf='$d_lockf'
22134 d_longdbl='$d_longdbl'
22135 d_longlong='$d_longlong'
22136 d_lseekproto='$d_lseekproto'
22137 d_lstat='$d_lstat'
22138 d_madvise='$d_madvise'
22139 d_malloc_good_size='$d_malloc_good_size'
22140 d_malloc_size='$d_malloc_size'
22141 d_mblen='$d_mblen'
22142 d_mbstowcs='$d_mbstowcs'
22143 d_mbtowc='$d_mbtowc'
22144 d_memchr='$d_memchr'
22145 d_memcmp='$d_memcmp'
22146 d_memcpy='$d_memcpy'
22147 d_memmove='$d_memmove'
22148 d_memset='$d_memset'
22149 d_mkdir='$d_mkdir'
22150 d_mkdtemp='$d_mkdtemp'
22151 d_mkfifo='$d_mkfifo'
22152 d_mkstemp='$d_mkstemp'
22153 d_mkstemps='$d_mkstemps'
22154 d_mktime='$d_mktime'
22155 d_mmap='$d_mmap'
22156 d_modfl='$d_modfl'
22157 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22158 d_modflproto='$d_modflproto'
22159 d_mprotect='$d_mprotect'
22160 d_msg='$d_msg'
22161 d_msg_ctrunc='$d_msg_ctrunc'
22162 d_msg_dontroute='$d_msg_dontroute'
22163 d_msg_oob='$d_msg_oob'
22164 d_msg_peek='$d_msg_peek'
22165 d_msg_proxy='$d_msg_proxy'
22166 d_msgctl='$d_msgctl'
22167 d_msgget='$d_msgget'
22168 d_msghdr_s='$d_msghdr_s'
22169 d_msgrcv='$d_msgrcv'
22170 d_msgsnd='$d_msgsnd'
22171 d_msync='$d_msync'
22172 d_munmap='$d_munmap'
22173 d_mymalloc='$d_mymalloc'
22174 d_ndbm='$d_ndbm'
22175 d_nice='$d_nice'
22176 d_nl_langinfo='$d_nl_langinfo'
22177 d_nv_preserves_uv='$d_nv_preserves_uv'
22178 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22179 d_off64_t='$d_off64_t'
22180 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22181 d_oldpthreads='$d_oldpthreads'
22182 d_oldsock='$d_oldsock'
22183 d_open3='$d_open3'
22184 d_pathconf='$d_pathconf'
22185 d_pause='$d_pause'
22186 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22187 d_phostname='$d_phostname'
22188 d_pipe='$d_pipe'
22189 d_poll='$d_poll'
22190 d_portable='$d_portable'
22191 d_printf_format_null='$d_printf_format_null'
22192 d_procselfexe='$d_procselfexe'
22193 d_pseudofork='$d_pseudofork'
22194 d_pthread_atfork='$d_pthread_atfork'
22195 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22196 d_pthread_yield='$d_pthread_yield'
22197 d_pwage='$d_pwage'
22198 d_pwchange='$d_pwchange'
22199 d_pwclass='$d_pwclass'
22200 d_pwcomment='$d_pwcomment'
22201 d_pwexpire='$d_pwexpire'
22202 d_pwgecos='$d_pwgecos'
22203 d_pwpasswd='$d_pwpasswd'
22204 d_pwquota='$d_pwquota'
22205 d_qgcvt='$d_qgcvt'
22206 d_quad='$d_quad'
22207 d_random_r='$d_random_r'
22208 d_readdir64_r='$d_readdir64_r'
22209 d_readdir='$d_readdir'
22210 d_readdir_r='$d_readdir_r'
22211 d_readlink='$d_readlink'
22212 d_readv='$d_readv'
22213 d_recvmsg='$d_recvmsg'
22214 d_rename='$d_rename'
22215 d_rewinddir='$d_rewinddir'
22216 d_rmdir='$d_rmdir'
22217 d_safebcpy='$d_safebcpy'
22218 d_safemcpy='$d_safemcpy'
22219 d_sanemcmp='$d_sanemcmp'
22220 d_sbrkproto='$d_sbrkproto'
22221 d_scalbnl='$d_scalbnl'
22222 d_sched_yield='$d_sched_yield'
22223 d_scm_rights='$d_scm_rights'
22224 d_seekdir='$d_seekdir'
22225 d_select='$d_select'
22226 d_sem='$d_sem'
22227 d_semctl='$d_semctl'
22228 d_semctl_semid_ds='$d_semctl_semid_ds'
22229 d_semctl_semun='$d_semctl_semun'
22230 d_semget='$d_semget'
22231 d_semop='$d_semop'
22232 d_sendmsg='$d_sendmsg'
22233 d_setegid='$d_setegid'
22234 d_seteuid='$d_seteuid'
22235 d_setgrent='$d_setgrent'
22236 d_setgrent_r='$d_setgrent_r'
22237 d_setgrps='$d_setgrps'
22238 d_sethent='$d_sethent'
22239 d_sethostent_r='$d_sethostent_r'
22240 d_setitimer='$d_setitimer'
22241 d_setlinebuf='$d_setlinebuf'
22242 d_setlocale='$d_setlocale'
22243 d_setlocale_r='$d_setlocale_r'
22244 d_setnent='$d_setnent'
22245 d_setnetent_r='$d_setnetent_r'
22246 d_setpent='$d_setpent'
22247 d_setpgid='$d_setpgid'
22248 d_setpgrp2='$d_setpgrp2'
22249 d_setpgrp='$d_setpgrp'
22250 d_setprior='$d_setprior'
22251 d_setproctitle='$d_setproctitle'
22252 d_setprotoent_r='$d_setprotoent_r'
22253 d_setpwent='$d_setpwent'
22254 d_setpwent_r='$d_setpwent_r'
22255 d_setregid='$d_setregid'
22256 d_setresgid='$d_setresgid'
22257 d_setresuid='$d_setresuid'
22258 d_setreuid='$d_setreuid'
22259 d_setrgid='$d_setrgid'
22260 d_setruid='$d_setruid'
22261 d_setsent='$d_setsent'
22262 d_setservent_r='$d_setservent_r'
22263 d_setsid='$d_setsid'
22264 d_setvbuf='$d_setvbuf'
22265 d_sfio='$d_sfio'
22266 d_shm='$d_shm'
22267 d_shmat='$d_shmat'
22268 d_shmatprototype='$d_shmatprototype'
22269 d_shmctl='$d_shmctl'
22270 d_shmdt='$d_shmdt'
22271 d_shmget='$d_shmget'
22272 d_sigaction='$d_sigaction'
22273 d_signbit='$d_signbit'
22274 d_sigprocmask='$d_sigprocmask'
22275 d_sigsetjmp='$d_sigsetjmp'
22276 d_sitearch='$d_sitearch'
22277 d_snprintf='$d_snprintf'
22278 d_sockatmark='$d_sockatmark'
22279 d_sockatmarkproto='$d_sockatmarkproto'
22280 d_socket='$d_socket'
22281 d_socklen_t='$d_socklen_t'
22282 d_sockpair='$d_sockpair'
22283 d_socks5_init='$d_socks5_init'
22284 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22285 d_sqrtl='$d_sqrtl'
22286 d_srand48_r='$d_srand48_r'
22287 d_srandom_r='$d_srandom_r'
22288 d_sresgproto='$d_sresgproto'
22289 d_sresuproto='$d_sresuproto'
22290 d_statblks='$d_statblks'
22291 d_statfs_f_flags='$d_statfs_f_flags'
22292 d_statfs_s='$d_statfs_s'
22293 d_statvfs='$d_statvfs'
22294 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22295 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22296 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22297 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22298 d_stdio_stream_array='$d_stdio_stream_array'
22299 d_stdiobase='$d_stdiobase'
22300 d_stdstdio='$d_stdstdio'
22301 d_strchr='$d_strchr'
22302 d_strcoll='$d_strcoll'
22303 d_strctcpy='$d_strctcpy'
22304 d_strerrm='$d_strerrm'
22305 d_strerror='$d_strerror'
22306 d_strerror_r='$d_strerror_r'
22307 d_strftime='$d_strftime'
22308 d_strlcat='$d_strlcat'
22309 d_strlcpy='$d_strlcpy'
22310 d_strtod='$d_strtod'
22311 d_strtol='$d_strtol'
22312 d_strtold='$d_strtold'
22313 d_strtoll='$d_strtoll'
22314 d_strtoq='$d_strtoq'
22315 d_strtoul='$d_strtoul'
22316 d_strtoull='$d_strtoull'
22317 d_strtouq='$d_strtouq'
22318 d_strxfrm='$d_strxfrm'
22319 d_suidsafe='$d_suidsafe'
22320 d_symlink='$d_symlink'
22321 d_syscall='$d_syscall'
22322 d_syscallproto='$d_syscallproto'
22323 d_sysconf='$d_sysconf'
22324 d_sysernlst='$d_sysernlst'
22325 d_syserrlst='$d_syserrlst'
22326 d_system='$d_system'
22327 d_tcgetpgrp='$d_tcgetpgrp'
22328 d_tcsetpgrp='$d_tcsetpgrp'
22329 d_telldir='$d_telldir'
22330 d_telldirproto='$d_telldirproto'
22331 d_time='$d_time'
22332 d_timegm='$d_timegm'
22333 d_times='$d_times'
22334 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22335 d_tm_tm_zone='$d_tm_tm_zone'
22336 d_tmpnam_r='$d_tmpnam_r'
22337 d_truncate='$d_truncate'
22338 d_ttyname_r='$d_ttyname_r'
22339 d_tzname='$d_tzname'
22340 d_u32align='$d_u32align'
22341 d_ualarm='$d_ualarm'
22342 d_umask='$d_umask'
22343 d_uname='$d_uname'
22344 d_union_semun='$d_union_semun'
22345 d_unordered='$d_unordered'
22346 d_unsetenv='$d_unsetenv'
22347 d_usleep='$d_usleep'
22348 d_usleepproto='$d_usleepproto'
22349 d_ustat='$d_ustat'
22350 d_vendorarch='$d_vendorarch'
22351 d_vendorbin='$d_vendorbin'
22352 d_vendorlib='$d_vendorlib'
22353 d_vendorscript='$d_vendorscript'
22354 d_vfork='$d_vfork'
22355 d_void_closedir='$d_void_closedir'
22356 d_voidsig='$d_voidsig'
22357 d_voidtty='$d_voidtty'
22358 d_volatile='$d_volatile'
22359 d_vprintf='$d_vprintf'
22360 d_vsnprintf='$d_vsnprintf'
22361 d_wait4='$d_wait4'
22362 d_waitpid='$d_waitpid'
22363 d_wcstombs='$d_wcstombs'
22364 d_wctomb='$d_wctomb'
22365 d_writev='$d_writev'
22366 d_xenix='$d_xenix'
22367 date='$date'
22368 db_hashtype='$db_hashtype'
22369 db_prefixtype='$db_prefixtype'
22370 db_version_major='$db_version_major'
22371 db_version_minor='$db_version_minor'
22372 db_version_patch='$db_version_patch'
22373 defvoidused='$defvoidused'
22374 direntrytype='$direntrytype'
22375 dlext='$dlext'
22376 dlsrc='$dlsrc'
22377 doublesize='$doublesize'
22378 drand01='$drand01'
22379 drand48_r_proto='$drand48_r_proto'
22380 dtrace='$dtrace'
22381 dynamic_ext='$dynamic_ext'
22382 eagain='$eagain'
22383 ebcdic='$ebcdic'
22384 echo='$echo'
22385 egrep='$egrep'
22386 emacs='$emacs'
22387 endgrent_r_proto='$endgrent_r_proto'
22388 endhostent_r_proto='$endhostent_r_proto'
22389 endnetent_r_proto='$endnetent_r_proto'
22390 endprotoent_r_proto='$endprotoent_r_proto'
22391 endpwent_r_proto='$endpwent_r_proto'
22392 endservent_r_proto='$endservent_r_proto'
22393 eunicefix='$eunicefix'
22394 exe_ext='$exe_ext'
22395 expr='$expr'
22396 extensions='$extensions'
22397 extras='$extras'
22398 fflushNULL='$fflushNULL'
22399 fflushall='$fflushall'
22400 find='$find'
22401 firstmakefile='$firstmakefile'
22402 flex='$flex'
22403 fpossize='$fpossize'
22404 fpostype='$fpostype'
22405 freetype='$freetype'
22406 from='$from'
22407 full_ar='$full_ar'
22408 full_csh='$full_csh'
22409 full_sed='$full_sed'
22410 gccansipedantic='$gccansipedantic'
22411 gccosandvers='$gccosandvers'
22412 gccversion='$gccversion'
22413 getgrent_r_proto='$getgrent_r_proto'
22414 getgrgid_r_proto='$getgrgid_r_proto'
22415 getgrnam_r_proto='$getgrnam_r_proto'
22416 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22417 gethostbyname_r_proto='$gethostbyname_r_proto'
22418 gethostent_r_proto='$gethostent_r_proto'
22419 getlogin_r_proto='$getlogin_r_proto'
22420 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22421 getnetbyname_r_proto='$getnetbyname_r_proto'
22422 getnetent_r_proto='$getnetent_r_proto'
22423 getprotobyname_r_proto='$getprotobyname_r_proto'
22424 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22425 getprotoent_r_proto='$getprotoent_r_proto'
22426 getpwent_r_proto='$getpwent_r_proto'
22427 getpwnam_r_proto='$getpwnam_r_proto'
22428 getpwuid_r_proto='$getpwuid_r_proto'
22429 getservbyname_r_proto='$getservbyname_r_proto'
22430 getservbyport_r_proto='$getservbyport_r_proto'
22431 getservent_r_proto='$getservent_r_proto'
22432 getspnam_r_proto='$getspnam_r_proto'
22433 gidformat='$gidformat'
22434 gidsign='$gidsign'
22435 gidsize='$gidsize'
22436 gidtype='$gidtype'
22437 glibpth='$glibpth'
22438 gmake='$gmake'
22439 gmtime_r_proto='$gmtime_r_proto'
22440 gnulibc_version='$gnulibc_version'
22441 grep='$grep'
22442 groupcat='$groupcat'
22443 groupstype='$groupstype'
22444 gzip='$gzip'
22445 h_fcntl='$h_fcntl'
22446 h_sysfile='$h_sysfile'
22447 hint='$hint'
22448 hostcat='$hostcat'
22449 html1dir='$html1dir'
22450 html1direxp='$html1direxp'
22451 html3dir='$html3dir'
22452 html3direxp='$html3direxp'
22453 i16size='$i16size'
22454 i16type='$i16type'
22455 i32size='$i32size'
22456 i32type='$i32type'
22457 i64size='$i64size'
22458 i64type='$i64type'
22459 i8size='$i8size'
22460 i8type='$i8type'
22461 i_arpainet='$i_arpainet'
22462 i_assert='$i_assert'
22463 i_bsdioctl='$i_bsdioctl'
22464 i_crypt='$i_crypt'
22465 i_db='$i_db'
22466 i_dbm='$i_dbm'
22467 i_dirent='$i_dirent'
22468 i_dld='$i_dld'
22469 i_dlfcn='$i_dlfcn'
22470 i_fcntl='$i_fcntl'
22471 i_float='$i_float'
22472 i_fp='$i_fp'
22473 i_fp_class='$i_fp_class'
22474 i_gdbm='$i_gdbm'
22475 i_gdbm_ndbm='$i_gdbm_ndbm'
22476 i_gdbmndbm='$i_gdbmndbm'
22477 i_grp='$i_grp'
22478 i_ieeefp='$i_ieeefp'
22479 i_inttypes='$i_inttypes'
22480 i_langinfo='$i_langinfo'
22481 i_libutil='$i_libutil'
22482 i_limits='$i_limits'
22483 i_locale='$i_locale'
22484 i_machcthr='$i_machcthr'
22485 i_malloc='$i_malloc'
22486 i_mallocmalloc='$i_mallocmalloc'
22487 i_math='$i_math'
22488 i_memory='$i_memory'
22489 i_mntent='$i_mntent'
22490 i_ndbm='$i_ndbm'
22491 i_netdb='$i_netdb'
22492 i_neterrno='$i_neterrno'
22493 i_netinettcp='$i_netinettcp'
22494 i_niin='$i_niin'
22495 i_poll='$i_poll'
22496 i_prot='$i_prot'
22497 i_pthread='$i_pthread'
22498 i_pwd='$i_pwd'
22499 i_rpcsvcdbm='$i_rpcsvcdbm'
22500 i_sfio='$i_sfio'
22501 i_sgtty='$i_sgtty'
22502 i_shadow='$i_shadow'
22503 i_socks='$i_socks'
22504 i_stdarg='$i_stdarg'
22505 i_stddef='$i_stddef'
22506 i_stdlib='$i_stdlib'
22507 i_string='$i_string'
22508 i_sunmath='$i_sunmath'
22509 i_sysaccess='$i_sysaccess'
22510 i_sysdir='$i_sysdir'
22511 i_sysfile='$i_sysfile'
22512 i_sysfilio='$i_sysfilio'
22513 i_sysin='$i_sysin'
22514 i_sysioctl='$i_sysioctl'
22515 i_syslog='$i_syslog'
22516 i_sysmman='$i_sysmman'
22517 i_sysmode='$i_sysmode'
22518 i_sysmount='$i_sysmount'
22519 i_sysndir='$i_sysndir'
22520 i_sysparam='$i_sysparam'
22521 i_syspoll='$i_syspoll'
22522 i_sysresrc='$i_sysresrc'
22523 i_syssecrt='$i_syssecrt'
22524 i_sysselct='$i_sysselct'
22525 i_syssockio='$i_syssockio'
22526 i_sysstat='$i_sysstat'
22527 i_sysstatfs='$i_sysstatfs'
22528 i_sysstatvfs='$i_sysstatvfs'
22529 i_systime='$i_systime'
22530 i_systimek='$i_systimek'
22531 i_systimes='$i_systimes'
22532 i_systypes='$i_systypes'
22533 i_sysuio='$i_sysuio'
22534 i_sysun='$i_sysun'
22535 i_sysutsname='$i_sysutsname'
22536 i_sysvfs='$i_sysvfs'
22537 i_syswait='$i_syswait'
22538 i_termio='$i_termio'
22539 i_termios='$i_termios'
22540 i_time='$i_time'
22541 i_unistd='$i_unistd'
22542 i_ustat='$i_ustat'
22543 i_utime='$i_utime'
22544 i_values='$i_values'
22545 i_varargs='$i_varargs'
22546 i_varhdr='$i_varhdr'
22547 i_vfork='$i_vfork'
22548 ignore_versioned_solibs='$ignore_versioned_solibs'
22549 inc_version_list='$inc_version_list'
22550 inc_version_list_init='$inc_version_list_init'
22551 incpath='$incpath'
22552 inews='$inews'
22553 initialinstalllocation='$initialinstalllocation'
22554 installarchlib='$installarchlib'
22555 installbin='$installbin'
22556 installhtml1dir='$installhtml1dir'
22557 installhtml3dir='$installhtml3dir'
22558 installman1dir='$installman1dir'
22559 installman3dir='$installman3dir'
22560 installprefix='$installprefix'
22561 installprefixexp='$installprefixexp'
22562 installprivlib='$installprivlib'
22563 installscript='$installscript'
22564 installsitearch='$installsitearch'
22565 installsitebin='$installsitebin'
22566 installsitehtml1dir='$installsitehtml1dir'
22567 installsitehtml3dir='$installsitehtml3dir'
22568 installsitelib='$installsitelib'
22569 installsiteman1dir='$installsiteman1dir'
22570 installsiteman3dir='$installsiteman3dir'
22571 installsitescript='$installsitescript'
22572 installstyle='$installstyle'
22573 installusrbinperl='$installusrbinperl'
22574 installvendorarch='$installvendorarch'
22575 installvendorbin='$installvendorbin'
22576 installvendorhtml1dir='$installvendorhtml1dir'
22577 installvendorhtml3dir='$installvendorhtml3dir'
22578 installvendorlib='$installvendorlib'
22579 installvendorman1dir='$installvendorman1dir'
22580 installvendorman3dir='$installvendorman3dir'
22581 installvendorscript='$installvendorscript'
22582 intsize='$intsize'
22583 issymlink='$issymlink'
22584 ivdformat='$ivdformat'
22585 ivsize='$ivsize'
22586 ivtype='$ivtype'
22587 known_extensions='$known_extensions'
22588 ksh='$ksh'
22589 ld='$ld'
22590 lddlflags='$lddlflags'
22591 ldflags='$ldflags'
22592 ldflags_uselargefiles='$ldflags_uselargefiles'
22593 ldlibpthname='$ldlibpthname'
22594 less='$less'
22595 lib_ext='$lib_ext'
22596 libc='$libc'
22597 libperl='$libperl'
22598 libpth='$libpth'
22599 libs='$libs'
22600 libsdirs='$libsdirs'
22601 libsfiles='$libsfiles'
22602 libsfound='$libsfound'
22603 libspath='$libspath'
22604 libswanted='$libswanted'
22605 libswanted_uselargefiles='$libswanted_uselargefiles'
22606 line='$line'
22607 lint='$lint'
22608 lkflags='$lkflags'
22609 ln='$ln'
22610 lns='$lns'
22611 localtime_r_proto='$localtime_r_proto'
22612 locincpth='$locincpth'
22613 loclibpth='$loclibpth'
22614 longdblsize='$longdblsize'
22615 longlongsize='$longlongsize'
22616 longsize='$longsize'
22617 lp='$lp'
22618 lpr='$lpr'
22619 ls='$ls'
22620 lseeksize='$lseeksize'
22621 lseektype='$lseektype'
22622 mad='$mad'
22623 madlyh='$madlyh'
22624 madlyobj='$madlyobj'
22625 madlysrc='$madlysrc'
22626 mail='$mail'
22627 mailx='$mailx'
22628 make='$make'
22629 make_set_make='$make_set_make'
22630 mallocobj='$mallocobj'
22631 mallocsrc='$mallocsrc'
22632 malloctype='$malloctype'
22633 man1dir='$man1dir'
22634 man1direxp='$man1direxp'
22635 man1ext='$man1ext'
22636 man3dir='$man3dir'
22637 man3direxp='$man3direxp'
22638 man3ext='$man3ext'
22639 mips_type='$mips_type'
22640 mistrustnm='$mistrustnm'
22641 mkdir='$mkdir'
22642 mmaptype='$mmaptype'
22643 modetype='$modetype'
22644 more='$more'
22645 multiarch='$multiarch'
22646 mv='$mv'
22647 myarchname='$myarchname'
22648 mydomain='$mydomain'
22649 myhostname='$myhostname'
22650 myuname='$myuname'
22651 n='$n'
22652 need_va_copy='$need_va_copy'
22653 netdb_hlen_type='$netdb_hlen_type'
22654 netdb_host_type='$netdb_host_type'
22655 netdb_name_type='$netdb_name_type'
22656 netdb_net_type='$netdb_net_type'
22657 nm='$nm'
22658 nm_opt='$nm_opt'
22659 nm_so_opt='$nm_so_opt'
22660 nonxs_ext='$nonxs_ext'
22661 nroff='$nroff'
22662 nvEUformat='$nvEUformat'
22663 nvFUformat='$nvFUformat'
22664 nvGUformat='$nvGUformat'
22665 nv_overflows_integers_at='$nv_overflows_integers_at'
22666 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22667 nveformat='$nveformat'
22668 nvfformat='$nvfformat'
22669 nvgformat='$nvgformat'
22670 nvsize='$nvsize'
22671 nvtype='$nvtype'
22672 o_nonblock='$o_nonblock'
22673 obj_ext='$obj_ext'
22674 old_pthread_create_joinable='$old_pthread_create_joinable'
22675 optimize='$optimize'
22676 orderlib='$orderlib'
22677 osname='$osname'
22678 osvers='$osvers'
22679 otherlibdirs='$otherlibdirs'
22680 package='$package'
22681 pager='$pager'
22682 passcat='$passcat'
22683 patchlevel='$patchlevel'
22684 path_sep='$path_sep'
22685 perl5='$perl5'
22686 perl='$perl'
22687 perl_patchlevel='$perl_patchlevel'
22688 perladmin='$perladmin'
22689 perllibs='$perllibs'
22690 perlpath='$perlpath'
22691 pg='$pg'
22692 phostname='$phostname'
22693 pidtype='$pidtype'
22694 plibpth='$plibpth'
22695 pmake='$pmake'
22696 pr='$pr'
22697 prefix='$prefix'
22698 prefixexp='$prefixexp'
22699 privlib='$privlib'
22700 privlibexp='$privlibexp'
22701 procselfexe='$procselfexe'
22702 prototype='$prototype'
22703 ptrsize='$ptrsize'
22704 quadkind='$quadkind'
22705 quadtype='$quadtype'
22706 randbits='$randbits'
22707 randfunc='$randfunc'
22708 random_r_proto='$random_r_proto'
22709 randseedtype='$randseedtype'
22710 ranlib='$ranlib'
22711 rd_nodata='$rd_nodata'
22712 readdir64_r_proto='$readdir64_r_proto'
22713 readdir_r_proto='$readdir_r_proto'
22714 revision='$revision'
22715 rm='$rm'
22716 rm_try='$rm_try'
22717 rmail='$rmail'
22718 run='$run'
22719 runnm='$runnm'
22720 sGMTIME_max='$sGMTIME_max'
22721 sGMTIME_min='$sGMTIME_min'
22722 sPRIEUldbl='$sPRIEUldbl'
22723 sPRIFUldbl='$sPRIFUldbl'
22724 sPRIGUldbl='$sPRIGUldbl'
22725 sPRIXU64='$sPRIXU64'
22726 sPRId64='$sPRId64'
22727 sPRIeldbl='$sPRIeldbl'
22728 sPRIfldbl='$sPRIfldbl'
22729 sPRIgldbl='$sPRIgldbl'
22730 sPRIi64='$sPRIi64'
22731 sPRIo64='$sPRIo64'
22732 sPRIu64='$sPRIu64'
22733 sPRIx64='$sPRIx64'
22734 sSCNfldbl='$sSCNfldbl'
22735 sched_yield='$sched_yield'
22736 scriptdir='$scriptdir'
22737 scriptdirexp='$scriptdirexp'
22738 sed='$sed'
22739 seedfunc='$seedfunc'
22740 selectminbits='$selectminbits'
22741 selecttype='$selecttype'
22742 sendmail='$sendmail'
22743 setgrent_r_proto='$setgrent_r_proto'
22744 sethostent_r_proto='$sethostent_r_proto'
22745 setlocale_r_proto='$setlocale_r_proto'
22746 setnetent_r_proto='$setnetent_r_proto'
22747 setprotoent_r_proto='$setprotoent_r_proto'
22748 setpwent_r_proto='$setpwent_r_proto'
22749 setservent_r_proto='$setservent_r_proto'
22750 sh='$sh'
22751 shar='$shar'
22752 sharpbang='$sharpbang'
22753 shmattype='$shmattype'
22754 shortsize='$shortsize'
22755 shrpenv='$shrpenv'
22756 shsharp='$shsharp'
22757 sig_count='$sig_count'
22758 sig_name='$sig_name'
22759 sig_name_init='$sig_name_init'
22760 sig_num='$sig_num'
22761 sig_num_init='$sig_num_init'
22762 sig_size='$sig_size'
22763 signal_t='$signal_t'
22764 sitearch='$sitearch'
22765 sitearchexp='$sitearchexp'
22766 sitebin='$sitebin'
22767 sitebinexp='$sitebinexp'
22768 sitehtml1dir='$sitehtml1dir'
22769 sitehtml1direxp='$sitehtml1direxp'
22770 sitehtml3dir='$sitehtml3dir'
22771 sitehtml3direxp='$sitehtml3direxp'
22772 sitelib='$sitelib'
22773 sitelib_stem='$sitelib_stem'
22774 sitelibexp='$sitelibexp'
22775 siteman1dir='$siteman1dir'
22776 siteman1direxp='$siteman1direxp'
22777 siteman3dir='$siteman3dir'
22778 siteman3direxp='$siteman3direxp'
22779 siteprefix='$siteprefix'
22780 siteprefixexp='$siteprefixexp'
22781 sitescript='$sitescript'
22782 sitescriptexp='$sitescriptexp'
22783 sizesize='$sizesize'
22784 sizetype='$sizetype'
22785 sleep='$sleep'
22786 smail='$smail'
22787 so='$so'
22788 sockethdr='$sockethdr'
22789 socketlib='$socketlib'
22790 socksizetype='$socksizetype'
22791 sort='$sort'
22792 spackage='$spackage'
22793 spitshell='$spitshell'
22794 srand48_r_proto='$srand48_r_proto'
22795 srandom_r_proto='$srandom_r_proto'
22796 src='$src'
22797 ssizetype='$ssizetype'
22798 startperl='$startperl'
22799 startsh='$startsh'
22800 static_ext='$static_ext'
22801 stdchar='$stdchar'
22802 stdio_base='$stdio_base'
22803 stdio_bufsiz='$stdio_bufsiz'
22804 stdio_cnt='$stdio_cnt'
22805 stdio_filbuf='$stdio_filbuf'
22806 stdio_ptr='$stdio_ptr'
22807 stdio_stream_array='$stdio_stream_array'
22808 strerror_r_proto='$strerror_r_proto'
22809 strings='$strings'
22810 submit='$submit'
22811 subversion='$subversion'
22812 sysman='$sysman'
22813 tail='$tail'
22814 tar='$tar'
22815 targetarch='$targetarch'
22816 tbl='$tbl'
22817 tee='$tee'
22818 test='$test'
22819 timeincl='$timeincl'
22820 timetype='$timetype'
22821 tmpnam_r_proto='$tmpnam_r_proto'
22822 to='$to'
22823 touch='$touch'
22824 tr='$tr'
22825 trnl='$trnl'
22826 troff='$troff'
22827 ttyname_r_proto='$ttyname_r_proto'
22828 u16size='$u16size'
22829 u16type='$u16type'
22830 u32size='$u32size'
22831 u32type='$u32type'
22832 u64size='$u64size'
22833 u64type='$u64type'
22834 u8size='$u8size'
22835 u8type='$u8type'
22836 uidformat='$uidformat'
22837 uidsign='$uidsign'
22838 uidsize='$uidsize'
22839 uidtype='$uidtype'
22840 uname='$uname'
22841 uniq='$uniq'
22842 uquadtype='$uquadtype'
22843 use5005threads='$use5005threads'
22844 use64bitall='$use64bitall'
22845 use64bitint='$use64bitint'
22846 usecrosscompile='$usecrosscompile'
22847 usedl='$usedl'
22848 usedtrace='$usedtrace'
22849 usefaststdio='$usefaststdio'
22850 useithreads='$useithreads'
22851 uselargefiles='$uselargefiles'
22852 uselongdouble='$uselongdouble'
22853 usemallocwrap='$usemallocwrap'
22854 usemorebits='$usemorebits'
22855 usemultiplicity='$usemultiplicity'
22856 usemymalloc='$usemymalloc'
22857 usenm='$usenm'
22858 useopcode='$useopcode'
22859 useperlio='$useperlio'
22860 useposix='$useposix'
22861 usereentrant='$usereentrant'
22862 userelocatableinc='$userelocatableinc'
22863 usesfio='$usesfio'
22864 useshrplib='$useshrplib'
22865 usesitecustomize='$usesitecustomize'
22866 usesocks='$usesocks'
22867 usethreads='$usethreads'
22868 usevendorprefix='$usevendorprefix'
22869 usevfork='$usevfork'
22870 usrinc='$usrinc'
22871 uuname='$uuname'
22872 uvXUformat='$uvXUformat'
22873 uvoformat='$uvoformat'
22874 uvsize='$uvsize'
22875 uvtype='$uvtype'
22876 uvuformat='$uvuformat'
22877 uvxformat='$uvxformat'
22878 vendorarch='$vendorarch'
22879 vendorarchexp='$vendorarchexp'
22880 vendorbin='$vendorbin'
22881 vendorbinexp='$vendorbinexp'
22882 vendorhtml1dir='$vendorhtml1dir'
22883 vendorhtml1direxp='$vendorhtml1direxp'
22884 vendorhtml3dir='$vendorhtml3dir'
22885 vendorhtml3direxp='$vendorhtml3direxp'
22886 vendorlib='$vendorlib'
22887 vendorlib_stem='$vendorlib_stem'
22888 vendorlibexp='$vendorlibexp'
22889 vendorman1dir='$vendorman1dir'
22890 vendorman1direxp='$vendorman1direxp'
22891 vendorman3dir='$vendorman3dir'
22892 vendorman3direxp='$vendorman3direxp'
22893 vendorprefix='$vendorprefix'
22894 vendorprefixexp='$vendorprefixexp'
22895 vendorscript='$vendorscript'
22896 vendorscriptexp='$vendorscriptexp'
22897 version='$version'
22898 version_patchlevel_string='$version_patchlevel_string'
22899 versiononly='$versiononly'
22900 vi='$vi'
22901 voidflags='$voidflags'
22902 xlibpth='$xlibpth'
22903 yacc='$yacc'
22904 yaccflags='$yaccflags'
22905 zcat='$zcat'
22906 zip='$zip'
22907 EOT
22908
22909 : Add in command line options if available
22910 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22911
22912 : add special variables
22913 $test -f $src/patchlevel.h && \
22914 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22915 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22916 echo "PERL_CONFIG_SH=true" >>config.sh
22917
22918 : propagate old symbols
22919 if $test -f UU/config.sh; then
22920         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22921         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22922                 config.sh config.sh UU/oldconfig.sh |\
22923                 $sort | $uniq -u >UU/oldsyms
22924         set X `cat UU/oldsyms`
22925         shift
22926         case $# in
22927         0) ;;
22928         *)
22929                 cat <<EOM
22930 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22931 EOM
22932                 echo ": Variables propagated from previous config.sh file." >>config.sh
22933                 for sym in `cat UU/oldsyms`; do
22934                         echo "    Propagating $hint variable "'$'"$sym..."
22935                         eval 'tmp="$'"${sym}"'"'
22936                         echo "$tmp" | \
22937                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22938                 done
22939                 ;;
22940         esac
22941 fi
22942
22943 : Finish up by extracting the .SH files
22944 case "$alldone" in
22945 exit)
22946         $rm -rf UU
22947         echo "Extraction done."
22948         exit 0
22949         ;;
22950 cont)
22951         ;;
22952 '')
22953         dflt=''
22954         nostick=true
22955         $cat <<EOM
22956
22957 If you'd like to make any changes to the config.sh file before I begin
22958 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22959
22960 EOM
22961         rp="Press return or use a shell escape to edit config.sh:"
22962         . UU/myread
22963         nostick=''
22964         case "$ans" in
22965         '') ;;
22966         *) : in case they cannot read
22967                 sh 1>&4 -c "$ans";;
22968         esac
22969         ;;
22970 esac
22971
22972 : if this fails, just run all the .SH files by hand
22973 . ./config.sh
22974
22975 echo " "
22976 exec 1>&4
22977 pwd=`pwd`
22978 . ./UU/extract
22979 cd "$pwd"
22980
22981 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22982         dflt=y
22983         case "$silent" in
22984         true) ;;
22985         *)
22986                 $cat <<EOM
22987
22988 Now you need to generate make dependencies by running "$make depend".
22989 You might prefer to run it in background: "$make depend > makedepend.out &"
22990 It can take a while, so you might not want to run it right now.
22991
22992 EOM
22993                 ;;
22994         esac
22995         rp="Run $make depend now?"
22996         . UU/myread
22997         case "$ans" in
22998         y*)
22999                 $make depend && echo "Now you must run '$make'."
23000                 ;;
23001         *)
23002                 echo "You must run '$make depend' then '$make'."
23003                 ;;
23004         esac
23005 elif test -f [Mm]akefile; then
23006         echo " "
23007         echo "Now you must run a $make."
23008 else
23009         echo "Configure done."
23010 fi
23011
23012 if $test -f Policy.sh; then
23013     $cat <<EOM
23014
23015 If you compile $package on a different machine or from a different object
23016 directory, copy the Policy.sh file from this object directory to the
23017 new one before you run Configure -- this will help you with most of
23018 the policy defaults.
23019
23020 EOM
23021 fi
23022 if $test -f config.msg; then
23023     echo "Hmm.  I also noted the following information while running:"
23024     echo " "
23025     $cat config.msg >&4
23026     $rm -f config.msg
23027 fi
23028 $rm -f kit*isdone ark*isdone
23029 $rm -rf UU
23030
23031 : End of Configure
23032