Refine Win32's s{GM|LOCAL}TIME_{min|max} values based on the output of
[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 Oct  3 17:54:11 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_asctime64=''
781 d_ctime64=''
782 d_difftime64=''
783 d_gmtime64=''
784 d_localtime64=''
785 d_mktime64=''
786 d_timegm=''
787 clocktype=''
788 d_times=''
789 d_tmpnam_r=''
790 tmpnam_r_proto=''
791 d_truncate=''
792 d_ttyname_r=''
793 ttyname_r_proto=''
794 d_tzname=''
795 d_u32align=''
796 d_ualarm=''
797 d_umask=''
798 d_semctl_semid_ds=''
799 d_semctl_semun=''
800 d_union_semun=''
801 d_unordered=''
802 d_unsetenv=''
803 d_usleep=''
804 d_usleepproto=''
805 d_ustat=''
806 d_pseudofork=''
807 d_vfork=''
808 usevfork=''
809 d_voidsig=''
810 signal_t=''
811 d_volatile=''
812 d_charvspr=''
813 d_vprintf=''
814 d_wait4=''
815 d_waitpid=''
816 d_wcstombs=''
817 d_wctomb=''
818 d_writev=''
819 dlext=''
820 cccdlflags=''
821 ccdlflags=''
822 dlsrc=''
823 ld=''
824 lddlflags=''
825 usedl=''
826 doublesize=''
827 ebcdic=''
828 fflushNULL=''
829 fflushall=''
830 fpossize=''
831 fpostype=''
832 gccansipedantic=''
833 gccosandvers=''
834 gccversion=''
835 gidformat=''
836 gidsign=''
837 gidsize=''
838 gidtype=''
839 groupstype=''
840 h_fcntl=''
841 h_sysfile=''
842 html1dir=''
843 html1direxp=''
844 installhtml1dir=''
845 html3dir=''
846 html3direxp=''
847 installhtml3dir=''
848 i_arpainet=''
849 i_assert=''
850 i_crypt=''
851 db_hashtype=''
852 db_prefixtype=''
853 db_version_major=''
854 db_version_minor=''
855 db_version_patch=''
856 i_db=''
857 i_dbm=''
858 i_rpcsvcdbm=''
859 d_dirnamlen=''
860 direntrytype=''
861 i_dirent=''
862 i_dld=''
863 i_dlfcn=''
864 i_fcntl=''
865 i_float=''
866 i_fp=''
867 i_fp_class=''
868 i_gdbm=''
869 d_grpasswd=''
870 i_grp=''
871 i_ieeefp=''
872 i_inttypes=''
873 i_langinfo=''
874 i_libutil=''
875 i_limits=''
876 i_locale=''
877 i_machcthr=''
878 i_malloc=''
879 i_mallocmalloc=''
880 i_math=''
881 i_memory=''
882 i_mntent=''
883 d_ndbm=''
884 i_gdbm_ndbm=''
885 i_gdbmndbm=''
886 i_ndbm=''
887 i_netdb=''
888 i_neterrno=''
889 i_netinettcp=''
890 i_niin=''
891 i_sysin=''
892 i_poll=''
893 i_prot=''
894 i_pthread=''
895 d_pwage=''
896 d_pwchange=''
897 d_pwclass=''
898 d_pwcomment=''
899 d_pwexpire=''
900 d_pwgecos=''
901 d_pwpasswd=''
902 d_pwquota=''
903 i_pwd=''
904 i_sfio=''
905 i_shadow=''
906 i_socks=''
907 i_stddef=''
908 i_stdlib=''
909 i_string=''
910 strings=''
911 i_sunmath=''
912 i_sysaccess=''
913 i_sysdir=''
914 i_sysfile=''
915 d_voidtty=''
916 i_bsdioctl=''
917 i_sysfilio=''
918 i_sysioctl=''
919 i_syssockio=''
920 i_syslog=''
921 i_sysmman=''
922 i_sysmode=''
923 i_sysmount=''
924 i_sysndir=''
925 i_sysparam=''
926 i_syspoll=''
927 i_sysresrc=''
928 i_syssecrt=''
929 i_sysselct=''
930 i_sysstat=''
931 i_sysstatfs=''
932 i_sysstatvfs=''
933 i_systimes=''
934 i_systypes=''
935 i_sysuio=''
936 i_sysun=''
937 i_sysutsname=''
938 i_sysvfs=''
939 i_syswait=''
940 i_sgtty=''
941 i_termio=''
942 i_termios=''
943 d_tm_tm_gmtoff=''
944 d_tm_tm_zone=''
945 i_systime=''
946 i_systimek=''
947 i_time=''
948 timeincl=''
949 i_unistd=''
950 i_ustat=''
951 i_utime=''
952 i_values=''
953 i_stdarg=''
954 i_varargs=''
955 i_varhdr=''
956 i_vfork=''
957 d_inc_version_list=''
958 inc_version_list=''
959 inc_version_list_init=''
960 installprefix=''
961 installprefixexp=''
962 installstyle=''
963 installusrbinperl=''
964 intsize=''
965 longsize=''
966 shortsize=''
967 issymlink=''
968 libc=''
969 ldlibpthname=''
970 libperl=''
971 shrpenv=''
972 useshrplib=''
973 glibpth=''
974 libpth=''
975 loclibpth=''
976 plibpth=''
977 xlibpth=''
978 ignore_versioned_solibs=''
979 libs=''
980 libsdirs=''
981 libsfiles=''
982 libsfound=''
983 libspath=''
984 lns=''
985 d_PRIEUldbl=''
986 d_PRIFUldbl=''
987 d_PRIGUldbl=''
988 d_PRIeldbl=''
989 d_PRIfldbl=''
990 d_PRIgldbl=''
991 d_SCNfldbl=''
992 sPRIEUldbl=''
993 sPRIFUldbl=''
994 sPRIGUldbl=''
995 sPRIeldbl=''
996 sPRIfldbl=''
997 sPRIgldbl=''
998 sSCNfldbl=''
999 lseeksize=''
1000 lseektype=''
1001 mad=''
1002 madlyh=''
1003 madlyobj=''
1004 madlysrc=''
1005 make_set_make=''
1006 d_mymalloc=''
1007 freetype=''
1008 mallocobj=''
1009 mallocsrc=''
1010 malloctype=''
1011 usemallocwrap=''
1012 usemymalloc=''
1013 installman1dir=''
1014 man1dir=''
1015 man1direxp=''
1016 man1ext=''
1017 installman3dir=''
1018 man3dir=''
1019 man3direxp=''
1020 man3ext=''
1021 modetype=''
1022 multiarch=''
1023 mydomain=''
1024 myhostname=''
1025 phostname=''
1026 c=''
1027 n=''
1028 d_eofnblk=''
1029 eagain=''
1030 o_nonblock=''
1031 rd_nodata=''
1032 need_va_copy=''
1033 netdb_hlen_type=''
1034 netdb_host_type=''
1035 netdb_name_type=''
1036 netdb_net_type=''
1037 groupcat=''
1038 hostcat=''
1039 passcat=''
1040 orderlib=''
1041 ranlib=''
1042 d_perl_otherlibdirs=''
1043 otherlibdirs=''
1044 package=''
1045 spackage=''
1046 pager=''
1047 api_revision=''
1048 api_subversion=''
1049 api_version=''
1050 api_versionstring=''
1051 patchlevel=''
1052 perl_patchlevel=''
1053 revision=''
1054 subversion=''
1055 version=''
1056 version_patchlevel_string=''
1057 perl5=''
1058 perladmin=''
1059 perlpath=''
1060 d_nv_preserves_uv=''
1061 d_nv_zero_is_allbits_zero=''
1062 i16size=''
1063 i16type=''
1064 i32size=''
1065 i32type=''
1066 i64size=''
1067 i64type=''
1068 i8size=''
1069 i8type=''
1070 ivsize=''
1071 ivtype=''
1072 nv_overflows_integers_at=''
1073 nv_preserves_uv_bits=''
1074 nvsize=''
1075 nvtype=''
1076 u16size=''
1077 u16type=''
1078 u32size=''
1079 u32type=''
1080 u64size=''
1081 u64type=''
1082 u8size=''
1083 u8type=''
1084 uvsize=''
1085 uvtype=''
1086 ivdformat=''
1087 nvEUformat=''
1088 nvFUformat=''
1089 nvGUformat=''
1090 nveformat=''
1091 nvfformat=''
1092 nvgformat=''
1093 uvXUformat=''
1094 uvoformat=''
1095 uvuformat=''
1096 uvxformat=''
1097 pidtype=''
1098 prefix=''
1099 prefixexp=''
1100 installprivlib=''
1101 privlib=''
1102 privlibexp=''
1103 prototype=''
1104 ptrsize=''
1105 d_PRIXU64=''
1106 d_PRId64=''
1107 d_PRIi64=''
1108 d_PRIo64=''
1109 d_PRIu64=''
1110 d_PRIx64=''
1111 sPRIXU64=''
1112 sPRId64=''
1113 sPRIi64=''
1114 sPRIo64=''
1115 sPRIu64=''
1116 sPRIx64=''
1117 d_quad=''
1118 quadkind=''
1119 quadtype=''
1120 uquadtype=''
1121 drand01=''
1122 randbits=''
1123 randfunc=''
1124 randseedtype=''
1125 seedfunc=''
1126 installscript=''
1127 scriptdir=''
1128 scriptdirexp=''
1129 selectminbits=''
1130 selecttype=''
1131 sh=''
1132 sig_count=''
1133 sig_name=''
1134 sig_name_init=''
1135 sig_num=''
1136 sig_num_init=''
1137 sig_size=''
1138 d_sitearch=''
1139 installsitearch=''
1140 sitearch=''
1141 sitearchexp=''
1142 installsitebin=''
1143 sitebin=''
1144 sitebinexp=''
1145 installsitehtml1dir=''
1146 sitehtml1dir=''
1147 sitehtml1direxp=''
1148 installsitehtml3dir=''
1149 sitehtml3dir=''
1150 sitehtml3direxp=''
1151 installsitelib=''
1152 sitelib=''
1153 sitelib_stem=''
1154 sitelibexp=''
1155 installsiteman1dir=''
1156 siteman1dir=''
1157 siteman1direxp=''
1158 installsiteman3dir=''
1159 siteman3dir=''
1160 siteman3direxp=''
1161 siteprefix=''
1162 siteprefixexp=''
1163 installsitescript=''
1164 sitescript=''
1165 sitescriptexp=''
1166 sizesize=''
1167 sizetype=''
1168 so=''
1169 socksizetype=''
1170 sharpbang=''
1171 shsharp=''
1172 spitshell=''
1173 src=''
1174 ssizetype=''
1175 startperl=''
1176 startsh=''
1177 stdchar=''
1178 d_stdio_stream_array=''
1179 stdio_stream_array=''
1180 sysman=''
1181 sGMTIME_max=''
1182 sGMTIME_min=''
1183 sLOCALTIME_max=''
1184 sLOCALTIME_min=''
1185 trnl=''
1186 uidformat=''
1187 uidsign=''
1188 uidsize=''
1189 uidtype=''
1190 archname64=''
1191 use64bitall=''
1192 use64bitint=''
1193 dtrace=''
1194 usedtrace=''
1195 usefaststdio=''
1196 ccflags_uselargefiles=''
1197 ldflags_uselargefiles=''
1198 libswanted_uselargefiles=''
1199 uselargefiles=''
1200 uselongdouble=''
1201 usemorebits=''
1202 usemultiplicity=''
1203 nm_opt=''
1204 nm_so_opt=''
1205 runnm=''
1206 usenm=''
1207 useperlio=''
1208 usesocks=''
1209 d_oldpthreads=''
1210 use5005threads=''
1211 useithreads=''
1212 usereentrant=''
1213 usethreads=''
1214 incpath=''
1215 mips_type=''
1216 usrinc=''
1217 d_vendorarch=''
1218 installvendorarch=''
1219 vendorarch=''
1220 vendorarchexp=''
1221 d_vendorbin=''
1222 installvendorbin=''
1223 vendorbin=''
1224 vendorbinexp=''
1225 installvendorhtml1dir=''
1226 vendorhtml1dir=''
1227 vendorhtml1direxp=''
1228 installvendorhtml3dir=''
1229 vendorhtml3dir=''
1230 vendorhtml3direxp=''
1231 d_vendorlib=''
1232 installvendorlib=''
1233 vendorlib=''
1234 vendorlib_stem=''
1235 vendorlibexp=''
1236 installvendorman1dir=''
1237 vendorman1dir=''
1238 vendorman1direxp=''
1239 installvendorman3dir=''
1240 vendorman3dir=''
1241 vendorman3direxp=''
1242 usevendorprefix=''
1243 vendorprefix=''
1244 vendorprefixexp=''
1245 d_vendorscript=''
1246 installvendorscript=''
1247 vendorscript=''
1248 vendorscriptexp=''
1249 versiononly=''
1250 defvoidused=''
1251 voidflags=''
1252 yacc=''
1253 yaccflags=''
1254 CONFIG=''
1255
1256 : Detect odd OSs
1257 define='define'
1258 undef='undef'
1259 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1260 rmlist=''
1261
1262 : We must find out about Eunice early
1263 eunicefix=':'
1264 if test -f /etc/unixtovms; then
1265         eunicefix=/etc/unixtovms
1266 fi
1267 if test -f /etc/unixtovms.exe; then
1268         eunicefix=/etc/unixtovms.exe
1269 fi
1270
1271 : Set executable suffix now -- needed before hints available
1272 if test -f "/libs/version.library"; then
1273 : Amiga OS
1274     _exe=""
1275 elif test -f "/system/gnu_library/bin/ar.pm"; then
1276 : Stratus VOS
1277     _exe=".pm"
1278 elif test -n "$DJGPP"; then
1279 : DOS DJGPP
1280     _exe=".exe"
1281 elif test -d c:/. -o -n "$is_os2" ; then
1282 : OS/2 or cygwin
1283     _exe=".exe"
1284 fi
1285
1286 groupstype=''
1287 i_whoami=''
1288 : Trailing extension.  Override this in a hint file, if needed.
1289 : Extra object files, if any, needed on this platform.
1290 archobjs=''
1291 archname=''
1292 libnames=''
1293 : change the next line if compiling for Xenix/286 on Xenix/386
1294 xlibpth='/usr/lib/386 /lib/386'
1295 : Possible local library directories to search.
1296 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1297 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1298
1299 : general looking path for locating libraries
1300 glibpth="/lib /usr/lib $xlibpth"
1301 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1302 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1303 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1304 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1305
1306 : Private path used by Configure to find libraries.  Its value
1307 : is prepended to libpth. This variable takes care of special
1308 : machines, like the mips.  Usually, it should be empty.
1309 plibpth=''
1310
1311 : default library list
1312 libswanted=''
1313 : some systems want to use only the non-versioned libso:s
1314 ignore_versioned_solibs=''
1315 : set usethreads on the Configure command line to enable threads.
1316 usereentrant='undef'
1317 : full support for void wanted by default
1318 defvoidused=15
1319
1320 : Possible local include directories to search.
1321 : Set locincpth to "" in a hint file to defeat local include searches.
1322 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1323 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1324 :
1325 : no include file wanted by default
1326 inclwanted=''
1327
1328 : Enable -DEBUGGING and -DDEBUGGING from the command line
1329 EBUGGING=''
1330 DEBUGGING=old
1331
1332 ccname=''
1333 ccversion=''
1334 perllibs=''
1335 : set useposix=false in your hint file to disable the POSIX extension.
1336 useposix=true
1337 : set useopcode=false in your hint file to disable the Opcode extension.
1338 useopcode=true
1339 archname64=''
1340 ccflags_uselargefiles=''
1341 ldflags_uselargefiles=''
1342 libswanted_uselargefiles=''
1343 : set usemultiplicity on the Configure command line to enable multiplicity.
1344 : set usesocks on the Configure command line to enable socks.
1345 : List of libraries we want.
1346 : If anyone needs extra -lxxx, put those in a hint file.
1347 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1348 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1349 : We probably want to search /usr/shlib before most other libraries.
1350 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1351 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1352 glibpth="/usr/shlib $glibpth"
1353 : Do not use vfork unless overridden by a hint file.
1354 usevfork=false
1355
1356 : Find the basic shell for Bourne shell scripts
1357 case "$sh" in
1358 '')
1359         case "$SYSTYPE" in
1360         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1361         *) xxx='/bin/sh';;
1362         esac
1363         if test -f "$xxx"; then
1364                 sh="$xxx"
1365         else
1366                 : Build up a list and do a single loop so we can 'break' out.
1367                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1368                 for xxx in sh bash ksh pdksh ash; do
1369                         for p in $pth; do
1370                                 try="$try ${p}/${xxx}"
1371                         done
1372                 done
1373                 for xxx in $try; do
1374                         if test -f "$xxx"; then
1375                                 sh="$xxx";
1376                                 break
1377                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1378                                 sh="$xxx";
1379                                 break
1380                         elif test -f "$xxx.exe"; then
1381                                 sh="$xxx";
1382                                 break
1383                         fi
1384                 done
1385         fi
1386         ;;
1387 esac
1388
1389 case "$sh" in
1390 '')     cat >&2 <<EOM
1391 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1392
1393 Usually it's in /bin/sh.  How did you even get this far?
1394 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1395 we'll try to straighten this all out.
1396 EOM
1397         exit 1
1398         ;;
1399 esac
1400
1401 : see if sh knows # comments
1402 if `$sh -c '#' >/dev/null 2>&1`; then
1403         shsharp=true
1404         spitshell=cat
1405         xcat=/bin/cat
1406         test -f $xcat$_exe || xcat=/usr/bin/cat
1407         if test ! -f $xcat$_exe; then
1408                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1409                         if test -f $p/cat$_exe; then
1410                                 xcat=$p/cat
1411                                 break
1412                         fi
1413                 done
1414                 if test ! -f $xcat$_exe; then
1415                         echo "Can't find cat anywhere!"
1416                         exit 1
1417                 fi
1418         fi
1419         echo "#!$xcat" >sharp
1420         $eunicefix sharp
1421         chmod +x sharp
1422         ./sharp > today 2>/dev/null
1423         if test -s today; then
1424                 sharpbang='#!'
1425         else
1426                 echo "#! $xcat" > sharp
1427                 $eunicefix sharp
1428                 chmod +x sharp
1429                 ./sharp > today 2>/dev/null
1430                 if test -s today; then
1431                         sharpbang='#! '
1432                 else
1433                         sharpbang=': use '
1434                 fi
1435         fi
1436 else
1437         echo " "
1438         echo "Your $sh doesn't grok # comments--I will strip them later on."
1439         shsharp=false
1440         cd ..
1441         echo "exec grep -v '^[  ]*#'" >spitshell
1442         chmod +x spitshell
1443         $eunicefix spitshell
1444         spitshell=`pwd`/spitshell
1445         cd UU
1446         echo "I presume that if # doesn't work, #! won't work either!"
1447         sharpbang=': use '
1448 fi
1449 rm -f sharp today
1450
1451 : figure out how to guarantee sh startup
1452 case "$startsh" in
1453 '') startsh=${sharpbang}${sh} ;;
1454 *)
1455 esac
1456 cat >sharp <<EOSS
1457 $startsh
1458 set abc
1459 test "$?abc" != 1
1460 EOSS
1461
1462 chmod +x sharp
1463 $eunicefix sharp
1464 if ./sharp; then
1465         : echo "Yup, it does."
1466 else
1467         echo "Hmm... '$startsh' does not guarantee sh startup..."
1468         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1469 fi
1470 rm -f sharp
1471
1472 : Save command line options in file UU/cmdline.opt for later use in
1473 : generating config.sh.
1474 cat > cmdline.opt <<EOSH
1475 : Configure command line arguments.
1476 config_arg0='$0'
1477 config_args='$*'
1478 config_argc=$#
1479 EOSH
1480 argn=1
1481 args_exp=''
1482 args_sep=''
1483 for arg in "$@"; do
1484         cat >>cmdline.opt <<EOSH
1485 config_arg$argn='$arg'
1486 EOSH
1487         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1488 $arg
1489 EOC
1490         arg_exp=`cat cmdl.opt`
1491         args_exp="$args_exp$args_sep'$arg_exp'"
1492         argn=`expr $argn + 1`
1493         args_sep=' '
1494 done
1495 rm -f cmdl.opt
1496
1497 : produce awk script to parse command line options
1498 cat >options.awk <<'EOF'
1499 BEGIN {
1500         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1501
1502         len = length(optstr);
1503         for (i = 1; i <= len; i++) {
1504                 c = substr(optstr, i, 1);
1505                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1506                 if (a == ":") {
1507                         arg[c] = 1;
1508                         i++;
1509                 }
1510                 opt[c] = 1;
1511         }
1512 }
1513 {
1514         expect = 0;
1515         str = $0;
1516         if (substr(str, 1, 1) != "-") {
1517                 printf("'%s'\n", str);
1518                 next;
1519         }
1520         len = length($0);
1521         for (i = 2; i <= len; i++) {
1522                 c = substr(str, i, 1);
1523                 if (!opt[c]) {
1524                         printf("-%s\n", substr(str, i));
1525                         next;
1526                 }
1527                 printf("-%s\n", c);
1528                 if (arg[c]) {
1529                         if (i < len)
1530                                 printf("'%s'\n", substr(str, i + 1));
1531                         else
1532                                 expect = 1;
1533                         next;
1534                 }
1535         }
1536 }
1537 END {
1538         if (expect)
1539                 print "?";
1540 }
1541 EOF
1542
1543 : process the command line options
1544 set X `for arg in "$@"; do echo "X$arg"; done |
1545         sed -e s/X// | awk -f options.awk`
1546 eval "set $*"
1547 shift
1548 rm -f options.awk
1549
1550 : set up default values
1551 fastread=''
1552 reuseval=false
1553 config_sh=''
1554 alldone=''
1555 error=''
1556 silent=''
1557 extractsh=''
1558 override=''
1559 knowitall=''
1560 rm -f optdef.sh posthint.sh
1561 cat >optdef.sh <<EOS
1562 $startsh
1563 EOS
1564
1565
1566 : option parsing
1567 while test $# -gt 0; do
1568         case "$1" in
1569         -d) shift; fastread=yes;;
1570         -e) shift; alldone=cont;;
1571         -f)
1572                 shift
1573                 cd ..
1574                 if test -r "$1"; then
1575                         config_sh="$1"
1576                 else
1577                         echo "$me: cannot read config file $1." >&2
1578                         error=true
1579                 fi
1580                 cd UU
1581                 shift;;
1582         --help|\
1583         -h) shift; error=true;;
1584         -r) shift; reuseval=true;;
1585         -s) shift; silent=true; realsilent=true;;
1586         -E) shift; alldone=exit;;
1587         -K) shift; knowitall=true;;
1588         -O) shift; override=true;;
1589         -S) shift; silent=true; extractsh=true;;
1590         -D)
1591                 shift
1592                 case "$1" in
1593                 *=)
1594                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1595                         echo "$me: ignoring -D $1" >&2
1596                         ;;
1597                 *=*) echo "$1" | \
1598                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1599                 *) echo "$1='define'" >> optdef.sh;;
1600                 esac
1601                 shift
1602                 ;;
1603         -U)
1604                 shift
1605                 case "$1" in
1606                 *=) echo "$1" >> optdef.sh;;
1607                 *=*)
1608                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1609                         echo "$me: ignoring -U $1" >&2
1610                         ;;
1611                 *) echo "$1='undef'" >> optdef.sh;;
1612                 esac
1613                 shift
1614                 ;;
1615         -A)
1616             shift
1617             xxx=''
1618             yyy="$1"
1619             zzz=''
1620             uuu=undef
1621             case "$yyy" in
1622             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1623                  case "$zzz" in
1624                  *:*) zzz='' ;;
1625                  *)   xxx=append
1626                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1627                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1628                  esac
1629                  ;;
1630             esac
1631             case "$xxx" in
1632             '')  case "$yyy" in
1633                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1634                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1635                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1636                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1637                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1638                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1639                  esac
1640                  ;;
1641             esac
1642             case "$xxx" in
1643             append)
1644                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1645             clear)
1646                 echo "$yyy=''"                  >> posthint.sh ;;
1647             define)
1648                 case "$zzz" in
1649                 '') zzz=define ;;
1650                 esac
1651                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1652             eval)
1653                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1654             prepend)
1655                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1656             undef)
1657                 case "$zzz" in
1658                 '') zzz="$uuu" ;;
1659                 esac
1660                 echo "$yyy=$zzz"                >> posthint.sh ;;
1661             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1662             esac
1663             shift
1664             ;;
1665         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1666             exit 0;;
1667         --) break;;
1668         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1669         *) break;;
1670         esac
1671 done
1672
1673 case "$error" in
1674 true)
1675         cat >&2 <<EOM
1676 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1677                  [-U symbol] [-U symbol=] [-A command:symbol...]
1678   -d : use defaults for all answers.
1679   -e : go on without questioning past the production of config.sh.
1680   -f : specify an alternate default configuration file.
1681   -h : print this help message and exit (with an error status).
1682   -r : reuse C symbols value if possible (skips costly nm extraction).
1683   -s : silent mode, only echoes questions and essential information.
1684   -D : define symbol to have some value:
1685          -D symbol         symbol gets the value 'define'
1686          -D symbol=value   symbol gets the value 'value'
1687        common used examples (see INSTALL for more info):
1688          -Duse64bitint            use 64bit integers
1689          -Duse64bitall            use 64bit integers and pointers
1690          -Dusethreads             use thread support
1691          -Dinc_version_list=none  do not include older perl trees in @INC
1692          -DEBUGGING=none          DEBUGGING options
1693          -Dcc=gcc                 choose your compiler
1694          -Dprefix=/opt/perl5      choose your destination
1695   -E : stop at the end of questions, after having produced config.sh.
1696   -K : do not use unless you know what you are doing.
1697   -O : let -D and -U override definitions from loaded configuration file.
1698   -S : perform variable substitutions on all .SH files (can mix with -f)
1699   -U : undefine symbol:
1700          -U symbol    symbol gets the value 'undef'
1701          -U symbol=   symbol gets completely empty
1702        e.g.:  -Uversiononly
1703   -A : manipulate symbol after the platform specific hints have been applied:
1704          -A append:symbol=value   append value to symbol
1705          -A symbol=value          like append:, but with a separating space
1706          -A define:symbol=value   define symbol to have value
1707          -A clear:symbol          define symbol to be ''
1708          -A define:symbol         define symbol to be 'define'
1709          -A eval:symbol=value     define symbol to be eval of value
1710          -A prepend:symbol=value  prepend value to symbol
1711          -A undef:symbol          define symbol to be 'undef'
1712          -A undef:symbol=         define symbol to be ''
1713        e.g.:  -A prepend:libswanted='cl pthread '
1714               -A ccflags=-DSOME_MACRO
1715   -V : print version number and exit (with a zero status).
1716 EOM
1717         exit 1
1718         ;;
1719 esac
1720
1721 : Sanity checks
1722 case "$fastread$alldone" in
1723 yescont|yesexit) ;;
1724 *)
1725         case "$extractsh" in
1726         true) ;;
1727         *)
1728                 if test ! -t 0; then
1729                         echo "Say 'sh Configure', not 'sh <Configure'"
1730                         exit 1
1731                 fi
1732                 ;;
1733         esac
1734         ;;
1735 esac
1736
1737 exec 4>&1
1738 case "$silent" in
1739 true) exec 1>/dev/null;;
1740 esac
1741
1742 : run the defines and the undefines, if any, but leave the file out there...
1743 touch optdef.sh
1744 . ./optdef.sh
1745 : create the posthint manipulation script and leave the file out there...
1746 touch posthint.sh
1747
1748 : set package name
1749 package='perl5'
1750 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1751 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1752 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1753 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1754 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1755 esac
1756
1757 : Some greps do not return status, grrr.
1758 echo "grimblepritz" >grimble
1759 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1760         contains=contains
1761 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1762         contains=grep
1763 else
1764         contains=contains
1765 fi
1766 rm -f grimble
1767 : the following should work in any shell
1768 case "$contains" in
1769 contains*)
1770         echo " "
1771         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1772         cat >contains <<'EOSS'
1773 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1774 EOSS
1775 chmod +x contains
1776 esac
1777
1778 : Find the path to the source tree
1779 case "$src" in
1780 '') case "$0" in
1781     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1782          case "$src" in
1783          /*)    ;;
1784          .)     ;;
1785          *)     src=`cd ../$src && pwd` ;;
1786          esac
1787          ;;
1788     *)   src='.';;
1789     esac;;
1790 esac
1791 case "$src" in
1792 '')     src=/
1793         rsrc=/
1794         ;;
1795 /*)     rsrc="$src";;
1796 *)      rsrc="../$src";;
1797 esac
1798 if test -f $rsrc/Configure && \
1799         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1800 then
1801    : found it, so we are ok.
1802 else
1803         rsrc=''
1804         for src in . .. ../.. ../../.. ../../../..; do
1805                 if test -f ../$src/Configure && \
1806                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1807                 then
1808                         rsrc=../$src
1809                         break
1810                 fi
1811         done
1812 fi
1813 case "$rsrc" in
1814 '')
1815         cat <<EOM >&4
1816
1817 Sorry, I can't seem to locate the source dir for $package.  Please start
1818 Configure with an explicit path -- i.e. /some/path/Configure.
1819
1820 EOM
1821         exit 1
1822         ;;
1823 ../.)   rsrc='..';;
1824 *)
1825         echo " "
1826         echo "Sources for $package found in \"$src\"." >&4
1827         ;;
1828 esac
1829
1830 : script used to extract .SH files with variable substitutions
1831 cat >extract <<'EOS'
1832 PERL_CONFIG_SH=true
1833 echo "Doing variable substitutions on .SH files..."
1834 if test -f MANIFEST; then
1835         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1836 else
1837         echo "(Looking for .SH files under the source directory.)"
1838         set x `(cd "$src"; find . -name "*.SH" -print)`
1839 fi
1840 shift
1841 case $# in
1842 0) set x `(cd "$src"; echo *.SH)`; shift;;
1843 esac
1844 if test ! -f "$src/$1"; then
1845         shift
1846 fi
1847 mkdir_p='
1848 name=$1;
1849 create="";
1850 while test $name; do
1851         if test ! -d "$name"; then
1852                 create="$name $create";
1853                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1854                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1855         else
1856                 name="";
1857         fi;
1858 done;
1859 for file in $create; do
1860         mkdir $file;
1861 done
1862 '
1863 for file in $*; do
1864         case "$src" in
1865         ".")
1866                 case "$file" in
1867                 */*)
1868                         dir=`expr X$file : 'X\(.*\)/'`
1869                         file=`expr X$file : 'X.*/\(.*\)'`
1870                         (cd "$dir" && . ./$file)
1871                         ;;
1872                 *)
1873                         . ./$file
1874                         ;;
1875                 esac
1876                 ;;
1877         *)
1878                 case "$file" in
1879                 */*)
1880                         dir=`expr X$file : 'X\(.*\)/'`
1881                         file=`expr X$file : 'X.*/\(.*\)'`
1882                         (set x $dir; shift; eval $mkdir_p)
1883                         sh <"$src/$dir/$file"
1884                         ;;
1885                 *)
1886                         sh <"$src/$file"
1887                         ;;
1888                 esac
1889                 ;;
1890         esac
1891 done
1892 if test -f "$src/config_h.SH"; then
1893         if test ! -f config.h; then
1894         : oops, they left it out of MANIFEST, probably, so do it anyway.
1895         . "$src/config_h.SH"
1896         fi
1897 fi
1898 EOS
1899
1900 : extract files and exit if asked to do so
1901 case "$extractsh" in
1902 true)
1903         case "$realsilent" in
1904         true) ;;
1905         *) exec 1>&4;;
1906         esac
1907         case "$config_sh" in
1908         '') config_sh='config.sh';;
1909         esac
1910         echo " "
1911         echo "Fetching answers from $config_sh..."
1912         cd ..
1913         . $config_sh
1914         test "$override" && . ./optdef.sh
1915         echo " "
1916         . UU/extract
1917         rm -rf UU
1918         echo "Extraction done."
1919         exit 0
1920         ;;
1921 esac
1922
1923 : Eunice requires " " instead of "", can you believe it
1924 echo " "
1925 : Here we go...
1926 echo "Beginning of configuration questions for $package."
1927
1928 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1929
1930 : first determine how to suppress newline on echo command
1931 echo " "
1932 echo "Checking echo to see how to suppress newlines..."
1933 (echo "hi there\c" ; echo " ") >.echotmp
1934 if $contains c .echotmp >/dev/null 2>&1 ; then
1935         echo "...using -n."
1936         n='-n'
1937         c=''
1938 else
1939         cat <<'EOM'
1940 ...using \c
1941 EOM
1942         n=''
1943         c='\c'
1944 fi
1945 echo $n "The star should be here-->$c"
1946 echo '*'
1947 rm -f .echotmp
1948
1949 : Now test for existence of everything in MANIFEST
1950 echo " "
1951 if test -f "$rsrc/MANIFEST"; then
1952         echo "First let's make sure your kit is complete.  Checking..." >&4
1953         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1954                 (split -l 50 2>/dev/null || split -50)
1955         rm -f missing
1956         tmppwd=`pwd`
1957         for filelist in x??; do
1958                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1959                         >/dev/null 2>>"$tmppwd/missing")
1960         done
1961         if test -s missing; then
1962                 cat missing >&4
1963                 cat >&4 <<'EOM'
1964
1965 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1966
1967 You have the option of continuing the configuration process, despite the
1968 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1969 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1970 and contact the author (perlbug@perl.org).
1971
1972 EOM
1973                 echo $n "Continue? [n] $c" >&4
1974                 read ans
1975                 case "$ans" in
1976                 y*)
1977                         echo "Continuing..." >&4
1978                         rm -f missing
1979                         ;;
1980                 *)
1981                         echo "ABORTING..." >&4
1982                         kill $$
1983                         ;;
1984                 esac
1985         else
1986                 echo "Looks good..."
1987         fi
1988 else
1989         echo "There is no MANIFEST file.  I hope your kit is complete !"
1990 fi
1991 rm -f missing x??
1992
1993 : Find the appropriate value for a newline for tr
1994 echo " "
1995 if test -n "$DJGPP"; then
1996        trnl='\012'
1997 fi
1998 if test X"$trnl" = X; then
1999         case "`echo foo|tr '\n' x 2>/dev/null`" in
2000         foox) trnl='\n' ;;
2001         esac
2002 fi
2003 if test X"$trnl" = X; then
2004         case "`echo foo|tr '\012' x 2>/dev/null`" in
2005         foox) trnl='\012' ;;
2006         esac
2007 fi
2008 if test X"$trnl" = X; then
2009        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2010        fooxy) trnl='\n\r' ;;
2011        esac
2012 fi
2013 if test X"$trnl" = X; then
2014         cat <<EOM >&2
2015
2016 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2017
2018 EOM
2019         exit 1
2020 fi
2021
2022 : compute the number of columns on the terminal for proper question formatting
2023 case "$COLUMNS" in
2024 '') COLUMNS='80';;
2025 esac
2026
2027 : set up the echo used in my read
2028 myecho="case \"\$xxxm\" in
2029 '') echo $n \"\$rp $c\" >&4;;
2030 *) case \"\$rp\" in
2031         '') echo $n \"[\$xxxm] $c\";;
2032         *)
2033                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2034                         echo \"\$rp\" >&4
2035                         echo $n \"[\$xxxm] $c\" >&4
2036                 else
2037                         echo $n \"\$rp [\$xxxm] $c\" >&4
2038                 fi
2039                 ;;
2040         esac;;
2041 esac"
2042
2043 : now set up to do reads with possible shell escape and default assignment
2044 cat <<EOSC >myread
2045 $startsh
2046 xxxm=\$dflt
2047 $myecho
2048 ans='!'
2049 case "\$fastread" in
2050 yes) case "\$dflt" in
2051         '') ;;
2052         *) ans='';
2053                 case "\$silent-\$rp" in
2054                 true-) ;;
2055                 *) echo " " >&4;;
2056                 esac;;
2057         esac;;
2058 *) case "\$silent" in
2059         true) case "\$rp" in
2060                 '') ans='';;
2061                 esac;;
2062         esac;;
2063 esac
2064 while expr "X\$ans" : "X!" >/dev/null; do
2065         read answ
2066         set x \$xxxm
2067         shift
2068         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2069         case  "\$answ" in
2070         "!")
2071                 sh 1>&4
2072                 echo " "
2073                 $myecho
2074                 ;;
2075         !*)
2076                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2077                 shift
2078                 sh 1>&4 -c "\$*"
2079                 echo " "
2080                 $myecho
2081                 ;;
2082         "\$ans")
2083                 case "\$ans" in
2084                 \\&*)
2085                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2086                         shift
2087                         case "\$1" in
2088                         -d)
2089                                 fastread=yes
2090                                 echo "(OK, I'll run with -d after this question.)" >&4
2091                                 ;;
2092                         -*)
2093                                 echo "*** Sorry, \$1 not supported yet." >&4
2094                                 ;;
2095                         esac
2096                         $myecho
2097                         ans=!
2098                         ;;
2099                 esac;;
2100         *)
2101                 case "\$aok" in
2102                 y)
2103                         echo "*** Substitution done -- please confirm."
2104                         xxxm="\$ans"
2105                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2106                         xxxm="\$ans"
2107                         ans=!
2108                         ;;
2109                 *)
2110                         echo "*** Error -- try again."
2111                         ans=!
2112                         ;;
2113                 esac
2114                 $myecho
2115                 ;;
2116         esac
2117         case "\$ans\$xxxm\$nostick" in
2118         '')
2119                 ans=!
2120                 $myecho
2121                 ;;
2122         esac
2123 done
2124 case "\$ans" in
2125 '') ans="\$xxxm";;
2126 esac
2127 EOSC
2128
2129 : create .config dir to save info across Configure sessions
2130 test -d ../.config || mkdir ../.config
2131 cat >../.config/README <<EOF
2132 This directory created by Configure to save information that should
2133 persist across sessions for $package.
2134
2135 You may safely delete it if you wish.
2136 EOF
2137
2138 : See if we are using a devel version and want that
2139 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2140 case "$usedevel" in
2141 $define|true|[yY]*) ;;
2142 *) case "$xversion" in
2143    *[13579])
2144         cat >&4 <<EOH
2145 *** WHOA THERE!!! ***
2146
2147     This is an UNSTABLE DEVELOPMENT release.
2148     The version of this $package distribution is $xversion, that is, odd,
2149     (as opposed to even) and that signifies a development release.
2150     If you want a maintenance release, you want an even-numbered version.
2151
2152     Do ***NOT*** install this into production use.
2153     Data corruption and crashes are possible.
2154
2155     It is most seriously suggested that you do not continue any further
2156     unless you want to help in developing and debugging Perl.
2157
2158     If you *still* want to build perl, you can answer 'y' now,
2159     or pass -Dusedevel to Configure.
2160
2161 EOH
2162         rp='Do you really want to continue?'
2163         dflt='n'
2164         . ./myread
2165         case "$ans" in
2166         [yY]) echo >&4 "Okay, continuing."
2167               usedevel="$define" ;;
2168         *) echo >&4 "Okay, bye."
2169            exit 1
2170            ;;
2171         esac
2172         ;;
2173     esac
2174     ;;
2175 esac
2176 case "$usedevel" in
2177 $define|true|[yY]*)
2178         case "$versiononly" in
2179         '') versiononly="$define" ;;
2180         esac
2181         case "$installusrbinperl" in
2182         '') installusrbinperl="$undef" ;;
2183         esac
2184         ;;
2185 esac
2186
2187 : general instructions
2188 needman=true
2189 firsttime=true
2190 user=`(logname) 2>/dev/null`
2191 case "$user" in
2192 '') user=`whoami 2>&1`;;
2193 esac
2194 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2195         firsttime=false
2196         echo " "
2197         rp='Would you like to see the instructions?'
2198         dflt=n
2199         . ./myread
2200         case "$ans" in
2201         [yY]*) ;;
2202         *) needman=false;;
2203         esac
2204 fi
2205 if $needman; then
2206         cat <<EOH
2207
2208 This installation shell script will examine your system and ask you questions
2209 to determine how the perl5 package should be installed. If you get
2210 stuck on a question, you may use a ! shell escape to start a subshell or
2211 execute a command.  Many of the questions will have default answers in square
2212 brackets; typing carriage return will give you the default.
2213
2214 On some of the questions which ask for file or directory names you are allowed
2215 to use the ~name construct to specify the login directory belonging to "name",
2216 even if you don't have a shell which knows about that.  Questions where this is
2217 allowed will be marked "(~name ok)".
2218
2219 EOH
2220         rp=''
2221         dflt='Type carriage return to continue'
2222         . ./myread
2223         cat <<'EOH'
2224
2225 The prompter used in this script allows you to use shell variables and
2226 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2227 in the default answer, as if the default line was a set of arguments given to a
2228 script shell.  This means you may also use $* to repeat the whole default line,
2229 so you do not have to re-type everything to add something to the default.
2230
2231 Everytime there is a substitution, you will have to confirm.  If there is an
2232 error (e.g. an unmatched backtick), the default answer will remain unchanged
2233 and you will be prompted again.
2234
2235 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2236 the questions and use the computed defaults (or the previous answers if there
2237 was already a config.sh file). Type 'Configure -h' for a list of options.
2238 You may also start interactively and then answer '& -d' at any prompt to turn
2239 on the non-interactive behaviour for the remainder of the execution.
2240
2241 EOH
2242         . ./myread
2243         cat <<EOH
2244
2245 Much effort has been expended to ensure that this shell script will run on any
2246 Unix system.  If despite that it blows up on yours, your best bet is to edit
2247 Configure and run it again.  If you can't run Configure for some reason,
2248 you'll have to generate a config.sh file by hand.  Whatever problems you
2249 have, let me (perlbug@perl.org) know how I blew it.
2250
2251 This installation script affects things in two ways:
2252
2253 1) it may do direct variable substitutions on some of the files included
2254    in this kit.
2255 2) it builds a config.h file for inclusion in C programs.  You may edit
2256    any of these files as the need arises after running this script.
2257
2258 If you make a mistake on a question, there is no easy way to back up to it
2259 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2260 files.  Configure will offer to let you do this before it runs the SH files.
2261
2262 EOH
2263         dflt='Type carriage return to continue'
2264         . ./myread
2265         case "$firsttime" in
2266         true) echo $user >>../.config/instruct;;
2267         esac
2268 fi
2269
2270 : find out where common programs are
2271 echo " "
2272 echo "Locating common programs..." >&4
2273 cat <<EOSC >loc
2274 $startsh
2275 case \$# in
2276 0) exit 1;;
2277 esac
2278 thing=\$1
2279 shift
2280 dflt=\$1
2281 shift
2282 for dir in \$*; do
2283         case "\$thing" in
2284         .)
2285         if test -d \$dir/\$thing; then
2286                 echo \$dir
2287                 exit 0
2288         fi
2289         ;;
2290         *)
2291         for thisthing in \$dir/\$thing; do
2292                 : just loop through to pick last item
2293         done
2294         if test -f \$thisthing; then
2295                 echo \$thisthing
2296                 exit 0
2297         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2298                 echo \$thisthing
2299                 exit 0
2300         elif test -f \$dir/\$thing.exe; then
2301                 if test -n "$DJGPP"; then
2302                         echo \$dir/\$thing.exe
2303                 elif test "$eunicefix" != ":"; then
2304                         : on Eunice apparently
2305                         echo \$dir/\$thing
2306                 fi
2307                 exit 0
2308         fi
2309         ;;
2310         esac
2311 done
2312 echo \$dflt
2313 exit 1
2314 EOSC
2315 chmod +x loc
2316 $eunicefix loc
2317 loclist="
2318 awk
2319 cat
2320 chmod
2321 comm
2322 cp
2323 echo
2324 expr
2325 grep
2326 ls
2327 mkdir
2328 rm
2329 sed
2330 sort
2331 touch
2332 tr
2333 uniq
2334 "
2335 trylist="
2336 ar
2337 bison
2338 byacc
2339 cpp
2340 csh
2341 date
2342 egrep
2343 gmake
2344 gzip
2345 less
2346 ln
2347 make
2348 more
2349 nm
2350 nroff
2351 pg
2352 test
2353 uname
2354 zip
2355 "
2356 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2357 pth="$pth /lib /usr/lib"
2358 for file in $loclist; do
2359         eval xxx=\$$file
2360         case "$xxx" in
2361         /*|?:[\\/]*)
2362                 if test -f "$xxx"; then
2363                         : ok
2364                 else
2365                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2366                         xxx=`./loc $file $file $pth`
2367                 fi
2368                 ;;
2369         '') xxx=`./loc $file $file $pth`;;
2370         *) xxx=`./loc $xxx $xxx $pth`;;
2371         esac
2372         eval $file=$xxx$_exe
2373         eval _$file=$xxx
2374         case "$xxx" in
2375         /*)
2376                 echo $file is in $xxx.
2377                 ;;
2378         ?:[\\/]*)
2379                 echo $file is in $xxx.
2380                 ;;
2381         *)
2382                 echo "I don't know where '$file' is, and my life depends on it." >&4
2383                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2384                 exit 1
2385                 ;;
2386         esac
2387 done
2388 echo " "
2389 echo "Don't worry if any of the following aren't found..."
2390 say=offhand
2391 for file in $trylist; do
2392         eval xxx=\$$file
2393         case "$xxx" in
2394         /*|?:[\\/]*)
2395                 if test -f "$xxx"; then
2396                         : ok
2397                 else
2398                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2399                         xxx=`./loc $file $file $pth`
2400                 fi
2401                 ;;
2402         '') xxx=`./loc $file $file $pth`;;
2403         *) xxx=`./loc $xxx $xxx $pth`;;
2404         esac
2405         eval $file=$xxx$_exe
2406         eval _$file=$xxx
2407         case "$xxx" in
2408         /*)
2409                 echo $file is in $xxx.
2410                 ;;
2411         ?:[\\/]*)
2412                 echo $file is in $xxx.
2413                 ;;
2414         *)
2415                 echo "I don't see $file out there, $say."
2416                 say=either
2417                 ;;
2418         esac
2419 done
2420 case "$egrep" in
2421 egrep)
2422         echo "Substituting grep for egrep."
2423         egrep=$grep
2424         _egrep=$grep
2425         ;;
2426 esac
2427 case "$ln" in
2428 ln)
2429         echo "Substituting cp for ln."
2430         ln=$cp
2431         _ln=$cp
2432         ;;
2433 esac
2434 case "$make" in
2435 make)
2436         case "$gmake" in
2437         gmake)
2438         echo "I can't find make or gmake, and my life depends on it." >&4
2439         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2440         exit 1
2441         ;;
2442         esac
2443         ;;
2444 esac
2445 case "$gmake" in
2446 gmake)  ;;
2447 *)      # We can't have osname yet.
2448         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2449                 # Assume that gmake, if found, is definitely GNU make
2450                 # and prefer it over the system make.
2451                 echo "Substituting gmake for make."
2452                 make=$gmake
2453                 _make=$gmake
2454         fi
2455         ;;
2456 esac
2457 case "$test" in
2458 test)
2459         echo "Hopefully test is built into your sh."
2460         ;;
2461 *)
2462         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2463                 echo "Using the test built into your sh."
2464                 test=test
2465                 _test=test
2466         fi
2467         ;;
2468 esac
2469 case "$echo" in
2470 echo)
2471         echo "Hopefully echo is built into your sh."
2472         ;;
2473 '') ;;
2474 *)
2475         echo " "
2476 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2477         $echo $n "hi there$c" >foo1
2478         echo $n "hi there$c" >foo2
2479         if cmp foo1 foo2 >/dev/null 2>&1; then
2480                 echo "They are compatible.  In fact, they may be identical."
2481         else
2482                 case "$n" in
2483                 '-n') n='' c='\c';;
2484                 *) n='-n' c='';;
2485                 esac
2486                 cat <<FOO
2487 They are not compatible!  You are probably running ksh on a non-USG system.
2488 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2489 have echo built in and we may have to run some Bourne shell scripts.  That
2490 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2491
2492 FOO
2493                 $echo $n "The star should be here-->$c"
2494                 $echo "*"
2495         fi
2496         $rm -f foo1 foo2
2497         ;;
2498 esac
2499
2500 # This question was auctioned at YAPC::Europe-2007 in Vienna
2501 # I never promised you could answer it. I only auctioned the question.
2502 cat <<FOO
2503 The following message is sponsored by
2504
2505   Dresden.pm<--The stars should be here.
2506
2507 Dear Perl user, system administrator or package
2508 maintainer, the Perl community sends greetings to
2509 you. Do you (emblematical) greet back [Y/n]? n
2510
2511 FOO
2512
2513 : Check what type of C compiler we use
2514 cat <<EOS >trygcc
2515 $startsh
2516 EOS
2517 cat <<'EOSC' >>trygcc
2518 case "$cc" in
2519 '') ;;
2520 *)  $rm -f try try.*
2521     $cat >try.c <<EOM
2522 int main(int argc, char *argv[]) {
2523   return 0;
2524 }
2525 EOM
2526     if $cc -o try $ccflags $ldflags try.c; then
2527        :
2528     else
2529         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530         despair=yes
2531         trygcc=yes
2532         case "$cc" in
2533         *gcc*) trygcc=no ;;
2534         esac
2535         # Skip this test because it gives a false match on output like:
2536         #    ./trygcc: line 23: cc: command not found
2537         # case "`$cc -v -c try.c 2>&1`" in
2538         # *gcc*) trygcc=no ;;
2539         # esac
2540         if $test X"$trygcc" = Xyes; then
2541             if gcc -o try -c try.c; then
2542                 echo " "
2543                 echo "You seem to have a working gcc, though." >&4
2544                 # Switching compilers may undo the work of hints files.
2545                 # The most common problem is -D_REENTRANT for threads.
2546                 # This heuristic catches that case, but gets false positives
2547                 # if -Dusethreads was not actually specified.  Better to
2548                 # bail out here with a useful message than fail 
2549                 # mysteriously later. Should we perhaps just try to
2550                 # re-invoke Configure -Dcc=gcc config_args ?
2551                 if $test -f usethreads.cbu; then
2552                         $cat >&4 <<EOM 
2553
2554 *** However, any setting of the C compiler flags (e.g. for thread support)
2555 *** will be lost.  It may be necessary for you to restart Configure and
2556 *** add -Dcc=gcc to your Configure command line.
2557
2558 EOM
2559                         rp="Would you like to go ahead and try gcc anyway?"
2560                         dflt=n
2561                 else
2562                         rp="Would you like to use it?"
2563                         dflt=y
2564                 fi
2565                 if $test -f myread; then
2566                     . ./myread
2567                 else
2568                     if $test -f UU/myread; then
2569                         . ./UU/myread
2570                     else
2571                         echo "Cannot find myread, sorry.  Aborting." >&2
2572                         exit 1
2573                     fi
2574                 fi  
2575                 case "$ans" in
2576                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2577                 esac
2578             fi
2579         fi
2580     fi
2581     $rm -f try try.*
2582     ;;
2583 esac
2584 EOSC
2585
2586 cat <<EOS >checkcc
2587 $startsh
2588 EOS
2589 cat <<'EOSC' >>checkcc
2590 case "$cc" in        
2591 '') ;;
2592 *)  $rm -f try try.*              
2593     $cat >try.c <<EOM
2594 int main(int argc, char *argv[]) {
2595   return 0;
2596 }
2597 EOM
2598     if $cc -o try $ccflags $ldflags try.c; then
2599        :
2600     else
2601         if $test X"$despair" = Xyes; then
2602            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2603         fi
2604         $cat >&4 <<EOM         
2605 You need to find a working C compiler.
2606 Either (purchase and) install the C compiler supplied by your OS vendor,
2607 or for a free C compiler try http://gcc.gnu.org/
2608 I cannot continue any further, aborting.
2609 EOM
2610         exit 1
2611     fi
2612     $rm -f try try.*
2613     ;;
2614 esac
2615 EOSC
2616
2617 : determine whether symbolic links are supported
2618 echo " "
2619 $touch blurfl
2620 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2621         echo "Symbolic links are supported." >&4
2622         lns="$ln -s"
2623 else
2624         echo "Symbolic links are NOT supported." >&4
2625         lns="$ln"
2626 fi
2627 $rm -f blurfl sym
2628
2629 : determine whether symbolic links are supported
2630 echo " "
2631 case "$lns" in
2632 *"ln"*" -s")
2633         echo "Checking how to test for symbolic links..." >&4
2634         $lns blurfl sym
2635         if $test "X$issymlink" = X; then
2636                 case "$newsh" in
2637                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2638                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2639                 esac
2640                 if test $? = 0; then
2641                         issymlink="test -h"
2642                 else
2643                         echo "Your builtin 'test -h' may be broken." >&4
2644                         case "$test" in
2645                         /*)     ;;
2646                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2647                                 for p in $pth
2648                                 do
2649                                         if test -f "$p/$test"; then
2650                                                 test="$p/$test"
2651                                                 break
2652                                         fi
2653                                 done
2654                                 ;;
2655                         esac
2656                         case "$test" in
2657                         /*)
2658                                 echo "Trying external '$test -h'." >&4
2659                                 issymlink="$test -h"
2660                                 if $test ! -h sym >/dev/null 2>&1; then
2661                                         echo "External '$test -h' is broken, too." >&4
2662                                         issymlink=''
2663                                 fi
2664                                 ;;
2665                         *)      issymlink='' ;;
2666                         esac
2667                 fi              
2668         fi
2669         if $test "X$issymlink" = X; then
2670                 if $test -L sym 2>/dev/null; then
2671                         issymlink="$test -L"
2672                         echo "The builtin '$test -L' worked." >&4
2673                 fi
2674         fi
2675         if $test "X$issymlink" != X; then
2676                 echo "You can test for symbolic links with '$issymlink'." >&4
2677         else
2678                 echo "I do not know how you can test for symbolic links." >&4
2679         fi
2680         $rm -f blurfl sym
2681         ;;
2682 *)      echo "No symbolic links, so not testing for their testing..." >&4
2683         ;;
2684 esac
2685 echo " "
2686
2687 : Make symlinks util
2688 case "$mksymlinks" in
2689 $define|true|[yY]*)
2690         case "$src" in
2691         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2692                 exit 1
2693                 ;;
2694         *)      case "$lns:$issymlink" in
2695                 *"ln"*" -s:"*"test -"?)
2696                         echo "Creating the symbolic links..." >&4
2697                         echo "(First creating the subdirectories...)" >&4
2698                         cd ..
2699                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2700                                 read directory
2701                                 test -z "$directory" && break
2702                                 mkdir -p $directory
2703                         done
2704                         # Sanity check 1.
2705                         if test ! -d t/base; then
2706                                 echo "Failed to create the subdirectories.  Aborting." >&4
2707                                 exit 1
2708                         fi
2709                         echo "(Then creating the symlinks...)" >&4
2710                         awk '{print $1}' $src/MANIFEST | while true; do
2711                                 read filename
2712                                 test -z "$filename" && break
2713                                 if test -f $filename; then
2714                                         if $issymlink $filename; then
2715                                                 rm -f $filename
2716                                         fi
2717                                 fi
2718                                 if test -f $filename; then
2719                                         echo "$filename already exists, not symlinking."
2720                                 else
2721                                         ln -s $src/$filename $filename
2722                                 fi
2723                         done
2724                         # Sanity check 2.
2725                         if test ! -f t/base/lex.t; then
2726                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2727                                 exit 1
2728                         fi
2729                         cd UU
2730                         ;;
2731                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2732                         ;;
2733                 esac
2734                 ;;
2735         esac
2736         ;;
2737 esac
2738
2739 : Check for Cross-Compilation
2740 case "$usecrosscompile" in
2741 $define|true|[yY]*)
2742         $echo "Cross-compiling..."
2743         croak=''
2744         case "$cc" in
2745         *-*-gcc) # A cross-compiling gcc, probably.
2746             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2747             ar=$targetarch-ar
2748             # leave out ld, choosing it is more complex
2749             nm=$targetarch-nm
2750             ranlib=$targetarch-ranlib
2751             $echo 'extern int foo;' > try.c
2752             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2753             shift
2754             if $test $# -gt 0; then
2755                 incpth="$incpth $*"
2756                 incpth="`$echo $incpth|$sed 's/^ //'`"
2757                 echo "Guessing incpth '$incpth'." >&4
2758                 for i in $*; do
2759                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2760                     if $test -d $j; then
2761                         libpth="$libpth $j"
2762                     fi
2763                 done   
2764                 libpth="`$echo $libpth|$sed 's/^ //'`"
2765                 echo "Guessing libpth '$libpth'." >&4
2766             fi
2767             $rm -f try.c
2768             ;;
2769         esac
2770         case "$targetarch" in
2771         '') echo "Targetarch not defined." >&4; croak=y ;;
2772         *)  echo "Using targetarch $targetarch." >&4 ;;
2773         esac
2774         case "$incpth" in
2775         '') echo "Incpth not defined." >&4; croak=y ;;
2776         *)  echo "Using incpth '$incpth'." >&4 ;;
2777         esac
2778         case "$libpth" in
2779         '') echo "Libpth not defined." >&4; croak=y ;;
2780         *)  echo "Using libpth '$libpth'." >&4 ;;
2781         esac
2782         case "$usrinc" in
2783         '') for i in $incpth; do
2784                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2785                     usrinc=$i
2786                     echo "Guessing usrinc $usrinc." >&4
2787                     break
2788                 fi
2789             done
2790             case "$usrinc" in
2791             '') echo "Usrinc not defined." >&4; croak=y ;;
2792             esac
2793             ;;
2794         *)  echo "Using usrinc $usrinc." >&4 ;;
2795         esac
2796         case "$targethost" in
2797         '') echo "Targethost not defined." >&4; croak=y ;;
2798         *)  echo "Using targethost $targethost." >&4
2799         esac
2800         locincpth=' '
2801         loclibpth=' '
2802         case "$croak" in
2803         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2804         esac
2805         case "$src" in
2806         /*) run=$src/Cross/run
2807             targetmkdir=$src/Cross/mkdir
2808             to=$src/Cross/to
2809             from=$src/Cross/from
2810             ;;
2811         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2812             run=$pwd/Cross/run
2813             targetmkdir=$pwd/Cross/mkdir
2814             to=$pwd/Cross/to
2815             from=$pwd/Cross/from
2816             ;;
2817         esac
2818         case "$targetrun" in
2819         '') targetrun=ssh ;;
2820         esac
2821         case "$targetto" in
2822         '') targetto=scp ;;
2823         esac
2824         case "$targetfrom" in
2825         '') targetfrom=scp ;;
2826         esac
2827         run=$run-$targetrun
2828         to=$to-$targetto
2829         from=$from-$targetfrom
2830         case "$targetdir" in
2831         '')  targetdir=/tmp
2832              echo "Guessing targetdir $targetdir." >&4
2833              ;;
2834         esac
2835         case "$targetuser" in
2836         '')  targetuser=root
2837              echo "Guessing targetuser $targetuser." >&4
2838              ;;
2839         esac
2840         case "$targetfrom" in
2841         scp)    q=-q ;;
2842         *)      q='' ;;
2843         esac
2844         case "$targetrun" in
2845         ssh|rsh)
2846             cat >$run <<EOF
2847 #!/bin/sh
2848 case "\$1" in
2849 -cwd)
2850   shift
2851   cwd=\$1
2852   shift
2853   ;;
2854 esac
2855 case "\$cwd" in
2856 '') cwd=$targetdir ;;
2857 esac
2858 exe=\$1
2859 shift
2860 if $test ! -f \$exe.xok; then
2861   $to \$exe
2862   $touch \$exe.xok
2863 fi
2864 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2865 EOF
2866             ;;
2867         *)  echo "Unknown targetrun '$targetrun'" >&4
2868             exit 1
2869             ;;
2870         esac
2871         case "$targetmkdir" in
2872         */Cross/mkdir)
2873             cat >$targetmkdir <<EOF
2874 #!/bin/sh
2875 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2876 EOF
2877             $chmod a+rx $targetmkdir
2878             ;;
2879         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2880             exit 1
2881             ;;
2882         esac
2883         case "$targetto" in
2884         scp|rcp)
2885             cat >$to <<EOF
2886 #!/bin/sh
2887 for f in \$@
2888 do
2889   case "\$f" in
2890   /*)
2891     $targetmkdir \`dirname \$f\`
2892     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2893     ;;
2894   *)
2895     $targetmkdir $targetdir/\`dirname \$f\`
2896     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2897     ;;
2898   esac
2899 done
2900 exit 0
2901 EOF
2902             ;;
2903         cp) cat >$to <<EOF
2904 #!/bin/sh
2905 for f in \$@
2906 do
2907   case "\$f" in
2908   /*)
2909     $mkdir -p $targetdir/\`dirname \$f\`
2910     $cp \$f $targetdir/\$f || exit 1
2911     ;;
2912   *)
2913     $targetmkdir $targetdir/\`dirname \$f\`
2914     $cp \$f $targetdir/\$f || exit 1
2915     ;;
2916   esac
2917 done
2918 exit 0
2919 EOF
2920             ;;
2921         *)  echo "Unknown targetto '$targetto'" >&4
2922             exit 1
2923             ;;
2924         esac
2925         case "$targetfrom" in
2926         scp|rcp)
2927           cat >$from <<EOF
2928 #!/bin/sh
2929 for f in \$@
2930 do
2931   $rm -f \$f
2932   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2933 done
2934 exit 0
2935 EOF
2936             ;;
2937         cp) cat >$from <<EOF
2938 #!/bin/sh
2939 for f in \$@
2940 do
2941   $rm -f \$f
2942   cp $targetdir/\$f . || exit 1
2943 done
2944 exit 0
2945 EOF
2946             ;;
2947         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2948             exit 1
2949             ;;
2950         esac
2951         if $test ! -f $run; then
2952             echo "Target 'run' script '$run' not found." >&4
2953         else
2954             $chmod a+rx $run
2955         fi
2956         if $test ! -f $to; then
2957             echo "Target 'to' script '$to' not found." >&4
2958         else
2959             $chmod a+rx $to
2960         fi
2961         if $test ! -f $from; then
2962             echo "Target 'from' script '$from' not found." >&4
2963         else
2964             $chmod a+rx $from
2965         fi
2966         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2967             exit 1
2968         fi
2969         cat >&4 <<EOF
2970 Using '$run' for remote execution,
2971 and '$from' and '$to'
2972 for remote file transfer.
2973 EOF
2974         ;;
2975 *)      run=''
2976         to=:
2977         from=:
2978         usecrosscompile='undef'
2979         targetarch=''
2980         ;;
2981 esac
2982
2983 : see whether [:lower:] and [:upper:] are supported character classes
2984 echo " "
2985 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2986 ABYZ)
2987         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2988         up='[:upper:]'
2989         low='[:lower:]'
2990         ;;
2991 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2992         # (0xd9 and 0xe2), therefore that is a nice testing point.
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2995             rs) up='[A-Z]'
2996                 low='[a-z]'
2997                 ;;
2998             esac
2999         fi
3000         if test "X$up" = X -o "X$low" = X; then
3001             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3002             rs) up='A-Z'
3003                 low='a-z'
3004                 ;;
3005             esac
3006         fi
3007         if test "X$up" = X -o "X$low" = X; then
3008             case "`echo RS | od -x 2>/dev/null`" in
3009             *D9E2*|*d9e2*)
3010                 echo "Hey, this might be EBCDIC." >&4
3011                 if test "X$up" = X -o "X$low" = X; then
3012                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3013                     rs) up='[A-IJ-RS-Z]'
3014                         low='[a-ij-rs-z]'
3015                         ;;
3016                     esac
3017                 fi
3018                 if test "X$up" = X -o "X$low" = X; then
3019                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3020                     rs) up='A-IJ-RS-Z'
3021                         low='a-ij-rs-z'
3022                         ;;
3023                     esac
3024                 fi
3025                 ;;
3026             esac
3027         fi
3028 esac
3029 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3030 rs)
3031     echo "Using $up and $low to convert case." >&4
3032     ;;
3033 *)
3034     echo "I don't know how to translate letters from upper to lower case." >&4
3035     echo "Your tr is not acting any way I know of." >&4
3036     exit 1
3037     ;;
3038 esac
3039 : set up the translation script tr, must be called with ./tr of course
3040 cat >tr <<EOSC
3041 $startsh
3042 case "\$1\$2" in
3043 '[A-Z][a-z]') exec $tr '$up' '$low';;
3044 '[a-z][A-Z]') exec $tr '$low' '$up';;
3045 esac
3046 exec $tr "\$@"
3047 EOSC
3048 chmod +x tr
3049 $eunicefix tr
3050
3051 : Try to determine whether config.sh was made on this system
3052 case "$config_sh" in
3053 '')
3054 myuname=`$uname -a 2>/dev/null`
3055 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3056 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3057 # because the A-Z/a-z are not consecutive.
3058 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3059         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3060 newmyuname="$myuname"
3061 dflt=n
3062 case "$knowitall" in
3063 '')
3064         if test -f ../config.sh; then
3065                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3066                         eval "`grep myuname= ../config.sh`"
3067                 fi
3068                 if test "X$myuname" = "X$newmyuname"; then
3069                         dflt=y
3070                 fi
3071         fi
3072         ;;
3073 *) dflt=y;;
3074 esac
3075
3076 : Get old answers from old config file if Configure was run on the
3077 : same system, otherwise use the hints.
3078 hint=default
3079 cd ..
3080 if test -f config.sh; then
3081         echo " "
3082         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3083         . UU/myread
3084         case "$ans" in
3085         n*|N*) echo "OK, I'll ignore it."
3086                 mv config.sh config.sh.old
3087                 myuname="$newmyuname"
3088                 ;;
3089         *)  echo "Fetching default answers from your old config.sh file..." >&4
3090                 tmp_n="$n"
3091                 tmp_c="$c"
3092                 tmp_sh="$sh"
3093                 . ./config.sh
3094                 cp config.sh UU
3095                 n="$tmp_n"
3096                 c="$tmp_c"
3097                 : Older versions did not always set $sh.  Catch re-use of such
3098                 : an old config.sh.
3099                 case "$sh" in
3100                 '') sh="$tmp_sh" ;;
3101                 esac
3102                 hint=previous
3103                 ;;
3104         esac
3105 fi
3106 . ./UU/checkcc
3107 if test ! -f config.sh; then
3108         $cat <<EOM
3109
3110 First time through, eh?  I have some defaults handy for some systems
3111 that need some extra help getting the Configure answers right:
3112
3113 EOM
3114         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3115         dflt=''
3116         : Half the following guesses are probably wrong... If you have better
3117         : tests or hints, please send them to perlbug@perl.org
3118         : The metaconfig authors would also appreciate a copy...
3119         $test -f /irix && osname=irix
3120         $test -f /xenix && osname=sco_xenix
3121         $test -f /dynix && osname=dynix
3122         $test -f /dnix && osname=dnix
3123         $test -f /lynx.os && osname=lynxos
3124         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3125         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3126         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3127         $test -f /bin/mips && /bin/mips && osname=mips
3128         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3129                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3130         $test -d /usr/apollo/bin && osname=apollo
3131         $test -f /etc/saf/_sactab && osname=svr4
3132         $test -d /usr/include/minix && osname=minix
3133         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3134         if $test -d /MachTen -o -d /MachTen_Folder; then
3135                 osname=machten
3136                 if $test -x /sbin/version; then
3137                         osvers=`/sbin/version | $awk '{print $2}' |
3138                         $sed -e 's/[A-Za-z]$//'`
3139                 elif $test -x /usr/etc/version; then
3140                         osvers=`/usr/etc/version | $awk '{print $2}' |
3141                         $sed -e 's/[A-Za-z]$//'`
3142                 else
3143                         osvers="$2.$3"
3144                 fi
3145         fi
3146
3147         $test -f /sys/posix.dll &&
3148                 $test -f /usr/bin/what &&
3149                 set X `/usr/bin/what /sys/posix.dll` &&
3150                 $test "$3" = UWIN &&
3151                 osname=uwin &&
3152                 osvers="$5"
3153
3154         if $test -f $uname; then
3155                 set X $myuname
3156                 shift
3157
3158                 case "$5" in
3159                 fps*) osname=fps ;;
3160                 mips*)
3161                         case "$4" in
3162                         umips) osname=umips ;;
3163                         *) osname=mips ;;
3164                         esac;;
3165                 [23]100) osname=mips ;;
3166                 next*) osname=next ;;
3167                 i386*)
3168                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3169                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3170                                 osname='sco'
3171                                 osvers=$tmp
3172                         elif $test -f /etc/kconfig; then
3173                                 osname=isc
3174                                 if test "$lns" = "$ln -s"; then
3175                                         osvers=4
3176                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3177                                         osvers=3
3178                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3179                                         osvers=2
3180                                 fi
3181                         fi
3182                         tmp=''
3183                         ;;
3184                 pc*)
3185                         if test -n "$DJGPP"; then
3186                                 osname=dos
3187                                 osvers=djgpp
3188                         fi
3189                         ;;
3190                 esac
3191
3192                 case "$1" in
3193                 aix) osname=aix
3194                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3195                         case "$tmp" in
3196                         # oslevel can fail with:
3197                         # oslevel: Unable to acquire lock.
3198                         *not\ found) osvers="$4"."$3" ;;
3199                         '<3240'|'<>3240') osvers=3.2.0 ;;
3200                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3201                         '=3250'|'>3250') osvers=3.2.5 ;;
3202                         *) osvers=$tmp;;
3203                         esac
3204                         ;;
3205                 bsd386) osname=bsd386
3206                         osvers=`$uname -r`
3207                         ;;
3208                 cygwin*) osname=cygwin
3209                         osvers="$3"
3210                         ;;
3211                 *dc.osx) osname=dcosx
3212                         osvers="$3"
3213                         ;;
3214                 dnix) osname=dnix
3215                         osvers="$3"
3216                         ;;
3217                 domainos) osname=apollo
3218                         osvers="$3"
3219                         ;;
3220                 dgux)   osname=dgux
3221                         osvers="$3"
3222                         ;;
3223                 dragonfly) osname=dragonfly
3224                         osvers="$3"
3225                         ;;
3226                 dynixptx*) osname=dynixptx
3227                         osvers=`echo "$4"|sed 's/^v//'`
3228                         ;;
3229                 freebsd) osname=freebsd
3230                         osvers="$3" ;;
3231                 genix)  osname=genix ;;
3232                 gnu)    osname=gnu
3233                         osvers="$3" ;;
3234                 hp*)    osname=hpux
3235                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3236                         ;;
3237                 irix*)  osname=irix
3238                         case "$3" in
3239                         4*) osvers=4 ;;
3240                         5*) osvers=5 ;;
3241                         *)      osvers="$3" ;;
3242                         esac
3243                         ;;
3244                 linux)  osname=linux
3245                         case "$3" in
3246                         *)      osvers="$3" ;;
3247                         esac
3248                         ;;
3249                 MiNT)   osname=mint
3250                         ;;
3251                 netbsd*) osname=netbsd
3252                         osvers="$3"
3253                         ;;
3254                 news-os) osvers="$3"
3255                         case "$3" in
3256                         4*) osname=newsos4 ;;
3257                         *) osname=newsos ;;
3258                         esac
3259                         ;;
3260                 next*) osname=next ;;
3261                 nonstop-ux) osname=nonstopux ;;
3262                 openbsd) osname=openbsd
3263                         osvers="$3"
3264                         ;;
3265                 os2)    osname=os2
3266                         osvers="$4"
3267                         ;;
3268                 POSIX-BC | posix-bc ) osname=posix-bc
3269                         osvers="$3"
3270                         ;;
3271                 powerux | power_ux | powermax_os | powermaxos | \
3272                 powerunix | power_unix) osname=powerux
3273                         osvers="$3"
3274                         ;;
3275                 qnx) osname=qnx
3276                         osvers="$4"
3277                         ;;
3278                 solaris) osname=solaris
3279                         case "$3" in
3280                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3281                         *)      osvers="$3" ;;
3282                         esac
3283                         ;;
3284                 sunos) osname=sunos
3285                         case "$3" in
3286                         5*) osname=solaris
3287                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3288                         *)      osvers="$3" ;;
3289                         esac
3290                         ;;
3291                 titanos) osname=titanos
3292                         case "$3" in
3293                         1*) osvers=1 ;;
3294                         2*) osvers=2 ;;
3295                         3*) osvers=3 ;;
3296                         4*) osvers=4 ;;
3297                         *)      osvers="$3" ;;
3298                         esac
3299                         ;;
3300                 ultrix) osname=ultrix
3301                         osvers="$3"
3302                         ;;
3303                 osf1|mls+)      case "$5" in
3304                                 alpha)
3305                                         osname=dec_osf
3306                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3307                                         case "$osvers" in
3308                                         [1-9].[0-9]*) ;;
3309                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3310                                         esac
3311                                         ;;
3312                         hp*)    osname=hp_osf1  ;;
3313                         mips)   osname=mips_osf1 ;;
3314                         esac
3315                         ;;
3316                 # UnixWare 7.1.2 is known as Open UNIX 8
3317                 openunix|unixware) osname=svr5
3318                         osvers="$4"
3319                         ;;
3320                 uts)    osname=uts
3321                         osvers="$3"
3322                         ;;
3323                 vos) osvers="$3"
3324                         ;;
3325                 $2) case "$osname" in
3326                         *isc*) ;;
3327                         *freebsd*) ;;
3328                         svr*)
3329                                 : svr4.x or possibly later
3330                                 case "svr$3" in
3331                                 ${osname}*)
3332                                         osname=svr$3
3333                                         osvers=$4
3334                                         ;;
3335                                 esac
3336                                 case "$osname" in
3337                                 svr4.0)
3338                                         : Check for ESIX
3339                                         if test -f /stand/boot ; then
3340                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3341                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3342                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3343                                                         if test -n "$isesix"; then
3344                                                                 osname=esix4
3345                                                         fi
3346                                                 fi
3347                                         fi
3348                                         ;;
3349                                 esac
3350                                 ;;
3351                         *)      if test -f /etc/systemid; then
3352                                         osname=sco
3353                                         set `echo $3 | $sed 's/\./ /g'` $4
3354                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3355                                                 osvers=$1.$2.$3
3356                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3357                                                 osvers=$1.$2
3358                                         elif $test -f $src/hints/sco_$1.sh; then
3359                                                 osvers=$1
3360                                         fi
3361                                 else
3362                                         case "$osname" in
3363                                         '') : Still unknown.  Probably a generic Sys V.
3364                                                 osname="sysv"
3365                                                 osvers="$3"
3366                                                 ;;
3367                                         esac
3368                                 fi
3369                                 ;;
3370                         esac
3371                         ;;
3372                 *)      case "$osname" in
3373                         '') : Still unknown.  Probably a generic BSD.
3374                                 osname="$1"
3375                                 osvers="$3"
3376                                 ;;
3377                         esac
3378                         ;;
3379                 esac
3380         else
3381                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3382                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3383                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3384                                 osname=news_os
3385                         fi
3386                         $rm -f UU/kernel.what
3387                 elif test -d c:/. -o -n "$is_os2" ; then
3388                         set X $myuname
3389                         osname=os2
3390                         osvers="$5"
3391                 fi
3392         fi
3393
3394         case "$targetarch" in
3395         '') ;;
3396         *)  hostarch=$osname
3397             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3398             osvers=''
3399             ;;
3400         esac
3401
3402         : Now look for a hint file osname_osvers, unless one has been
3403         : specified already.
3404         case "$hintfile" in
3405         ''|' ')
3406                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3407                 : Also try without trailing minor version numbers.
3408                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3409                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3410                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3411                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3412                 case "$file" in
3413                 '') dflt=none ;;
3414                 *)  case "$osvers" in
3415                         '') dflt=$file
3416                                 ;;
3417                         *)  if $test -f $src/hints/$file.sh ; then
3418                                         dflt=$file
3419                                 elif $test -f $src/hints/$xfile.sh ; then
3420                                         dflt=$xfile
3421                                 elif $test -f $src/hints/$xxfile.sh ; then
3422                                         dflt=$xxfile
3423                                 elif $test -f $src/hints/$xxxfile.sh ; then
3424                                         dflt=$xxxfile
3425                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3426                                         dflt=$xxxxfile
3427                                 elif $test -f "$src/hints/${osname}.sh" ; then
3428                                         dflt="${osname}"
3429                                 else
3430                                         dflt=none
3431                                 fi
3432                                 ;;
3433                         esac
3434                         ;;
3435                 esac
3436                 if $test -f Policy.sh ; then
3437                         case "$dflt" in
3438                         *Policy*) ;;
3439                         none) dflt="Policy" ;;
3440                         *) dflt="Policy $dflt" ;;
3441                         esac
3442                 fi
3443                 ;;
3444         *)
3445                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3446                 ;;
3447         esac
3448
3449         if $test -f Policy.sh ; then
3450                 $cat <<EOM
3451
3452 There's also a Policy hint file available, which should make the
3453 site-specific (policy) questions easier to answer.
3454 EOM
3455
3456         fi
3457
3458         $cat <<EOM
3459
3460 You may give one or more space-separated answers, or "none" if appropriate.
3461 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3462 previous run of Configure, you may specify it as well as or instead of
3463 OS-specific hints.  If hints are provided for your OS, you should use them:
3464 although Perl can probably be built without hints on many platforms, using
3465 hints often improve performance and may enable features that Configure can't
3466 set up on its own. If there are no hints that match your OS, specify "none";
3467 DO NOT give a wrong version or a wrong OS.
3468
3469 EOM
3470
3471         rp="Which of these apply, if any?"
3472         . UU/myread
3473         tans=$ans
3474         for file in $tans; do
3475                 if $test X$file = XPolicy -a -f Policy.sh; then
3476                         . Policy.sh
3477                         $cat Policy.sh >> UU/config.sh
3478                 elif $test -f $src/hints/$file.sh; then
3479                         . $src/hints/$file.sh
3480                         $cat $src/hints/$file.sh >> UU/config.sh
3481                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3482                         : nothing
3483                 else
3484                         : Give one chance to correct a possible typo.
3485                         echo "$file.sh does not exist"
3486                         dflt=$file
3487                         rp="hint to use instead?"
3488                         . UU/myread
3489                         for file in $ans; do
3490                                 if $test -f "$src/hints/$file.sh"; then
3491                                         . $src/hints/$file.sh
3492                                         $cat $src/hints/$file.sh >> UU/config.sh
3493                                 elif $test X$ans = X -o X$ans = Xnone ; then
3494                                         : nothing
3495                                 else
3496                                         echo "$file.sh does not exist -- ignored."
3497                                 fi
3498                         done
3499                 fi
3500         done
3501
3502         hint=recommended
3503         : Remember our hint file for later.
3504         if $test -f "$src/hints/$file.sh" ; then
3505                 hintfile="$file"
3506         else
3507                 hintfile=''
3508         fi
3509 fi
3510 cd UU
3511 ;;
3512 *)
3513         echo " "
3514         echo "Fetching default answers from $config_sh..." >&4
3515         tmp_n="$n"
3516         tmp_c="$c"
3517         cd ..
3518         cp $config_sh config.sh 2>/dev/null
3519         chmod +w config.sh
3520         . ./config.sh
3521         cd UU
3522         cp ../config.sh .
3523         n="$tmp_n"
3524         c="$tmp_c"
3525         hint=previous
3526         ;;
3527 esac
3528 test "$override" && . ./optdef.sh
3529
3530 : Restore computed paths
3531 for file in $loclist $trylist; do
3532         eval $file="\$_$file"
3533 done
3534
3535 cat << EOM
3536
3537 Configure uses the operating system name and version to set some defaults.
3538 The default value is probably right if the name rings a bell. Otherwise,
3539 since spelling matters for me, either accept the default or answer "none"
3540 to leave it blank.
3541
3542 EOM
3543 case "$osname" in
3544         ''|' ')
3545                 case "$hintfile" in
3546                 ''|' '|none) dflt=none ;;
3547                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3548                 esac
3549                 ;;
3550         *) dflt="$osname" ;;
3551 esac
3552 rp="Operating system name?"
3553 . ./myread
3554 case "$ans" in
3555 none)  osname='' ;;
3556 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3557 esac
3558 echo " "
3559 case "$osvers" in
3560         ''|' ')
3561                 case "$hintfile" in
3562                 ''|' '|none) dflt=none ;;
3563                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3564                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3565                         case "$dflt" in
3566                         ''|' ') dflt=none ;;
3567                         esac
3568                         ;;
3569                 esac
3570                 ;;
3571         *) dflt="$osvers" ;;
3572 esac
3573 rp="Operating system version?"
3574 . ./myread
3575 case "$ans" in
3576 none)  osvers='' ;;
3577 *) osvers="$ans" ;;
3578 esac
3579
3580
3581 . ./posthint.sh
3582
3583 : who configured the system
3584 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3585 case "$cf_by" in
3586 "")
3587         cf_by=`(logname) 2>/dev/null`
3588         case "$cf_by" in
3589         "")
3590                 cf_by=`(whoami) 2>/dev/null`
3591                 case "$cf_by" in
3592                 "") cf_by=unknown ;;
3593                 esac ;;
3594         esac ;;
3595 esac
3596
3597 : decide how portable to be.  Allow command line overrides.
3598 case "$d_portable" in
3599 "$undef") ;;
3600 *)      d_portable="$define" ;;
3601 esac
3602
3603 : set up shell script to do ~ expansion
3604 cat >filexp <<EOSS
3605 $startsh
3606 : expand filename
3607 case "\$1" in
3608  \~/*|\~)
3609         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3610         ;;
3611  \~*)
3612         if $test -f /bin/csh; then
3613                 /bin/csh -f -c "glob \$1"
3614                 failed=\$?
3615                 echo ""
3616                 exit \$failed
3617         else
3618                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3619                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3620                 if $test ! -d "\$dir"; then
3621                         me=\`basename \$0\`
3622                         echo "\$me: can't locate home directory for: \$name" >&2
3623                         exit 1
3624                 fi
3625                 case "\$1" in
3626                 */*)
3627                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3628                         ;;
3629                 *)
3630                         echo \$dir
3631                         ;;
3632                 esac
3633         fi
3634         ;;
3635 *)
3636         echo \$1
3637         ;;
3638 esac
3639 EOSS
3640 chmod +x filexp
3641 $eunicefix filexp
3642
3643 : now set up to get a file name
3644 cat <<EOS >getfile
3645 $startsh
3646 EOS
3647 cat <<'EOSC' >>getfile
3648 tilde=''
3649 fullpath=''
3650 already=''
3651 skip=''
3652 none_ok=''
3653 exp_file=''
3654 nopath_ok=''
3655 orig_rp="$rp"
3656 orig_dflt="$dflt"
3657 case "$gfpth" in
3658 '') gfpth='.' ;;
3659 esac
3660
3661 case "$fn" in
3662 *\(*)
3663         : getfile will accept an answer from the comma-separated list
3664         : enclosed in parentheses even if it does not meet other criteria.
3665         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3666         fn=`echo $fn | sed 's/(.*)//'`
3667         ;;
3668 esac
3669
3670 case "$fn" in
3671 *:*)
3672         loc_file=`expr $fn : '.*:\(.*\)'`
3673         fn=`expr $fn : '\(.*\):.*'`
3674         ;;
3675 esac
3676
3677 case "$fn" in
3678 *~*) tilde=true;;
3679 esac
3680 case "$fn" in
3681 */*) fullpath=true;;
3682 esac
3683 case "$fn" in
3684 *+*) skip=true;;
3685 esac
3686 case "$fn" in
3687 *n*) none_ok=true;;
3688 esac
3689 case "$fn" in
3690 *e*) exp_file=true;;
3691 esac
3692 case "$fn" in
3693 *p*) nopath_ok=true;;
3694 esac
3695
3696 case "$fn" in
3697 *f*) type='File';;
3698 *d*) type='Directory';;
3699 *l*) type='Locate';;
3700 esac
3701
3702 what="$type"
3703 case "$what" in
3704 Locate) what='File';;
3705 esac
3706
3707 case "$exp_file" in
3708 '')
3709         case "$d_portable" in
3710         "$define") ;;
3711         *) exp_file=true;;
3712         esac
3713         ;;
3714 esac
3715
3716 cd ..
3717 while test "$type"; do
3718         redo=''
3719         rp="$orig_rp"
3720         dflt="$orig_dflt"
3721         case "$tilde" in
3722         true) rp="$rp (~name ok)";;
3723         esac
3724         . UU/myread
3725         if test -f UU/getfile.ok && \
3726                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3727         then
3728                 value="$ans"
3729                 ansexp="$ans"
3730                 break
3731         fi
3732         case "$ans" in
3733         none)
3734                 value=''
3735                 ansexp=''
3736                 case "$none_ok" in
3737                 true) type='';;
3738                 esac
3739                 ;;
3740         *)
3741                 case "$tilde" in
3742                 '') value="$ans"
3743                         ansexp="$ans";;
3744                 *)
3745                         value=`UU/filexp $ans`
3746                         case $? in
3747                         0)
3748                                 if test "$ans" != "$value"; then
3749                                         echo "(That expands to $value on this system.)"
3750                                 fi
3751                                 ;;
3752                         *) value="$ans";;
3753                         esac
3754                         ansexp="$value"
3755                         case "$exp_file" in
3756                         '') value="$ans";;
3757                         esac
3758                         ;;
3759                 esac
3760                 case "$fullpath" in
3761                 true)
3762                         case "$ansexp" in
3763                         /*) value="$ansexp" ;;
3764                         [a-zA-Z]:/*) value="$ansexp" ;;
3765                         *)
3766                                 redo=true
3767                                 case "$already" in
3768                                 true)
3769                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3770                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3771                                         ;;
3772                                 *)
3773                                 echo "Please give a full path name, starting with slash." >&4
3774                                         case "$tilde" in
3775                                         true)
3776                                 echo "Note that using ~name is ok provided it expands well." >&4
3777                                                 already=true
3778                                                 ;;
3779                                         esac
3780                                 esac
3781                                 ;;
3782                         esac
3783                         ;;
3784                 esac
3785                 case "$redo" in
3786                 '')
3787                         case "$type" in
3788                         File)
3789                                 for fp in $gfpth; do
3790                                         if test "X$fp" = X.; then
3791                                             pf="$ansexp"
3792                                         else    
3793                                             pf="$fp/$ansexp"
3794                                         fi
3795                                         if test -f "$pf"; then
3796                                                 type=''
3797                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3798                                         then
3799                                                 echo "($value is not a plain file, but that's ok.)"
3800                                                 type=''
3801                                         fi
3802                                         if test X"$type" = X; then
3803                                             value="$pf"
3804                                             break
3805                                         fi
3806                                 done
3807                                 ;;
3808                         Directory)
3809                                 for fp in $gfpth; do
3810                                         if test "X$fp" = X.; then
3811                                             dir="$ans"
3812                                             direxp="$ansexp"
3813                                         else    
3814                                             dir="$fp/$ansexp"
3815                                             direxp="$fp/$ansexp"
3816                                         fi
3817                                         if test -d "$direxp"; then
3818                                                 type=''
3819                                                 value="$dir"
3820                                                 break
3821                                         fi
3822                                 done
3823                                 ;;
3824                         Locate)
3825                                 if test -d "$ansexp"; then
3826                                         echo "(Looking for $loc_file in directory $value.)"
3827                                         value="$value/$loc_file"
3828                                         ansexp="$ansexp/$loc_file"
3829                                 fi
3830                                 if test -f "$ansexp"; then
3831                                         type=''
3832                                 fi
3833                                 case "$nopath_ok" in
3834                                 true)   case "$value" in
3835                                         */*) ;;
3836                                         *)      echo "Assuming $value will be in people's path."
3837                                                 type=''
3838                                                 ;;
3839                                         esac
3840                                         ;;
3841                                 esac
3842                                 ;;
3843                         esac
3844
3845                         case "$skip" in
3846                         true) type='';
3847                         esac
3848
3849                         case "$type" in
3850                         '') ;;
3851                         *)
3852                                 if test "$fastread" = yes; then
3853                                         dflt=y
3854                                 else
3855                                         dflt=n
3856                                 fi
3857                                 rp="$what $value doesn't exist.  Use that name anyway?"
3858                                 . UU/myread
3859                                 dflt=''
3860                                 case "$ans" in
3861                                 y*) type='';;
3862                                 *) echo " ";;
3863                                 esac
3864                                 ;;
3865                         esac
3866                         ;;
3867                 esac
3868                 ;;
3869         esac
3870 done
3871 cd UU
3872 ans="$value"
3873 rp="$orig_rp"
3874 dflt="$orig_dflt"
3875 rm -f getfile.ok
3876 test "X$gfpthkeep" != Xy && gfpth=""
3877 EOSC
3878
3879 : determine root of directory hierarchy where package will be installed.
3880 case "$prefix" in
3881 '')
3882         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3883         ;;
3884 *?/)
3885         dflt=`echo "$prefix" | sed 's/.$//'`
3886         ;;
3887 *)
3888         dflt="$prefix"
3889         ;;
3890 esac
3891 $cat <<EOM
3892
3893 By default, $package will be installed in $dflt/bin, manual pages
3894 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3895 installation directories. Typically this is something like /usr/local.
3896 If you wish to have binaries under /usr/bin but other parts of the
3897 installation under /usr/local, that's ok: you will be prompted
3898 separately for each of the installation directories, the prefix being
3899 only used to set the defaults.
3900
3901 EOM
3902 fn=d~
3903 rp='Installation prefix to use?'
3904 . ./getfile
3905 oldprefix=''
3906 case "$prefix" in
3907 '') ;;
3908 *)
3909         case "$ans" in
3910         "$prefix") ;;
3911         *) oldprefix="$prefix";;
3912         esac
3913         ;;
3914 esac
3915 prefix="$ans"
3916 prefixexp="$ansexp"
3917
3918 : allow them to override the AFS root
3919 case "$afsroot" in
3920 '')     afsroot=/afs ;;
3921 *)      afsroot=$afsroot ;;
3922 esac
3923
3924 : is AFS running?
3925 echo " "
3926 case "$afs" in
3927 $define|true)   afs=true ;;
3928 $undef|false)   afs=false ;;
3929 *)      if $test -d $afsroot; then
3930                 afs=true
3931         else
3932                 afs=false
3933         fi
3934         ;;
3935 esac
3936 if $afs; then
3937         echo "AFS may be running... I'll be extra cautious then..." >&4
3938 else
3939         echo "AFS does not seem to be running..." >&4
3940 fi
3941
3942 : determine installation prefix for where package is to be installed.
3943 if $afs; then 
3944 $cat <<EOM
3945
3946 Since you are running AFS, I need to distinguish the directory in which
3947 files will reside from the directory in which they are installed (and from
3948 which they are presumably copied to the former directory by occult means).
3949
3950 EOM
3951         case "$installprefix" in
3952         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3953         *) dflt="$installprefix";;
3954         esac
3955 else
3956 $cat <<EOM
3957
3958 In some special cases, particularly when building $package for distribution,
3959 it is convenient to distinguish the directory in which files should be
3960 installed from the directory ($prefix) in which they will
3961 eventually reside.  For most users, these two directories are the same.
3962
3963 EOM
3964         case "$installprefix" in
3965         '') dflt=$prefix ;;
3966         *) dflt=$installprefix;;
3967         esac
3968 fi
3969 fn=d~
3970 rp='What installation prefix should I use for installing files?'
3971 . ./getfile
3972 installprefix="$ans"
3973 installprefixexp="$ansexp"
3974
3975 : Perform the prefixexp/installprefixexp correction if necessary
3976 cat <<EOS >installprefix
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>installprefix
3980 : Change installation prefix, if necessary.
3981 if $test X"$prefix" != X"$installprefix"; then
3982     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3983 else
3984     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3985 fi
3986 EOSC
3987 chmod +x installprefix
3988 $eunicefix installprefix
3989
3990 : Set variables such as privlib and privlibexp from the output of ./getfile
3991 : performing the prefixexp/installprefixexp correction if necessary.
3992 cat <<EOS >setprefixvar
3993 $startsh
3994 EOS
3995 cat <<'EOSC' >>setprefixvar
3996 eval "${prefixvar}=\"\$ans\""
3997 eval "${prefixvar}exp=\"\$ansexp\""
3998 . ./installprefix
3999 EOSC
4000 chmod +x setprefixvar
4001 $eunicefix setprefixvar
4002
4003 : set up the script used to warn in case of inconsistency
4004 cat <<EOS >whoa
4005 $startsh
4006 EOS
4007 cat <<'EOSC' >>whoa
4008 dflt=y
4009 case "$hint" in
4010     recommended)
4011         case "$hintfile" in
4012         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4013                 ;;
4014         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4015                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4016                 ;;
4017         esac
4018         ;;
4019     *)  echo " "
4020         echo "*** WHOA THERE!!! ***" >&4
4021         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4022         ;;
4023 esac
4024 rp="    Keep the $hint value?"
4025 . ./myread
4026 case "$ans" in
4027 y) td=$was; tu=$was;;
4028 esac
4029 EOSC
4030
4031 : function used to set '$1' to '$val'
4032 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4033 case "$val$was" in
4034 $define$undef) . ./whoa; eval "$var=\$td";;
4035 $undef$define) . ./whoa; eval "$var=\$tu";;
4036 *) eval "$var=$val";;
4037 esac'
4038
4039 : Check is we will use socks
4040 case "$usesocks" in
4041 $define|true|[yY]*)     dflt='y';;
4042 *) dflt='n';;
4043 esac
4044 cat <<EOM
4045
4046 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4047 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4048 to use the PerlIO abstraction layer, this will be implicitly selected.
4049
4050 If this doesn't make any sense to you, just accept the default '$dflt'.
4051 EOM
4052 rp='Build Perl for SOCKS?'
4053 . ./myread
4054 case "$ans" in
4055 y|Y)    val="$define" ;;
4056 *)      val="$undef" ;;
4057 esac
4058 set usesocks
4059 eval $setvar
4060
4061 case "$usesocks" in
4062 $define|true|[yY]*) useperlio="$define";;
4063 esac
4064
4065 : Check if we want perlio
4066 case "$useperlio" in
4067 $define|true|[yY]*|'')  dflt='y';;
4068 *) dflt='n';;
4069 esac
4070 cat <<EOM
4071
4072 Previous version of $package used the standard IO mechanisms as
4073 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4074 alternate IO mechanisms via the PerlIO abstraction layer, but the
4075 stdio mechanism is still available if needed.  The abstraction layer
4076 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4077 Using PerlIO with sfio may cause problems with some extension modules.
4078
4079 If this doesn't make any sense to you, just accept the default '$dflt'.
4080 EOM
4081 rp='Use the PerlIO abstraction layer?'
4082 . ./myread
4083 case "$ans" in
4084 y|Y)
4085         val="$define"
4086         ;;
4087 *)
4088         echo "Ok, doing things the stdio way."
4089         val="$undef"
4090         ;;
4091 esac
4092 set useperlio
4093 eval $setvar
4094
4095 case "$usesocks" in
4096 $define|true|[yY]*)
4097         case "$useperlio" in
4098         $define|true|[yY]*) ;;
4099         *)      cat >&4 <<EOM
4100
4101 You are using the SOCKS proxy protocol library which means that you
4102 should also use the PerlIO layer.  You may be headed for trouble.
4103
4104 EOM
4105                 ;;
4106         esac
4107         ;;
4108 esac
4109
4110 : get the patchlevel
4111 echo " "
4112 echo "Getting the current patchlevel..." >&4
4113 if $test -r $rsrc/patchlevel.h;then
4114         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4115         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4116         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4117         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4118         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4119         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4120         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4121 else
4122         revision=0
4123         patchlevel=0
4124         subversion=0
4125         api_revision=0
4126         api_version=0
4127         api_subversion=0
4128         perl_patchlevel=0
4129         $echo "(You do not have patchlevel.h.  Eek.)"
4130 fi
4131 if $test -r $rsrc/.patch ; then
4132         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4133                 perl_patchlevel=`cat $rsrc/.patch`
4134         fi
4135 fi
4136 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4137 version_patchlevel_string="version $patchlevel subversion $subversion"
4138 case "$perl_patchlevel" in
4139 0|'') ;;
4140 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4141 esac
4142
4143 $echo "(You have $package $version_patchlevel_string.)"
4144
4145 case "$osname" in
4146 dos|vms)
4147         : XXX Should be a Configure test for double-dots in filenames.
4148         version=`echo $revision $patchlevel $subversion | \
4149                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4150         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4151                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4152         ;;
4153 *)
4154         version=`echo $revision $patchlevel $subversion | \
4155                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4156         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4157                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4158         ;;
4159 esac
4160 : Special case the 5.005_xx maintenance series, which used 5.005
4161 : without any subversion label as a subdirectory in $sitelib
4162 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4163         api_versionstring='5.005'
4164 fi
4165
4166 : Do we want threads support and if so, what type
4167 case "$usethreads" in
4168 $define|true|[yY]*)     dflt='y';;
4169 *)     # Catch case where user specified ithreads or 5005threads but
4170        # forgot -Dusethreads (A.D. 4/2002)
4171        case "$useithreads$use5005threads" in
4172        *$define*)
4173                 case "$useperlio" in
4174                 "$define")      dflt='y' ;;
4175                 *)              dflt='n' ;;
4176                 esac
4177                 ;;
4178        *)       dflt='n';;
4179        esac
4180        ;;
4181 esac
4182 cat <<EOM
4183
4184 Perl can be built to take advantage of threads on some systems.
4185 To do so, Configure can be run with -Dusethreads.
4186
4187 Note that Perl built with threading support runs slightly slower
4188 and uses more memory than plain Perl. The current implementation
4189 is believed to be stable, but it is fairly new, and so should be
4190 treated with caution.
4191
4192 If this doesn't make any sense to you, just accept the default '$dflt'.
4193 EOM
4194 rp='Build a threading Perl?'
4195 . ./myread
4196 case "$ans" in
4197 y|Y)    val="$define" ;;
4198 *)      val="$undef" ;;
4199 esac
4200 set usethreads
4201 eval $setvar
4202
4203 if $test $patchlevel -lt 9; then
4204     case "$usethreads" in
4205     $define)
4206         $cat <<EOM
4207
4208 Since release 5.6, Perl has had two different threading implementations,
4209 the newer interpreter-based version (ithreads) with one interpreter per
4210 thread, and the older 5.005 version (5005threads).
4211 The 5005threads version is effectively unmaintained and will probably be
4212 removed in Perl 5.10, so there should be no need to build a Perl using it
4213 unless needed for backwards compatibility with some existing 5.005threads
4214 code.
4215
4216 EOM
4217         : Default to ithreads unless overridden on command line or with
4218         : old config.sh
4219         dflt='y'
4220         case "$use5005threads" in
4221                 $define|true|[yY]*) dflt='n';;
4222         esac
4223         case "$useithreads" in
4224                 $undef|false|[nN]*) dflt='n';;
4225         esac
4226         rp='Use the newer interpreter-based ithreads?'
4227         . ./myread
4228         case "$ans" in
4229         y|Y)    val="$define" ;;
4230         *)      val="$undef" ;;
4231         esac
4232         set useithreads
4233         eval $setvar
4234         : Now set use5005threads to the opposite value.
4235         case "$useithreads" in
4236         $define) val="$undef" ;;
4237         *) val="$define" ;;
4238         esac
4239         set use5005threads
4240         eval $setvar
4241         ;;
4242     *)
4243         useithreads="$undef"
4244         use5005threads="$undef"
4245         ;;
4246     esac
4247
4248     case "$useithreads$use5005threads" in
4249     "$define$define")
4250         $cat >&4 <<EOM
4251
4252 You cannot have both the ithreads and the 5.005 threads enabled
4253 at the same time.  Disabling the 5.005 threads since they are
4254 much less stable than the ithreads.
4255
4256 EOM
4257         use5005threads="$undef"
4258         ;;
4259     esac
4260
4261 else
4262 : perl-5.9.x and later
4263
4264     if test X"$usethreads" = "X$define"; then
4265         case "$use5005threads" in
4266             $define|true|[yY]*)
4267                 $cat >&4 <<EOM
4268
4269 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4270
4271 EOM
4272             ;;
4273         esac
4274     fi
4275
4276     use5005threads="$undef"
4277     useithreads="$usethreads"
4278 fi
4279
4280 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4281         cat >&4 <<EOF
4282 ***
4283 *** To build with ithreads you must also use the PerlIO layer.
4284 *** Cannot continue, aborting.
4285 ***
4286 EOF
4287         exit 1
4288 fi
4289
4290 case "$d_oldpthreads" in
4291 '')     : Configure tests would be welcome here.  For now, assume undef.
4292         val="$undef" ;;
4293 *)      val="$d_oldpthreads" ;;
4294 esac
4295 set d_oldpthreads
4296 eval $setvar
4297
4298
4299 : Look for a hint-file generated 'call-back-unit'.  If the
4300 : user has specified that a threading perl is to be built,
4301 : we may need to set or change some other defaults.
4302 if $test -f usethreads.cbu; then
4303     echo "Your platform has some specific hints regarding threaded builds, using them..."
4304     . ./usethreads.cbu
4305 else
4306     case "$usethreads" in
4307         "$define"|true|[yY]*)
4308                 $cat <<EOM
4309 (Your platform does not have any specific hints for threaded builds.
4310  Assuming POSIX threads, then.)
4311 EOM
4312         ;;
4313     esac
4314 fi
4315
4316 : Check if multiplicity is required
4317 cat <<EOM
4318
4319 Perl can be built so that multiple Perl interpreters can coexist
4320 within the same Perl executable.
4321 EOM
4322
4323 case "$useithreads" in
4324 $define)
4325         cat <<EOM
4326 This multiple interpreter support is required for interpreter-based threads.
4327 EOM
4328         val="$define"
4329         ;;
4330 *)      case "$usemultiplicity" in
4331         $define|true|[yY]*)     dflt='y';;
4332         *) dflt='n';;
4333         esac
4334         echo " "
4335         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4336         rp='Build Perl for multiplicity?'
4337         . ./myread
4338         case "$ans" in
4339         y|Y)    val="$define" ;;
4340         *)      val="$undef" ;;
4341         esac
4342         ;;
4343 esac
4344 set usemultiplicity
4345 eval $setvar
4346
4347 : Check if morebits is requested
4348 case "$usemorebits" in
4349 "$define"|true|[yY]*)
4350         use64bitint="$define"
4351         uselongdouble="$define"
4352         usemorebits="$define"
4353         ;;
4354 *)      usemorebits="$undef"
4355         ;;
4356 esac
4357
4358 : Determine the C compiler to be used
4359 echo " "
4360 case "$cc" in
4361 '') dflt=cc;;
4362 *) dflt="$cc";;
4363 esac
4364 rp="Use which C compiler?"
4365 . ./myread
4366 cc="$ans"
4367
4368 : See whether they have no cc but they do have gcc
4369 . ./trygcc
4370 if $test -f cc.cbu; then
4371     . ./cc.cbu
4372 fi
4373 . ./checkcc
4374
4375 : make some quick guesses about what we are up against
4376 echo " "
4377 $echo $n "Hmm...  $c"
4378 echo exit 1 >bsd
4379 echo exit 1 >usg
4380 echo exit 1 >v7
4381 echo exit 1 >osf1
4382 echo exit 1 >eunice
4383 echo exit 1 >xenix
4384 echo exit 1 >venix
4385 echo exit 1 >os2
4386 d_bsd="$undef"
4387 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4388 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4389 then
4390         echo "Looks kind of like an OSF/1 system, but we'll see..."
4391         echo exit 0 >osf1
4392 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4393         xxx=`./loc addbib blurfl $pth`
4394         if $test -f $xxx; then
4395         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4396                 echo exit 0 >bsd
4397                 echo exit 0 >usg
4398         else
4399                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4400                         echo "Looks kind of like an extended USG system, but we'll see..."
4401                 else
4402                         echo "Looks kind of like a USG system, but we'll see..."
4403                 fi
4404                 echo exit 0 >usg
4405         fi
4406 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4407         echo "Looks kind of like a BSD system, but we'll see..."
4408         d_bsd="$define"
4409         echo exit 0 >bsd
4410 else
4411         echo "Looks kind of like a Version 7 system, but we'll see..."
4412         echo exit 0 >v7
4413 fi
4414 case "$eunicefix" in
4415 *unixtovms*)
4416         $cat <<'EOI'
4417 There is, however, a strange, musty smell in the air that reminds me of
4418 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4419 EOI
4420         echo exit 0 >eunice
4421         d_eunice="$define"
4422 : it so happens the Eunice I know will not run shell scripts in Unix format
4423         ;;
4424 *)
4425         echo " "
4426         echo "Congratulations.  You aren't running Eunice."
4427         d_eunice="$undef"
4428         ;;
4429 esac
4430 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4431 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4432 : semicolon as a patch separator
4433 case "$p_" in
4434 :) ;;
4435 *)
4436         $cat <<'EOI'
4437 I have the feeling something is not exactly right, however...don't tell me...
4438 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4439 (Or you may be running DOS with DJGPP.)
4440 EOI
4441         echo exit 0 >os2
4442         ;;
4443 esac
4444 if test -f /xenix; then
4445         echo "Actually, this looks more like a XENIX system..."
4446         echo exit 0 >xenix
4447         d_xenix="$define"
4448 else
4449         echo " "
4450         echo "It's not Xenix..."
4451         d_xenix="$undef"
4452 fi
4453 chmod +x xenix
4454 $eunicefix xenix
4455 if test -f /venix; then
4456         echo "Actually, this looks more like a VENIX system..."
4457         echo exit 0 >venix
4458 else
4459         echo " "
4460         if ./xenix; then
4461                 : null
4462         else
4463                 echo "Nor is it Venix..."
4464         fi
4465 fi
4466 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4467 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4468 $rm -f foo
4469
4470 : Check if we are using GNU gcc and what its version is
4471 echo " "
4472 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4473 $cat >try.c <<EOM
4474 #include <stdio.h>
4475 int main() {
4476 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4477 #ifdef __VERSION__
4478         printf("%s\n", __VERSION__);
4479 #else
4480         printf("%s\n", "1");
4481 #endif
4482 #endif
4483         return(0);
4484 }
4485 EOM
4486 if $cc -o try $ccflags $ldflags try.c; then
4487         gccversion=`$run ./try`
4488         case "$gccversion" in
4489         '') echo "You are not using GNU cc." ;;
4490         *)  echo "You are using GNU cc $gccversion."
4491             ccname=gcc
4492             ;;
4493         esac
4494 else
4495         echo " "
4496         echo "*** WHOA THERE!!! ***" >&4
4497         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4498         case "$knowitall" in
4499         '')
4500         echo "    You'd better start hunting for one and let me know about it." >&4
4501                 exit 1
4502                 ;;
4503         esac
4504 fi
4505 $rm -f try try.*
4506 case "$gccversion" in
4507 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4508 esac
4509 case "$gccversion" in
4510 '') gccosandvers='' ;;
4511 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4512    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4513    gccshortvers=''
4514    case "$gccosandvers" in
4515    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4516    $osname$osvers) ;; # looking good
4517    $osname*) cat <<EOM >&4
4518
4519 *** WHOA THERE!!! ***
4520
4521     Your gcc has not been compiled for the exact release of
4522     your operating system ($gccosandvers versus $osname$osvers).
4523
4524     In general it is a good idea to keep gcc synchronized with
4525     the operating system because otherwise serious problems
4526     may ensue when trying to compile software, like Perl.
4527
4528     I'm trying to be optimistic here, though, and will continue.
4529     If later during the configuration and build icky compilation
4530     problems appear (headerfile conflicts being the most common
4531     manifestation), I suggest reinstalling the gcc to match
4532     your operating system release.
4533
4534 EOM
4535       ;;
4536    *) gccosandvers='' ;; # failed to parse, better be silent
4537    esac
4538    ;;
4539 esac
4540 case "$ccname" in
4541 '') ccname="$cc" ;;
4542 esac
4543
4544 # gcc 3.* complain about adding -Idirectories that they already know about,
4545 # so we will take those off from locincpth.
4546 case "$gccversion" in
4547 3*)
4548     echo "main(){}">try.c
4549     for incdir in $locincpth; do
4550        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4551              grep '^c[cp]p*[01]: warning: changing search order '`
4552        if test "X$warn" != X; then
4553            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4554        fi
4555     done
4556     $rm -f try try.*
4557 esac
4558
4559 : What should the include directory be ?
4560 echo " "
4561 $echo $n "Hmm...  $c"
4562 dflt='/usr/include'
4563 incpath=''
4564 mips_type=''
4565 if $test -f /bin/mips && /bin/mips; then
4566         echo "Looks like a MIPS system..."
4567         $cat >usr.c <<'EOCP'
4568 #ifdef SYSTYPE_BSD43
4569 /bsd43
4570 #endif
4571 EOCP
4572         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4573                 dflt='/bsd43/usr/include'
4574                 incpath='/bsd43'
4575                 mips_type='BSD 4.3'
4576         else
4577                 mips_type='System V'
4578         fi
4579         $rm -f usr.c usr.out
4580         echo "and you're compiling with the $mips_type compiler and libraries."
4581         xxx_prompt=y
4582         echo "exit 0" >mips
4583 else
4584         echo "Doesn't look like a MIPS system."
4585         xxx_prompt=n
4586         echo "exit 1" >mips
4587 fi
4588 chmod +x mips
4589 $eunicefix mips
4590 case "$usrinc" in
4591 '') ;;
4592 *) dflt="$usrinc";;
4593 esac
4594 case "$xxx_prompt" in
4595 y)      fn=d/
4596         echo " "
4597         rp='Where are the include files you want to use?'
4598         . ./getfile
4599         usrinc="$ans"
4600         ;;
4601 *)      usrinc="$dflt"
4602         ;;
4603 esac
4604
4605 : see how we invoke the C preprocessor
4606 echo " "
4607 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4608 cat <<'EOT' >testcpp.c
4609 #define ABC abc
4610 #define XYZ xyz
4611 ABC.XYZ
4612 EOT
4613 cd ..
4614 if test ! -f cppstdin; then
4615         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4616                 # AIX cc -E doesn't show the absolute headerfile
4617                 # locations but we'll cheat by using the -M flag.
4618                 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
4619         else
4620                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4621         fi
4622 else
4623         echo "Keeping your $hint cppstdin wrapper."
4624 fi
4625 chmod 755 cppstdin
4626 wrapper=`pwd`/cppstdin
4627 ok='false'
4628 cd UU
4629
4630 if $test "X$cppstdin" != "X" && \
4631         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4632         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4633 then
4634         echo "You used to use $cppstdin $cppminus so we'll use that again."
4635         case "$cpprun" in
4636         '') echo "But let's see if we can live without a wrapper..." ;;
4637         *)
4638                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4639                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4640                 then
4641                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4642                         ok='true'
4643                 else
4644                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4645                 fi
4646                 ;;
4647         esac
4648 else
4649         case "$cppstdin" in
4650         '') ;;
4651         *)
4652                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4653                 ;;
4654         esac
4655 fi
4656
4657 if $ok; then
4658         : nothing
4659 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4660         $cc -E <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         echo "Yup, it does."
4663         x_cpp="$cc -E"
4664         x_minus='';
4665 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4666         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4667         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668         echo "Yup, it does."
4669         x_cpp="$cc -E"
4670         x_minus='-';
4671 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4672         $cc -P <testcpp.c >testcpp.out 2>&1; \
4673         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4674         echo "Yipee, that works!"
4675         x_cpp="$cc -P"
4676         x_minus='';
4677 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4678         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4679         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4680         echo "At long last!"
4681         x_cpp="$cc -P"
4682         x_minus='-';
4683 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4684         $cpp <testcpp.c >testcpp.out 2>&1; \
4685         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4686         echo "It works!"
4687         x_cpp="$cpp"
4688         x_minus='';
4689 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4690         $cpp - <testcpp.c >testcpp.out 2>&1; \
4691         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4692         echo "Hooray, it works!  I was beginning to wonder."
4693         x_cpp="$cpp"
4694         x_minus='-';
4695 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4696         $wrapper <testcpp.c >testcpp.out 2>&1; \
4697         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4698         x_cpp="$wrapper"
4699         x_minus=''
4700         echo "Eureka!"
4701 else
4702         dflt=''
4703         rp="No dice.  I can't find a C preprocessor.  Name one:"
4704         . ./myread
4705         x_cpp="$ans"
4706         x_minus=''
4707         $x_cpp <testcpp.c >testcpp.out 2>&1
4708         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4709                 echo "OK, that will do." >&4
4710         else
4711 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4712                 exit 1
4713         fi
4714 fi
4715
4716 case "$ok" in
4717 false)
4718         cppstdin="$x_cpp"
4719         cppminus="$x_minus"
4720         cpprun="$x_cpp"
4721         cpplast="$x_minus"
4722         set X $x_cpp
4723         shift
4724         case "$1" in
4725         "$cpp")
4726                 echo "Perhaps can we force $cc -E using a wrapper..."
4727                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4728                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4729                 then
4730                         echo "Yup, we can."
4731                         cppstdin="$wrapper"
4732                         cppminus='';
4733                 else
4734                         echo "Nope, we'll have to live without it..."
4735                 fi
4736                 ;;
4737         esac
4738         case "$cpprun" in
4739         "$wrapper")
4740                 cpprun=''
4741                 cpplast=''
4742                 ;;
4743         esac
4744         ;;
4745 esac
4746
4747 case "$cppstdin" in
4748 "$wrapper"|'cppstdin') ;;
4749 *) $rm -f $wrapper;;
4750 esac
4751 $rm -f testcpp.c testcpp.out
4752
4753 : Set private lib path
4754 case "$plibpth" in
4755 '') if ./mips; then
4756                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4757         fi;;
4758 esac
4759 case "$libpth" in
4760 ' ') dlist='';;
4761 '') dlist="$loclibpth $plibpth $glibpth";;
4762 *) dlist="$libpth";;
4763 esac
4764
4765 : Now check and see which directories actually exist, avoiding duplicates
4766 libpth=''
4767 for xxx in $dlist
4768 do
4769     if $test -d $xxx; then
4770                 case " $libpth " in
4771                 *" $xxx "*) ;;
4772                 *) libpth="$libpth $xxx";;
4773                 esac
4774     fi
4775 done
4776 $cat <<'EOM'
4777
4778 Some systems have incompatible or broken versions of libraries.  Among
4779 the directories listed in the question below, please remove any you
4780 know not to be holding relevant libraries, and add any that are needed.
4781 Say "none" for none.
4782
4783 EOM
4784 case "$libpth" in
4785 '') dflt='none';;
4786 *)
4787         set X $libpth
4788         shift
4789         dflt=${1+"$@"}
4790         ;;
4791 esac
4792 rp="Directories to use for library searches?"
4793 . ./myread
4794 case "$ans" in
4795 none) libpth=' ';;
4796 *) libpth="$ans";;
4797 esac
4798
4799 : compute shared library extension
4800 case "$so" in
4801 '')
4802         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4803                 dflt='sl'
4804         else
4805                 dflt='so'
4806         fi
4807         ;;
4808 *) dflt="$so";;
4809 esac
4810 $cat <<EOM
4811
4812 On some systems, shared libraries may be available.  Answer 'none' if
4813 you want to suppress searching of shared libraries for the remainder
4814 of this configuration.
4815
4816 EOM
4817 rp='What is the file extension used for shared libraries?'
4818 . ./myread
4819 so="$ans"
4820
4821 : Define several unixisms.
4822 : Hints files or command line option can be used to override them.
4823 : The convoluted testing is in case hints files set either the old
4824 : or the new name.
4825 case "$_exe" in
4826 '')     case "$exe_ext" in
4827         '')     ;;
4828         *)      _exe="$exe_ext" ;;
4829         esac
4830         ;;
4831 esac
4832 case "$_a" in
4833 '')     case "$lib_ext" in
4834     '') _a='.a';;
4835         *)      _a="$lib_ext" ;;
4836         esac
4837         ;;
4838 esac
4839 case "$_o" in
4840 '') case "$obj_ext" in
4841         '')     _o='.o';;
4842         *)      _o="$obj_ext";;
4843         esac
4844         ;;
4845 esac
4846 case "$p_" in
4847 '') case "$path_sep" in
4848         '')     p_=':';;
4849         *)      p_="$path_sep";;
4850         esac
4851         ;;
4852 esac
4853 exe_ext=$_exe
4854 lib_ext=$_a
4855 obj_ext=$_o
4856 path_sep=$p_
4857
4858 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4859
4860 : Which makefile gets called first.  This is used by make depend.
4861 case "$firstmakefile" in
4862 '') firstmakefile='makefile';;
4863 esac
4864
4865 : Check for uselongdouble support
4866 case "$ccflags" in
4867 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4868 esac
4869
4870 case "$uselongdouble" in
4871 $define|true|[yY]*)     dflt='y';;
4872 *) dflt='n';;
4873 esac
4874 cat <<EOM
4875
4876 Perl can be built to take advantage of long doubles which
4877 (if available) may give more accuracy and range for floating point numbers.
4878
4879 If this doesn't make any sense to you, just accept the default '$dflt'.
4880 EOM
4881 rp='Try to use long doubles if available?'
4882 . ./myread
4883 case "$ans" in
4884 y|Y)    val="$define"   ;;
4885 *)      val="$undef"    ;;
4886 esac
4887 set uselongdouble
4888 eval $setvar
4889
4890 case "$uselongdouble" in
4891 true|[yY]*) uselongdouble="$define" ;;
4892 esac
4893
4894 : Look for a hint-file generated 'call-back-unit'.  If the
4895 : user has specified that long doubles should be used,
4896 : we may need to set or change some other defaults.
4897 if $test -f uselongdouble.cbu; then
4898     echo "Your platform has some specific hints regarding long doubles, using them..."
4899     . ./uselongdouble.cbu
4900 else
4901     case "$uselongdouble" in
4902         $define)
4903                 $cat <<EOM
4904 (Your platform does not have any specific hints for long doubles.)
4905 EOM
4906         ;;
4907     esac
4908 fi
4909
4910 : Looking for optional libraries
4911 echo " "
4912 echo "Checking for optional libraries..." >&4
4913 case "$libs" in
4914 ' '|'') dflt='';;
4915 *) dflt="$libs";;
4916 esac
4917 case "$libswanted" in
4918 '') libswanted='c_s';;
4919 esac
4920 case "$usesocks" in
4921 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4922 esac
4923 libsfound=''
4924 libsfiles=''
4925 libsdirs=''
4926 libspath=''
4927 for thisdir in $libpth $xlibpth; do
4928   test -d $thisdir && libspath="$libspath $thisdir"
4929 done
4930 for thislib in $libswanted; do
4931         for thisdir in $libspath; do
4932             xxx=''
4933             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4934                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=shared
4937             fi
4938             if test ! -f "$xxx"; then
4939                 xxx=$thisdir/lib$thislib.$so
4940                 $test -f "$xxx" && eval $libscheck
4941                 $test -f "$xxx" && libstyle=shared
4942             fi
4943             if test ! -f "$xxx"; then
4944                 xxx=$thisdir/lib$thislib$_a
4945                 $test -f "$xxx" && eval $libscheck
4946                 $test -f "$xxx" && libstyle=static
4947             fi
4948             if test ! -f "$xxx"; then
4949                 xxx=$thisdir/$thislib$_a
4950                 $test -f "$xxx" && eval $libscheck
4951                 $test -f "$xxx" && libstyle=static
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/lib${thislib}_s$_a
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=static
4957                 $test -f "$xxx" && thislib=${thislib}_s
4958             fi
4959             if test ! -f "$xxx"; then
4960                 xxx=$thisdir/Slib$thislib$_a
4961                 $test -f "$xxx" && eval $libscheck
4962                 $test -f "$xxx" && libstyle=static
4963             fi
4964             if $test -f "$xxx"; then
4965                 case "$libstyle" in
4966                 shared) echo "Found -l$thislib (shared)." ;;
4967                 static) echo "Found -l$thislib." ;;
4968                 *)      echo "Found -l$thislib ($libstyle)." ;;
4969                 esac
4970                 case " $dflt " in
4971                 *"-l$thislib "*);;
4972                 *) dflt="$dflt -l$thislib"
4973                    libsfound="$libsfound $xxx"
4974                    yyy=`basename $xxx`
4975                    libsfiles="$libsfiles $yyy"
4976                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4977                    case " $libsdirs " in
4978                    *" $yyy "*) ;;
4979                    *) libsdirs="$libsdirs $yyy" ;;
4980                    esac
4981                    ;;
4982                 esac
4983                 break
4984             fi
4985         done
4986         if $test ! -f "$xxx"; then
4987             echo "No -l$thislib."
4988         fi
4989 done
4990 set X $dflt
4991 shift
4992 dflt="$*"
4993 case "$libs" in
4994 '') dflt="$dflt";;
4995 *) dflt="$libs";;
4996 esac
4997 case "$dflt" in
4998 ' '|'') dflt='none';;
4999 esac
5000
5001 $cat <<EOM
5002
5003 In order to compile $package on your machine, a number of libraries
5004 are usually needed.  Include any other special libraries here as well.
5005 Say "none" for none.  The default list is almost always right.
5006 EOM
5007
5008 echo " "
5009 rp="What libraries to use?"
5010 . ./myread
5011 case "$ans" in
5012 none) libs=' ';;
5013 *) libs="$ans";;
5014 esac
5015
5016 : determine optimization, if desired, or use for debug flag also
5017 case "$optimize" in
5018 ' '|$undef) dflt='none';;
5019 '') dflt='-O';;
5020 *) dflt="$optimize";;
5021 esac
5022 $cat <<EOH
5023
5024 By default, $package compiles with the -O flag to use the optimizer.
5025 Alternately, you might want to use the symbolic debugger, which uses
5026 the -g flag (on traditional Unix systems).  Either flag can be
5027 specified here.  To use neither flag, specify the word "none".
5028
5029 EOH
5030 rp="What optimizer/debugger flag should be used?"
5031 . ./myread
5032 optimize="$ans"
5033 case "$optimize" in
5034 'none') optimize=" ";;
5035 esac
5036
5037 : Check what DEBUGGING is required from the command line
5038 : -DEBUGGING      or -DDEBUGGING or
5039 : -DEBUGGING=both                       = -g + -DDEBUGGING
5040 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5041 : -DEBUGGING=none or -UDEBUGGING        =
5042 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5043 case "$EBUGGING" in
5044 '')     ;;
5045 *)      DEBUGGING=$EBUGGING ;;
5046 esac
5047
5048 case "$DEBUGGING" in
5049 -g|both|$define)
5050     case "$optimize" in
5051         *-g*) ;;
5052         *)    optimize="$optimize -g" ;;
5053     esac ;;
5054 none|$undef)
5055     case "$optimize" in
5056         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5057                 shift
5058                 optimize="$*"
5059                 ;;
5060     esac ;;
5061 esac
5062
5063 dflt=''
5064 case "$DEBUGGING" in
5065 both|$define) dflt='-DDEBUGGING'
5066 esac
5067
5068 : argument order is deliberate, as the flag will start with - which set could
5069 : think is an option
5070 checkccflag='check=$1; flag=$2; callback=$3;
5071 echo " ";
5072 echo "Checking if your compiler accepts $flag" 2>&1;
5073 echo "int main(void) { return 0; }" > gcctest.c;
5074 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5075     echo "Yes, it does." 2>&1;
5076     if $test -s gcctest.out ; then
5077         echo "But your platform does not like it:";
5078         cat gcctest.out;
5079     else
5080         case "$ccflags" in
5081         *$check*)
5082             echo "Leaving current flags $ccflags alone." 2>&1
5083             ;;
5084         *) dflt="$dflt $flag";
5085             eval $callback
5086             ;;
5087         esac
5088     fi
5089 else
5090     echo "Nope, it does not, but that is ok." 2>&1;
5091 fi
5092 '
5093
5094 : We will not override a previous value, but we might want to
5095 : augment a hint file
5096 case "$hint" in
5097 default|recommended)
5098         case "$gccversion" in
5099         1*) dflt="$dflt -fpcc-struct-return" ;;
5100         esac
5101         case "$optimize:$DEBUGGING" in
5102         *-g*:old) dflt="$dflt -DDEBUGGING";;
5103         esac
5104         case "$gccversion" in
5105         2*) if $test -d /etc/conf/kconfig.d &&
5106                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5107                 then
5108                         # Interactive Systems (ISC) POSIX mode.
5109                         dflt="$dflt -posix"
5110                 fi
5111                 ;;
5112         esac
5113         case "$gccversion" in
5114         1*) ;;
5115         2.[0-8]*) ;;
5116         ?*)     set strict-aliasing -fno-strict-aliasing
5117                 eval $checkccflag
5118                 ;;
5119         esac
5120         # For gcc, adding -pipe speeds up compilations for some, but apparently
5121         # some assemblers can't read from stdin.  (It also slows down compilations
5122         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5123         case "$gccversion" in
5124         ?*)     set pipe -pipe
5125                 eval $checkccflag
5126                 ;;
5127         esac
5128
5129         # on x86_64 (at least) we require an extra library (libssp) in the
5130         # link command line. This library is not named, so I infer that it is
5131         # an implementation detail that may change. Hence the safest approach
5132         # is to add the flag to the flags passed to the compiler at link time,
5133         # as that way the compiler can do the right implementation dependant
5134         # thing. (NWC)
5135         case "$gccversion" in
5136         ?*)     set stack-protector -fstack-protector
5137                 eval $checkccflag
5138                 ;;
5139         esac
5140         ;;
5141 esac
5142
5143 case "$mips_type" in
5144 *BSD*|'') inclwanted="$locincpth $usrinc";;
5145 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5146 esac
5147 for thisincl in $inclwanted; do
5148         if $test -d $thisincl; then
5149                 if $test x$thisincl != x$usrinc; then
5150                         case "$dflt" in
5151                         *" -I$thisincl "*);;
5152                         *) dflt="$dflt -I$thisincl ";;
5153                         esac
5154                 fi
5155         fi
5156 done
5157
5158 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5159         xxx=true;
5160 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5161         xxx=true;
5162 else
5163         xxx=false;
5164 fi;
5165 if $xxx; then
5166         case "$dflt" in
5167         *$2*);;
5168         *) dflt="$dflt -D$2";;
5169         esac;
5170 fi'
5171
5172 set signal.h LANGUAGE_C; eval $inctest
5173
5174 case "$usesocks" in
5175 $define)
5176         ccflags="$ccflags -DSOCKS"
5177         ;;
5178 esac
5179
5180 case "$hint" in
5181 default|recommended) dflt="$ccflags $dflt" ;;
5182 *) dflt="$ccflags";;
5183 esac
5184
5185 case "$dflt" in
5186 ''|' ') dflt=none;;
5187 esac
5188
5189 $cat <<EOH
5190
5191 Your C compiler may want other flags.  For this question you should include
5192 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5193 but you should NOT include libraries or ld flags like -lwhatever.  If you
5194 want $package to honor its debug switch, you should include -DDEBUGGING here.
5195 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5196
5197 To use no flags, specify the word "none".
5198
5199 EOH
5200 set X $dflt
5201 shift
5202 dflt=${1+"$@"}
5203 rp="Any additional cc flags?"
5204 . ./myread
5205 case "$ans" in
5206 none) ccflags='';;
5207 *) ccflags="$ans";;
5208 esac
5209
5210 : the following weeds options from ccflags that are of no interest to cpp
5211 case "$cppflags" in
5212 '') cppflags="$ccflags" ;;
5213 *)  cppflags="$cppflags $ccflags" ;;
5214 esac
5215 case "$gccversion" in
5216 1*) cppflags="$cppflags -D__GNUC__"
5217 esac
5218 case "$mips_type" in
5219 '');;
5220 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5221 esac
5222 case "$cppflags" in
5223 '');;
5224 *)
5225         echo " "
5226         echo "Let me guess what the preprocessor flags are..." >&4
5227         set X $cppflags
5228         shift
5229         cppflags=''
5230         $cat >cpp.c <<'EOM'
5231 #define BLURFL foo
5232
5233 BLURFL xx LFRULB
5234 EOM
5235         previous=''
5236         for flag in $*
5237         do
5238                 case "$flag" in
5239                 -*) ftry="$flag";;
5240                 *) ftry="$previous $flag";;
5241                 esac
5242                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5243                         >cpp1.out 2>/dev/null && \
5244                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5245                         >cpp2.out 2>/dev/null && \
5246                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5247                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5248                 then
5249                         cppflags="$cppflags $ftry"
5250                         previous=''
5251                 else
5252                         previous="$flag"
5253                 fi
5254         done
5255         set X $cppflags
5256         shift
5257         cppflags=${1+"$@"}
5258         case "$cppflags" in
5259         *-*)  echo "They appear to be: $cppflags";;
5260         esac
5261         $rm -f cpp.c cpp?.out
5262         ;;
5263 esac
5264
5265 : flags used in final linking phase
5266 case "$ldflags" in
5267 '') if ./venix; then
5268                 dflt='-i -z'
5269         else
5270                 dflt=''
5271         fi
5272         case "$ccflags" in
5273         *-posix*) dflt="$dflt -posix" ;;
5274         esac
5275         ;;
5276 *) dflt="$ldflags";;
5277 esac
5278 # See note above about -fstack-protector
5279 case "$ccflags" in
5280 *-fstack-protector*) 
5281         case "$dflt" in
5282         *-fstack-protector*) ;; # Don't add it again
5283         *) dflt="$dflt -fstack-protector" ;; 
5284         esac
5285         ;;
5286 esac
5287
5288 : Try to guess additional flags to pick up local libraries.
5289 for thislibdir in $libpth; do
5290         case " $loclibpth " in
5291         *" $thislibdir "*)
5292                 case "$dflt " in
5293                 *"-L$thislibdir "*) ;;
5294                 *)  dflt="$dflt -L$thislibdir" ;;
5295                 esac
5296                 ;;
5297         esac
5298 done
5299
5300 case "$dflt" in
5301 '') dflt='none' ;;
5302 esac
5303
5304 $cat <<EOH
5305
5306 Your C linker may need flags.  For this question you should
5307 include -L/whatever and any other flags used by the C linker, but you
5308 should NOT include libraries like -lwhatever.
5309
5310 Make sure you include the appropriate -L/path flags if your C linker
5311 does not normally search all of the directories you specified above,
5312 namely
5313         $libpth
5314 To use no flags, specify the word "none".
5315
5316 EOH
5317
5318 rp="Any additional ld flags (NOT including libraries)?"
5319 . ./myread
5320 case "$ans" in
5321 none) ldflags='';;
5322 *) ldflags="$ans";;
5323 esac
5324 rmlist="$rmlist pdp11"
5325
5326 : coherency check
5327 echo " "
5328 echo "Checking your choice of C compiler and flags for coherency..." >&4
5329 $cat > try.c <<'EOF'
5330 #include <stdio.h>
5331 int main() { printf("Ok\n"); return(0); }
5332 EOF
5333 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5334 shift
5335 $cat >try.msg <<'EOM'
5336 I've tried to compile and run the following simple program:
5337
5338 EOM
5339 $cat try.c >> try.msg
5340
5341 $cat >> try.msg <<EOM
5342
5343 I used the command:
5344
5345         $*
5346         $run ./try
5347
5348 and I got the following output:
5349
5350 EOM
5351 dflt=y
5352 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5353         if $sh -c "$run ./try " >>try.msg 2>&1; then
5354                 xxx=`$run ./try`
5355                 case "$xxx" in
5356                 "Ok") dflt=n ;;
5357                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5358                         case " $libs " in
5359                         *" -lsfio "*)
5360                                 cat >> try.msg <<'EOQS'
5361 If $libs contains -lsfio, and sfio is mis-configured, then it
5362 sometimes (apparently) runs and exits with a 0 status, but with no
5363 output!  It may have to do with sfio's use of _exit vs. exit.
5364
5365 EOQS
5366                                 rp="You have a big problem.  Shall I abort Configure"
5367                                 dflt=y
5368                                 ;;
5369                         esac
5370                         ;;
5371                 esac
5372         else
5373                 echo "The program compiled OK, but exited with status $?." >>try.msg
5374                 rp="You have a problem.  Shall I abort Configure"
5375                 dflt=y
5376         fi
5377 else
5378         echo "I can't compile the test program." >>try.msg
5379         rp="You have a BIG problem.  Shall I abort Configure"
5380         dflt=y
5381 fi
5382 case "$dflt" in
5383 y)
5384         $cat try.msg >&4
5385         case "$knowitall" in
5386         '')
5387                 echo "(The supplied flags or libraries might be incorrect.)"
5388                 ;;
5389         *) dflt=n;;
5390         esac
5391         echo " "
5392         . ./myread
5393         case "$ans" in
5394         n*|N*) ;;
5395         *)      echo "Ok.  Stopping Configure." >&4
5396                 exit 1
5397                 ;;
5398         esac
5399         ;;
5400 n) echo "OK, that should do.";;
5401 esac
5402 $rm_try gcctest gcctest.out
5403
5404 : define a shorthand compile call
5405 compile='
5406 mc_file=$1;
5407 shift;
5408 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5409 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5410 exit 1;
5411 fi;
5412 esac;
5413 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5414 : define a shorthand compile call for compilations that should be ok.
5415 compile_ok='
5416 mc_file=$1;
5417 shift;
5418 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5419
5420 : determine filename position in cpp output
5421 echo " "
5422 echo "Computing filename position in cpp output for #include directives..." >&4
5423 case "$osname" in
5424 vos) testaccess=-e ;;
5425 *)   testaccess=-r ;;
5426 esac
5427 echo '#include <stdio.h>' > foo.c
5428 $cat >fieldn <<EOF
5429 $startsh
5430 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5431 $grep '^[       ]*#.*stdio\.h' | \
5432 while read cline; do
5433         pos=1
5434         set \$cline
5435         while $test \$# -gt 0; do
5436                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5437                         echo "\$pos"
5438                         exit 0
5439                 fi
5440                 shift
5441                 pos=\`expr \$pos + 1\`
5442         done
5443 done
5444 EOF
5445 chmod +x fieldn
5446 fieldn=`./fieldn`
5447 $rm -f foo.c fieldn
5448 case $fieldn in
5449 '') pos='???';;
5450 1) pos=first;;
5451 2) pos=second;;
5452 3) pos=third;;
5453 *) pos="${fieldn}th";;
5454 esac
5455 echo "Your cpp writes the filename in the $pos field of the line."
5456
5457 case "$osname" in
5458 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5459 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5460 *)   cppfilter='' ;;
5461 esac
5462 : locate header file
5463 $cat >findhdr <<EOF
5464 $startsh
5465 wanted=\$1
5466 name=''
5467 for usrincdir in $usrinc
5468 do
5469         if test -f \$usrincdir/\$wanted; then
5470                 echo "\$usrincdir/\$wanted"
5471                 exit 0
5472         fi
5473 done
5474 awkprg='{ print \$$fieldn }'
5475 echo "#include <\$wanted>" > foo\$\$.c
5476 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5477 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5478 while read cline; do
5479         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5480         case "\$name" in
5481         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5482         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5483         *) exit 2;;
5484         esac;
5485 done;
5486 #
5487 # status = 0: grep returned 0 lines, case statement not executed
5488 # status = 1: headerfile found
5489 # status = 2: while loop executed, no headerfile found
5490 #
5491 status=\$?
5492 $rm -f foo\$\$.c;
5493 if test \$status -eq 1; then
5494         exit 0;
5495 fi
5496 exit 1
5497 EOF
5498 chmod +x findhdr
5499
5500 : define an alternate in-header-list? function
5501 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5502 cont=true; xxf="echo \"<\$1> found.\" >&4";
5503 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5504 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5505 esac;
5506 case $# in 4) instead=instead;; *) instead="at last";; esac;
5507 while $test "$cont"; do
5508         xxx=`./findhdr $1`
5509         var=$2; eval "was=\$$2";
5510         if $test "$xxx" && $test -r "$xxx";
5511         then eval $xxf;
5512         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5513                 cont="";
5514         else eval $xxnf;
5515         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5516         set $yyy; shift; shift; yyy=$@;
5517         case $# in 0) cont="";;
5518         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5519                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5520         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5521                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5522         esac;
5523 done;
5524 while $test "$yyy";
5525 do set $yyy; var=$2; eval "was=\$$2";
5526         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5527         set $yyy; shift; shift; yyy=$@;
5528 done'
5529
5530 : see if stdlib is available
5531 set stdlib.h i_stdlib
5532 eval $inhdr
5533
5534 : check for lengths of integral types
5535 echo " "
5536 case "$intsize" in
5537 '')
5538         echo "Checking to see how big your integers are..." >&4
5539         $cat >try.c <<EOCP
5540 #include <stdio.h>
5541 #$i_stdlib I_STDLIB
5542 #ifdef I_STDLIB
5543 #include <stdlib.h>
5544 #endif
5545 int main()
5546 {
5547         printf("intsize=%d;\n", (int)sizeof(int));
5548         printf("longsize=%d;\n", (int)sizeof(long));
5549         printf("shortsize=%d;\n", (int)sizeof(short));
5550         exit(0);
5551 }
5552 EOCP
5553         set try
5554         if eval $compile_ok && $run ./try > /dev/null; then
5555                 eval `$run ./try`
5556                 echo "Your integers are $intsize bytes long."
5557                 echo "Your long integers are $longsize bytes long."
5558                 echo "Your short integers are $shortsize bytes long."
5559         else
5560                 $cat >&4 <<EOM
5561 !
5562 Help! I can't compile and run the intsize test program: please enlighten me!
5563 (This is probably a misconfiguration in your system or libraries, and
5564 you really ought to fix it.  Still, I'll try anyway.)
5565 !
5566 EOM
5567                 dflt=4
5568                 rp="What is the size of an integer (in bytes)?"
5569                 . ./myread
5570                 intsize="$ans"
5571                 dflt=$intsize
5572                 rp="What is the size of a long integer (in bytes)?"
5573                 . ./myread
5574                 longsize="$ans"
5575                 dflt=2
5576                 rp="What is the size of a short integer (in bytes)?"
5577                 . ./myread
5578                 shortsize="$ans"
5579         fi
5580         ;;
5581 esac
5582 $rm_try
5583
5584 : check for long long
5585 echo " "
5586 echo "Checking to see if you have long long..." >&4
5587 echo 'int main() { long long x = 7; return 0; }' > try.c
5588 set try
5589 if eval $compile; then
5590         val="$define"
5591         echo "You have long long."
5592 else
5593         val="$undef"
5594         echo "You do not have long long."
5595 fi
5596 $rm_try
5597 set d_longlong
5598 eval $setvar
5599
5600 : check for length of long long
5601 case "${d_longlong}${longlongsize}" in
5602 $define)
5603         echo " "
5604         echo "Checking to see how big your long longs are..." >&4
5605         $cat >try.c <<'EOCP'
5606 #include <stdio.h>
5607 int main()
5608 {
5609     printf("%d\n", (int)sizeof(long long));
5610     return(0);
5611 }
5612 EOCP
5613         set try
5614         if eval $compile_ok; then
5615                 longlongsize=`$run ./try`
5616                 echo "Your long longs are $longlongsize bytes long."
5617         else
5618                 dflt='8'
5619                 echo " "
5620                 echo "(I can't seem to compile the test program.  Guessing...)"
5621                 rp="What is the size of a long long (in bytes)?"
5622                 . ./myread
5623                 longlongsize="$ans"
5624         fi
5625         if $test "X$longsize" = "X$longlongsize"; then
5626                 echo "(That isn't any different from an ordinary long.)"
5627         fi
5628         ;;
5629 esac
5630 $rm_try
5631
5632 : see if inttypes.h is available
5633 : we want a real compile instead of Inhdr because some systems
5634 : have an inttypes.h which includes non-existent headers
5635 echo " "
5636 $cat >try.c <<EOCP
5637 #include <inttypes.h>
5638 int main() {
5639         static int32_t foo32 = 0x12345678;
5640 }
5641 EOCP
5642 set try
5643 if eval $compile; then
5644         echo "<inttypes.h> found." >&4
5645         val="$define"
5646 else
5647         echo "<inttypes.h> NOT found." >&4
5648         val="$undef"
5649 fi
5650 $rm_try
5651 set i_inttypes
5652 eval $setvar
5653
5654 : check for int64_t
5655 echo " "
5656 echo "Checking to see if you have int64_t..." >&4
5657 $cat >try.c <<EOCP
5658 #include <sys/types.h>
5659 #$i_inttypes I_INTTYPES
5660 #ifdef I_INTTYPES
5661 #include <inttypes.h>
5662 #endif
5663 int main() { int64_t x = 7; }
5664 EOCP
5665 set try
5666 if eval $compile; then
5667         val="$define"
5668         echo "You have int64_t."
5669 else
5670         val="$undef"
5671         echo "You do not have int64_t."
5672 fi
5673 $rm_try
5674 set d_int64_t
5675 eval $setvar
5676
5677 : Check if 64bit ints have a quad type
5678 echo " "
5679 echo "Checking which 64-bit integer type we could use..." >&4
5680
5681 case "$intsize" in
5682 8) val=int
5683    set quadtype
5684    eval $setvar
5685    val='"unsigned int"'
5686    set uquadtype
5687    eval $setvar
5688    quadkind=1
5689    ;;
5690 *) case "$longsize" in
5691    8) val=long
5692       set quadtype
5693       eval $setvar
5694       val='"unsigned long"'
5695       set uquadtype
5696       eval $setvar
5697       quadkind=2
5698       ;;
5699    *) case "$d_longlong:$longlongsize" in
5700       define:8)
5701         val='"long long"'
5702         set quadtype
5703         eval $setvar
5704         val='"unsigned long long"'
5705         set uquadtype
5706         eval $setvar
5707         quadkind=3
5708         ;;
5709       *) case "$d_int64_t" in
5710          define)
5711            val=int64_t
5712            set quadtype
5713            eval $setvar
5714            val=uint64_t
5715            set uquadtype
5716            eval $setvar
5717            quadkind=4
5718            ;;
5719          esac
5720          ;;
5721       esac
5722       ;;
5723    esac
5724    ;;
5725 esac
5726
5727 case "$quadtype" in
5728 '')     echo "Alas, no 64-bit integer types in sight." >&4
5729         d_quad="$undef"
5730         ;;
5731 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5732         d_quad="$define"
5733         ;;
5734 esac
5735
5736 : Do we want 64bit support
5737 case "$uselonglong" in
5738 "$define"|true|[yY]*)
5739         cat <<EOM >&4
5740
5741 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5742 EOM
5743         use64bitint="$define"
5744         ;;
5745 esac
5746 case "$use64bits" in
5747 "$define"|true|[yY]*)
5748         cat <<EOM >&4
5749
5750 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5751 EOM
5752         use64bitint="$define"
5753         ;;
5754 esac
5755 case "$use64bitints" in
5756 "$define"|true|[yY]*)
5757         cat <<EOM >&4
5758
5759 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5760 EOM
5761         use64bitint="$define"
5762         ;;
5763 esac
5764 case "$use64bitsint" in
5765 "$define"|true|[yY]*)
5766         cat <<EOM >&4
5767
5768 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5769 EOM
5770         use64bitint="$define"
5771         ;;
5772 esac
5773 case "$uselonglongs" in
5774 "$define"|true|[yY]*)
5775         cat <<EOM >&4
5776
5777 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5778 EOM
5779         use64bitint="$define"
5780         ;;
5781 esac
5782 case "$use64bitsall" in
5783 "$define"|true|[yY]*)
5784         cat <<EOM >&4
5785
5786 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5787 EOM
5788         use64bitall="$define"
5789         ;;
5790 esac
5791
5792 case "$ccflags" in
5793 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5794 esac
5795 case "$use64bitall" in
5796 "$define"|true|[yY]*) use64bitint="$define" ;;
5797 esac
5798
5799 case "$longsize" in
5800 8) cat <<EOM
5801
5802 You have natively 64-bit long integers.
5803 EOM
5804    val="$define"
5805    ;;
5806 *) case "$use64bitint" in
5807    "$define"|true|[yY]*) dflt='y';;
5808    *) dflt='n';;
5809    esac
5810    case "$d_quad" in
5811    "$define") ;;
5812    *) dflt='n' ;;
5813    esac
5814    cat <<EOM
5815
5816 Perl can be built to take advantage of 64-bit integer types
5817 on some systems.  To do so, Configure can be run with -Duse64bitint.
5818 Choosing this option will most probably introduce binary incompatibilities.
5819
5820 If this doesn't make any sense to you, just accept the default '$dflt'.
5821 (The default has been chosen based on your configuration.)
5822 EOM
5823    rp='Try to use 64-bit integers, if available?'
5824    . ./myread
5825    case "$ans" in
5826    [yY]*) val="$define" ;;
5827    *)     val="$undef"  ;;
5828    esac
5829    ;;
5830 esac
5831 set use64bitint
5832 eval $setvar
5833
5834 case "$use64bitall" in
5835 "$define"|true|[yY]*) dflt='y' ;;
5836 *) case "$longsize" in
5837    8) dflt='y' ;;
5838    *) dflt='n' ;;
5839    esac
5840    ;;
5841 esac
5842 cat <<EOM
5843
5844 You may also choose to try maximal 64-bitness.  It means using as much
5845 64-bitness as possible on the platform.  This in turn means even more
5846 binary incompatibilities.  On the other hand, your platform may not
5847 have any more 64-bitness available than what you already have chosen.
5848
5849 If this doesn't make any sense to you, just accept the default '$dflt'.
5850 (The default has been chosen based on your configuration.)
5851 EOM
5852 rp='Try to use maximal 64-bit support, if available?'
5853 . ./myread
5854 case "$ans" in
5855 [yY]*) val="$define" ;;
5856 *)     val="$undef"  ;;
5857 esac
5858 set use64bitall
5859 eval $setvar
5860 case "$use64bitall" in
5861 "$define")
5862         case "$use64bitint" in
5863         "$undef")
5864                 cat <<EOM
5865
5866 Since you have chosen a maximally 64-bit build, I'm also turning on
5867 the use of 64-bit integers.
5868 EOM
5869                 use64bitint="$define" ;;
5870         esac
5871         ;;
5872 esac
5873
5874 : Look for a hint-file generated 'call-back-unit'.  If the
5875 : user has specified that a 64-bit perl is to be built,
5876 : we may need to set or change some other defaults.
5877 if $test -f use64bitint.cbu; then
5878         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5879         . ./use64bitint.cbu
5880 fi
5881 case "$use64bitint" in
5882 "$define"|true|[yY]*)
5883         case "$longsize" in
5884         4) case "$archname64" in
5885            '') archname64=64int ;;
5886            esac
5887            ;;
5888         esac
5889         ;;
5890 esac
5891
5892 : Look for a hint-file generated 'call-back-unit'.  If the
5893 : user has specified that a maximally 64-bit perl is to be built,
5894 : we may need to set or change some other defaults.
5895 if $test -f use64bitall.cbu; then
5896         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5897         . ./use64bitall.cbu
5898 fi
5899 case "$use64bitall" in
5900 "$define"|true|[yY]*)
5901         case "$longsize" in
5902         4) case "$archname64" in
5903            ''|64int) archname64=64all ;;
5904            esac
5905            ;;
5906         esac
5907         ;;
5908 esac
5909
5910 case "$d_quad:$use64bitint" in
5911 $undef:$define)
5912         cat >&4 <<EOF
5913
5914 *** You have chosen to use 64-bit integers,
5915 *** but none can be found.
5916 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5917 *** Cannot continue, aborting.
5918
5919 EOF
5920         exit 1
5921         ;;
5922 esac
5923
5924 : check for length of double
5925 echo " "
5926 case "$doublesize" in
5927 '')
5928         echo "Checking to see how big your double precision numbers are..." >&4
5929         $cat >try.c <<EOCP
5930 #include <stdio.h>
5931 #$i_stdlib I_STDLIB
5932 #ifdef I_STDLIB
5933 #include <stdlib.h>
5934 #endif
5935 int main()
5936 {
5937     printf("%d\n", (int)sizeof(double));
5938     exit(0);
5939 }
5940 EOCP
5941         set try
5942         if eval $compile_ok; then
5943                 doublesize=`$run ./try`
5944                 echo "Your double is $doublesize bytes long."
5945         else
5946                 dflt='8'
5947                 echo "(I can't seem to compile the test program.  Guessing...)"
5948                 rp="What is the size of a double precision number (in bytes)?"
5949                 . ./myread
5950                 doublesize="$ans"
5951         fi
5952         ;;
5953 esac
5954 $rm_try
5955
5956 : check for long doubles
5957 echo " "
5958 echo "Checking to see if you have long double..." >&4
5959 echo 'int main() { long double x = 7.0; }' > try.c
5960 set try
5961 if eval $compile; then
5962         val="$define"
5963         echo "You have long double."
5964 else
5965         val="$undef"
5966         echo "You do not have long double."
5967 fi
5968 $rm_try
5969 set d_longdbl
5970 eval $setvar
5971
5972 : check for length of long double
5973 case "${d_longdbl}${longdblsize}" in
5974 $define)
5975         echo " "
5976         echo "Checking to see how big your long doubles are..." >&4
5977         $cat >try.c <<'EOCP'
5978 #include <stdio.h>
5979 int main()
5980 {
5981         printf("%d\n", sizeof(long double));
5982 }
5983 EOCP
5984         set try
5985         set try
5986         if eval $compile; then
5987                 longdblsize=`$run ./try`
5988                 echo "Your long doubles are $longdblsize bytes long."
5989         else
5990                 dflt='8'
5991                 echo " "
5992                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5993                 rp="What is the size of a long double (in bytes)?"
5994                 . ./myread
5995                 longdblsize="$ans"
5996         fi
5997         if $test "X$doublesize" = "X$longdblsize"; then
5998                 echo "That isn't any different from an ordinary double."
5999                 echo "I'll keep your setting anyway, but you may see some"
6000                 echo "harmless compilation warnings."
6001         fi
6002         ;;
6003 esac
6004 $rm_try
6005
6006 : determine the architecture name
6007 echo " "
6008 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6009         tarch=`arch`"-$osname"
6010 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6011         if uname -m > tmparch 2>&1 ; then
6012                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6013                         -e 's/$/'"-$osname/" tmparch`
6014         else
6015                 tarch="$osname"
6016         fi
6017         $rm -f tmparch
6018 else
6019         tarch="$osname"
6020 fi
6021 case "$myarchname" in
6022 ''|"$tarch") ;;
6023 *)
6024         echo "(Your architecture name used to be $myarchname.)"
6025         archname=''
6026         ;;
6027 esac
6028 case "$targetarch" in
6029 '') ;;
6030 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6031 esac
6032 myarchname="$tarch"
6033 case "$archname" in
6034 '') dflt="$tarch";;
6035 *) dflt="$archname";;
6036 esac
6037 rp='What is your architecture name'
6038 . ./myread
6039 archname="$ans"
6040 case "$usethreads" in
6041 $define)
6042         echo "Threads selected." >&4
6043         case "$archname" in
6044         *-thread*) echo "...and architecture name already has -thread." >&4
6045                 ;;
6046         *)      archname="$archname-thread"
6047                 echo "...setting architecture name to $archname." >&4
6048                 ;;
6049         esac
6050         ;;
6051 esac
6052 case "$usemultiplicity" in
6053 $define)
6054         echo "Multiplicity selected." >&4
6055         case "$archname" in
6056         *-multi*) echo "...and architecture name already has -multi." >&4
6057                 ;;
6058         *)      archname="$archname-multi"
6059                 echo "...setting architecture name to $archname." >&4
6060                 ;;
6061         esac
6062         ;;
6063 esac
6064 case "$use64bitint$use64bitall" in
6065 *"$define"*)
6066         case "$archname64" in
6067         '')
6068                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6069                 ;;
6070         *)
6071                 case "$use64bitint" in
6072                 "$define") echo "64 bit integers selected." >&4 ;;
6073                 esac
6074                 case "$use64bitall" in
6075                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6076                 esac
6077                 case "$archname" in
6078                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6079                         ;;
6080                 *)      archname="$archname-$archname64"
6081                         echo "...setting architecture name to $archname." >&4
6082                         ;;
6083                 esac
6084                 ;;
6085         esac
6086 esac
6087 case "$uselongdouble" in
6088 $define)
6089         echo "Long doubles selected." >&4
6090         case "$longdblsize" in
6091         $doublesize)
6092                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6093                 ;;
6094         *)
6095                 case "$archname" in
6096                 *-ld*) echo "...and architecture name already has -ld." >&4
6097                         ;;
6098                 *)      archname="$archname-ld"
6099                         echo "...setting architecture name to $archname." >&4
6100                         ;;
6101                 esac
6102                 ;;
6103         esac
6104         ;;
6105 esac
6106 case "$useperlio" in
6107 $define)
6108         echo "Perlio selected." >&4
6109         ;;
6110 *)
6111         echo "Perlio not selected, using stdio." >&4
6112         case "$archname" in
6113         *-stdio*) echo "...and architecture name already has -stdio." >&4
6114                 ;;
6115         *)      archname="$archname-stdio"
6116                 echo "...setting architecture name to $archname." >&4
6117                 ;;
6118         esac
6119         ;;
6120 esac
6121 if $test -f archname.cbu; then
6122         echo "Your platform has some specific hints for architecture name, using them..."
6123         . ./archname.cbu
6124 fi
6125
6126 : set the prefixit variable, to compute a suitable default value
6127 prefixit='case "$3" in
6128 ""|none)
6129         case "$oldprefix" in
6130         "") eval "$1=\"\$$2\"";;
6131         *)
6132                 case "$3" in
6133                 "") eval "$1=";;
6134                 none)
6135                         eval "tp=\"\$$2\"";
6136                         case "$tp" in
6137                         ""|" ") eval "$1=\"\$$2\"";;
6138                         *) eval "$1=";;
6139                         esac;;
6140                 esac;;
6141         esac;;
6142 *)
6143         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6144         case "$tp" in
6145         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6146         /*-$oldprefix/*|\~*-$oldprefix/*)
6147                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6148         *) eval "$1=\"\$$2\"";;
6149         esac;;
6150 esac'
6151
6152 : determine installation style
6153 : For now, try to deduce it from prefix unless it is already set.
6154 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6155 case "$installstyle" in
6156 '')     case "$prefix" in
6157                 *perl*) dflt='lib';;
6158                 *) dflt='lib/perl5' ;;
6159         esac
6160         ;;
6161 *)      dflt="$installstyle" ;;
6162 esac
6163 : Probably not worth prompting for this since we prompt for all
6164 : the directories individually, and the prompt would be too long and
6165 : confusing anyway.
6166 installstyle=$dflt
6167
6168 : determine where public executables go
6169 echo " "
6170 set dflt bin bin
6171 eval $prefixit
6172 fn=d~
6173 rp='Pathname where the public executables will reside?'
6174 . ./getfile
6175 if $test "X$ansexp" != "X$binexp"; then
6176         installbin=''
6177 fi
6178 prefixvar=bin
6179 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6180 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6181 :     this via initialinstalllocation
6182 . ./setprefixvar
6183
6184 case "$userelocatableinc" in
6185 $define|true|[yY]*)     dflt='y' ;;
6186 *)                      dflt='n' ;;
6187 esac
6188 cat <<EOM
6189
6190 Would you like to build Perl so that the installation is relocatable, so that
6191 library paths in @INC are determined relative to the path of the perl binary?
6192 This is not advised for system Perl installs, or if you need to run setid
6193 scripts or scripts under taint mode.
6194
6195 If this doesn't make any sense to you, just accept the default '$dflt'.
6196 EOM
6197 rp='Use relocatable @INC?'
6198 . ./myread
6199 case "$ans" in
6200 y|Y)    val="$define" ;;
6201 *)      val="$undef"  ;;
6202 esac
6203 set userelocatableinc
6204 eval $setvar
6205
6206 initialinstalllocation="$binexp"
6207 : Default prefix is now "up one level from where the binaries are"
6208 case "$userelocatableinc" in
6209 $define|true|[yY]*)
6210     bin=".../"
6211     binexp=".../"
6212     prefix=".../.."
6213     prefixexp=".../.."
6214     installprefixexp=".../.."
6215     ;;
6216 esac
6217
6218 : determine where private library files go
6219 : Usual default is /usr/local/lib/perl5/$version.
6220 : Also allow things like /opt/perl/lib/$version, since
6221 : /opt/perl/lib/perl5... would be redundant.
6222 : The default "style" setting is made in installstyle.U
6223 case "$installstyle" in
6224 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6225 *)       set dflt privlib lib/$version ;;
6226 esac
6227 eval $prefixit
6228 $cat <<EOM
6229
6230 There are some auxiliary files for $package that need to be put into a
6231 private library directory that is accessible by everyone.
6232
6233 EOM
6234 fn=$binexp
6235 fn=d~+
6236 rp='Pathname where the private library files will reside?'
6237 . ./getfile
6238 prefixvar=privlib
6239 . ./setprefixvar
6240
6241 : set the prefixup variable, to restore leading tilda escape
6242 prefixup='case "$prefixexp" in
6243 "$prefix") ;;
6244 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6245 esac'
6246
6247 : determine where public architecture dependent libraries go
6248 set archlib archlib
6249 eval $prefixit
6250 : privlib default is /usr/local/lib/$package/$version
6251 : archlib default is /usr/local/lib/$package/$version/$archname
6252 : privlib may have an optional trailing /share.
6253 tdflt=`echo $privlib | $sed 's,/share$,,'`
6254 tdflt=$tdflt/$archname
6255 case "$archlib" in
6256 '')     dflt=$tdflt
6257         ;;
6258 *)      dflt="$archlib"
6259     ;;
6260 esac
6261 $cat <<EOM
6262
6263 $spackage contains architecture-dependent library files.  If you are
6264 sharing libraries in a heterogeneous environment, you might store
6265 these files in a separate location.  Otherwise, you can just include
6266 them with the rest of the public library files.
6267
6268 EOM
6269 fn=$binexp
6270 fn=d+~
6271 rp='Where do you want to put the public architecture-dependent libraries?'
6272 . ./getfile
6273 prefixvar=archlib
6274 . ./setprefixvar
6275 if $test X"$archlib" = X"$privlib"; then
6276         d_archlib="$undef"
6277 else
6278         d_archlib="$define"
6279 fi
6280
6281 : see if setuid scripts can be secure
6282 $cat <<EOM
6283
6284 Some kernels have a bug that prevents setuid #! scripts from being
6285 secure.  Some sites have disabled setuid #! scripts because of this.
6286
6287 First let's decide if your kernel supports secure setuid #! scripts.
6288 (If setuid #! scripts would be secure but have been disabled anyway,
6289 don't say that they are secure if asked.)
6290
6291 EOM
6292
6293 val="$undef"
6294 if $test -d /dev/fd; then
6295         echo "#!$ls" >reflect
6296         chmod +x,u+s reflect
6297         ./reflect >flect 2>&1
6298         if $contains "/dev/fd" flect >/dev/null; then
6299                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6300                 val="$define"
6301         else
6302                 $cat <<EOM
6303 If you are not sure if they are secure, I can check but I'll need a
6304 username and password different from the one you are using right now.
6305 If you don't have such a username or don't want me to test, simply
6306 enter 'none'.
6307
6308 EOM
6309                 rp='Other username to test security of setuid scripts with?'
6310                 dflt='none'
6311                 . ./myread
6312                 case "$ans" in
6313                 n|none)
6314                         case "$d_suidsafe" in
6315                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6316                                 dflt=n;;
6317                         "$undef")
6318                                 echo "Well, the $hint value is *not* secure." >&4
6319                                 dflt=n;;
6320                         *)      echo "Well, the $hint value *is* secure." >&4
6321                                 dflt=y;;
6322                         esac
6323                         ;;
6324                 *)
6325                         $rm -f reflect flect
6326                         echo "#!$ls" >reflect
6327                         chmod +x,u+s reflect
6328                         echo >flect
6329                         chmod a+w flect
6330                         echo '"su" will (probably) prompt you for '"$ans's password."
6331                         su $ans -c './reflect >flect'
6332                         if $contains "/dev/fd" flect >/dev/null; then
6333                                 echo "Okay, it looks like setuid scripts are secure." >&4
6334                                 dflt=y
6335                         else
6336                                 echo "I don't think setuid scripts are secure." >&4
6337                                 dflt=n
6338                         fi
6339                         ;;
6340                 esac
6341                 rp='Does your kernel have *secure* setuid scripts?'
6342                 . ./myread
6343                 case "$ans" in
6344                 [yY]*)  val="$define";;
6345                 *)      val="$undef";;
6346                 esac
6347         fi
6348 else
6349         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6350         echo "(That's for file descriptors, not floppy disks.)"
6351         val="$undef"
6352 fi
6353 set d_suidsafe
6354 eval $setvar
6355
6356 $rm -f reflect flect
6357
6358 : now see if they want to do setuid emulation
6359 echo " "
6360 val="$undef"
6361 case "$d_suidsafe" in
6362 "$define")
6363         val="$undef"
6364         echo "No need to emulate SUID scripts since they are secure here." >&4
6365         ;;
6366 *)
6367         $cat <<EOM
6368 Some systems have disabled setuid scripts, especially systems where
6369 setuid scripts cannot be secure.  On systems where setuid scripts have
6370 been disabled, the setuid/setgid bits on scripts are currently
6371 useless.  It is possible for $package to detect those bits and emulate
6372 setuid/setgid in a secure fashion.  This emulation will only work if
6373 setuid scripts have been disabled in your kernel.
6374
6375 EOM
6376         case "$d_dosuid" in
6377         "$define") dflt=y ;;
6378         *) dflt=n ;;
6379         esac
6380         rp="Do you want to do setuid/setgid emulation?"
6381         . ./myread
6382         case "$ans" in
6383         [yY]*)  val="$define";;
6384         *)      val="$undef";;
6385         esac
6386         ;;
6387 esac
6388 set d_dosuid
6389 eval $setvar
6390
6391 : Find perl5.005 or later.
6392 echo "Looking for a previously installed perl5.005 or later... "
6393 case "$perl5" in
6394 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6395                 : Check if this perl is recent and can load a simple module
6396                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6397                         perl5=$tdir/perl
6398                         break;
6399                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6400                         perl5=$tdir/perl5
6401                         break;
6402                 fi
6403         done
6404         ;;
6405 *)      perl5="$perl5"
6406         ;;
6407 esac
6408 case "$perl5" in
6409 '')     echo "None found.  That's ok.";;
6410 *)      echo "Using $perl5." ;;
6411 esac
6412
6413 : Set the siteprefix variables
6414 $cat <<EOM
6415
6416 After $package is installed, you may wish to install various
6417 add-on modules and utilities.  Typically, these add-ons will
6418 be installed under $prefix with the rest
6419 of this package.  However, you may wish to install such add-ons
6420 elsewhere under a different prefix.
6421
6422 If you do not wish to put everything under a single prefix, that's
6423 ok.  You will be prompted for the individual locations; this siteprefix
6424 is only used to suggest the defaults.
6425
6426 The default should be fine for most people.
6427
6428 EOM
6429 fn=d~+
6430 rp='Installation prefix to use for add-on modules and utilities?'
6431 : XXX Here might be another good place for an installstyle setting.
6432 case "$siteprefix" in
6433 '') dflt=$prefix ;;
6434 *)  dflt=$siteprefix ;;
6435 esac
6436 . ./getfile
6437 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6438 oldsiteprefix=''
6439 case "$siteprefix" in
6440 '') ;;
6441 *)      case "$ans" in
6442         "$prefix") ;;
6443         *) oldsiteprefix="$prefix";;
6444         esac
6445         ;;
6446 esac
6447 siteprefix="$ans"
6448 siteprefixexp="$ansexp"
6449
6450 : determine where site specific libraries go.
6451 : Usual default is /usr/local/lib/perl5/site_perl/$version
6452 : The default "style" setting is made in installstyle.U
6453 : XXX No longer works with Prefixit stuff.
6454 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6455 case "$sitelib" in
6456 '') case "$installstyle" in
6457         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6458         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6459         esac
6460         ;;
6461 *)      dflt="$sitelib"
6462         ;;
6463 esac
6464 $cat <<EOM
6465
6466 The installation process will create a directory for
6467 site-specific extensions and modules.  Most users find it convenient
6468 to place all site-specific files in this directory rather than in the
6469 main distribution directory.
6470
6471 EOM
6472 fn=d~+
6473 rp='Pathname for the site-specific library files?'
6474 . ./getfile
6475 prefixvar=sitelib
6476 . ./setprefixvar
6477 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6478
6479 : Determine list of previous versions to include in @INC
6480 $cat > getverlist <<EOPL
6481 #!$perl5 -w
6482 use File::Basename;
6483 \$api_versionstring = "$api_versionstring";
6484 \$version = "$version";
6485 \$stem = "$sitelib_stem";
6486 \$archname = "$archname";
6487 EOPL
6488         $cat >> getverlist <<'EOPL'
6489 # The list found is store twice for each entry: the original name, and
6490 # the binary broken down version as pack "sss", so sorting is easy and
6491 # unambiguous. This will work for all versions that have a maximum of
6492 # three digit groups, separate by '.'s or '_'s. Names are extended with
6493 # ".0.0" to ensure at least three elements for the pack.
6494 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6495
6496 # Can't have leading @ because metaconfig interprets it as a command!
6497 ;@inc_version_list=();
6498 # XXX Redo to do opendir/readdir?
6499 if (-d $stem) {
6500     chdir($stem);
6501     ;@candidates = map {
6502         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6503 }
6504 else {
6505     ;@candidates = ();
6506 }
6507
6508 ($pversion, $aversion, $vsn5005) = map {
6509     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6510 foreach $d (@candidates) {
6511     if ($d->[1] lt $pversion) {
6512         if ($d->[1] ge $aversion) {
6513             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6514         }
6515         elsif ($d->[1] ge $vsn5005) {
6516             unshift(@inc_version_list, grep { -d } $d->[0]);
6517         }
6518     }
6519     else {
6520         # Skip newer version.  I.e. don't look in
6521         # 5.7.0 if we're installing 5.6.1.
6522     }
6523 }
6524
6525 if (@inc_version_list) {
6526     print join(' ', @inc_version_list);
6527 }
6528 else {
6529     # Blank space to preserve value for next Configure run.
6530     print " ";
6531 }
6532 EOPL
6533 chmod +x getverlist
6534 case "$inc_version_list" in
6535 '')     if test -x "$perl5$exe_ext"; then
6536                 dflt=`$perl5 getverlist`
6537         else
6538                 dflt='none'
6539         fi
6540         ;;
6541 $undef) dflt='none' ;;
6542 *)  eval dflt=\"$inc_version_list\" ;;
6543 esac
6544 case "$dflt" in
6545 ''|' ') dflt=none ;;
6546 esac
6547 case "$dflt" in
6548 5.005) dflt=none ;;
6549 esac
6550 $cat <<EOM
6551
6552 In order to ease the process of upgrading, this version of perl
6553 can be configured to use modules built and installed with earlier
6554 versions of perl that were installed under $prefix.  Specify here
6555 the list of earlier versions that this version of perl should check.
6556 If Configure detected no earlier versions of perl installed under
6557 $prefix, then the list will be empty.  Answer 'none' to tell perl
6558 to not search earlier versions.
6559
6560 The default should almost always be sensible, so if you're not sure,
6561 just accept the default.
6562 EOM
6563
6564 rp='List of earlier versions to include in @INC?'
6565 . ./myread
6566 case "$ans" in
6567 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6568 *) inc_version_list="$ans" ;;
6569 esac
6570 case "$inc_version_list" in
6571 ''|' ')
6572         inc_version_list_init='0'
6573         d_inc_version_list="$undef"
6574         ;;
6575 *)      inc_version_list_init=`echo $inc_version_list |
6576                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6577         d_inc_version_list="$define"
6578         ;;
6579 esac
6580 $rm -f getverlist
6581
6582 : see if malloc/malloc.h has to be included
6583 set malloc/malloc.h i_mallocmalloc
6584 eval $inhdr
6585
6586 : see if this is a malloc.h system
6587 : we want a real compile instead of Inhdr because some systems have a
6588 : malloc.h that just gives a compile error saying to use stdlib.h instead
6589 echo " "
6590 $cat >try.c <<EOCP
6591 #include <stdlib.h>
6592 #include <malloc.h>
6593 #$i_mallocmalloc I_MALLOCMALLOC
6594 #ifdef I_MALLOCMALLOC
6595 # include <malloc/malloc.h>
6596 #endif
6597
6598 int main () { return 0; }
6599 EOCP
6600 set try
6601 if eval $compile; then
6602     echo "<malloc.h> found." >&4
6603     val="$define"
6604 else
6605     echo "<malloc.h> NOT found." >&4
6606     val="$undef"
6607 fi
6608 $rm_try
6609 set i_malloc
6610 eval $setvar
6611
6612 : check for void type
6613 echo " "
6614 echo "Checking to see how well your C compiler groks the void type..." >&4
6615 case "$voidflags" in
6616 '')
6617         $cat >try.c <<EOCP
6618 #$i_stdlib I_STDLIB
6619 #ifdef I_STDLIB
6620 #include <stdlib.h>
6621 #endif
6622 #if TRY & 1
6623 void sub() {
6624 #else
6625 sub() {
6626 #endif
6627         extern void moo();      /* function returning void */
6628         void (*goo)();          /* ptr to func returning void */
6629 #if TRY & 8
6630         void *hue;              /* generic ptr */
6631 #endif
6632 #if TRY & 2
6633         void (*foo[10])();
6634 #endif
6635
6636 #if TRY & 4
6637         if(goo == moo) {
6638                 exit(0);
6639         }
6640 #endif
6641         exit(0);
6642 }
6643 int main() { sub(); }
6644 EOCP
6645         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6646                 voidflags=$defvoidused
6647         echo "Good.  It appears to support void to the level $package wants.">&4
6648                 if $contains warning .out >/dev/null 2>&1; then
6649                         echo "However, you might get some warnings that look like this:"
6650                         $cat .out
6651                 fi
6652         else
6653 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6654                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6655                         echo "It supports 1..."
6656                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6657                                 echo "It also supports 2..."
6658                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6659                                         voidflags=7
6660                                         echo "And it supports 4 but not 8 definitely."
6661                                 else
6662                                         echo "It doesn't support 4..."
6663                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6664                                                 voidflags=11
6665                                                 echo "But it supports 8."
6666                                         else
6667                                                 voidflags=3
6668                                                 echo "Neither does it support 8."
6669                                         fi
6670                                 fi
6671                         else
6672                                 echo "It does not support 2..."
6673                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6674                                         voidflags=13
6675                                         echo "But it supports 4 and 8."
6676                                 else
6677                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6678                                                 voidflags=5
6679                                                 echo "And it supports 4 but has not heard about 8."
6680                                         else
6681                                                 echo "However it supports 8 but not 4."
6682                                         fi
6683                                 fi
6684                         fi
6685                 else
6686                         echo "There is no support at all for void."
6687                         voidflags=0
6688                 fi
6689         fi
6690 esac
6691 case "$voidflags" in
6692 "$defvoidused") ;;
6693 *)      $cat >&4 <<'EOM'
6694   Support flag bits are:
6695     1: basic void declarations.
6696     2: arrays of pointers to functions returning void.
6697     4: operations between pointers to and addresses of void functions.
6698     8: generic void pointers.
6699 EOM
6700         dflt="$voidflags";
6701         rp="Your void support flags add up to what?"
6702         . ./myread
6703         voidflags="$ans"
6704         ;;
6705 esac
6706 $rm_try
6707
6708 : check for length of pointer
6709 echo " "
6710 case "$ptrsize" in
6711 '')
6712         echo "Checking to see how big your pointers are..." >&4
6713         if test "$voidflags" -gt 7; then
6714                 echo '#define VOID_PTR char *' > try.c
6715         else
6716                 echo '#define VOID_PTR void *' > try.c
6717         fi
6718         $cat >>try.c <<EOCP
6719 #include <stdio.h>
6720 #$i_stdlib I_STDLIB
6721 #ifdef I_STDLIB
6722 #include <stdlib.h>
6723 #endif
6724 int main()
6725 {
6726     printf("%d\n", (int)sizeof(VOID_PTR));
6727     exit(0);
6728 }
6729 EOCP
6730         set try
6731         if eval $compile_ok; then
6732                 ptrsize=`$run ./try`
6733                 echo "Your pointers are $ptrsize bytes long."
6734         else
6735                 dflt='4'
6736                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6737                 rp="What is the size of a pointer (in bytes)?"
6738                 . ./myread
6739                 ptrsize="$ans"
6740         fi
6741         ;;
6742 esac
6743 $rm_try
6744 case "$use64bitall" in
6745 "$define"|true|[yY]*)
6746         case "$ptrsize" in
6747         4)      cat <<EOM >&4
6748
6749 *** You have chosen a maximally 64-bit build,
6750 *** but your pointers are only 4 bytes wide.
6751 *** Please rerun Configure without -Duse64bitall.
6752 EOM
6753                 case "$d_quad" in
6754                 define)
6755                         cat <<EOM >&4
6756 *** Since you have quads, you could possibly try with -Duse64bitint.
6757 EOM
6758                         ;;
6759                 esac
6760                 cat <<EOM >&4
6761 *** Cannot continue, aborting.
6762
6763 EOM
6764
6765                 exit 1
6766                 ;;
6767         esac
6768         ;;
6769 esac
6770
6771
6772 : determine whether to use malloc wrapping
6773 echo " "
6774 case "$usemallocwrap" in
6775 [yY]*|true|$define)     dflt='y' ;;
6776 [nN]*|false|$undef)     dflt='n' ;;
6777 *)      case "$usedevel" in
6778         [yY]*|true|$define)     dflt='y' ;;
6779         *) dflt='n' ;;
6780         esac
6781         ;;
6782 esac
6783 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6784 . ./myread
6785 usemallocwrap="$ans"
6786 case "$ans" in
6787 y*|true)
6788         usemallocwrap="$define" ;;
6789 *)
6790         usemallocwrap="$undef" ;;
6791 esac
6792
6793 : determine which malloc to compile in
6794 echo " "
6795 case "$usemymalloc" in
6796 [yY]*|true|$define)     dflt='y' ;;
6797 [nN]*|false|$undef)     dflt='n' ;;
6798 *)      case "$ptrsize" in
6799         4) dflt='y' ;;
6800         *) dflt='n' ;;
6801         esac
6802         ;;
6803 esac
6804 rp="Do you wish to attempt to use the malloc that comes with $package?"
6805 . ./myread
6806 usemymalloc="$ans"
6807 case "$ans" in
6808 y*|true)
6809         usemymalloc='y'
6810         mallocsrc='malloc.c'
6811         mallocobj="malloc$_o"
6812         d_mymalloc="$define"
6813         case "$libs" in
6814         *-lmalloc*)
6815                 : Remove malloc from list of libraries to use
6816                 echo "Removing unneeded -lmalloc from library list" >&4
6817                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6818                 shift
6819                 libs="$*"
6820                 echo "libs = $libs" >&4
6821                 ;;
6822         esac
6823         ;;
6824 *)
6825         usemymalloc='n'
6826         mallocsrc=''
6827         mallocobj=''
6828         d_mymalloc="$undef"
6829         ;;
6830 esac
6831
6832 : compute the return types of malloc and free
6833 echo " "
6834 $cat >malloc.c <<END
6835 #$i_malloc I_MALLOC
6836 #$i_stdlib I_STDLIB
6837 #include <stdio.h>
6838 #include <sys/types.h>
6839 #ifdef I_MALLOC
6840 #include <malloc.h>
6841 #endif
6842 #ifdef I_STDLIB
6843 #include <stdlib.h>
6844 #endif
6845 #ifdef TRY_MALLOC
6846 void *malloc();
6847 #endif
6848 #ifdef TRY_FREE
6849 void free();
6850 #endif
6851 END
6852 case "$malloctype" in
6853 '')
6854         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6855                 malloctype='void *'
6856         else
6857                 malloctype='char *'
6858         fi
6859         ;;
6860 esac
6861 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6862
6863 case "$freetype" in
6864 '')
6865         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6866                 freetype='void'
6867         else
6868                 freetype='int'
6869         fi
6870         ;;
6871 esac
6872 echo "Your system uses $freetype free(), it would seem." >&4
6873 $rm -f malloc.[co]
6874 : determine where site specific architecture-dependent libraries go.
6875 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6876 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6877 : sitelib may have an optional trailing /share.
6878 case "$sitearch" in
6879 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6880         dflt="$dflt/$archname"
6881         ;;
6882 *)      dflt="$sitearch"
6883         ;;
6884 esac
6885 set sitearch sitearch none
6886 eval $prefixit
6887 $cat <<EOM
6888
6889 The installation process will also create a directory for
6890 architecture-dependent site-specific extensions and modules.
6891
6892 EOM
6893 fn=d~+
6894 rp='Pathname for the site-specific architecture-dependent library files?'
6895 . ./getfile
6896 prefixvar=sitearch
6897 . ./setprefixvar
6898 if $test X"$sitearch" = X"$sitelib"; then
6899         d_sitearch="$undef"
6900 else
6901         d_sitearch="$define"
6902 fi
6903
6904 : Set the vendorprefix variables
6905 $cat <<EOM
6906
6907 The installation process will also create a directory for
6908 vendor-supplied add-ons.  Vendors who supply perl with their system
6909 may find it convenient to place all vendor-supplied files in this
6910 directory rather than in the main distribution directory.  This will
6911 ease upgrades between binary-compatible maintenance versions of perl.
6912
6913 Of course you may also use these directories in whatever way you see
6914 fit.  For example, you might use them to access modules shared over a
6915 company-wide network.
6916
6917 The default answer should be fine for most people.
6918 This causes further questions about vendor add-ons to be skipped
6919 and no vendor-specific directories will be configured for perl.
6920
6921 EOM
6922 rp='Do you want to configure vendor-specific add-on directories?'
6923 case "$usevendorprefix" in
6924 define|true|[yY]*) dflt=y ;;
6925 *)      : User may have set vendorprefix directly on Configure command line.
6926         case "$vendorprefix" in
6927         ''|' ') dflt=n ;;
6928         *)      dflt=y ;;
6929         esac
6930         ;;
6931 esac
6932 . ./myread
6933 case "$ans" in
6934 [yY]*)  fn=d~+
6935         rp='Installation prefix to use for vendor-supplied add-ons?'
6936         case "$vendorprefix" in
6937         '') dflt='' ;;
6938         *)  dflt=$vendorprefix ;;
6939         esac
6940         . ./getfile
6941         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6942         oldvendorprefix=''
6943         case "$vendorprefix" in
6944         '') ;;
6945         *)      case "$ans" in
6946                 "$prefix") ;;
6947                 *) oldvendorprefix="$prefix";;
6948                 esac
6949                 ;;
6950         esac
6951         usevendorprefix="$define"
6952         vendorprefix="$ans"
6953         vendorprefixexp="$ansexp"
6954         ;;
6955 *)      usevendorprefix="$undef"
6956         vendorprefix=''
6957         vendorprefixexp=''
6958         ;;
6959 esac
6960
6961 : Set the vendorlib variables
6962 case "$vendorprefix" in
6963 '')     d_vendorlib="$undef"
6964         vendorlib=''
6965         vendorlibexp=''
6966         ;;
6967 *)      d_vendorlib="$define"
6968         : determine where vendor-supplied modules go.
6969         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6970         case "$vendorlib" in
6971         '')
6972                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6973                 case "$installstyle" in
6974                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6975                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6976                 esac
6977                 ;;
6978         *)      dflt="$vendorlib"
6979                 ;;
6980         esac
6981         fn=d~+
6982         rp='Pathname for the vendor-supplied library files?'
6983         . ./getfile
6984         vendorlib="$ans"
6985         vendorlibexp="$ansexp"
6986         ;;
6987 esac
6988 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6989 prefixvar=vendorlib
6990 . ./installprefix
6991
6992 : Set the vendorarch variables
6993 case "$vendorprefix" in
6994 '')     d_vendorarch="$undef"
6995         vendorarch=''
6996         vendorarchexp=''
6997         ;;
6998 *)      d_vendorarch="$define"
6999         : determine where vendor-supplied architecture-dependent libraries go.
7000         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7001         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7002         : vendorlib may have an optional trailing /share.
7003         case "$vendorarch" in
7004         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7005                 dflt="$dflt/$archname"
7006                 ;;
7007         *)      dflt="$vendorarch" ;;
7008         esac
7009         fn=d~+
7010         rp='Pathname for vendor-supplied architecture-dependent files?'
7011         . ./getfile
7012         vendorarch="$ans"
7013         vendorarchexp="$ansexp"
7014         ;;
7015 esac
7016 prefixvar=vendorarch
7017 . ./installprefix
7018
7019 : Final catch-all directories to search
7020 $cat <<EOM
7021
7022 Lastly, you can have perl look in other directories for extensions and
7023 modules in addition to those already specified.
7024 These directories will be searched after 
7025         $sitearch 
7026         $sitelib 
7027 EOM
7028 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7029 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7030 echo ' '
7031 case "$otherlibdirs" in
7032 ''|' ') dflt='none' ;;
7033 *)      dflt="$otherlibdirs" ;;
7034 esac
7035 $cat <<EOM
7036 Enter a colon-separated set of extra paths to include in perl's @INC
7037 search path, or enter 'none' for no extra paths.
7038
7039 EOM
7040
7041 rp='Colon-separated list of additional directories for perl to search?'
7042 . ./myread
7043 case "$ans" in
7044 ' '|''|none)    otherlibdirs=' ' ;;     
7045 *)      otherlibdirs="$ans" ;;
7046 esac
7047 case "$otherlibdirs" in
7048 ' ') val=$undef ;;
7049 *)      val=$define ;;
7050 esac
7051 set d_perl_otherlibdirs
7052 eval $setvar
7053
7054 : Cruising for prototypes
7055 echo " "
7056 echo "Checking out function prototypes..." >&4
7057 $cat >prototype.c <<EOCP
7058 #$i_stdlib I_STDLIB
7059 #ifdef I_STDLIB
7060 #include <stdlib.h>
7061 #endif
7062 int main(int argc, char *argv[]) {
7063         exit(0);}
7064 EOCP
7065 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7066         echo "Your C compiler appears to support function prototypes."
7067         val="$define"
7068 else
7069         echo "Your C compiler doesn't seem to understand function prototypes."
7070         val="$undef"
7071 fi
7072 set prototype
7073 eval $setvar
7074 $rm -f prototype*
7075
7076 : Check if ansi2knr is required
7077 case "$prototype" in
7078 "$define") ;;
7079 *)      ansi2knr='ansi2knr'
7080         echo " "
7081         cat <<EOM >&4
7082
7083 $me:  FATAL ERROR:
7084 This version of $package can only be compiled by a compiler that 
7085 understands function prototypes.  Unfortunately, your C compiler 
7086         $cc $ccflags
7087 doesn't seem to understand them.  Sorry about that.
7088
7089 If GNU cc is available for your system, perhaps you could try that instead.  
7090
7091 Eventually, we hope to support building Perl with pre-ANSI compilers.
7092 If you would like to help in that effort, please contact <perlbug@perl.org>.
7093
7094 Aborting Configure now.
7095 EOM
7096         exit 2
7097         ;;
7098 esac
7099
7100 : DTrace support
7101 dflt_dtrace='/usr/sbin/dtrace'
7102 cat <<EOM
7103
7104 Perl can be built to support DTrace on platforms that support it.
7105 DTrace is a diagnosis and performance analysis tool from Sun.
7106
7107 If this doesn't make any sense to you, just accept the default '$dflt'.
7108 EOM
7109
7110 while $test 1 ; do
7111         case "$usedtrace" in
7112         $define|true|[yY]*)
7113                 dflt='y'
7114                 ;;
7115         ?*)
7116                 dflt='y'
7117                 dflt_dtrace=$usedtrace
7118                 ;;
7119         *)
7120                 dflt='n'
7121                 ;;
7122         esac
7123
7124         rp='Support DTrace if available?'
7125         . ./myread
7126         case "$ans" in
7127         y|Y)    val="$define" ;;
7128         *)      val="$undef" ;;
7129         esac
7130         set usedtrace
7131         eval $setvar
7132
7133         test "X$usedtrace" != "X$define" && break
7134
7135         echo " "
7136         rp='Where is the dtrace executable?'
7137         dflt=$dflt_dtrace
7138         . ./getfile
7139         val="$ans"
7140         set dtrace
7141         eval $setvar
7142
7143         if $test -f $dtrace
7144         then
7145                 if $dtrace -h -s ../perldtrace.d \
7146                         -o perldtrace.tmp >/dev/null 2>&1 \
7147                         && rm -f perldtrace.tmp
7148                 then
7149                         echo " "
7150                         echo "Good: your $dtrace knows about the -h flag."
7151                 else
7152                         cat >&2 <<EOM
7153
7154 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7155 ***
7156 *** Your installed dtrace doesn't support the -h switch to compile a D
7157 *** program into a C header. Can't continue.
7158
7159 EOM
7160                         exit 1
7161                 fi
7162                 break;
7163         fi
7164
7165         case "$fastread" in
7166         yes)
7167                 cat >&2 <<EOM
7168
7169 *** $me:  Fatal Error:  $dtrace not found.
7170 *** Can't continue.
7171
7172 EOM
7173                 exit 1
7174                 ;;
7175         *)
7176                 echo "*** $dtrace was not found."
7177                 echo " "
7178                 ;;
7179         esac
7180 done
7181
7182 : See if we want extra modules installed
7183 echo " "
7184 case "$extras" in
7185 '') dflt='n';;
7186 *) dflt='y';;
7187 esac
7188 cat <<EOM
7189 Perl can be built with extra modules or bundles of modules which
7190 will be fetched from the CPAN and installed alongside Perl.
7191
7192 Notice that you will need access to the CPAN; either via the Internet,
7193 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7194 be asked later to configure the CPAN.pm module which will in turn do
7195 the installation of the rest of the extra modules or bundles.)
7196
7197 Notice also that if the modules require any external software such as
7198 libraries and headers (the libz library and the zlib.h header for the
7199 Compress::Zlib module, for example) you MUST have any such software
7200 already installed, this configuration process will NOT install such
7201 things for you.
7202
7203 If this doesn't make any sense to you, just accept the default '$dflt'.
7204 EOM
7205 rp='Install any extra modules (y or n)?'
7206 . ./myread
7207 case "$ans" in
7208 y|Y)
7209         cat <<EOM
7210
7211 Please list any extra modules or bundles to be installed from CPAN,
7212 with spaces between the names.  The names can be in any format the
7213 'install' command of CPAN.pm will understand.  (Answer 'none',
7214 without the quotes, to install no extra modules or bundles.)
7215 EOM
7216         rp='Extras?'
7217         dflt="$extras"
7218         . ./myread
7219         extras="$ans"
7220 esac
7221 case "$extras" in
7222 ''|'none')
7223         val=''
7224         $rm -f ../extras.lst
7225         ;;
7226 *)      echo "(Saving the list of extras for later...)"
7227         echo "$extras" > ../extras.lst
7228         val="'$extras'"
7229         ;;
7230 esac
7231 set extras
7232 eval $setvar
7233 echo " "
7234
7235 : determine where html pages for programs go
7236 set html1dir html1dir none
7237 eval $prefixit
7238 $cat <<EOM
7239
7240 If you wish to install html files for programs in $spackage, indicate
7241 the appropriate directory here.  To skip installing html files,
7242 answer "none".
7243 EOM
7244 case "$html1dir" in
7245 ''|none|$undef|' ') dflt=none ;;
7246 *) dflt=$html1dir ;;
7247 esac
7248 fn=dn+~
7249 rp="Directory for the main $spackage html pages?"
7250 . ./getfile
7251 prefixvar=html1dir
7252 . ./setprefixvar
7253 : Use ' ' for none so value is preserved next time through Configure
7254 $test X"$html1dir" = "X" && html1dir=' '
7255
7256 : determine where html pages for libraries and modules go
7257 set html3dir html3dir none
7258 eval $prefixit
7259 $cat <<EOM
7260
7261 If you wish to install html files for modules associated with $spackage,
7262 indicate the appropriate directory here.  To skip installing html files,
7263 answer "none".
7264 EOM
7265 : There is no obvious default.  If they have specified html1dir, then
7266 : try to key off that, possibly changing .../html1 into .../html3.
7267 case "$html3dir" in
7268 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7269 *) dflt=$html3dir ;;
7270 esac
7271 fn=dn+~
7272 rp="Directory for the $spackage module html pages?"
7273 . ./getfile
7274 prefixvar=html3dir
7275 . ./setprefixvar
7276 : Use ' ' for none so value is preserved next time through Configure
7277 $test X"$html3dir" = "X" && html3dir=' '
7278
7279 : determine whether to install perl also as /usr/bin/perl
7280
7281 echo " "
7282 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7283         $cat <<EOM
7284 Many scripts expect perl to be installed as /usr/bin/perl.
7285
7286 If you want to, I can install the perl you are about to compile
7287 as /usr/bin/perl (in addition to $bin/perl).
7288 EOM
7289         if test -f /usr/bin/perl; then
7290             $cat <<EOM
7291
7292 However, please note that because you already have a /usr/bin/perl,
7293 overwriting that with a new Perl would very probably cause problems.
7294 Therefore I'm assuming you don't want to do that (unless you insist).
7295
7296 EOM
7297             case "$installusrbinperl" in
7298             "$define"|[yY]*)    dflt='y';;
7299             *)                  dflt='n';;
7300             esac
7301         else
7302             $cat <<EOM
7303
7304 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7305
7306 EOM
7307             case "$installusrbinperl" in
7308             "$undef"|[nN]*)     dflt='n';;
7309             *)                  dflt='y';;
7310             esac
7311         fi
7312         rp="Do you want to install perl as /usr/bin/perl?"
7313         . ./myread
7314         case "$ans" in
7315         [yY]*)  val="$define";;
7316         *)      val="$undef" ;;
7317         esac
7318 else
7319         val="$undef"
7320 fi
7321 set installusrbinperl
7322 eval $setvar
7323
7324 : Check if we are using the GNU C library
7325 echo " "
7326 echo "Checking for GNU C Library..." >&4
7327 cat >try.c <<'EOCP'
7328 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7329    alone are insufficient to distinguish different versions, such as
7330    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7331    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7332 */
7333 #include <stdio.h>
7334 int main(void)
7335 {
7336 #ifdef __GLIBC__
7337 #   ifdef __GLIBC_MINOR__
7338 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7339 #           include <gnu/libc-version.h>
7340             printf("%s\n",  gnu_get_libc_version());
7341 #       else
7342             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7343 #       endif
7344 #   else
7345         printf("%d\n",  __GLIBC__);
7346 #   endif
7347     return 0;
7348 #else
7349     return 1;
7350 #endif
7351 }
7352 EOCP
7353 set try
7354 if eval $compile_ok && $run ./try > glibc.ver; then
7355         val="$define"
7356         gnulibc_version=`$cat glibc.ver`
7357         echo "You are using the GNU C Library version $gnulibc_version"
7358 else
7359         val="$undef"
7360         gnulibc_version=''
7361         echo "You are not using the GNU C Library"
7362 fi
7363 $rm_try glibc.ver
7364 set d_gnulibc
7365 eval $setvar
7366
7367 : see if nm is to be used to determine whether a symbol is defined or not
7368 case "$usenm" in
7369 '')
7370         dflt=''
7371         case "$d_gnulibc" in
7372         "$define")
7373                 echo " "
7374                 echo "nm probably won't work on the GNU C Library." >&4
7375                 dflt=n
7376                 ;;
7377         esac
7378         case "$dflt" in
7379         '') 
7380                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7381                         echo " "
7382                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7383                         echo "'nm' won't be sufficient on this sytem." >&4
7384                         dflt=n
7385                 fi
7386                 ;;
7387         esac
7388         case "$dflt" in
7389         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7390                 if $test $dflt -gt 20; then
7391                         dflt=y
7392                 else
7393                         dflt=n
7394                 fi
7395                 ;;
7396         esac
7397         ;;
7398 *)
7399         case "$usenm" in
7400         true|$define) dflt=y;;
7401         *) dflt=n;;
7402         esac
7403         ;;
7404 esac
7405 $cat <<EOM
7406
7407 I can use $nm to extract the symbols from your C libraries. This
7408 is a time consuming task which may generate huge output on the disk (up
7409 to 3 megabytes) but that should make the symbols extraction faster. The
7410 alternative is to skip the 'nm' extraction part and to compile a small
7411 test program instead to determine whether each symbol is present. If
7412 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7413 this may be the best solution.
7414
7415 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7416
7417 EOM
7418 rp="Shall I use $nm to extract C symbols from the libraries?"
7419 . ./myread
7420 case "$ans" in
7421 [Nn]*) usenm=false;;
7422 *) usenm=true;;
7423 esac
7424
7425 runnm=$usenm
7426 case "$reuseval" in
7427 true) runnm=false;;
7428 esac
7429
7430 : nm options which may be necessary
7431 case "$nm_opt" in
7432 '') if $test -f /mach_boot; then
7433                 nm_opt=''       # Mach
7434         elif $test -d /usr/ccs/lib; then
7435                 nm_opt='-p'     # Solaris (and SunOS?)
7436         elif $test -f /dgux; then
7437                 nm_opt='-p'     # DG-UX
7438         elif $test -f /lib64/rld; then
7439                 nm_opt='-p'     # 64-bit Irix
7440         else
7441                 nm_opt=''
7442         fi;;
7443 esac
7444
7445 : nm options which may be necessary for shared libraries but illegal
7446 : for archive libraries.  Thank you, Linux.
7447 case "$nm_so_opt" in
7448 '')     case "$myuname" in
7449         *linux*|gnu*)
7450                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7451                         nm_so_opt='--dynamic'
7452                 fi
7453                 ;;
7454         esac
7455         ;;
7456 esac
7457
7458 : Figure out where the libc is located
7459 case "$runnm" in
7460 true)
7461 : get list of predefined functions in a handy place
7462 echo " "
7463 case "$libc" in
7464 '') libc=unknown
7465         case "$libs" in
7466         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7467         esac
7468         ;;
7469 esac
7470 case "$libs" in
7471 '') ;;
7472 *)  for thislib in $libs; do
7473         case "$thislib" in
7474         -lc|-lc_s)
7475                 : Handle C library specially below.
7476                 ;;
7477         -l*)
7478                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7479                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7480                         :
7481                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7482                         :
7483                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7484                         :
7485                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7486                         :
7487                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7488                         :
7489                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7490                         :
7491                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7492                         :
7493                 else
7494                         try=''
7495                 fi
7496                 libnames="$libnames $try"
7497                 ;;
7498         *) libnames="$libnames $thislib" ;;
7499         esac
7500         done
7501         ;;
7502 esac
7503 xxx=normal
7504 case "$libc" in
7505 unknown)
7506         set /lib/libc.$so
7507         for xxx in $libpth; do
7508                 $test -r $1 || set $xxx/libc.$so
7509                 : The messy sed command sorts on library version numbers.
7510                 $test -r $1 || \
7511                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7512                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7513                                 h
7514                                 s/[0-9][0-9]*/0000&/g
7515                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7516                                 G
7517                                 s/\n/ /' | \
7518                          $sort | $sed -e 's/^.* //'`
7519                 eval set \$$#
7520         done
7521         $test -r $1 || set /usr/ccs/lib/libc.$so
7522         $test -r $1 || set /lib/libsys_s$_a
7523         ;;
7524 *)
7525         set blurfl
7526         ;;
7527 esac
7528 if $test -r "$1"; then
7529         echo "Your (shared) C library seems to be in $1."
7530         libc="$1"
7531 elif $test -r /lib/libc && $test -r /lib/clib; then
7532         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7533         xxx=apollo
7534         libc='/lib/clib /lib/libc'
7535         if $test -r /lib/syslib; then
7536                 echo "(Your math library is in /lib/syslib.)"
7537                 libc="$libc /lib/syslib"
7538         fi
7539 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7540         echo "Your C library seems to be in $libc, as you said before."
7541 elif $test -r $incpath/usr/lib/libc$_a; then
7542         libc=$incpath/usr/lib/libc$_a;
7543         echo "Your C library seems to be in $libc.  That's fine."
7544 elif $test -r /lib/libc$_a; then
7545         libc=/lib/libc$_a;
7546         echo "Your C library seems to be in $libc.  You're normal."
7547 else
7548         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7549                 :
7550         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7551                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7552         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7553                 :
7554         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7555                 :
7556         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7557                 :
7558         else
7559                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7560         fi
7561         if $test -r "$tans"; then
7562                 echo "Your C library seems to be in $tans, of all places."
7563                 libc=$tans
7564         else
7565                 libc='blurfl'
7566         fi
7567 fi
7568 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7569         dflt="$libc"
7570         cat <<EOM
7571
7572 If the guess above is wrong (which it might be if you're using a strange
7573 compiler, or your machine supports multiple models), you can override it here.
7574
7575 EOM
7576 else
7577         dflt=''
7578         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7579         cat >&4 <<EOM
7580 I can't seem to find your C library.  I've looked in the following places:
7581
7582 EOM
7583         $sed 's/^/      /' libpath
7584         cat <<EOM
7585
7586 None of these seems to contain your C library. I need to get its name...
7587
7588 EOM
7589 fi
7590 fn=f
7591 rp='Where is your C library?'
7592 . ./getfile
7593 libc="$ans"
7594
7595 echo " "
7596 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7597 set X `cat libnames`
7598 shift
7599 xxx=files
7600 case $# in 1) xxx=file; esac
7601 echo "Extracting names from the following $xxx for later perusal:" >&4
7602 echo " "
7603 $sed 's/^/      /' libnames >&4
7604 echo " "
7605 $echo $n "This may take a while...$c" >&4
7606
7607 for file in $*; do
7608         case $file in
7609         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7610         *) $nm $nm_opt $file 2>/dev/null;;
7611         esac
7612 done >libc.tmp
7613
7614 $echo $n ".$c"
7615 $grep fprintf libc.tmp > libc.ptf
7616 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7617 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7618 xxx='[ADTSIW]'
7619 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7644                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7669         eval $xscan;\
7670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671                 eval $xrun
7672 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 else
7677         $nm -p $* 2>/dev/null >libc.tmp
7678         $grep fprintf libc.tmp > libc.ptf
7679         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7680                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7681         then
7682                 nm_opt='-p'
7683                 eval $xrun
7684         else
7685                 echo " "
7686                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7687                 com=''
7688                 if $ar t $libc > libc.tmp && \
7689                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7690                 then
7691                         for thisname in $libnames $libc; do
7692                                 $ar t $thisname >>libc.tmp
7693                         done
7694                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7695                         echo "Ok." >&4
7696                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7697                         for thisname in $libnames $libc; do
7698                                 $ar tv $thisname >>libc.tmp
7699                                 emximp -o tmp.imp $thisname \
7700                                     2>/dev/null && \
7701                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7702                                     < tmp.imp >>libc.tmp
7703                                 $rm -f tmp.imp
7704                         done
7705                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7706                         echo "Ok." >&4
7707                 else
7708                         echo "$ar didn't seem to work right." >&4
7709                         echo "Maybe this is a Cray...trying bld instead..." >&4
7710                         if  bld t $libc | \
7711                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7712                                 $test -s libc.list
7713                         then
7714                                 for thisname in $libnames; do
7715                                         bld t $libnames | \
7716                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7717                                         $ar t $thisname >>libc.tmp
7718                                 done
7719                                 echo "Ok." >&4
7720                         else
7721                                 echo "That didn't work either.  Giving up." >&4
7722                                 exit 1
7723                         fi
7724                 fi
7725         fi
7726 fi
7727 nm_extract="$com"
7728 case "$PASE" in
7729 define)
7730     echo " "
7731     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7732     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7733     ;;
7734 *)  if $test -f /lib/syscalls.exp; then
7735         echo " "
7736         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7737         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7738                 /lib/syscalls.exp >>libc.list
7739     fi
7740     ;;
7741 esac
7742 ;;
7743 esac
7744 $rm -f libnames libpath
7745
7746 : see if dld is available
7747 set dld.h i_dld
7748 eval $inhdr
7749
7750 : Check if we are using C++
7751 echo " "
7752 echo "Checking for C++..." >&4
7753 $cat >try.c <<'EOCP'
7754 #include <stdio.h>
7755 int main(void)
7756 {
7757 #ifdef __cplusplus
7758     return 0;
7759 #else
7760     return 1;
7761 #endif
7762 }
7763 EOCP
7764 set try
7765 if eval $compile_ok && $run ./try; then
7766         val="$define"
7767         echo "You are using a C++ compiler."
7768 else
7769         val="$undef"
7770         echo "You are not using a C++ compiler."
7771 fi
7772 $rm_try cplusplus$$
7773 set d_cplusplus
7774 eval $setvar
7775
7776 : is a C symbol defined?
7777 csym='tlook=$1;
7778 case "$3" in
7779 -v) tf=libc.tmp; tdc="";;
7780 -a) tf=libc.tmp; tdc="[]";;
7781 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7782 esac;
7783 tx=yes;
7784 case "$reuseval-$4" in
7785 true-) ;;
7786 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7787 esac;
7788 case "$tx" in
7789 yes)
7790         tval=false;
7791         case "$d_cplusplus" in
7792                 $define) extern_C=\"C\";;
7793         esac;
7794         if $test "$runnm" = true; then
7795                 if $contains $tlook $tf >/dev/null 2>&1; then
7796                         tval=true;
7797                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7798                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7799                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7800                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7801                         $rm_try;
7802                 fi;
7803         else
7804                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7805                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7806                 $rm_try;
7807         fi;
7808         ;;
7809 *)
7810         case "$tval" in
7811         $define) tval=true;;
7812         *) tval=false;;
7813         esac;
7814         ;;
7815 esac;
7816 eval "$2=$tval"'
7817
7818 : define an is-in-libc? function
7819 inlibc='echo " "; td=$define; tu=$undef;
7820 sym=$1; var=$2; eval "was=\$$2";
7821 tx=yes;
7822 case "$reuseval$was" in
7823 true) ;;
7824 true*) tx=no;;
7825 esac;
7826 case "$tx" in
7827 yes)
7828         set $sym tres -f;
7829         eval $csym;
7830         case "$tres" in
7831         true)
7832                 echo "$sym() found." >&4;
7833                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7834         *)
7835                 echo "$sym() NOT found." >&4;
7836                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7837         esac;;
7838 *)
7839         case "$was" in
7840         $define) echo "$sym() found." >&4;;
7841         *) echo "$sym() NOT found." >&4;;
7842         esac;;
7843 esac'
7844
7845 : see if dlopen exists
7846 xxx_runnm="$runnm"
7847 xxx_ccflags="$ccflags"
7848 runnm=false
7849 : with g++ one needs -shared to get is-in-libc to work for dlopen
7850 case "$gccversion" in
7851 '')     ;;
7852 *)      case "$d_cplusplus" in
7853         "$define") ccflags="$ccflags -shared" ;;
7854         esac
7855         ;;
7856 esac
7857 set dlopen d_dlopen
7858 eval $inlibc
7859 runnm="$xxx_runnm"
7860 ccflags="$xxx_ccflags"
7861
7862 : see if this is a unistd.h system
7863 set unistd.h i_unistd
7864 eval $inhdr
7865
7866 : determine which dynamic loading, if any, to compile in
7867 echo " "
7868 dldir="ext/DynaLoader"
7869 case "$usedl" in
7870 $define|y|true)
7871         dflt='y'
7872         usedl="$define"
7873         ;;
7874 $undef|n|false)
7875         dflt='n'
7876         usedl="$undef"
7877         ;;
7878 *)
7879         dflt='n'
7880         case "$d_dlopen" in
7881             $define) dflt='y' ;;
7882         esac
7883         case "$i_dld" in
7884             $define) dflt='y' ;;
7885         esac
7886         : Does a dl_xxx.xs file exist for this operating system
7887         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7888         ;;
7889 esac
7890 rp="Do you wish to use dynamic loading?"
7891 . ./myread
7892 usedl="$ans"
7893 case "$ans" in
7894 y*) usedl="$define"
7895         case "$dlsrc" in
7896         '')
7897                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7898                         dflt="$dldir/dl_${osname}.xs"
7899                 elif $test "$d_dlopen" = "$define" ; then
7900                         dflt="$dldir/dl_dlopen.xs"
7901                 elif $test "$i_dld" = "$define" ; then
7902                         dflt="$dldir/dl_dld.xs"
7903                 else
7904                         dflt=''
7905                 fi
7906                 ;;
7907         *)      dflt="$dldir/$dlsrc"
7908                 ;;
7909         esac
7910     echo "The following dynamic loading files are available:"
7911         : Can not go over to $dldir because getfile has path hard-coded in.
7912         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7913         rp="Source file to use for dynamic loading"
7914         fn="fne"
7915         gfpth="$src"
7916         . ./getfile
7917         usedl="$define"
7918         : emulate basename
7919         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7920
7921         $cat << EOM
7922
7923 Some systems may require passing special flags to $cc -c to
7924 compile modules that will be used to create a shared library.
7925 To use no flags, say "none".
7926
7927 EOM
7928     case "$cccdlflags" in
7929     '') case "$gccversion" in
7930                 '') case "$osname" in
7931                         hpux)   dflt='+z' ;;
7932                         next)   dflt='none' ;;
7933                         irix*)  dflt='-KPIC' ;;
7934                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7935                         sunos)  dflt='-pic' ;;
7936                         *)      dflt='none' ;;
7937                     esac
7938                         ;;
7939                 *)  case "$osname" in
7940                         darwin) dflt='none' ;;
7941                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7942                         *)      dflt='-fpic' ;;
7943                     esac ;;
7944             esac ;;
7945         ' ') dflt='none' ;;
7946     *)  dflt="$cccdlflags" ;;
7947     esac
7948     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7949     . ./myread
7950     case "$ans" in
7951     none) cccdlflags=' ' ;;
7952     *) cccdlflags="$ans" ;;
7953     esac
7954
7955     cat << EOM
7956
7957 Some systems use ld to create libraries that can be dynamically loaded,
7958 while other systems (such as those using ELF) use $cc.
7959
7960 EOM
7961         case "$ld" in
7962         '')     $cat >try.c <<EOM
7963 /* Test for whether ELF binaries are produced */
7964 #include <fcntl.h>
7965 #$i_stdlib I_STDLIB
7966 #ifdef I_STDLIB
7967 #include <stdlib.h>
7968 #endif
7969 #$i_unistd I_UNISTD
7970 #ifdef I_UNISTD
7971 #include <unistd.h>
7972 #endif
7973 int main() {
7974         char b[4];
7975         int i = open("a.out",O_RDONLY);
7976         if(i == -1)
7977                 exit(1); /* fail */
7978         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7979                 exit(0); /* succeed (yes, it's ELF) */
7980         else
7981                 exit(1); /* fail */
7982 }
7983 EOM
7984                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7985                         cat <<EOM
7986 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7987 EOM
7988                         dflt="$cc"
7989                 else
7990                         echo "I'll use ld to build dynamic libraries."
7991                         dflt='ld'
7992                 fi
7993                 $rm_try
7994                 ;;
7995         *)      dflt="$ld"
7996                 ;;
7997         esac
7998
7999     rp="What command should be used to create dynamic libraries?"
8000     . ./myread
8001         ld="$ans"
8002
8003     cat << EOM
8004
8005 Some systems may require passing special flags to $ld to create a
8006 library that can be dynamically loaded.  If your ld flags include
8007 -L/other/path options to locate libraries outside your loader's normal
8008 search path, you may need to specify those -L options here as well.  To
8009 use no flags, say "none".
8010
8011 EOM
8012     case "$lddlflags" in
8013     '') case "$osname" in
8014                         beos) dflt='-nostart' ;;
8015                         hpux) dflt='-b';
8016                               case "$gccversion" in
8017                               '') dflt="$dflt +vnocompatwarnings" ;;
8018                               esac
8019                               ;;
8020                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8021                         next)  dflt='none' ;;
8022                         solaris) dflt='-G' ;;
8023                         sunos) dflt='-assert nodefinitions' ;;
8024                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8025                 *)     dflt='none' ;;
8026                         esac
8027                         ;;
8028     *) dflt="$lddlflags" ;;
8029     esac
8030
8031         : Try to guess additional flags to pick up local libraries.
8032         : Be careful not to append to a plain 'none'
8033         case "$dflt" in
8034         none) dflt='' ;;
8035         esac
8036         for thisflag in $ldflags; do
8037                 case "$thisflag" in
8038                 -L*|-R*|-Wl,-R*)
8039                         case " $dflt " in
8040                         *" $thisflag "*) ;;
8041                         *) dflt="$dflt $thisflag" ;;
8042                         esac
8043                         ;;
8044                 esac
8045         done
8046
8047         case "$dflt" in
8048         ''|' ') dflt='none' ;;
8049         esac
8050
8051         case "$ldflags" in
8052         *-fstack-protector*)
8053             case "$dflt" in
8054                         *-fstack-protector*) ;; # Don't add it again
8055                         *) dflt="$dflt -fstack-protector" ;; 
8056                 esac
8057                 ;;
8058         esac
8059
8060
8061     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8062     . ./myread
8063     case "$ans" in
8064     none) lddlflags=' ' ;;
8065     *) lddlflags="$ans" ;;
8066     esac
8067
8068         cat <<EOM
8069
8070 Some systems may require passing special flags to $cc to indicate that
8071 the resulting executable will use dynamic linking.  To use no flags,
8072 say "none".
8073
8074 EOM
8075     case "$ccdlflags" in
8076     '') case "$osname" in
8077             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8078             next|sunos) dflt='none' ;;
8079             *)          dflt='none' ;;
8080             esac ;;
8081     ' ')  dflt='none' ;;
8082     *)  dflt="$ccdlflags" ;;
8083     esac
8084     rp="Any special flags to pass to $cc to use dynamic linking?"
8085     . ./myread
8086     case "$ans" in
8087     none) ccdlflags=' ' ;;
8088     *) ccdlflags="$ans" ;;
8089     esac
8090     ;;
8091 *)  usedl="$undef"
8092         ld='ld'
8093     dlsrc='dl_none.xs'
8094     lddlflags=''
8095     ccdlflags=''
8096     ;;
8097 esac
8098
8099 : Do we want a shared libperl?
8100 also=''
8101 case "$usedl" in
8102 $undef)
8103         # No dynamic loading being used, so don't bother even to prompt.
8104         useshrplib='false'
8105         ;;
8106 *)      case "$useshrplib" in
8107         '')     case "$osname" in
8108                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8109                         dflt=y
8110                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8111                         ;;
8112                 next*)
8113                         case "$osvers" in
8114                         4*)     dflt=y
8115                                 also='Building a shared libperl is needed for MAB support.'
8116                                 ;;
8117                         *)      dflt=n
8118                                 ;;
8119                         esac
8120                         ;;
8121                 *)      dflt=n
8122                         ;;
8123                 esac
8124                 ;;
8125         $define|true|[Yy]*)
8126                 dflt=y
8127                 ;;
8128         *)      dflt=n
8129                 ;;
8130         esac
8131         $cat << EOM
8132
8133 The perl executable is normally obtained by linking perlmain.c with
8134 libperl${_a}, any static extensions (usually just DynaLoader), and
8135 any other libraries needed on this system (such as -lm, etc.).  Since
8136 your system supports dynamic loading, it is probably possible to build
8137 a shared libperl.$so.  If you will have more than one executable linked
8138 to libperl.$so, this will significantly reduce the size of each
8139 executable, but it may have a noticeable effect on performance.  The
8140 default is probably sensible for your system.
8141 $also
8142
8143 EOM
8144         rp="Build a shared libperl.$so (y/n)"
8145         . ./myread
8146         case "$ans" in
8147         true|$define|[Yy]*)
8148                 useshrplib='true'  ;;
8149         *)      useshrplib='false' ;;
8150         esac
8151         ;;
8152 esac
8153
8154 case "$useshrplib" in
8155 true)
8156         case "$libperl" in
8157         '')
8158                 # Figure out a good name for libperl.so.  Since it gets stored in
8159                 # a version-specific architecture-dependent library, the version
8160                 # number isn't really that important, except for making cc/ld happy.
8161                 #
8162                 # A name such as libperl.so.10.1
8163                 majmin="libperl.$so.$patchlevel.$subversion"
8164                 # A name such as libperl.so.100
8165                 majonly=`echo $patchlevel $subversion |
8166                         $awk '{printf "%d%02d", $1, $2}'`
8167                 majonly=libperl.$so.$majonly
8168                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8169                 # rely on figuring it out from the naming of libc.
8170                 case "${osname}${osvers}" in
8171                 next4*)
8172                         dflt=libperl.5.$so
8173                         # XXX How handle the --version stuff for MAB?
8174                         ;;
8175                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8176                         dflt=libperl.$so
8177                         ;;
8178                 cygwin*) # ld links now against the dll directly
8179                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8180                         majonly=`echo $patchlevel $subversion |
8181                                 $awk '{printf "%03d%03d", $1, $2}'`
8182                         majonly=cygperl5.$majonly.$so
8183                         dflt=$majmin
8184                         ;;
8185                 *)      # Try to guess based on whether libc has major.minor.
8186                         case "$libc" in
8187                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8188                         *libc.$so.[0-9]*) dflt=$majonly ;;
8189                         *)      dflt=libperl.$so ;;
8190                         esac
8191                         ;;
8192                 esac
8193                 ;;
8194         *)      dflt=$libperl
8195                 ;;
8196         esac
8197         cat << EOM
8198
8199 I need to select a good name for the shared libperl.  If your system uses
8200 library names with major and minor numbers, then you might want something
8201 like $majmin.  Alternatively, if your system uses a single version
8202 number for shared libraries, then you might want to use $majonly.
8203 Or, your system might be quite happy with a simple libperl.$so.
8204
8205 Since the shared libperl will get installed into a version-specific
8206 architecture-dependent directory, the version number of the shared perl
8207 library probably isn't important, so the default should be o.k.
8208
8209 EOM
8210         rp='What name do you want to give to the shared libperl?'
8211         . ./myread
8212         libperl=$ans
8213         echo "Ok, I'll use $libperl"
8214         ;;
8215 *)
8216         libperl="libperl${_a}"
8217         ;;
8218 esac
8219
8220 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8221 case "$shrpdir" in
8222 '') ;;
8223 *)      $cat >&4 <<EOM
8224 WARNING:  Use of the shrpdir variable for the installation location of
8225 the shared $libperl is not supported.  It was never documented and
8226 will not work in this version.  Let me (perlbug@perl.org)
8227 know of any problems this may cause.
8228
8229 EOM
8230         case "$shrpdir" in
8231         "$archlibexp/CORE")
8232                 $cat >&4 <<EOM
8233 But your current setting of $shrpdir is
8234 the default anyway, so it's harmless.
8235 EOM
8236                 ;;
8237         *)
8238                 $cat >&4 <<EOM
8239 Further, your current attempted setting of $shrpdir
8240 conflicts with the value of $archlibexp/CORE
8241 that installperl will use.
8242 EOM
8243                 ;;
8244         esac
8245         ;;
8246 esac
8247
8248 # How will the perl executable find the installed shared $libperl?
8249 # Add $xxx to ccdlflags.
8250 # If we can't figure out a command-line option, use $shrpenv to
8251 # set env LD_RUN_PATH.  The main perl makefile uses this.
8252 shrpdir=$archlibexp/CORE
8253 xxx=''
8254 tmp_shrpenv=''
8255 if "$useshrplib"; then
8256     case "$osname" in
8257         aix)
8258                 # We'll set it in Makefile.SH...
8259                 ;;
8260         solaris)
8261                 xxx="-R $shrpdir"
8262                 ;;
8263         freebsd|netbsd|openbsd|interix|dragonfly)
8264                 xxx="-Wl,-R$shrpdir"
8265                 ;;
8266         bsdos|linux|irix*|dec_osf|gnu*)
8267                 xxx="-Wl,-rpath,$shrpdir"
8268                 ;;
8269         next)
8270                 # next doesn't like the default...
8271                 ;;
8272         beos)
8273                 # beos doesn't like the default, either.
8274                 ;;
8275         hpux*)
8276                 # hpux doesn't like the default, either.
8277                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8278                 ;;
8279         cygwin)
8280                 # cygwin needs only ldlibpth
8281                 ;;
8282         *)
8283                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8284                 ;;
8285         esac
8286         case "$xxx" in
8287         '') ;;
8288         *)
8289                 # Only add $xxx if it isn't already in ccdlflags.
8290                 case " $ccdlflags " in
8291                 *" $xxx "*)     ;;
8292                 *)      ccdlflags="$ccdlflags $xxx"
8293                         cat <<EOM >&4
8294
8295 Adding $xxx to the flags
8296 passed to $ld so that the perl executable will find the
8297 installed shared $libperl.
8298
8299 EOM
8300                         ;;
8301                 esac
8302                 ;;
8303         esac
8304 fi
8305 # Fix ccdlflags in AIX for building external extensions.
8306 # (For building Perl itself bare -bE:perl.exp is needed,
8307 #  Makefile.SH takes care of this.)
8308 case "$osname" in
8309 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8310 esac
8311 # Respect a hint or command-line value.
8312 case "$shrpenv" in
8313 '') shrpenv="$tmp_shrpenv" ;;
8314 esac
8315 case "$ldlibpthname" in
8316 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8317 none)   ldlibpthname='' ;;
8318 esac
8319
8320 : determine where manual pages are on this system
8321 echo " "
8322 case "$sysman" in
8323 '') 
8324         syspath='/usr/share/man/man1 /usr/man/man1'
8325         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8326         syspath="$syspath /usr/man/u_man/man1"
8327         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8328         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8329         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8330         sysman=`./loc . /usr/man/man1 $syspath`
8331         ;;
8332 esac
8333 if $test -d "$sysman"; then
8334         echo "System manual is in $sysman." >&4
8335 else
8336         echo "Could not find manual pages in source form." >&4
8337 fi
8338
8339 : determine where manual pages go
8340 set man1dir man1dir none
8341 eval $prefixit
8342 $cat <<EOM
8343
8344 $spackage has manual pages available in source form.
8345 EOM
8346 case "$nroff" in
8347 nroff)
8348         echo "However, you don't have nroff, so they're probably useless to you."
8349         case "$man1dir" in
8350         '') man1dir="none";;
8351         esac;;
8352 esac
8353 echo "If you don't want the manual sources installed, answer 'none'."
8354 case "$man1dir" in
8355 ' ') dflt=none
8356         ;;
8357 '')
8358         lookpath="$prefixexp/share/man/man1"
8359         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8360         lookpath="$lookpath $prefixexp/man/p_man/man1"
8361         lookpath="$lookpath $prefixexp/man/u_man/man1"
8362         lookpath="$lookpath $prefixexp/man/man.1"
8363         case "$sysman" in
8364         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8365         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8366         esac
8367         set dflt
8368         eval $prefixup
8369         ;;
8370 *)  dflt="$man1dir"
8371         ;;
8372 esac
8373 echo " "
8374 fn=dn+~
8375 rp="Where do the main $spackage manual pages (source) go?"
8376 . ./getfile
8377 if $test "X$man1direxp" != "X$ansexp"; then
8378         installman1dir=''
8379 fi
8380 prefixvar=man1dir
8381 . ./setprefixvar
8382
8383 case "$man1dir" in
8384 '')     man1dir=' '
8385         installman1dir='';;
8386 esac
8387
8388 : What suffix to use on installed man pages
8389
8390 case "$man1dir" in
8391 ' ')
8392         man1ext='0'
8393         ;;
8394 *)
8395         rp="What suffix should be used for the main $spackage man pages?"
8396         case "$man1ext" in
8397         '')     case "$man1dir" in
8398                 *1)  dflt=1 ;;
8399                 *1p) dflt=1p ;;
8400                 *1pm) dflt=1pm ;;
8401                 *l) dflt=l;;
8402                 *n) dflt=n;;
8403                 *o) dflt=o;;
8404                 *p) dflt=p;;
8405                 *C) dflt=C;;
8406                 *L) dflt=L;;
8407                 *L1) dflt=L1;;
8408                 *) dflt=1;;
8409                 esac
8410                 ;;
8411         *)      dflt="$man1ext";;
8412         esac
8413         . ./myread
8414         man1ext="$ans"
8415         ;;
8416 esac
8417
8418 : see if we can have long filenames
8419 echo " "
8420 first=123456789abcdef
8421 $rm -f $first
8422 if (echo hi >$first) 2>/dev/null; then
8423         if $test -f 123456789abcde; then
8424                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8425                 val="$undef"
8426         else
8427                 echo 'You can have filenames longer than 14 characters.'>&4
8428                 val="$define"
8429         fi
8430 else
8431         $cat <<'EOM'
8432 You can't have filenames longer than 14 chars.
8433 You can't even think about them!
8434 EOM
8435         val="$undef"
8436 fi
8437 set d_flexfnam
8438 eval $setvar
8439 $rm -rf 123456789abcde*
8440
8441 : determine where library module manual pages go
8442 set man3dir man3dir none
8443 eval $prefixit
8444 $cat <<EOM
8445
8446 $spackage has manual pages for many of the library modules.
8447 EOM
8448
8449 case "$nroff" in
8450 nroff)
8451         $cat <<'EOM'
8452 However, you don't have nroff, so they're probably useless to you.
8453 EOM
8454         case "$man3dir" in
8455         '') man3dir="none";;
8456         esac;;
8457 esac
8458
8459 case "$d_flexfnam" in
8460 undef)
8461         $cat <<'EOM'
8462 However, your system can't handle the long file names like File::Basename.3.
8463 EOM
8464         case "$man3dir" in
8465         '') man3dir="none";;
8466         esac;;
8467 esac
8468
8469 echo "If you don't want the manual sources installed, answer 'none'."
8470 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8471 case "$man3dir" in
8472 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8473         if $test -d "$privlib/man/man3"; then
8474                 cat <<EOM >&4
8475
8476 WARNING:  Previous versions of perl installed man3 pages into
8477 $privlib/man/man3.  This version will suggest a
8478 new default of $dflt.
8479 EOM
8480                 tdflt=$dflt
8481                 dflt='n'
8482                 rp='Do you wish to preserve the old behavior?(y/n)'
8483                 . ./myread
8484                 case "$ans" in
8485                 y*) dflt="$privlib/man/man3" ;;
8486                 *)  dflt=$tdflt ;;
8487                 esac
8488     fi
8489         ;;
8490 *)      dflt="$man3dir" ;;
8491 esac
8492 case "$dflt" in
8493 ' ') dflt=none ;;
8494 esac
8495 echo " "
8496 fn=dn+~
8497 rp="Where do the $package library man pages (source) go?"
8498 . ./getfile
8499 prefixvar=man3dir
8500 . ./setprefixvar
8501
8502 case "$man3dir" in
8503 '')     man3dir=' '
8504         installman3dir='';;
8505 esac
8506
8507 : What suffix to use on installed man pages
8508 case "$man3dir" in
8509 ' ')
8510         man3ext='0'
8511         ;;
8512 *)
8513         rp="What suffix should be used for the $package library man pages?"
8514         case "$man3ext" in
8515         '')     case "$man3dir" in
8516                 *3)  dflt=3 ;;
8517                 *3p) dflt=3p ;;
8518                 *3pm) dflt=3pm ;;
8519                 *l) dflt=l;;
8520                 *n) dflt=n;;
8521                 *o) dflt=o;;
8522                 *p) dflt=p;;
8523                 *C) dflt=C;;
8524                 *L) dflt=L;;
8525                 *L3) dflt=L3;;
8526                 *) dflt=3;;
8527                 esac
8528                 ;;
8529         *)      dflt="$man3ext";;
8530         esac
8531         . ./myread
8532         man3ext="$ans"
8533         ;;
8534 esac
8535
8536 : see if we have to deal with yellow pages, now NIS.
8537 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8538         if $test -f /usr/etc/nibindd; then
8539                 echo " "
8540                 echo "I'm fairly confident you're on a NeXT."
8541                 echo " "
8542                 rp='Do you get the hosts file via NetInfo?'
8543                 dflt=y
8544                 case "$hostcat" in
8545                 nidump*) ;;
8546                 '') ;;
8547                 *) dflt=n;;
8548                 esac
8549                 . ./myread
8550                 case "$ans" in
8551                 y*) hostcat='nidump hosts .';;
8552                 *)      case "$hostcat" in
8553                         nidump*) hostcat='';;
8554                         esac
8555                         ;;
8556                 esac
8557         fi
8558         case "$hostcat" in
8559         nidump*) ;;
8560         *)
8561                 case "$hostcat" in
8562                 *ypcat*) dflt=y;;
8563                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8564                                 dflt=y
8565                         else
8566                                 dflt=n
8567                         fi;;
8568                 *) dflt=n;;
8569                 esac
8570                 echo " "
8571                 rp='Are you getting the hosts file via yellow pages?'
8572                 . ./myread
8573                 case "$ans" in
8574                 y*) hostcat='ypcat hosts';;
8575                 *) hostcat='cat /etc/hosts';;
8576                 esac
8577                 ;;
8578         esac
8579 fi
8580 case "$hostcat" in
8581 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8582 esac
8583 case "$groupcat" in
8584 '') test -f /etc/group && groupcat='cat /etc/group';;
8585 esac
8586 case "$passcat" in
8587 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8588 esac
8589
8590 : now get the host name
8591 echo " "
8592 echo "Figuring out host name..." >&4
8593 case "$myhostname" in
8594 '') cont=true
8595         echo 'Maybe "hostname" will work...'
8596         if tans=`sh -c hostname 2>&1` ; then
8597                 myhostname=$tans
8598                 phostname=hostname
8599                 cont=''
8600         fi
8601         ;;
8602 *) cont='';;
8603 esac
8604 if $test "$cont"; then
8605         if ./xenix; then
8606                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8607                 if tans=`cat /etc/systemid 2>&1` ; then
8608                         myhostname=$tans
8609                         phostname='cat /etc/systemid'
8610                         echo "Whadyaknow.  Xenix always was a bit strange..."
8611                         cont=''
8612                 fi
8613         elif $test -r /etc/systemid; then
8614                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8615         fi
8616 fi
8617 if $test "$cont"; then
8618         echo 'No, maybe "uuname -l" will work...'
8619         if tans=`sh -c 'uuname -l' 2>&1` ; then
8620                 myhostname=$tans
8621                 phostname='uuname -l'
8622         else
8623                 echo 'Strange.  Maybe "uname -n" will work...'
8624                 if tans=`sh -c 'uname -n' 2>&1` ; then
8625                         myhostname=$tans
8626                         phostname='uname -n'
8627                 else
8628                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8629                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8630                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8631                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8632                         else
8633                                 case "$myhostname" in
8634                                 '') echo "Does this machine have an identity crisis or something?"
8635                                         phostname='';;
8636                                 *)
8637                                         echo "Well, you said $myhostname before..."
8638                                         phostname='echo $myhostname';;
8639                                 esac
8640                         fi
8641                 fi
8642         fi
8643 fi
8644 case "$myhostname" in
8645 '') myhostname=noname ;;
8646 esac
8647 : you do not want to know about this
8648 set $myhostname
8649 myhostname=$1
8650
8651 : verify guess
8652 if $test "$myhostname" ; then
8653         dflt=y
8654         rp='Your host name appears to be "'$myhostname'".'" Right?"
8655         . ./myread
8656         case "$ans" in
8657         y*) ;;
8658         *) myhostname='';;
8659         esac
8660 fi
8661
8662 : bad guess or no guess
8663 while $test "X$myhostname" = X ; do
8664         dflt=''
8665         rp="Please type the (one word) name of your host:"
8666         . ./myread
8667         myhostname="$ans"
8668 done
8669
8670 : translate upper to lower if necessary
8671 case "$myhostname" in
8672 *[A-Z]*)
8673         echo "(Normalizing case in your host name)"
8674         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8675         ;;
8676 esac
8677
8678 case "$myhostname" in
8679 *.*)
8680         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8681         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8682         echo "(Trimming domain name from host name--host name is now $myhostname)"
8683         ;;
8684 *) case "$mydomain" in
8685         '')
8686                 {
8687                         test "X$hostcat" = "Xypcat hosts" &&
8688                         ypmatch "$myhostname" hosts 2>/dev/null |\
8689                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8690                         $test -s hosts
8691                 } || {
8692                         test "X$hostcat" != "X" &&
8693                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8694                                         /[       ]$myhostname[  . ]/p" > hosts
8695                 }
8696                 tmp_re="[       . ]"
8697                 if $test -f hosts; then
8698                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8699                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8700                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8701                                 hosts | $sort | $uniq | \
8702                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8703                         case `$echo X$dflt` in
8704                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8705                                 dflt=.
8706                                 ;;
8707                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8708                                 ;;
8709                         esac
8710                 else
8711                         echo "(I cannot locate a hosts database anywhere)"
8712                         dflt=.
8713                 fi
8714                 case "$dflt" in
8715                 .)
8716                         tans=`./loc resolv.conf X /etc /usr/etc`
8717                         if $test -f "$tans"; then
8718                                 echo "(Attempting domain name extraction from $tans)"
8719                                 dflt=.`$sed -n -e 's/   / /g' \
8720                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8721                                   -e 1q 2>/dev/null`
8722                                 case "$dflt" in
8723                                 .) dflt=.`$sed -n -e 's/        / /g' \
8724                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8725                                      -e 1q 2>/dev/null`
8726                                         ;;
8727                                 esac
8728                         fi
8729                         ;;
8730                 esac
8731                 case "$dflt" in
8732                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8733                         dflt=.`sh -c domainname 2>/dev/null`
8734                         case "$dflt" in
8735                         '') dflt='.';;
8736                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8737                         esac
8738                         ;;
8739                 esac
8740                 case "$dflt$osname" in
8741                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8742                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8743                         ;;
8744                 esac
8745                 case "$dflt" in
8746                 .) echo "(Lost all hope -- silly guess then)"
8747                         dflt='.nonet'
8748                         ;;
8749                 esac
8750                 $rm -f hosts
8751                 ;;
8752         *) dflt="$mydomain";;
8753         esac;;
8754 esac
8755 echo " "
8756 rp="What is your domain name?"
8757 . ./myread
8758 tans="$ans"
8759 case "$ans" in
8760 '') ;;
8761 .*) ;;
8762 *) tans=".$tans";;
8763 esac
8764 mydomain="$tans"
8765
8766 : translate upper to lower if necessary
8767 case "$mydomain" in
8768 *[A-Z]*)
8769         echo "(Normalizing case in your domain name)"
8770         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8771         ;;
8772 esac
8773
8774 : a little sanity check here
8775 case "$phostname" in
8776 '') ;;
8777 *)
8778         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8779         $myhostname$mydomain|$myhostname) ;;
8780         *)
8781                 case "$phostname" in
8782                 sed*)
8783                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8784                         ;;
8785                 *)
8786                         echo "(That doesn't agree with your $phostname command, by the way.)"
8787                         ;;
8788                 esac
8789         ;;
8790         esac
8791         ;;
8792 esac
8793
8794 : determine the e-mail address of the user who is running us
8795 $cat <<EOM
8796
8797 I need to get your e-mail address in Internet format if possible, i.e.
8798 something like user@host.domain. Please answer accurately since I have
8799 no easy means to double check it. The default value provided below
8800 is most probably close to reality but may not be valid from outside
8801 your organization...
8802
8803 EOM
8804 cont=x
8805 while test "$cont"; do
8806         case "$cf_email" in
8807         '') dflt="$cf_by@$myhostname$mydomain";;
8808         *) dflt="$cf_email";;
8809         esac
8810         rp='What is your e-mail address?'
8811         . ./myread
8812         cf_email="$ans"
8813         case "$cf_email" in
8814         *@*.*) cont='' ;;
8815         *)
8816                 rp='Address does not look like an Internet one.  Use it anyway?'
8817                 case "$fastread" in
8818                 yes) dflt=y ;;
8819                 *) dflt=n ;;
8820                 esac
8821                 . ./myread
8822                 case "$ans" in
8823                 y*) cont='' ;;
8824                 *) echo " " ;;
8825                 esac
8826                 ;;
8827         esac
8828 done
8829
8830 : Ask e-mail of administrator
8831 $cat <<EOM
8832
8833 If you or somebody else will be maintaining perl at your site, please
8834 fill in the correct e-mail address here so that they may be contacted
8835 if necessary. Currently, the "perlbug" program included with perl
8836 will send mail to this address in addition to perlbug@perl.org. You may
8837 enter "none" for no administrator.
8838
8839 EOM
8840 case "$perladmin" in
8841 '') dflt="$cf_email";;
8842 *) dflt="$perladmin";;
8843 esac
8844 rp='Perl administrator e-mail address'
8845 . ./myread
8846 perladmin="$ans"
8847
8848 : determine whether to only install version-specific parts.
8849 echo " "
8850 $cat <<EOM
8851 Do you want to install only the version-specific parts of the perl
8852 distribution?  Usually you do *not* want to do this.
8853 EOM
8854 case "$versiononly" in
8855 "$define"|[Yy]*|true) dflt='y' ;;
8856 *) dflt='n';
8857 esac
8858 rp="Do you want to install only the version-specific parts of perl?"
8859 . ./myread
8860 case "$ans" in
8861 [yY]*)  val="$define";;
8862 *)      val="$undef" ;;
8863 esac
8864 set versiononly
8865 eval $setvar
8866
8867 case "$versiononly" in
8868 "$define") inc_version_list=''
8869            inc_version_list_init=0
8870            ;;
8871 esac
8872
8873 : figure out how to guarantee perl startup
8874 : XXX Note that this currently takes advantage of the bug that binexp ignores
8875 :     the Configure -Dinstallprefix setting, which in turn means that under
8876 :     relocatable @INC, initialinstalllocation is what binexp started as.
8877 case "$startperl" in
8878 '')
8879         case "$sharpbang" in
8880         *!)
8881                 $cat <<EOH
8882
8883 I can use the #! construct to start perl on your system. This will
8884 make startup of perl scripts faster, but may cause problems if you
8885 want to share those scripts and perl is not in a standard place
8886 ($initialinstalllocation/perl) on all your platforms. The alternative
8887 is to force a shell by starting the script with a single ':' character.
8888
8889 EOH
8890                 case "$versiononly" in
8891                 "$define")      dflt="$initialinstalllocation/perl$version";;
8892                 *)              dflt="$initialinstalllocation/perl";;
8893                 esac
8894                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8895                 . ./myread
8896                 case "$ans" in
8897                 none)   startperl=": # use perl";;
8898                 *)      startperl="#!$ans"
8899                         if $test 30 -lt `echo "$ans" | wc -c`; then
8900                                 $cat >&4 <<EOM
8901
8902 WARNING:  Some systems limit the #! command to 32 characters.
8903 If you experience difficulty running Perl scripts with #!, try
8904 installing Perl in a directory with a shorter pathname.
8905
8906 EOM
8907                         fi ;;
8908                 esac
8909                 ;;
8910         *) startperl=": # use perl"
8911                 ;;
8912         esac
8913         ;;
8914 esac
8915 echo "I'll use $startperl to start perl scripts."
8916
8917 : figure best path for perl in scripts
8918 case "$perlpath" in
8919 '')
8920         case "$versiononly" in
8921         "$define")      perlpath="$initialinstalllocation/perl$version";;
8922         *)              perlpath="$initialinstalllocation/perl";;
8923         esac
8924         case "$startperl" in
8925         *!*) ;;
8926         *)
8927                 $cat <<EOH
8928
8929 I will use the "eval 'exec'" idiom to start Perl on your system.
8930 I can use the full path of your Perl binary for this purpose, but
8931 doing so may cause problems if you want to share those scripts and
8932 Perl is not always in a standard place ($initialinstalllocation/perl).
8933
8934 EOH
8935                 dflt="$initialinstalllocation/perl"
8936                 rp="What path shall I use in \"eval 'exec'\"?"
8937                 . ./myread
8938                 perlpath="$ans"
8939                 ;;
8940         esac
8941         ;;
8942 esac
8943 case "$startperl" in
8944 *!*)    ;;
8945 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8946 esac
8947
8948 : determine where public executable scripts go
8949 set scriptdir scriptdir
8950 eval $prefixit
8951 case "$scriptdir" in
8952 '')
8953         dflt="$bin"
8954         : guess some guesses
8955         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8956         $test -d /usr/share/bin     && dflt=/usr/share/bin
8957         $test -d /usr/local/script  && dflt=/usr/local/script
8958         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8959         $test -d $prefixexp/script  && dflt=$prefixexp/script
8960         set dflt
8961         eval $prefixup
8962         ;;
8963 *)  dflt="$scriptdir"
8964         ;;
8965 esac
8966 $cat <<EOM
8967
8968 Some installations have a separate directory just for executable scripts so
8969 that they can mount it across multiple architectures but keep the scripts in
8970 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8971 Or you might just lump your scripts in with all your other executables.
8972
8973 EOM
8974 fn=d~
8975 rp='Where do you keep publicly executable scripts?'
8976 . ./getfile
8977 if $test "X$ansexp" != "X$scriptdirexp"; then
8978         installscript=''
8979 fi
8980 installscriptdir=''
8981 prefixvar=scriptdir
8982 . ./setprefixvar
8983 : A little fix up for an irregularly named variable.
8984 installscript="$installscriptdir"
8985
8986 : determine where add-on public executables go
8987 case "$sitebin" in
8988 '')     dflt=$siteprefix/bin ;;
8989 *)      dflt=$sitebin ;;
8990 esac
8991 fn=d~
8992 rp='Pathname where the add-on public executables should be installed?'
8993 . ./getfile
8994 prefixvar=sitebin
8995 . ./setprefixvar
8996
8997 : determine where add-on html pages go
8998 : There is no standard location, so try to copy the previously-selected
8999 : directory structure for the core html pages.
9000 case "$sitehtml1dir" in
9001 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9002 *)     dflt=$sitehtml1dir ;;
9003 esac
9004 case "$dflt" in
9005 ''|' ') dflt=none ;;
9006 esac
9007 fn=dn+~
9008 rp='Pathname where the site-specific html pages should be installed?'
9009 . ./getfile
9010 prefixvar=sitehtml1dir
9011 . ./setprefixvar
9012
9013 : determine where add-on library html pages go
9014 : There is no standard location, so try to copy the previously-selected
9015 : directory structure for the core html pages.
9016 case "$sitehtml3dir" in
9017 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9018 *)     dflt=$sitehtml3dir ;;
9019 esac
9020 case "$dflt" in
9021 ''|' ') dflt=none ;;
9022 esac
9023 fn=dn+~
9024 rp='Pathname where the site-specific library html pages should be installed?'
9025 . ./getfile
9026 prefixvar=sitehtml3dir
9027 . ./setprefixvar
9028
9029 : determine where add-on manual pages go
9030 case "$siteman1dir" in
9031 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9032 *)      dflt=$siteman1dir ;;
9033 esac
9034 case "$dflt" in
9035 ''|' ') dflt=none ;;
9036 esac
9037 fn=dn+~
9038 rp='Pathname where the site-specific manual pages should be installed?'
9039 . ./getfile
9040 prefixvar=siteman1dir
9041 . ./setprefixvar
9042
9043 : determine where add-on library man pages go
9044 case "$siteman3dir" in
9045 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9046 *)      dflt=$siteman3dir ;;
9047 esac
9048 case "$dflt" in
9049 ''|' ') dflt=none ;;
9050 esac
9051 fn=dn+~
9052 rp='Pathname where the site-specific library manual pages should be installed?'
9053 . ./getfile
9054 prefixvar=siteman3dir
9055 . ./setprefixvar
9056
9057 : determine where add-on public executable scripts go
9058 case "$sitescript" in
9059 '')     dflt=$siteprefix/script
9060         $test -d $dflt || dflt=$sitebin ;;
9061 *)  dflt="$sitescript" ;;
9062 esac
9063 fn=d~+
9064 rp='Pathname where add-on public executable scripts should be installed?'
9065 . ./getfile
9066 prefixvar=sitescript
9067 . ./setprefixvar
9068
9069 : Check if faststdio is requested and available
9070 case "$usefaststdio" in
9071 $define|true|[yY]*|'')
9072         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9073         case "$xversion" in
9074         [68])   dflt='y' ;;
9075         *)      dflt='n' ;;
9076         esac
9077         ;;
9078 *) dflt='n';;
9079 esac
9080 cat <<EOM
9081
9082 Perl can be built to use 'fast stdio', which means using the stdio
9083 library but also directly manipulating the stdio buffers to enable
9084 faster I/O.  Using stdio is better for backward compatibility (especially
9085 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9086 interface has been preferred instead of stdio.
9087
9088 If this doesn't make any sense to you, just accept the default '$dflt'.
9089 EOM
9090 rp='Use the "fast stdio" if available?'
9091 . ./myread
9092 case "$ans" in
9093 y|Y)    val="$define" ;;
9094 *)      val="$undef" ;;
9095 esac
9096 set usefaststdio
9097 eval $setvar
9098
9099
9100 : define an is-a-typedef? function
9101 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9102 case "$inclist" in
9103 "") inclist="sys/types.h";;
9104 esac;
9105 eval "varval=\$$var";
9106 case "$varval" in
9107 "")
9108         $rm -f temp.c;
9109         for inc in $inclist; do
9110                 echo "#include <$inc>" >>temp.c;
9111         done;
9112         echo "#ifdef $type" >> temp.c;
9113         echo "printf(\"We have $type\");" >> temp.c;
9114         echo "#endif" >> temp.c;
9115         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9116         if $contains $type temp.E >/dev/null 2>&1; then
9117                 eval "$var=\$type";
9118         else
9119                 eval "$var=\$def";
9120         fi;
9121         $rm -f temp.?;;
9122 *) eval "$var=\$varval";;
9123 esac'
9124
9125 : define an is-a-typedef? function that prompts if the type is not available.
9126 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9127 case "$inclist" in
9128 "") inclist="sys/types.h";;
9129 esac;
9130 eval "varval=\$$var";
9131 case "$varval" in
9132 "")
9133         $rm -f temp.c;
9134         for inc in $inclist; do
9135                 echo "#include <$inc>" >>temp.c;
9136         done;
9137         echo "#ifdef $type" >> temp.c;
9138         echo "printf(\"We have $type\");" >> temp.c;
9139         echo "#endif" >> temp.c;
9140         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9141         echo " " ;
9142         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9143         if $contains $type temp.E >/dev/null 2>&1; then
9144                 echo "$type found." >&4;
9145                 eval "$var=\$type";
9146         else
9147                 echo "$type NOT found." >&4;
9148                 dflt="$def";
9149                 . ./myread ;
9150                 eval "$var=\$ans";
9151         fi;
9152         $rm -f temp.?;;
9153 *) eval "$var=\$varval";;
9154 esac'
9155
9156 : see what type lseek is declared as in the kernel
9157 rp="What is the type used for lseek's offset on this system?"
9158 set off_t lseektype long stdio.h sys/types.h
9159 eval $typedef_ask
9160
9161 echo " "
9162 echo "Checking to see how big your file offsets are..." >&4
9163 $cat >try.c <<EOCP
9164 #include <sys/types.h>
9165 #include <stdio.h>
9166 int main()
9167 {
9168     printf("%d\n", (int)sizeof($lseektype));
9169     return(0);
9170 }
9171 EOCP
9172 set try
9173 if eval $compile_ok; then
9174         lseeksize=`$run ./try`
9175         echo "Your file offsets are $lseeksize bytes long."
9176 else
9177         dflt=$longsize
9178         echo " "
9179         echo "(I can't seem to compile the test program.  Guessing...)"
9180         rp="What is the size of your file offsets (in bytes)?"
9181         . ./myread
9182         lseeksize="$ans"
9183 fi
9184 $rm_try
9185
9186 : see what type file positions are declared as in the library
9187 rp="What is the type for file position used by fsetpos()?"
9188 set fpos_t fpostype long stdio.h sys/types.h
9189 eval $typedef_ask
9190
9191 : Check size for Fpos_t
9192 echo " "
9193 case "$fpostype" in
9194 *_t) zzz="$fpostype"    ;;
9195 *)   zzz="fpos_t"       ;;
9196 esac
9197 echo "Checking the size of $zzz..." >&4
9198 cat > try.c <<EOCP
9199 #include <sys/types.h>
9200 #include <stdio.h>
9201 #$i_stdlib I_STDLIB
9202 #ifdef I_STDLIB
9203 #include <stdlib.h>
9204 #endif
9205 int main() {
9206     printf("%d\n", (int)sizeof($fpostype));
9207     exit(0);
9208 }
9209 EOCP
9210 set try
9211 if eval $compile_ok; then
9212         yyy=`$run ./try`
9213         case "$yyy" in
9214         '')     fpossize=4
9215                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9216                 ;;
9217         *)      fpossize=$yyy
9218                 echo "Your $zzz is $fpossize bytes long."
9219                 ;;
9220         esac
9221 else
9222         dflt="$longsize"
9223         echo " " >&4
9224         echo "(I can't compile the test program.  Guessing...)" >&4
9225         rp="What is the size of your file positions (in bytes)?"
9226         . ./myread
9227         fpossize="$ans"
9228 fi
9229
9230 : Check for large file support
9231 # Backward compatibility (uselfs is deprecated).
9232 case "$uselfs" in
9233 "$define"|true|[yY]*)
9234         cat <<EOM >&4
9235
9236 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9237 EOM
9238         uselargefiles="$define"
9239         ;;
9240 esac
9241
9242 case "$lseeksize:$fpossize" in
9243 8:8) cat <<EOM
9244
9245 You can have files larger than 2 gigabytes.
9246 EOM
9247    val="$define" ;;
9248 *)    case "$uselargefiles" in
9249    "$undef"|false|[nN]*) dflt='n' ;;
9250    *)   dflt='y' ;;
9251    esac
9252    cat <<EOM
9253
9254 Perl can be built to understand large files (files larger than 2 gigabytes)
9255 on some systems.  To do so, Configure can be run with -Duselargefiles.
9256
9257 If this doesn't make any sense to you, just accept the default '$dflt'.
9258 EOM
9259    rp='Try to understand large files, if available?'
9260    . ./myread
9261    case "$ans" in
9262    y|Y)         val="$define" ;;
9263    *)           val="$undef"  ;;
9264    esac
9265    ;;
9266 esac
9267 set uselargefiles
9268 eval $setvar
9269 : Look for a hint-file generated 'call-back-unit'.  If the
9270 : user has specified that a large files perl is to be built,
9271 : we may need to set or change some other defaults.
9272 if $test -f uselargefiles.cbu; then
9273         echo "Your platform has some specific hints regarding large file builds, using them..."
9274         . ./uselargefiles.cbu
9275 fi
9276 case "$uselargefiles" in
9277 "$define")
9278         if $test -f uselargefiles.cbu; then
9279                 echo " "
9280                 echo "Rechecking to see how big your file offsets are..." >&4
9281                 $cat >try.c <<EOCP
9282 #include <sys/types.h>
9283 #include <stdio.h>
9284 int main()
9285 {
9286     printf("%d\n", (int)sizeof($lseektype));
9287     return(0);
9288 }
9289 EOCP
9290                 set try
9291                 if eval $compile_ok; then
9292                         lseeksize=`$run ./try`
9293                         $echo "Your file offsets are now $lseeksize bytes long."
9294                 else
9295                         dflt="$lseeksize"
9296                         echo " "
9297                         echo "(I can't seem to compile the test program.  Guessing...)"
9298                         rp="What is the size of your file offsets (in bytes)?"
9299                         . ./myread
9300                         lseeksize="$ans"
9301                 fi
9302                 case "$fpostype" in
9303                 *_t) zzz="$fpostype"    ;;
9304                 *)   zzz="fpos_t"       ;;
9305                 esac
9306                 $echo $n "Rechecking the size of $zzz...$c" >&4
9307                 $cat > try.c <<EOCP
9308 #include <sys/types.h>
9309 #include <stdio.h>
9310 #$i_stdlib I_STDLIB
9311 #ifdef I_STDLIB
9312 #include <stdlib.h>
9313 #endif
9314 int main() {
9315     printf("%d\n", (int)sizeof($fpostype));
9316     return(0);
9317 }
9318 EOCP
9319                 set try
9320                 if eval $compile_ok; then
9321                         yyy=`$run ./try`
9322                         dflt="$lseeksize"
9323                         case "$yyy" in
9324                         '')     echo " "
9325                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9326                                 ;;
9327                         *)      fpossize=$yyy
9328                                 echo " $fpossize bytes." >&4
9329                                 ;;
9330                         esac
9331                 else
9332                         dflt="$fpossize"
9333                         echo " "
9334                         echo "(I can't compile the test program.  Guessing...)" >&4
9335                         rp="What is the size of your file positions (in bytes)?"
9336                         . ./myread
9337                         fpossize="$ans"
9338                 fi
9339                 $rm_try
9340         fi
9341         ;;
9342 esac
9343
9344 : Set the vendorbin variables
9345 case "$vendorprefix" in
9346 '')     d_vendorbin="$undef"
9347         vendorbin=''
9348         vendorbinexp=''
9349         ;;
9350 *)      d_vendorbin="$define"
9351         : determine where vendor-supplied executables go.
9352         case "$vendorbin" in
9353         '') dflt=$vendorprefix/bin ;;
9354         *)      dflt="$vendorbin" ;;
9355         esac
9356         fn=d~+
9357         rp='Pathname for the vendor-supplied executables directory?'
9358         . ./getfile
9359         vendorbin="$ans"
9360         vendorbinexp="$ansexp"
9361         ;;
9362 esac
9363 prefixvar=vendorbin
9364 . ./installprefix
9365
9366 : Set the vendorhtml1dir variables
9367 case "$vendorprefix" in
9368 '')     vendorhtml1dir=''
9369         vendorhtml1direxp=''
9370         ;;
9371 *)      : determine where vendor-supplied html pages go.
9372         : There is no standard location, so try to copy the previously-selected
9373         : directory structure for the core html pages.
9374         : XXX Better default suggestions would be welcome.
9375         case "$vendorhtml1dir" in
9376         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9377         *)      dflt=$vendorhtml1dir ;;
9378         esac
9379         case "$dflt" in
9380         ''|' ') dflt=none ;;
9381         esac
9382         fn=dn+~
9383         rp='Pathname for the vendor-supplied html pages?'
9384         . ./getfile
9385         vendorhtml1dir="$ans"
9386         vendorhtml1direxp="$ansexp"
9387         ;;
9388 esac
9389 : Use ' ' for none so value is preserved next time through Configure
9390 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9391 prefixvar=vendorhtml1dir
9392 . ./installprefix
9393
9394 : Set the vendorhtml3dir variables
9395 case "$vendorprefix" in
9396 '')     vendorhtml3dir=''
9397         vendorhtml3direxp=''
9398         ;;
9399 *)      : determine where vendor-supplied module html pages go.
9400         : There is no standard location, so try to copy the previously-selected
9401         : directory structure for the core html pages.
9402         : XXX Better default suggestions would be welcome.
9403         case "$vendorhtml3dir" in
9404         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9405         *)      dflt=$vendorhtml3dir ;;
9406         esac
9407         case "$dflt" in
9408         ''|' ') dflt=none ;;
9409         esac
9410         fn=dn+~
9411         rp='Pathname for the vendor-supplied html pages?'
9412         . ./getfile
9413         vendorhtml3dir="$ans"
9414         vendorhtml3direxp="$ansexp"
9415         ;;
9416 esac
9417 : Use ' ' for none so value is preserved next time through Configure
9418 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9419 prefixvar=vendorhtml3dir
9420 . ./installprefix
9421
9422 : Set the vendorman1dir variables
9423 case "$vendorprefix" in
9424 '')     vendorman1dir=''
9425         vendorman1direxp=''
9426         ;;
9427 *)      : determine where vendor-supplied manual pages go.
9428         case "$vendorman1dir" in
9429         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9430         *)      dflt=$vendorman1dir ;;
9431         esac
9432         case "$dflt" in
9433         ''|' ') dflt=none ;;
9434         esac
9435         fn=nd~+
9436         rp='Pathname for the vendor-supplied manual section 1 pages?'
9437         . ./getfile
9438         vendorman1dir="$ans"
9439         vendorman1direxp="$ansexp"
9440         ;;
9441 esac
9442 : Use ' ' for none so value is preserved next time through Configure
9443 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9444 prefixvar=vendorman1dir
9445 . ./installprefix
9446
9447 : Set the vendorman3dir variables
9448 case "$vendorprefix" in
9449 '')     vendorman3dir=''
9450         vendorman3direxp=''
9451         ;;
9452 *)      : determine where vendor-supplied module manual pages go.
9453         case "$vendorman3dir" in
9454         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9455         *)      dflt=$vendorman3dir ;;
9456         esac
9457         case "$dflt" in
9458         ''|' ') dflt=none ;;
9459         esac
9460         fn=nd~+
9461         rp='Pathname for the vendor-supplied manual section 3 pages?'
9462         . ./getfile
9463         vendorman3dir="$ans"
9464         vendorman3direxp="$ansexp"
9465         ;;
9466 esac
9467 : Use ' ' for none so value is preserved next time through Configure
9468 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9469 prefixvar=vendorman3dir
9470 . ./installprefix
9471
9472 : Set the vendorscript variables
9473 case "$vendorprefix" in
9474 '')     d_vendorscript="$undef"
9475         vendorscript=''
9476         vendorscriptexp=''
9477         ;;
9478 *)      d_vendorscript="$define"
9479         : determine where vendor-supplied scripts go.
9480         case "$vendorscript" in
9481         '')     dflt=$vendorprefix/script
9482                 $test -d $dflt || dflt=$vendorbin ;;
9483         *)  dflt="$vendorscript" ;;
9484         esac
9485         $cat <<EOM
9486
9487 The installation process will create a directory for
9488 vendor-supplied scripts.
9489
9490 EOM
9491         fn=d~+
9492         rp='Pathname for the vendor-supplied scripts directory?'
9493         . ./getfile
9494         vendorscript="$ans"
9495         vendorscriptexp="$ansexp"
9496         ;;
9497 esac
9498 prefixvar=vendorscript
9499 . ./installprefix
9500
9501 : see if qgcvt exists
9502 set qgcvt d_qgcvt
9503 eval $inlibc
9504
9505 : Check print/scan long double stuff
9506 echo " "
9507
9508 if $test X"$d_longdbl" = X"$define"; then
9509
9510 echo "Checking how to print long doubles..." >&4
9511
9512 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9513         $cat >try.c <<'EOCP'
9514 #include <sys/types.h>
9515 #include <stdio.h>
9516 int main() {
9517   double d = 123.456;
9518   printf("%.3f\n", d);
9519 }
9520 EOCP
9521         set try
9522         if eval $compile; then
9523                 yyy=`$run ./try`
9524                 case "$yyy" in
9525                 123.456)
9526                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9527                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9528                         echo "We will use %f."
9529                         ;;
9530                 esac
9531         fi
9532 fi
9533
9534 if $test X"$sPRIfldbl" = X; then
9535         $cat >try.c <<'EOCP'
9536 #include <sys/types.h>
9537 #include <stdio.h>
9538 int main() {
9539   long double d = 123.456;
9540   printf("%.3Lf\n", d);
9541 }
9542 EOCP
9543         set try
9544         if eval $compile; then
9545                 yyy=`$run ./try`
9546                 case "$yyy" in
9547                 123.456)
9548                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9549                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9550                         echo "We will use %Lf."
9551                         ;;
9552                 esac
9553         fi
9554 fi
9555
9556 if $test X"$sPRIfldbl" = X; then
9557         $cat >try.c <<'EOCP'
9558 #include <sys/types.h>
9559 #include <stdio.h>
9560 int main() {
9561   long double d = 123.456;
9562   printf("%.3llf\n", d);
9563 }
9564 EOCP
9565         set try
9566         if eval $compile; then
9567                 yyy=`$run ./try`
9568                 case "$yyy" in
9569                 123.456)
9570                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9571                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9572                         echo "We will use %llf."
9573                         ;;
9574                 esac
9575         fi
9576 fi
9577
9578 if $test X"$sPRIfldbl" = X; then
9579         $cat >try.c <<'EOCP'
9580 #include <sys/types.h>
9581 #include <stdio.h>
9582 int main() {
9583   long double d = 123.456;
9584   printf("%.3lf\n", d);
9585 }
9586 EOCP
9587         set try
9588         if eval $compile; then
9589                 yyy=`$run ./try`
9590                 case "$yyy" in
9591                 123.456)
9592                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9593                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9594                         echo "We will use %lf."
9595                         ;;
9596                 esac
9597         fi
9598 fi
9599
9600 if $test X"$sPRIfldbl" = X; then
9601         echo "Cannot figure out how to print long doubles." >&4
9602 else
9603         sSCNfldbl=$sPRIfldbl    # expect consistency
9604 fi
9605
9606 $rm_try
9607
9608 fi # d_longdbl
9609
9610 case "$sPRIfldbl" in
9611 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9612         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9613         d_SCNfldbl="$undef";
9614         ;;
9615 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9616         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9617         d_SCNfldbl="$define";
9618         ;;
9619 esac
9620
9621 : Check how to convert floats to strings.
9622
9623 if test "X$d_Gconvert" = X; then
9624
9625 echo " "
9626 echo "Checking for an efficient way to convert floats to strings."
9627 echo " " > try.c
9628 case "$uselongdouble" in
9629 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9630 esac
9631 case "$d_longdbl" in
9632 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9633 esac
9634 case "$d_PRIgldbl" in
9635 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9636 esac
9637 $cat >>try.c <<EOP
9638 #ifdef TRY_gconvert
9639 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9640 char *myname = "gconvert";
9641 #endif
9642 #ifdef TRY_gcvt
9643 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9644 char *myname = "gcvt";
9645 #endif
9646 #ifdef TRY_qgcvt
9647 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9648 char *myname = "qgcvt";
9649 #define DOUBLETYPE long double
9650 #endif
9651 #ifdef TRY_sprintf
9652 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9653 #ifdef HAS_PRIgldbl
9654 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9655 #else
9656 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9657 #endif
9658 #else
9659 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9660 #endif
9661 char *myname = "sprintf";
9662 #endif
9663
9664 #ifndef DOUBLETYPE
9665 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9666 #define DOUBLETYPE long double
9667 #else
9668 #define DOUBLETYPE double
9669 #endif
9670 #endif
9671
9672 #include <stdio.h>
9673
9674 #define I_STDLIB $i_stdlib
9675 #ifdef I_STDLIB
9676 #include <stdlib.h>
9677 #endif
9678
9679 int
9680 checkit(expect, got)
9681 char *expect;
9682 char *got;
9683 {
9684     if (strcmp(expect, got)) {
9685                 printf("%s oddity:  Expected %s, got %s\n",
9686                         myname, expect, got);
9687                 exit(1);
9688         }
9689 }
9690
9691 int main()
9692 {
9693         char buf[64];
9694         buf[63] = '\0';
9695
9696         /* This must be 1st test on (which?) platform */
9697         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9698         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9699         checkit("0.1", buf);
9700
9701         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9702         checkit("0.01", buf);
9703
9704         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9705         checkit("0.001", buf);
9706
9707         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9708         checkit("0.0001", buf);
9709
9710         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9711         if (strlen(buf) > 5)
9712             checkit("9e-005", buf); /* for Microsoft ?? */
9713         else
9714             checkit("9e-05", buf);
9715
9716         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9717         checkit("1", buf);
9718
9719         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9720         checkit("1.1", buf);
9721
9722         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9723         checkit("1.01", buf);
9724
9725         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9726         checkit("1.001", buf);
9727
9728         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9729         checkit("1.0001", buf);
9730
9731         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9732         checkit("1.00001", buf);
9733
9734         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9735         checkit("1.000001", buf);
9736
9737         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9738         checkit("0", buf);
9739
9740         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9741         checkit("-1", buf);
9742
9743         /* Some Linux gcvt's give 1.e+5 here. */
9744         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9745         checkit("100000", buf);
9746
9747         /* Some Linux gcvt's give -1.e+5 here. */
9748         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9749         checkit("-100000", buf);
9750
9751         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9752         checkit("123.456", buf);
9753
9754         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9755         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9756         /* 34 should be enough to scare even long double
9757          * places into using the e notation. */
9758         if (strlen(buf) > 5)
9759             checkit("1e+034", buf); /* for Microsoft */
9760         else
9761             checkit("1e+34", buf);
9762
9763         /* For Perl, if you add additional tests here, also add them to
9764          * t/base/num.t for benefit of platforms not using Configure or
9765          * overriding d_Gconvert */
9766
9767         exit(0);
9768 }
9769 EOP
9770 : first add preferred functions to our list
9771 xxx_list=""
9772 for xxx_convert in $gconvert_preference; do
9773     case $xxx_convert in
9774     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9775     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9776     esac
9777 done
9778 : then add any others
9779 for xxx_convert in gconvert gcvt sprintf; do
9780     case "$xxx_list" in
9781     *$xxx_convert*) ;;
9782     *) xxx_list="$xxx_list $xxx_convert" ;;
9783     esac
9784 done
9785
9786 case "$d_longdbl$uselongdouble" in
9787 "$define$define")
9788     : again, add prefered functions to our list first
9789     xxx_ld_list=""
9790     for xxx_convert in $gconvert_ld_preference; do
9791         case $xxx_convert in
9792         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9793         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9794         esac
9795     done
9796     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9797     for xxx_convert in qgcvt sprintf $xxx_list; do
9798         case "$xxx_ld_list" in
9799         $xxx_convert*|*" $xxx_convert"*) ;;
9800         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9801         esac
9802     done
9803     : if sprintf cannot do long doubles, move it to the end
9804     if test "$d_PRIgldbl" != "$define"; then
9805         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9806     fi
9807     : if no qgcvt, remove it
9808     if test "$d_qgcvt" != "$define"; then
9809         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9810     fi
9811     : use the ld_list
9812     xxx_list="$xxx_ld_list"
9813     ;;
9814 esac
9815
9816 for xxx_convert in $xxx_list; do
9817         echo "Trying $xxx_convert..."
9818         $rm -f try try$_o core
9819         set try -DTRY_$xxx_convert
9820         if eval $compile; then
9821                 echo "$xxx_convert() found." >&4
9822                 if $run ./try; then
9823                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9824                         break;
9825                 else
9826                         echo "...But $xxx_convert didn't work as I expected."
9827                         xxx_convert=''
9828                 fi
9829         else
9830                 echo "$xxx_convert NOT found." >&4
9831         fi
9832 done
9833
9834 if test X$xxx_convert = X; then
9835     echo "*** WHOA THERE!!! ***" >&4
9836     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9837     xxx_convert=sprintf
9838 fi
9839
9840 case "$xxx_convert" in
9841 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9842 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9843 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9844 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9845    "$define$define$define")
9846       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9847    "$define$define$undef")
9848       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9849    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9850    esac
9851    ;;
9852 esac
9853
9854 fi
9855 $rm_try
9856
9857 : see if _fwalk exists
9858 set fwalk d__fwalk
9859 eval $inlibc
9860
9861 : Initialize h_fcntl
9862 h_fcntl=false
9863
9864 : Initialize h_sysfile
9865 h_sysfile=false
9866
9867 : access call always available on UNIX
9868 set access d_access
9869 eval $inlibc
9870
9871 : locate the flags for 'access()'
9872 case "$d_access" in
9873 "$define")
9874         echo " "
9875         $cat >access.c <<EOCP
9876 #include <sys/types.h>
9877 #ifdef I_FCNTL
9878 #include <fcntl.h>
9879 #endif
9880 #ifdef I_SYS_FILE
9881 #include <sys/file.h>
9882 #endif
9883 #ifdef I_UNISTD
9884 #include <unistd.h>
9885 #endif
9886 #$i_stdlib I_STDLIB
9887 #ifdef I_STDLIB
9888 #include <stdlib.h>
9889 #endif
9890 int main() {
9891         exit(R_OK);
9892 }
9893 EOCP
9894         : check sys/file.h first, no particular reason here
9895         if $test `./findhdr sys/file.h` && \
9896                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9897                 h_sysfile=true;
9898                 echo "<sys/file.h> defines the *_OK access constants." >&4
9899         elif $test `./findhdr fcntl.h` && \
9900                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9901                 h_fcntl=true;
9902                 echo "<fcntl.h> defines the *_OK access constants." >&4
9903         elif $test `./findhdr unistd.h` && \
9904                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9905                 echo "<unistd.h> defines the *_OK access constants." >&4
9906         else
9907                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9908         fi
9909         ;;
9910 esac
9911 $rm -f access*
9912
9913 : see if accessx exists
9914 set accessx d_accessx
9915 eval $inlibc
9916
9917 : see if aintl exists
9918 set aintl d_aintl
9919 eval $inlibc
9920
9921 : see if alarm exists
9922 set alarm d_alarm
9923 eval $inlibc
9924
9925 : see if 64bit time functions exists
9926
9927 set ctime64 d_ctime64
9928 eval $inlibc
9929
9930 set localtime64 d_localtime64
9931 eval $inlibc
9932
9933 set gmtime64 d_gmtime64
9934 eval $inlibc
9935
9936 set mktime64 d_mktime64
9937 eval $inlibc
9938
9939 set difftime64 d_difftime64
9940 eval $inlibc
9941
9942 set asctime64 d_asctime64
9943 eval $inlibc
9944
9945 : see if POSIX threads are available
9946 set pthread.h i_pthread
9947 eval $inhdr
9948
9949 : define a fucntion to check prototypes
9950 $cat > protochk <<EOSH
9951 $startsh
9952 cc="$cc"
9953 optimize="$optimize"
9954 ccflags="$ccflags"
9955 prototype="$prototype"
9956 define="$define"
9957 rm_try="$rm_try"
9958 usethreads=$usethreads
9959 i_pthread=$i_pthread
9960 pthread_h_first=$pthread_h_first
9961 EOSH
9962
9963 $cat >> protochk <<'EOSH'
9964
9965 $rm_try
9966 foo="$1"
9967 shift
9968 while test $# -ge 2; do
9969         case "$1" in
9970                 $define) echo "#include <$2>" >> try.c ;;
9971                 literal) echo "$2" >> try.c ;;
9972         esac
9973     # Extra magic for the benefit of systems that need pthread.h
9974     # to be included early to correctly detect threadsafe functions.
9975     # Such functions must guarantee themselves, though, that the usethreads
9976     # and i_pthread have been defined, before calling protochk.
9977     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9978         echo "#include <pthread.h>" >> try.c
9979         pthread_h_done=yes
9980     fi
9981     shift 2
9982 done
9983 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9984 cat >> try.c <<'EOCP'
9985 #ifdef CAN_PROTOTYPE
9986 #define _(args) args
9987 #else
9988 #define _(args) ()
9989 #endif
9990 EOCP
9991 echo "$foo" >> try.c
9992 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9993 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9994 status=$?
9995 $rm_try
9996 exit $status
9997 EOSH
9998 chmod +x protochk
9999 $eunicefix protochk
10000
10001 : Define hasproto macro for Configure internal use
10002 hasproto='varname=$1; func=$2; 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 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10010 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10011         echo "$func() prototype found.";
10012         val="$define";
10013 else
10014         echo "$func() prototype NOT found.";
10015         val="$undef";
10016 fi;
10017 set $varname;
10018 eval $setvar;
10019 $rm_try tryout.c'
10020
10021 : see if sys/types.h has to be included
10022 set sys/types.h i_systypes
10023 eval $inhdr
10024
10025 : see if sys/select.h has to be included
10026 set sys/select.h i_sysselct
10027 eval $inhdr
10028
10029 : Define hasfield macro for Configure internal use
10030 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10031 while $test $# -ge 2; do
10032         case "$1" in
10033         $define) echo "#include <$2>";;
10034         esac ;
10035     shift 2;
10036 done > try.c;
10037 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10038 set try;
10039 if eval $compile; then
10040         val="$define";
10041 else
10042         val="$undef";
10043 fi;
10044 set $varname;
10045 eval $setvar;
10046 $rm_try'
10047
10048 : see if we should include time.h, sys/time.h, or both
10049 echo " "
10050 if test "X$timeincl" = X; then
10051         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10052         $echo $n "I'm now running the test program...$c"
10053         $cat >try.c <<EOCP
10054 #include <sys/types.h>
10055 #ifdef I_TIME
10056 #include <time.h>
10057 #endif
10058 #ifdef I_SYSTIME
10059 #ifdef SYSTIMEKERNEL
10060 #define KERNEL
10061 #endif
10062 #include <sys/time.h>
10063 #endif
10064 #ifdef I_SYSSELECT
10065 #include <sys/select.h>
10066 #endif
10067 #$i_stdlib I_STDLIB
10068 #ifdef I_STDLIB
10069 #include <stdlib.h>
10070 #endif
10071 int main()
10072 {
10073         struct tm foo;
10074 #ifdef S_TIMEVAL
10075         struct timeval bar;
10076 #endif
10077 #ifdef S_TIMEZONE
10078         struct timezone tzp;
10079 #endif
10080         if (foo.tm_sec == foo.tm_sec)
10081                 exit(0);
10082 #ifdef S_TIMEVAL
10083         if (bar.tv_sec == bar.tv_sec)
10084                 exit(0);
10085 #endif
10086         exit(1);
10087 }
10088 EOCP
10089         flags=''
10090         for s_timezone in '-DS_TIMEZONE' ''; do
10091         sysselect=''
10092         for s_timeval in '-DS_TIMEVAL' ''; do
10093         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10094         for i_time in '' '-DI_TIME'; do
10095         for i_systime in '-DI_SYSTIME' ''; do
10096                 case "$flags" in
10097                 '') $echo $n ".$c"
10098                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10099                         if eval $compile; then
10100                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10101                                 shift
10102                                 flags="$*"
10103                                 echo " "
10104                                 $echo $n "Succeeded with $flags$c"
10105                         fi
10106                         ;;
10107                 esac
10108         done
10109         done
10110         done
10111         done
10112         done
10113         timeincl=''
10114         echo " "
10115         case "$flags" in
10116         *SYSTIMEKERNEL*) i_systimek="$define"
10117                 timeincl=`./findhdr sys/time.h`
10118                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10119         *) i_systimek="$undef";;
10120         esac
10121         case "$flags" in
10122         *I_TIME*) i_time="$define"
10123                 timeincl=`./findhdr time.h`" $timeincl"
10124                 echo "We'll include <time.h>." >&4;;
10125         *) i_time="$undef";;
10126         esac
10127         case "$flags" in
10128         *I_SYSTIME*) i_systime="$define"
10129                 timeincl=`./findhdr sys/time.h`" $timeincl"
10130                 echo "We'll include <sys/time.h>." >&4;;
10131         *) i_systime="$undef";;
10132         esac
10133         $rm_try
10134 fi
10135 : see if struct tm knows about tm_zone
10136 case "$i_systime$i_time" in
10137 *$define*)
10138         echo " "
10139         echo "Checking to see if your struct tm has tm_zone field..." >&4
10140         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10141         eval $hasfield
10142         ;;
10143 *)      val="$undef"
10144         set d_tm_tm_zone
10145         eval $setvar
10146         ;;
10147 esac
10148 case "$d_tm_tm_zone" in
10149 "$define")      echo "Yes, it does."   ;;
10150 *)              echo "No, it doesn't." ;;
10151 esac
10152 : see if struct tm knows about tm_gmtoff
10153 case "$i_systime$i_time" in
10154 *$define*)
10155         echo " "
10156         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10157         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10158         eval $hasfield
10159         ;;
10160 *)      val="$undef"
10161         set d_tm_tm_gmtoff
10162         eval $setvar
10163         ;;
10164 esac
10165 case "$d_tm_tm_gmtoff" in
10166 "$define")      echo "Yes, it does."   ;;
10167 *)              echo "No, it doesn't." ;;
10168 esac
10169
10170 : see if asctime_r exists
10171 set asctime_r d_asctime_r
10172 eval $inlibc
10173 case "$d_asctime_r" in
10174 "$define")
10175         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10176         case "$d_asctime_r_proto:$usethreads" in
10177         ":define")      d_asctime_r_proto=define
10178                 set d_asctime_r_proto asctime_r $hdrs
10179                 eval $hasproto ;;
10180         *)      ;;
10181         esac
10182         case "$d_asctime_r_proto" in
10183         define)
10184         case "$asctime_r_proto" in
10185         ''|0) try='char* asctime_r(const struct tm*, char*);'
10186         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10187         esac
10188         case "$asctime_r_proto" in
10189         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10190         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10191         esac
10192         case "$asctime_r_proto" in
10193         ''|0) try='int asctime_r(const struct tm*, char*);'
10194         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10195         esac
10196         case "$asctime_r_proto" in
10197         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10198         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10199         esac
10200         case "$asctime_r_proto" in
10201         ''|0)   d_asctime_r=undef
10202                 asctime_r_proto=0
10203                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10204         * )     case "$asctime_r_proto" in
10205                 REENTRANT_PROTO*) ;;
10206                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10207                 esac
10208                 echo "Prototype: $try" ;;
10209         esac
10210         ;;
10211         *)      case "$usethreads" in
10212                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10213                 esac
10214                 d_asctime_r=undef
10215                 asctime_r_proto=0
10216                 ;;
10217         esac
10218         ;;
10219 *)      asctime_r_proto=0
10220         ;;
10221 esac
10222
10223 : see if atolf exists
10224 set atolf d_atolf
10225 eval $inlibc
10226
10227 : see if atoll exists
10228 set atoll d_atoll
10229 eval $inlibc
10230
10231 : Look for GCC-style attribute format
10232 case "$d_attribute_format" in
10233 '')
10234 echo " "
10235 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10236 $cat >attrib.c <<'EOCP'
10237 #include <stdio.h>
10238 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10239 EOCP
10240 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10241         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10242                 echo "Your C compiler doesn't support __attribute__((format))."
10243                 val="$undef"
10244         else
10245                 echo "Your C compiler supports __attribute__((format))."
10246                 val="$define"
10247         fi
10248 else
10249         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10250         val="$undef"
10251 fi
10252 ;;
10253 *) val="$d_attribute_format" ;;
10254 esac
10255 set d_attribute_format
10256 eval $setvar
10257 $rm -f attrib*
10258
10259 : Look for GCC-style attribute format with null format allowed
10260 case "$d_printf_format_null" in
10261 '') case "$d_attribute_format" in
10262     $define)
10263         echo " "
10264         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10265 $cat >attrib.c <<EOCP
10266 #include <stdio.h>
10267 #$i_stdlib I_STDLIB
10268 #ifdef I_STDLIB
10269 #include <stdlib.h>
10270 #endif
10271 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10272 int null_printf (char* pat,...) { return (int)pat; }
10273 int main () { exit(null_printf(NULL)); }
10274 EOCP
10275         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10276             : run the executable in case it produces a run-time warning
10277             if $run ./attrib >>attrib.out 2>&1; then
10278                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10279                     echo "Your C compiler doesn't allow __printf__ format to be null."
10280                     val="$undef"
10281                 else
10282                     echo "Your C compiler allows __printf__ format to be null."
10283                     val="$define"
10284                 fi
10285             else
10286             echo "Your C compiler executable failed with __printf__ format null."
10287             val="$undef"
10288         fi
10289     else
10290         echo "Your C compiler fails with __printf__ format null."
10291         val="$undef"
10292     fi
10293     ;;
10294     *)  val="$undef" ;;
10295     esac
10296 ;;
10297 *)  val="$d_printf_format_null" ;;
10298 esac
10299 set d_printf_format_null
10300 eval $setvar
10301 $rm -f attrib*
10302
10303 : Look for GCC-style attribute malloc
10304 case "$d_attribute_malloc" in
10305 '')
10306 echo " "
10307 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10308 $cat >attrib.c <<'EOCP'
10309 #include <stdio.h>
10310 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
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__((malloc))."
10315                 val="$undef"
10316         else
10317                 echo "Your C compiler supports __attribute__((malloc))."
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_malloc" ;;
10326 esac
10327 set d_attribute_malloc
10328 eval $setvar
10329 $rm -f attrib*
10330
10331 : Look for GCC-style attribute nonnull
10332 case "$d_attribute_nonnull" in
10333 '')
10334 echo " "
10335 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10336 $cat >attrib.c <<'EOCP'
10337 #include <stdio.h>
10338 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
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__((nonnull))."
10343                 val="$undef"
10344         else
10345                 echo "Your C compiler supports __attribute__((nonnull))."
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_nonnull" ;;
10354 esac
10355 set d_attribute_nonnull
10356 eval $setvar
10357 $rm -f attrib*
10358
10359 : Look for GCC-style attribute noreturn
10360 case "$d_attribute_noreturn" in
10361 '')
10362 echo " "
10363 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10364 $cat >attrib.c <<'EOCP'
10365 #include <stdio.h>
10366 void fall_over_dead( void ) __attribute__((noreturn));
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__((noreturn))."
10371                 val="$undef"
10372         else
10373                 echo "Your C compiler supports __attribute__((noreturn))."
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_noreturn" ;;
10382 esac
10383 set d_attribute_noreturn
10384 eval $setvar
10385 $rm -f attrib*
10386
10387 : Look for GCC-style attribute pure
10388 case "$d_attribute_pure" in
10389 '')
10390 echo " "
10391 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10392 $cat >attrib.c <<'EOCP'
10393 #include <stdio.h>
10394 int square( int n ) __attribute__((pure));
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__((pure))."
10399                 val="$undef"
10400         else
10401                 echo "Your C compiler supports __attribute__((pure))."
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_pure" ;;
10410 esac
10411 set d_attribute_pure
10412 eval $setvar
10413 $rm -f attrib*
10414
10415 : Look for GCC-style attribute unused
10416 case "$d_attribute_unused" in
10417 '')
10418 echo " "
10419 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10420 $cat >attrib.c <<'EOCP'
10421 #include <stdio.h>
10422 int do_something( int dummy __attribute__((unused)), int n );
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__((unused))."
10427                 val="$undef"
10428         else
10429                 echo "Your C compiler supports __attribute__((unused))."
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_unused" ;;
10438 esac
10439 set d_attribute_unused
10440 eval $setvar
10441 $rm -f attrib*
10442
10443 : Look for GCC-style attribute warn_unused_result
10444 case "$d_attribute_warn_unused_result" in
10445 '')
10446 echo " "
10447 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10448 $cat >attrib.c <<'EOCP'
10449 #include <stdio.h>
10450 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10451 EOCP
10452 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10453         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10454                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10455                 val="$undef"
10456         else
10457                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10458                 val="$define"
10459         fi
10460 else
10461         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10462         val="$undef"
10463 fi
10464 ;;
10465 *) val="$d_attribute_warn_unused_result" ;;
10466 esac
10467 set d_attribute_warn_unused_result
10468 eval $setvar
10469 $rm -f attrib*
10470
10471 : see if bcmp exists
10472 set bcmp d_bcmp
10473 eval $inlibc
10474
10475 : see if bcopy exists
10476 set bcopy d_bcopy
10477 eval $inlibc
10478
10479 : see if getpgrp exists
10480 set getpgrp d_getpgrp
10481 eval $inlibc
10482
10483 case "$d_getpgrp" in
10484 "$define")
10485         echo " "
10486         echo "Checking to see which flavor of getpgrp is in use..."
10487         $cat >try.c <<EOP
10488 #$i_unistd I_UNISTD
10489 #include <sys/types.h>
10490 #ifdef I_UNISTD
10491 #  include <unistd.h>
10492 #endif
10493 #$i_stdlib I_STDLIB
10494 #ifdef I_STDLIB
10495 #include <stdlib.h>
10496 #endif
10497 int main()
10498 {
10499         if (getuid() == 0) {
10500                 printf("(I see you are running Configure as super-user...)\n");
10501                 setuid(1);
10502         }
10503 #ifdef TRY_BSD_PGRP
10504         if (getpgrp(1) == 0)
10505                 exit(0);
10506 #else
10507         if (getpgrp() > 0)
10508                 exit(0);
10509 #endif
10510         exit(1);
10511 }
10512 EOP
10513         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10514                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10515                 val="$define"
10516         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10517                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10518                 val="$undef"
10519         else
10520                 echo "I can't seem to compile and run the test program."
10521                 if ./usg; then
10522                         xxx="a USG one, i.e. you use getpgrp()."
10523                 else
10524                         # SVR4 systems can appear rather BSD-ish.
10525                         case "$i_unistd" in
10526                         $undef)
10527                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10528                                 val="$define"
10529                                 ;;
10530                         $define)
10531                                 xxx="probably a USG one, i.e. you use getpgrp()."
10532                                 val="$undef"
10533                                 ;;
10534                         esac
10535                 fi
10536                 echo "Assuming your getpgrp is $xxx" >&4
10537         fi
10538         ;;
10539 *) val="$undef";;
10540 esac
10541 set d_bsdgetpgrp
10542 eval $setvar
10543 $rm_try
10544
10545 : see if setpgrp exists
10546 set setpgrp d_setpgrp
10547 eval $inlibc
10548
10549 case "$d_setpgrp" in
10550 "$define")
10551         echo " "
10552         echo "Checking to see which flavor of setpgrp is in use..."
10553         $cat >try.c <<EOP
10554 #$i_unistd I_UNISTD
10555 #include <sys/types.h>
10556 #ifdef I_UNISTD
10557 #  include <unistd.h>
10558 #endif
10559 #$i_stdlib I_STDLIB
10560 #ifdef I_STDLIB
10561 #include <stdlib.h>
10562 #endif
10563 int main()
10564 {
10565         if (getuid() == 0) {
10566                 printf("(I see you are running Configure as super-user...)\n");
10567                 setuid(1);
10568         }
10569 #ifdef TRY_BSD_PGRP
10570         if (-1 == setpgrp(1, 1))
10571                 exit(0);
10572 #else
10573         if (setpgrp() != -1)
10574                 exit(0);
10575 #endif
10576         exit(1);
10577 }
10578 EOP
10579         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10580                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10581                 val="$define"
10582         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10583                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10584                 val="$undef"
10585         else
10586                 echo "(I can't seem to compile and run the test program.)"
10587                 if ./usg; then
10588                         xxx="a USG one, i.e. you use setpgrp()."
10589                 else
10590                         # SVR4 systems can appear rather BSD-ish.
10591                         case "$i_unistd" in
10592                         $undef)
10593                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10594                                 val="$define"
10595                                 ;;
10596                         $define)
10597                                 xxx="probably a USG one, i.e. you use setpgrp()."
10598                                 val="$undef"
10599                                 ;;
10600                         esac
10601                 fi
10602                 echo "Assuming your setpgrp is $xxx" >&4
10603         fi
10604         ;;
10605 *) val="$undef";;
10606 esac
10607 set d_bsdsetpgrp
10608 eval $setvar
10609 $rm_try
10610
10611 : Look for GCC-style __builtin_choose_expr
10612 case "$d_builtin_choose_expr" in
10613 '')
10614     echo " "
10615     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10616     $cat >try.c <<'EOCP'
10617 #include <assert.h>
10618 #include <stdlib.h>
10619 #include <stdio.h>
10620
10621 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10622
10623 int main(void) {
10624     assert( SYRINX(1) == 2112 );
10625     assert( SYRINX(1) != 5150 );
10626     assert( SYRINX(0) == 5150 );
10627     assert( SYRINX(0) != 2112 );
10628     puts( "All good!" );
10629     exit(0);
10630 }
10631
10632 EOCP
10633     set try
10634     if eval $compile && $run ./try; then
10635         echo "Your C compiler supports __builtin_choose_expr."
10636         val="$define"
10637     else
10638         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10639         val="$undef"
10640     fi
10641 ;;
10642 *) val="$d_builtin_choose_expr" ;;
10643 esac
10644
10645 set d_builtin_choose_expr
10646 eval $setvar
10647 $rm_try
10648
10649 : Look for GCC-style __builtin_expect
10650 case "$d_builtin_expect" in
10651 '')
10652     echo " "
10653     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10654     $cat >try.c <<'EOCP'
10655 int main(void) {
10656     int n = 50;
10657     if ( __builtin_expect(n, 0) ) n = 1;
10658     /* Remember shell exit code truth is 0, C truth is non-zero */
10659     return !(n == 1);
10660 }
10661 EOCP
10662     set try
10663     if eval $compile && $run ./try; then
10664         echo "Your C compiler supports __builtin_expect."
10665         val="$define"
10666     else
10667         echo "Your C compiler doesn't seem to understand __builtin_expect."
10668         val="$undef"
10669     fi
10670     ;;
10671 *) val="$d_builtin_expect" ;;
10672 esac
10673
10674 set d_builtin_expect
10675 eval $setvar
10676 $rm_try
10677
10678 : see if bzero exists
10679 set bzero d_bzero
10680 eval $inlibc
10681
10682 : see if stdarg is available
10683 echo " "
10684 if $test `./findhdr stdarg.h`; then
10685         echo "<stdarg.h> found." >&4
10686         valstd="$define"
10687 else
10688         echo "<stdarg.h> NOT found." >&4
10689         valstd="$undef"
10690 fi
10691
10692 : see if varags is available
10693 echo " "
10694 if $test `./findhdr varargs.h`; then
10695         echo "<varargs.h> found." >&4
10696 else
10697         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10698 fi
10699
10700 : set up the varargs testing programs
10701 $cat > varargs.c <<EOP
10702 #ifdef I_STDARG
10703 #include <stdarg.h>
10704 #endif
10705 #ifdef I_VARARGS
10706 #include <varargs.h>
10707 #endif
10708
10709 #ifdef I_STDARG
10710 int f(char *p, ...)
10711 #else
10712 int f(va_alist)
10713 va_dcl
10714 #endif
10715 {
10716         va_list ap;
10717 #ifndef I_STDARG
10718         char *p;
10719 #endif
10720 #ifdef I_STDARG
10721         va_start(ap,p);
10722 #else
10723         va_start(ap);
10724         p = va_arg(ap, char *);
10725 #endif
10726         va_end(ap);
10727         return 0;
10728 }
10729 EOP
10730 $cat > varargs <<EOP
10731 $startsh
10732 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10733         echo "true"
10734 else
10735         echo "false"
10736 fi
10737 $rm -f varargs$_o
10738 EOP
10739 chmod +x varargs
10740
10741 : now check which varargs header should be included
10742 echo " "
10743 i_varhdr=''
10744 case "$valstd" in
10745 "$define")
10746         if `./varargs I_STDARG`; then
10747                 val='stdarg.h'
10748         elif `./varargs I_VARARGS`; then
10749                 val='varargs.h'
10750         fi
10751         ;;
10752 *)
10753         if `./varargs I_VARARGS`; then
10754                 val='varargs.h'
10755         fi
10756         ;;
10757 esac
10758 case "$val" in
10759 '')
10760 echo "I could not find the definition for va_dcl... You have problems..." >&4
10761         val="$undef"; set i_stdarg; eval $setvar
10762         val="$undef"; set i_varargs; eval $setvar
10763         ;;
10764 *)
10765         set i_varhdr
10766         eval $setvar
10767         case "$i_varhdr" in
10768         stdarg.h)
10769                 val="$define"; set i_stdarg; eval $setvar
10770                 val="$undef"; set i_varargs; eval $setvar
10771                 ;;
10772         varargs.h)
10773                 val="$undef"; set i_stdarg; eval $setvar
10774                 val="$define"; set i_varargs; eval $setvar
10775                 ;;
10776         esac
10777         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10778 esac
10779 $rm -f varargs*
10780
10781 : see if the Compiler supports C99 variadic macros
10782 case "$i_stdarg$i_stdlib" in
10783     "$define$define")
10784     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10785     $cat >try.c <<EOCP
10786 #include <stdio.h>
10787 #include <stdarg.h>
10788
10789 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10790
10791 int main() {
10792   char buf[20];
10793   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10794   puts(buf);
10795   return 0;
10796 }
10797 EOCP
10798     set try
10799     if eval $compile && $run ./try 2>&1 >/dev/null; then
10800         case "`$run ./try`" in
10801             "123 456 789")
10802             echo "You have C99 variadic macros." >&4
10803             d_c99_variadic_macros="$define"
10804             ;;
10805             *)
10806             echo "You don't have functional C99 variadic macros." >&4
10807             d_c99_variadic_macros="$undef"
10808             ;;
10809         esac
10810     else
10811         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10812         d_c99_variadic_macros="$undef"
10813     fi
10814     $rm_try
10815     ;;
10816     *)
10817     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10818     d_c99_variadic_macros="$undef"
10819     ;;
10820 esac
10821
10822 : see if signal is declared as pointer to function returning int or void
10823 echo " "
10824 xxx=`./findhdr signal.h`
10825 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10826 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10827         echo "You have int (*signal())() instead of void." >&4
10828         val="$undef"
10829 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10830         echo "You have void (*signal())()." >&4
10831         val="$define"
10832 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10833         echo "You have int (*signal())() instead of void." >&4
10834         val="$undef"
10835 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10836         echo "You have void (*signal())()." >&4
10837         val="$define"
10838 else
10839         case "$d_voidsig" in
10840         '')
10841         echo "I can't determine whether signal handler returns void or int..." >&4
10842                 dflt=void
10843                 rp="What type does your signal handler return?"
10844                 . ./myread
10845                 case "$ans" in
10846                 v*) val="$define";;
10847                 *) val="$undef";;
10848                 esac;;
10849         "$define")
10850                 echo "As you already told me, signal handler returns void." >&4
10851                 val="$define"
10852                 ;;
10853         *)      echo "As you already told me, signal handler returns int." >&4
10854                 val="$undef"
10855                 ;;
10856         esac
10857 fi
10858 set d_voidsig
10859 eval $setvar
10860 case "$d_voidsig" in
10861 "$define") signal_t="void";;
10862 *) signal_t="int";;
10863 esac
10864 $rm -f $$.tmp
10865
10866 : check for ability to cast large floats to 32-bit ints.
10867 echo " "
10868 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10869 if $test "$intsize" -ge 4; then
10870         xxx=int
10871 else
10872         xxx=long
10873 fi
10874 $cat >try.c <<EOCP
10875 #include <stdio.h>
10876 #$i_stdlib I_STDLIB
10877 #ifdef I_STDLIB
10878 #include <stdlib.h>
10879 #endif
10880 #include <sys/types.h>
10881 #include <signal.h>
10882 $signal_t blech(int s) { exit(3); }
10883 int main()
10884 {
10885         $xxx i32;
10886         double f, g;
10887         int result = 0;
10888         char str[16];
10889         signal(SIGFPE, blech);
10890
10891         /* Don't let compiler optimize the test away.  Store the number
10892            in a writable string for gcc to pass to sscanf under HP/UX.
10893         */
10894         sprintf(str, "2147483647");
10895         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10896         g = 10 * f;
10897         i32  = ($xxx) g;
10898
10899         /* x86 processors will probably give 0x8000 0000, which is a
10900            sign change.  We don't want that.  We want to mimic SPARC
10901            behavior here, which is to preserve the sign and give
10902            back 0x7fff ffff.
10903         */
10904         if (i32 != ($xxx) f)
10905                 result |= 1;
10906         exit(result);
10907 }
10908 EOCP
10909 set try
10910 if eval $compile_ok; then
10911         $run ./try
10912         yyy=$?
10913 else
10914         echo "(I can't seem to compile the test program--assuming it can't)"
10915         yyy=1
10916 fi
10917 case "$yyy" in
10918 0)      val="$define"
10919         echo "Yup, it can."
10920         ;;
10921 *)      val="$undef"
10922         echo "Nope, it can't."
10923         ;;
10924 esac
10925 set d_casti32
10926 eval $setvar
10927 $rm_try
10928
10929 : check for ability to cast negative floats to unsigned
10930 echo " "
10931 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10932 $cat >try.c <<EOCP
10933 #include <stdio.h>
10934 #$i_stdlib I_STDLIB
10935 #ifdef I_STDLIB
10936 #include <stdlib.h>
10937 #endif
10938 #include <sys/types.h>
10939 #include <signal.h>
10940 $signal_t blech(int s) { exit(7); }
10941 $signal_t blech_in_list(int s) { exit(4); }
10942 unsigned long dummy_long(unsigned long p) { return p; }
10943 unsigned int dummy_int(unsigned int p) { return p; }
10944 unsigned short dummy_short(unsigned short p) { return p; }
10945 int main()
10946 {
10947         double f;
10948         unsigned long along;
10949         unsigned int aint;
10950         unsigned short ashort;
10951         int result = 0;
10952         char str[16];
10953
10954         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10955            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10956            optimized the whole file away
10957         */
10958         /* Store the number in a writable string for gcc to pass to
10959            sscanf under HP/UX.
10960         */
10961         sprintf(str, "-123");
10962         sscanf(str, "%lf", &f);  /* f = -123.; */
10963
10964         signal(SIGFPE, blech);
10965         along = (unsigned long)f;
10966         aint = (unsigned int)f;
10967         ashort = (unsigned short)f;
10968         if (along != (unsigned long)-123)
10969                 result |= 1;
10970         if (aint != (unsigned int)-123)
10971                 result |= 1;
10972         if (ashort != (unsigned short)-123)
10973                 result |= 1;
10974         sprintf(str, "1073741824.");
10975         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10976         f = f + f;
10977         along = 0;
10978         along = (unsigned long)f;
10979         if (along != 0x80000000)
10980                 result |= 2;
10981         f -= 1.;
10982         along = 0;
10983         along = (unsigned long)f;
10984         if (along != 0x7fffffff)
10985                 result |= 1;
10986         f += 2.;
10987         along = 0;
10988         along = (unsigned long)f;
10989         if (along != 0x80000001)
10990                 result |= 2;
10991         if (result)
10992                 exit(result);
10993         signal(SIGFPE, blech_in_list);
10994         sprintf(str, "123.");
10995         sscanf(str, "%lf", &f);  /* f = 123.; */
10996         along = dummy_long((unsigned long)f);
10997         aint = dummy_int((unsigned int)f);
10998         ashort = dummy_short((unsigned short)f);
10999         if (along != (unsigned long)123)
11000                 result |= 4;
11001         if (aint != (unsigned int)123)
11002                 result |= 4;
11003         if (ashort != (unsigned short)123)
11004                 result |= 4;
11005         exit(result);
11006
11007 }
11008 EOCP
11009 set try
11010 if eval $compile_ok; then
11011         $run ./try
11012         castflags=$?
11013 else
11014         echo "(I can't seem to compile the test program--assuming it can't)"
11015         castflags=7
11016 fi
11017 case "$castflags" in
11018 0)      val="$define"
11019         echo "Yup, it can."
11020         ;;
11021 *)      val="$undef"
11022         echo "Nope, it can't."
11023         ;;
11024 esac
11025 set d_castneg
11026 eval $setvar
11027 $rm_try
11028
11029 : see if vprintf exists
11030 echo " "
11031 if set vprintf val -f d_vprintf; eval $csym; $val; then
11032         echo 'vprintf() found.' >&4
11033         val="$define"
11034         $cat >try.c <<EOF
11035 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11036 #$i_varargs I_VARARGS
11037
11038 #$i_stdlib I_STDLIB
11039 #$i_unistd I_UNISTD
11040
11041 #ifdef I_STDARG
11042 #  include <stdarg.h>
11043 #else /* I_VARARGS */
11044 #  include <varargs.h>
11045 #endif
11046
11047 #ifdef I_UNISTD
11048 #  include <unistd.h>
11049 #endif
11050
11051 #ifdef I_STDLIB
11052 #  include <stdlib.h>
11053 #endif
11054
11055 #include <stdio.h> /* vsprintf prototype */
11056
11057 #ifdef I_STDARG
11058 void xxx(int n, ...)
11059 {
11060     va_list args;
11061     char buf[10];
11062     va_start(args, n);
11063     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11064 }
11065 int main() { xxx(1, "foo"); }
11066
11067 #else /* I_VARARGS */
11068
11069 xxx(va_alist)
11070 va_dcl
11071 {
11072     va_list args;
11073     char buf[10];
11074     va_start(args);
11075     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11076 }
11077 int main() { xxx("foo"); }
11078
11079 #endif
11080
11081 EOF
11082         set try
11083         if eval $compile_ok; then
11084                 if $run ./try; then
11085                         echo "Your vsprintf() returns (int)." >&4
11086                         val2="$undef"
11087                 else
11088                         echo "Your vsprintf() returns (char*)." >&4
11089                         val2="$define"
11090                 fi
11091         else
11092                 echo 'I am unable to compile the vsprintf() test program.' >&4
11093                 # We shouldn't get here.  If we do, assume the standard signature,
11094                 # not the old BSD one.
11095                 echo 'Guessing that vsprintf() returns (int).' >&4
11096                 val2="$undef"
11097         fi
11098 else
11099         echo 'vprintf() NOT found.' >&4
11100         val="$undef"
11101         val2="$undef"
11102 fi
11103 $rm_try
11104 set d_vprintf
11105 eval $setvar
11106 val=$val2
11107 set d_charvspr
11108 eval $setvar
11109
11110 : see if chown exists
11111 set chown d_chown
11112 eval $inlibc
11113
11114 : see if chroot exists
11115 set chroot d_chroot
11116 eval $inlibc
11117
11118 : see if chsize exists
11119 set chsize d_chsize
11120 eval $inlibc
11121
11122 : see if class exists
11123 set class d_class
11124 eval $inlibc
11125
11126 : see if clearenv exists
11127 set clearenv d_clearenv
11128 eval $inlibc
11129
11130 : Define hasstruct macro for Configure internal use
11131 hasstruct='varname=$1; struct=$2; shift; shift;
11132 while $test $# -ge 2; do
11133         case "$1" in
11134         $define) echo "#include <$2>";;
11135         esac ;
11136     shift 2;
11137 done > try.c;
11138 echo "int main () { struct $struct foo; }" >> try.c;
11139 set try;
11140 if eval $compile; then
11141         val="$define";
11142 else
11143         val="$undef";
11144 fi;
11145 set $varname;
11146 eval $setvar;
11147 $rm_try'
11148
11149 : see whether socket exists
11150 socketlib=''
11151 sockethdr=''
11152 echo " "
11153 $echo $n "Hmm... $c" >&4
11154 if set socket val -f d_socket; eval $csym; $val; then
11155         echo "Looks like you have Berkeley networking support." >&4
11156         d_socket="$define"
11157         if set setsockopt val -f; eval $csym; $val; then
11158                 d_oldsock="$undef"
11159         else
11160                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11161                 d_oldsock="$define"
11162         fi
11163 else
11164         if $contains socklib libc.list >/dev/null 2>&1; then
11165                 echo "Looks like you have Berkeley networking support." >&4
11166                 d_socket="$define"
11167                 : we will have to assume that it supports the 4.2 BSD interface
11168                 d_oldsock="$undef"
11169         else
11170                 echo "You don't have Berkeley networking in libc$_a..." >&4
11171                 if test "X$d_socket" = "X$define"; then
11172                    echo "...but you seem to believe that you have sockets." >&4
11173                 else
11174                         for net in net socket
11175                         do
11176                                 if test -f /usr/lib/lib$net$_a; then
11177                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11178                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11179                                         if $contains socket libc.list >/dev/null 2>&1; then
11180                                                 d_socket="$define"
11181                                                 socketlib="-l$net"
11182                                                 case "$net" in
11183                                                 net)
11184                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11185                                                         sockethdr="-I/usr/netinclude"
11186                                                         ;;
11187                                                 esac
11188                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11189                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11190                                                         d_oldsock="$undef"
11191                                                 else
11192                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11193                                                         d_oldsock="$define"
11194                                                 fi
11195                                                 break
11196                                         fi
11197                                 fi
11198                         done
11199                         if test "X$d_socket" != "X$define"; then
11200                            echo "or anywhere else I see." >&4
11201                            d_socket="$undef"
11202                            d_oldsock="$undef"
11203                         fi
11204                 fi
11205         fi
11206 fi
11207
11208 : see if socketpair exists
11209 set socketpair d_sockpair
11210 eval $inlibc
11211
11212
11213 echo " "
11214 echo "Checking the availability of certain socket constants..." >&4
11215 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11216         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11217         $cat >try.c <<EOF
11218 #include <sys/types.h>
11219 #include <sys/socket.h>
11220 int main() {
11221     int i = $ENUM;
11222 }
11223 EOF
11224         val="$undef"
11225         set try; if eval $compile; then
11226                 val="$define"
11227         fi
11228         set d_${enum}; eval $setvar
11229         $rm_try
11230 done
11231
11232 : see if this is a sys/uio.h system
11233 set sys/uio.h i_sysuio
11234 eval $inhdr
11235
11236 : Check for cmsghdr support
11237 echo " "
11238 echo "Checking to see if your system supports struct cmsghdr..." >&4
11239 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11240 eval $hasstruct
11241 case "$d_cmsghdr_s" in
11242 "$define")      echo "Yes, it does."   ;;
11243 *)              echo "No, it doesn't." ;;
11244 esac
11245
11246
11247 : check for const keyword
11248 echo " "
11249 echo 'Checking to see if your C compiler knows about "const"...' >&4
11250 $cat >const.c <<'EOCP'
11251 typedef struct spug { int drokk; } spug;
11252 int main()
11253 {
11254         const char *foo;
11255         const spug y = { 0 };
11256 }
11257 EOCP
11258 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11259         val="$define"
11260         echo "Yup, it does."
11261 else
11262         val="$undef"
11263         echo "Nope, it doesn't."
11264 fi
11265 set d_const
11266 eval $setvar
11267
11268 : see if copysignl exists
11269 set copysignl d_copysignl
11270 eval $inlibc
11271
11272 : see if crypt exists
11273 echo " "
11274 set crypt d_crypt
11275 eval $inlibc
11276 case "$d_crypt" in
11277 $define) cryptlib='' ;;
11278 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11279                 echo 'crypt() found.' >&4
11280                 val="$define"
11281                 cryptlib=''
11282         else
11283                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11284                 if $test -z "$cryptlib"; then
11285                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11286                 else
11287                         cryptlib=-lcrypt
11288                 fi
11289                 if $test -z "$cryptlib"; then
11290                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11291                 else
11292                         cryptlib=-lcrypt
11293                 fi
11294                 if $test -z "$cryptlib"; then
11295                         cryptlib=`./loc libcrypt$_a "" $libpth`
11296                 else
11297                         cryptlib=-lcrypt
11298                 fi
11299                 if $test -z "$cryptlib"; then
11300                         echo 'crypt() NOT found.' >&4
11301                         val="$undef"
11302                 else
11303                         val="$define"
11304                 fi
11305         fi
11306         set d_crypt
11307         eval $setvar
11308         ;;
11309 esac
11310
11311 : see if this is a crypt.h system
11312 set crypt.h i_crypt
11313 eval $inhdr
11314
11315 : see if crypt_r exists
11316 set crypt_r d_crypt_r
11317 eval $inlibc
11318 case "$d_crypt_r" in
11319 "$define")
11320         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11321         case "$d_crypt_r_proto:$usethreads" in
11322         ":define")      d_crypt_r_proto=define
11323                 set d_crypt_r_proto crypt_r $hdrs
11324                 eval $hasproto ;;
11325         *)      ;;
11326         esac
11327         case "$d_crypt_r_proto" in
11328         define)
11329         case "$crypt_r_proto" in
11330         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11331         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11332         esac
11333         case "$crypt_r_proto" in
11334         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11335         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11336         esac
11337         case "$crypt_r_proto" in
11338         ''|0)   d_crypt_r=undef
11339                 crypt_r_proto=0
11340                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11341         * )     case "$crypt_r_proto" in
11342                 REENTRANT_PROTO*) ;;
11343                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11344                 esac
11345                 echo "Prototype: $try" ;;
11346         esac
11347         ;;
11348         *)      case "$usethreads" in
11349                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11350                 esac
11351                 d_crypt_r=undef
11352                 crypt_r_proto=0
11353                 ;;
11354         esac
11355         ;;
11356 *)      crypt_r_proto=0
11357         ;;
11358 esac
11359
11360 : get csh whereabouts
11361 case "$csh" in
11362 'csh') val="$undef" ;;
11363 *) val="$define" ;;
11364 esac
11365 set d_csh
11366 eval $setvar
11367 : Respect a hint or command line value for full_csh.
11368 case "$full_csh" in
11369 '') full_csh=$csh ;;
11370 esac
11371
11372 : see if ctermid exists
11373 set ctermid d_ctermid
11374 eval $inlibc
11375
11376 : see if ctermid_r exists
11377 set ctermid_r d_ctermid_r
11378 eval $inlibc
11379 case "$d_ctermid_r" in
11380 "$define")
11381         hdrs="$i_systypes sys/types.h define stdio.h "
11382         case "$d_ctermid_r_proto:$usethreads" in
11383         ":define")      d_ctermid_r_proto=define
11384                 set d_ctermid_r_proto ctermid_r $hdrs
11385                 eval $hasproto ;;
11386         *)      ;;
11387         esac
11388         case "$d_ctermid_r_proto" in
11389         define)
11390         case "$ctermid_r_proto" in
11391         ''|0) try='char* ctermid_r(char*);'
11392         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11393         esac
11394         case "$ctermid_r_proto" in
11395         ''|0)   d_ctermid_r=undef
11396                 ctermid_r_proto=0
11397                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11398         * )     case "$ctermid_r_proto" in
11399                 REENTRANT_PROTO*) ;;
11400                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11401                 esac
11402                 echo "Prototype: $try" ;;
11403         esac
11404         ;;
11405         *)      case "$usethreads" in
11406                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11407                 esac
11408                 d_ctermid_r=undef
11409                 ctermid_r_proto=0
11410                 ;;
11411         esac
11412         ;;
11413 *)      ctermid_r_proto=0
11414         ;;
11415 esac
11416
11417 : see if ctime_r exists
11418 set ctime_r d_ctime_r
11419 eval $inlibc
11420 case "$d_ctime_r" in
11421 "$define")
11422         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11423         case "$d_ctime_r_proto:$usethreads" in
11424         ":define")      d_ctime_r_proto=define
11425                 set d_ctime_r_proto ctime_r $hdrs
11426                 eval $hasproto ;;
11427         *)      ;;
11428         esac
11429         case "$d_ctime_r_proto" in
11430         define)
11431         case "$ctime_r_proto" in
11432         ''|0) try='char* ctime_r(const time_t*, char*);'
11433         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11434         esac
11435         case "$ctime_r_proto" in
11436         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11437         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11438         esac
11439         case "$ctime_r_proto" in
11440         ''|0) try='int ctime_r(const time_t*, char*);'
11441         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11442         esac
11443         case "$ctime_r_proto" in
11444         ''|0) try='int ctime_r(const time_t*, char*, int);'
11445         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11446         esac
11447         case "$ctime_r_proto" in
11448         ''|0)   d_ctime_r=undef
11449                 ctime_r_proto=0
11450                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11451         * )     case "$ctime_r_proto" in
11452                 REENTRANT_PROTO*) ;;
11453                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11454                 esac
11455                 echo "Prototype: $try" ;;
11456         esac
11457         ;;
11458         *)      case "$usethreads" in
11459                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11460                 esac
11461                 d_ctime_r=undef
11462                 ctime_r_proto=0
11463                 ;;
11464         esac
11465         ;;
11466 *)      ctime_r_proto=0
11467         ;;
11468 esac
11469
11470 : see if cuserid exists
11471 set cuserid d_cuserid
11472 eval $inlibc
11473
11474 : see if this is a limits.h system
11475 set limits.h i_limits
11476 eval $inhdr
11477
11478 : see if this is a float.h system
11479 set float.h i_float
11480 eval $inhdr
11481
11482 : See if number of significant digits in a double precision number is known
11483 echo " "
11484 $cat >dbl_dig.c <<EOM
11485 #$i_limits I_LIMITS
11486 #$i_float I_FLOAT
11487 #ifdef I_LIMITS
11488 #include <limits.h>
11489 #endif
11490 #ifdef I_FLOAT
11491 #include <float.h>
11492 #endif
11493 #ifdef DBL_DIG
11494 printf("Contains DBL_DIG");
11495 #endif
11496 EOM
11497 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11498 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11499         echo "DBL_DIG found." >&4
11500         val="$define"
11501 else
11502         echo "DBL_DIG NOT found." >&4
11503         val="$undef"
11504 fi
11505 $rm -f dbl_dig.?
11506 set d_dbl_dig
11507 eval $setvar
11508
11509 : see if dbm.h is available
11510 : see if dbmclose exists
11511 set dbmclose d_dbmclose
11512 eval $inlibc
11513
11514 case "$d_dbmclose" in
11515 $define)
11516         set dbm.h i_dbm
11517         eval $inhdr
11518         case "$i_dbm" in
11519         $define)
11520                 val="$undef"
11521                 set i_rpcsvcdbm
11522                 eval $setvar
11523                 ;;
11524         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11525                 eval $inhdr
11526                 ;;
11527         esac
11528         ;;
11529 *)      echo "We won't be including <dbm.h>"
11530         val="$undef"
11531         set i_dbm
11532         eval $setvar
11533         val="$undef"
11534         set i_rpcsvcdbm
11535         eval $setvar
11536         ;;
11537 esac
11538
11539 : see if prototype for dbminit is available
11540 echo " "
11541 set d_dbminitproto dbminit $i_dbm dbm.h
11542 eval $hasproto
11543
11544 : see if difftime exists
11545 set difftime d_difftime
11546 eval $inlibc
11547
11548 : see if this is a dirent system
11549 echo " "
11550 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11551         val="$define"
11552         echo "<dirent.h> found." >&4
11553 else
11554         val="$undef"
11555         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11556                 echo "<sys/dir.h> found." >&4
11557                 echo " "
11558         else
11559                 xinc=`./findhdr sys/ndir.h`
11560         fi
11561         echo "<dirent.h> NOT found." >&4
11562 fi
11563 set i_dirent
11564 eval $setvar
11565
11566 : Look for type of directory structure.
11567 echo " "
11568 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11569
11570 case "$direntrytype" in
11571 ''|' ')
11572         case "$i_dirent" in
11573         $define) guess1='struct dirent' ;;
11574         *) guess1='struct direct'  ;;
11575         esac
11576         ;;
11577 *)      guess1="$direntrytype"
11578         ;;
11579 esac
11580
11581 case "$guess1" in
11582 'struct dirent') guess2='struct direct' ;;
11583 *) guess2='struct dirent' ;;
11584 esac
11585
11586 if $contains "$guess1" try.c >/dev/null 2>&1; then
11587         direntrytype="$guess1"
11588         echo "Your directory entries are $direntrytype." >&4
11589 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11590         direntrytype="$guess2"
11591         echo "Your directory entries seem to be $direntrytype." >&4
11592 else
11593         echo "I don't recognize your system's directory entries." >&4
11594         rp="What type is used for directory entries on this system?"
11595         dflt="$guess1"
11596         . ./myread
11597         direntrytype="$ans"
11598 fi
11599 $rm_try
11600
11601 : see if the directory entry stores field length
11602 echo " "
11603 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11604 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11605         echo "Good, your directory entry keeps length information in d_namlen." >&4
11606         val="$define"
11607 else
11608         echo "Your directory entry does not know about the d_namlen field." >&4
11609         val="$undef"
11610 fi
11611 set d_dirnamlen
11612 eval $setvar
11613 $rm_try
11614
11615 : Look for DIR.dd_fd
11616 case "$i_dirent" in
11617 "$define")
11618     echo "Checking to see if DIR has a dd_fd member variable" >&4
11619     $cat >try.c <<EOCP
11620 #$i_stdlib I_STDLIB
11621 #ifdef I_STDLIB
11622 #include <stdlib.h>
11623 #endif
11624 #include <dirent.h>
11625
11626 int main() {
11627     DIR dir;
11628     dir.dd_fd = 1;
11629     return 0;
11630 }
11631 EOCP
11632     val=$undef
11633     set try
11634     if eval $compile; then
11635         echo "Yes, it does."
11636         val="$define"
11637     else
11638         echo "No, it does not."
11639         val="$undef"
11640     fi
11641     ;;
11642 *)
11643     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11644     val="$undef"
11645     ;;
11646 esac
11647 set d_dir_dd_fd
11648 eval $setvar
11649 $rm_try
11650
11651 : see if this is an sysdir system
11652 set sys/dir.h i_sysdir
11653 eval $inhdr
11654
11655 : see if this is an sysndir system
11656 set sys/ndir.h i_sysndir
11657 eval $inhdr
11658
11659 : Look for dirfd
11660 echo " "
11661 $cat >dirfd.c <<EOM
11662 #include <stdio.h>
11663 #$i_stdlib I_STDLIB
11664 #ifdef I_STDLIB
11665 #include <stdlib.h>
11666 #endif
11667 #$i_dirent I_DIRENT             /**/
11668 #$i_sysdir I_SYS_DIR            /**/
11669 #$i_sysndir I_SYS_NDIR          /**/
11670 #$i_systypes I_SYS_TYPES        /**/
11671 #if defined(I_SYS_TYPES)
11672 #include <sys/types.h>
11673 #endif
11674 #if defined(I_DIRENT)
11675 #include <dirent.h>
11676 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11677 #include <sys/dir.h>
11678 #endif
11679 #else
11680 #ifdef I_SYS_NDIR
11681 #include <sys/ndir.h>
11682 #else
11683 #ifdef I_SYS_DIR
11684 #ifdef hp9000s500
11685 #include <ndir.h>       /* may be wrong in the future */
11686 #else
11687 #include <sys/dir.h>
11688 #endif
11689 #endif
11690 #endif
11691 #endif 
11692 int main() {
11693         DIR *dirp = opendir(".");
11694         if (dirfd(dirp) >= 0)
11695                 exit(0);
11696         else
11697                 exit(1);
11698 }
11699 EOM
11700 val=$undef
11701 set dirfd
11702 if eval $compile; then
11703         val="$define"
11704 fi
11705 case "$val" in
11706 $define)        echo "dirfd() found." >&4       ;;
11707 *)              echo "dirfd() NOT found." >&4   ;;
11708 esac
11709 set d_dirfd
11710 eval $setvar
11711 $rm -f dirfd*
11712
11713 : see if dlerror exists
11714 xxx_runnm="$runnm"
11715 runnm=false
11716 set dlerror d_dlerror
11717 eval $inlibc
11718 runnm="$xxx_runnm"
11719
11720 : see if dlfcn is available
11721 set dlfcn.h i_dlfcn
11722 eval $inhdr
11723
11724 : Check what extension to use for shared libs
11725 case "$usedl" in
11726 $define|y|true)
11727         $cat << EOM
11728
11729 On a few systems, the dynamically loaded modules that perl generates and uses
11730 will need a different extension than shared libs. The default will probably
11731 be appropriate.
11732
11733 EOM
11734         case "$dlext" in
11735         '')     dflt="$so" ;;
11736         *)      dflt="$dlext" ;;
11737         esac
11738         rp='What is the extension of dynamically loaded modules'
11739         . ./myread
11740         dlext="$ans"
11741         ;;
11742 *)
11743         dlext="none"
11744         ;;
11745 esac
11746
11747 : Check if dlsym need a leading underscore
11748 echo " "
11749 val="$undef"
11750
11751 case "$dlsrc" in
11752 dl_dlopen.xs)
11753         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11754         $cat >dyna.c <<'EOM'
11755 fred () { }
11756 EOM
11757
11758 $cat >fred.c<<EOM
11759
11760 #include <stdio.h>
11761 #$i_stdlib I_STDLIB
11762 #ifdef I_STDLIB
11763 #include <stdlib.h>
11764 #endif
11765 #$i_dlfcn I_DLFCN
11766 #ifdef I_DLFCN
11767 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11768 #else
11769 #include <sys/types.h>
11770 #include <nlist.h>
11771 #include <link.h>
11772 #endif
11773
11774 extern int fred() ;
11775
11776 int main()
11777 {
11778     void * handle ;
11779     void * symbol ;
11780 #ifndef RTLD_LAZY
11781     int mode = 1 ;
11782 #else
11783     int mode = RTLD_LAZY ;
11784 #endif
11785     handle = dlopen("./dyna.$dlext", mode) ;
11786     if (handle == NULL) {
11787         printf ("1\n") ;
11788         fflush (stdout) ;
11789         exit(0);
11790     }
11791     symbol = dlsym(handle, "fred") ;
11792     if (symbol == NULL) {
11793         /* try putting a leading underscore */
11794         symbol = dlsym(handle, "_fred") ;
11795         if (symbol == NULL) {
11796             printf ("2\n") ;
11797             fflush (stdout) ;
11798             exit(0);
11799         }
11800         printf ("3\n") ;
11801     }
11802     else
11803         printf ("4\n") ;
11804     fflush (stdout) ;
11805     exit(0);
11806 }
11807 EOM
11808         : Call the object file tmp-dyna.o in case dlext=o.
11809         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11810                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11811                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11812                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11813                 xxx=`$run ./fred`
11814                 case $xxx in
11815                 1)      echo "Test program failed using dlopen." >&4
11816                         echo "Perhaps you should not use dynamic loading." >&4;;
11817                 2)      echo "Test program failed using dlsym." >&4
11818                         echo "Perhaps you should not use dynamic loading." >&4;;
11819                 3)      echo "dlsym needs a leading underscore" >&4
11820                         val="$define" ;;
11821                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11822                 esac
11823         else
11824                 echo "I can't compile and run the test program." >&4
11825                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11826         fi
11827         ;;
11828 esac
11829
11830 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11831
11832 set d_dlsymun
11833 eval $setvar
11834
11835 : see if drand48_r exists
11836 set drand48_r d_drand48_r
11837 eval $inlibc
11838 case "$d_drand48_r" in
11839 "$define")
11840         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11841         case "$d_drand48_r_proto:$usethreads" in
11842         ":define")      d_drand48_r_proto=define
11843                 set d_drand48_r_proto drand48_r $hdrs
11844                 eval $hasproto ;;
11845         *)      ;;
11846         esac
11847         case "$d_drand48_r_proto" in
11848         define)
11849         case "$drand48_r_proto" in
11850         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11851         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11852         esac
11853         case "$drand48_r_proto" in
11854         ''|0)   d_drand48_r=undef
11855                 drand48_r_proto=0
11856                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11857         * )     case "$drand48_r_proto" in
11858                 REENTRANT_PROTO*) ;;
11859                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11860                 esac
11861                 echo "Prototype: $try" ;;
11862         esac
11863         ;;
11864         *)      case "$usethreads" in
11865                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11866                 esac
11867                 d_drand48_r=undef
11868                 drand48_r_proto=0
11869                 ;;
11870         esac
11871         ;;
11872 *)      drand48_r_proto=0
11873         ;;
11874 esac
11875
11876 : see if prototype for drand48 is available
11877 echo " "
11878 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11879 eval $hasproto
11880
11881 : see if dup2 exists
11882 set dup2 d_dup2
11883 eval $inlibc
11884
11885 : see if eaccess exists
11886 set eaccess d_eaccess
11887 eval $inlibc
11888
11889 : see if endgrent exists
11890 set endgrent d_endgrent
11891 eval $inlibc
11892
11893 : see if this is an grp system
11894 set grp.h i_grp
11895 eval $inhdr
11896
11897 case "$i_grp" in
11898 $define)
11899         xxx=`./findhdr grp.h`
11900         $cppstdin $cppflags $cppminus < $xxx >$$.h
11901
11902         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11903                 val="$define"
11904         else
11905                 val="$undef"
11906         fi
11907         set d_grpasswd
11908         eval $setvar
11909
11910         $rm -f $$.h
11911         ;;
11912 *)
11913         val="$undef";
11914         set d_grpasswd; eval $setvar
11915         ;;
11916 esac
11917
11918 : see if endgrent_r exists
11919 set endgrent_r d_endgrent_r
11920 eval $inlibc
11921 case "$d_endgrent_r" in
11922 "$define")
11923         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11924         case "$d_endgrent_r_proto:$usethreads" in
11925         ":define")      d_endgrent_r_proto=define
11926                 set d_endgrent_r_proto endgrent_r $hdrs
11927                 eval $hasproto ;;
11928         *)      ;;
11929         esac
11930         case "$d_endgrent_r_proto" in
11931         define)
11932         case "$endgrent_r_proto" in
11933         ''|0) try='int endgrent_r(FILE**);'
11934         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11935         esac
11936         case "$endgrent_r_proto" in
11937         ''|0) try='void endgrent_r(FILE**);'
11938         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11939         esac
11940         case "$endgrent_r_proto" in
11941         ''|0)   d_endgrent_r=undef
11942                 endgrent_r_proto=0
11943                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11944         * )     case "$endgrent_r_proto" in
11945                 REENTRANT_PROTO*) ;;
11946                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11947                 esac
11948                 echo "Prototype: $try" ;;
11949         esac
11950         ;;
11951         *)      case "$usethreads" in
11952                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11953                 esac
11954                 d_endgrent_r=undef
11955                 endgrent_r_proto=0
11956                 ;;
11957         esac
11958         ;;
11959 *)      endgrent_r_proto=0
11960         ;;
11961 esac
11962
11963 : see if endhostent exists
11964 set endhostent d_endhent
11965 eval $inlibc
11966
11967 : see if this is a netdb.h system
11968 set netdb.h i_netdb
11969 eval $inhdr
11970
11971 : see if endhostent_r exists
11972 set endhostent_r d_endhostent_r
11973 eval $inlibc
11974 case "$d_endhostent_r" in
11975 "$define")
11976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11977         case "$d_endhostent_r_proto:$usethreads" in
11978         ":define")      d_endhostent_r_proto=define
11979                 set d_endhostent_r_proto endhostent_r $hdrs
11980                 eval $hasproto ;;
11981         *)      ;;
11982         esac
11983         case "$d_endhostent_r_proto" in
11984         define)
11985         case "$endhostent_r_proto" in
11986         ''|0) try='int endhostent_r(struct hostent_data*);'
11987         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11988         esac
11989         case "$endhostent_r_proto" in
11990         ''|0) try='void endhostent_r(struct hostent_data*);'
11991         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11992         esac
11993         case "$endhostent_r_proto" in
11994         ''|0)   d_endhostent_r=undef
11995                 endhostent_r_proto=0
11996                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11997         * )     case "$endhostent_r_proto" in
11998                 REENTRANT_PROTO*) ;;
11999                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12000                 esac
12001                 echo "Prototype: $try" ;;
12002         esac
12003         ;;
12004         *)      case "$usethreads" in
12005                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12006                 esac
12007                 d_endhostent_r=undef
12008                 endhostent_r_proto=0
12009                 ;;
12010         esac
12011         ;;
12012 *)      endhostent_r_proto=0
12013         ;;
12014 esac
12015
12016 : see if endnetent exists
12017 set endnetent d_endnent
12018 eval $inlibc
12019
12020 : see if endnetent_r exists
12021 set endnetent_r d_endnetent_r
12022 eval $inlibc
12023 case "$d_endnetent_r" in
12024 "$define")
12025         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12026         case "$d_endnetent_r_proto:$usethreads" in
12027         ":define")      d_endnetent_r_proto=define
12028                 set d_endnetent_r_proto endnetent_r $hdrs
12029                 eval $hasproto ;;
12030         *)      ;;
12031         esac
12032         case "$d_endnetent_r_proto" in
12033         define)
12034         case "$endnetent_r_proto" in
12035         ''|0) try='int endnetent_r(struct netent_data*);'
12036         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
12037         esac
12038         case "$endnetent_r_proto" in
12039         ''|0) try='void endnetent_r(struct netent_data*);'
12040         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12041         esac
12042         case "$endnetent_r_proto" in
12043         ''|0)   d_endnetent_r=undef
12044                 endnetent_r_proto=0
12045                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12046         * )     case "$endnetent_r_proto" in
12047                 REENTRANT_PROTO*) ;;
12048                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12049                 esac
12050                 echo "Prototype: $try" ;;
12051         esac
12052         ;;
12053         *)      case "$usethreads" in
12054                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12055                 esac
12056                 d_endnetent_r=undef
12057                 endnetent_r_proto=0
12058                 ;;
12059         esac
12060         ;;
12061 *)      endnetent_r_proto=0
12062         ;;
12063 esac
12064
12065 : see if endprotoent exists
12066 set endprotoent d_endpent
12067 eval $inlibc
12068
12069 : see if endprotoent_r exists
12070 set endprotoent_r d_endprotoent_r
12071 eval $inlibc
12072 case "$d_endprotoent_r" in
12073 "$define")
12074         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12075         case "$d_endprotoent_r_proto:$usethreads" in
12076         ":define")      d_endprotoent_r_proto=define
12077                 set d_endprotoent_r_proto endprotoent_r $hdrs
12078                 eval $hasproto ;;
12079         *)      ;;
12080         esac
12081         case "$d_endprotoent_r_proto" in
12082         define)
12083         case "$endprotoent_r_proto" in
12084         ''|0) try='int endprotoent_r(struct protoent_data*);'
12085         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12086         esac
12087         case "$endprotoent_r_proto" in
12088         ''|0) try='void endprotoent_r(struct protoent_data*);'
12089         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12090         esac
12091         case "$endprotoent_r_proto" in
12092         ''|0)   d_endprotoent_r=undef
12093                 endprotoent_r_proto=0
12094                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12095         * )     case "$endprotoent_r_proto" in
12096                 REENTRANT_PROTO*) ;;
12097                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12098                 esac
12099                 echo "Prototype: $try" ;;
12100         esac
12101         ;;
12102         *)      case "$usethreads" in
12103                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12104                 esac
12105                 d_endprotoent_r=undef
12106                 endprotoent_r_proto=0
12107                 ;;
12108         esac
12109         ;;
12110 *)      endprotoent_r_proto=0
12111         ;;
12112 esac
12113
12114 : see if endpwent exists
12115 set endpwent d_endpwent
12116 eval $inlibc
12117
12118 : see if this is a pwd.h system
12119 set pwd.h i_pwd
12120 eval $inhdr
12121
12122 case "$i_pwd" in
12123 $define)
12124         xxx=`./findhdr pwd.h`
12125         $cppstdin $cppflags $cppminus < $xxx >$$.h
12126
12127         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12128                 val="$define"
12129         else
12130                 val="$undef"
12131         fi
12132         set d_pwquota
12133         eval $setvar
12134
12135         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12136                 val="$define"
12137         else
12138                 val="$undef"
12139         fi
12140         set d_pwage
12141         eval $setvar
12142
12143         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12144                 val="$define"
12145         else
12146                 val="$undef"
12147         fi
12148         set d_pwchange
12149         eval $setvar
12150
12151         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12152                 val="$define"
12153         else
12154                 val="$undef"
12155         fi
12156         set d_pwclass
12157         eval $setvar
12158
12159         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12160                 val="$define"
12161         else
12162                 val="$undef"
12163         fi
12164         set d_pwexpire
12165         eval $setvar
12166
12167         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12168                 val="$define"
12169         else
12170                 val="$undef"
12171         fi
12172         set d_pwcomment
12173         eval $setvar
12174
12175         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12176                 val="$define"
12177         else
12178                 val="$undef"
12179         fi
12180         set d_pwgecos
12181         eval $setvar
12182
12183         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12184                 val="$define"
12185         else
12186                 val="$undef"
12187         fi
12188         set d_pwpasswd
12189         eval $setvar
12190
12191         $rm -f $$.h
12192         ;;
12193 *)
12194         val="$undef"; 
12195         set d_pwquota; eval $setvar
12196         set d_pwage; eval $setvar
12197         set d_pwchange; eval $setvar
12198         set d_pwclass; eval $setvar
12199         set d_pwexpire; eval $setvar
12200         set d_pwcomment; eval $setvar
12201         set d_pwgecos; eval $setvar
12202         set d_pwpasswd; eval $setvar
12203         ;;
12204 esac
12205
12206 : see if endpwent_r exists
12207 set endpwent_r d_endpwent_r
12208 eval $inlibc
12209 case "$d_endpwent_r" in
12210 "$define")
12211         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12212         case "$d_endpwent_r_proto:$usethreads" in
12213         ":define")      d_endpwent_r_proto=define
12214                 set d_endpwent_r_proto endpwent_r $hdrs
12215                 eval $hasproto ;;
12216         *)      ;;
12217         esac
12218         case "$d_endpwent_r_proto" in
12219         define)
12220         case "$endpwent_r_proto" in
12221         ''|0) try='int endpwent_r(FILE**);'
12222         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12223         esac
12224         case "$endpwent_r_proto" in
12225         ''|0) try='void endpwent_r(FILE**);'
12226         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12227         esac
12228         case "$endpwent_r_proto" in
12229         ''|0)   d_endpwent_r=undef
12230                 endpwent_r_proto=0
12231                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12232         * )     case "$endpwent_r_proto" in
12233                 REENTRANT_PROTO*) ;;
12234                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12235                 esac
12236                 echo "Prototype: $try" ;;
12237         esac
12238         ;;
12239         *)      case "$usethreads" in
12240                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12241                 esac
12242                 d_endpwent_r=undef
12243                 endpwent_r_proto=0
12244                 ;;
12245         esac
12246         ;;
12247 *)      endpwent_r_proto=0
12248         ;;
12249 esac
12250
12251 : see if endservent exists
12252 set endservent d_endsent
12253 eval $inlibc
12254
12255 : see if endservent_r exists
12256 set endservent_r d_endservent_r
12257 eval $inlibc
12258 case "$d_endservent_r" in
12259 "$define")
12260         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12261         case "$d_endservent_r_proto:$usethreads" in
12262         ":define")      d_endservent_r_proto=define
12263                 set d_endservent_r_proto endservent_r $hdrs
12264                 eval $hasproto ;;
12265         *)      ;;
12266         esac
12267         case "$d_endservent_r_proto" in
12268         define)
12269         case "$endservent_r_proto" in
12270         ''|0) try='int endservent_r(struct servent_data*);'
12271         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12272         esac
12273         case "$endservent_r_proto" in
12274         ''|0) try='void endservent_r(struct servent_data*);'
12275         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12276         esac
12277         case "$endservent_r_proto" in
12278         ''|0)   d_endservent_r=undef
12279                 endservent_r_proto=0
12280                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12281         * )     case "$endservent_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_endservent_r=undef
12292                 endservent_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      endservent_r_proto=0
12297         ;;
12298 esac
12299
12300 : Locate the flags for 'open()'
12301 echo " "
12302 $cat >try.c <<EOCP
12303 #include <sys/types.h>
12304 #ifdef I_FCNTL
12305 #include <fcntl.h>
12306 #endif
12307 #ifdef I_SYS_FILE
12308 #include <sys/file.h>
12309 #endif
12310 #$i_stdlib I_STDLIB
12311 #ifdef I_STDLIB
12312 #include <stdlib.h>
12313 #endif
12314 int main() {
12315         if(O_RDONLY);
12316 #ifdef O_TRUNC
12317         exit(0);
12318 #else
12319         exit(1);
12320 #endif
12321 }
12322 EOCP
12323 : check sys/file.h first to get FREAD on Sun
12324 if $test `./findhdr sys/file.h` && \
12325                 set try -DI_SYS_FILE && eval $compile; then
12326         h_sysfile=true;
12327         echo "<sys/file.h> defines the O_* constants..." >&4
12328         if $run ./try; then
12329                 echo "and you have the 3 argument form of open()." >&4
12330                 val="$define"
12331         else
12332                 echo "but not the 3 argument form of open().  Oh, well." >&4
12333                 val="$undef"
12334         fi
12335 elif $test `./findhdr fcntl.h` && \
12336                 set try -DI_FCNTL && eval $compile; then
12337         h_fcntl=true;
12338         echo "<fcntl.h> defines the O_* constants..." >&4
12339         if $run ./try; then
12340                 echo "and you have the 3 argument form of open()." >&4
12341                 val="$define"
12342         else
12343                 echo "but not the 3 argument form of open().  Oh, well." >&4
12344                 val="$undef"
12345         fi
12346 else
12347         val="$undef"
12348         echo "I can't find the O_* constant definitions!  You got problems." >&4
12349 fi
12350 set d_open3
12351 eval $setvar
12352 $rm_try
12353
12354 : script used to emit important warnings
12355 cat >warn <<EOS
12356 $startsh
12357 if test \$# -gt 0; then
12358         echo "\$@" >msg
12359 else
12360         cat >msg
12361 fi
12362 echo "*** WARNING:" >&4
12363 sed -e 's/^/*** /' <msg >&4
12364 echo "*** " >&4
12365 cat msg >>config.msg
12366 echo " " >>config.msg
12367 rm -f msg
12368 EOS
12369 chmod +x warn
12370 $eunicefix warn
12371
12372 : see which of string.h or strings.h is needed
12373 echo " "
12374 strings=`./findhdr string.h`
12375 if $test "$strings" && $test -r "$strings"; then
12376         echo "Using <string.h> instead of <strings.h>." >&4
12377         val="$define"
12378 else
12379         val="$undef"
12380         strings=`./findhdr strings.h`
12381         if $test "$strings" && $test -r "$strings"; then
12382                 echo "Using <strings.h> instead of <string.h>." >&4
12383         else
12384                 ./warn "No string header found -- You'll surely have problems."
12385         fi
12386 fi
12387 set i_string
12388 eval $setvar
12389 case "$i_string" in
12390 "$undef") strings=`./findhdr strings.h`;;
12391 *)        strings=`./findhdr string.h`;;
12392 esac
12393
12394 : see if this is a sys/file.h system
12395 val=''
12396 set sys/file.h val
12397 eval $inhdr
12398
12399 : do we need to include sys/file.h ?
12400 case "$val" in
12401 "$define")
12402         echo " "
12403         if $h_sysfile; then
12404                 val="$define"
12405                 echo "We'll be including <sys/file.h>." >&4
12406         else
12407                 val="$undef"
12408                 echo "We won't be including <sys/file.h>." >&4
12409         fi
12410         ;;
12411 *)
12412         h_sysfile=false
12413         ;;
12414 esac
12415 set i_sysfile
12416 eval $setvar
12417
12418 : see if fcntl.h is there
12419 val=''
12420 set fcntl.h val
12421 eval $inhdr
12422
12423 : see if we can include fcntl.h
12424 case "$val" in
12425 "$define")
12426         echo " "
12427         if $h_fcntl; then
12428                 val="$define"
12429                 echo "We'll be including <fcntl.h>." >&4
12430         else
12431                 val="$undef"
12432                 if $h_sysfile; then
12433         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12434                 else
12435                         echo "We won't be including <fcntl.h>." >&4
12436                 fi
12437         fi
12438         ;;
12439 *)
12440         h_fcntl=false
12441         val="$undef"
12442         ;;
12443 esac
12444 set i_fcntl
12445 eval $setvar
12446
12447 : see if fork exists
12448 set fork d_fork
12449 eval $inlibc
12450
12451 : see if pipe exists
12452 set pipe d_pipe
12453 eval $inlibc
12454
12455 : check for non-blocking I/O stuff
12456 case "$h_sysfile" in
12457 true) echo "#include <sys/file.h>" > head.c;;
12458 *)
12459        case "$h_fcntl" in
12460        true) echo "#include <fcntl.h>" > head.c;;
12461        *) echo "#include <sys/fcntl.h>" > head.c;;
12462        esac
12463        ;;
12464 esac
12465 echo " "
12466 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12467 case "$o_nonblock" in
12468 '')
12469         $cat head.c > try.c
12470         $cat >>try.c <<EOCP
12471 #include <stdio.h>
12472 #$i_stdlib I_STDLIB
12473 #ifdef I_STDLIB
12474 #include <stdlib.h>
12475 #endif
12476 #$i_fcntl I_FCNTL
12477 #ifdef I_FCNTL
12478 #include <fcntl.h>
12479 #endif
12480 int main() {
12481 #ifdef O_NONBLOCK
12482         printf("O_NONBLOCK\n");
12483         exit(0);
12484 #endif
12485 #ifdef O_NDELAY
12486         printf("O_NDELAY\n");
12487         exit(0);
12488 #endif
12489 #ifdef FNDELAY
12490         printf("FNDELAY\n");
12491         exit(0);
12492 #endif
12493         exit(0);
12494 }
12495 EOCP
12496         set try
12497         if eval $compile_ok; then
12498                 o_nonblock=`$run ./try`
12499                 case "$o_nonblock" in
12500                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12501                 *) echo "Seems like we can use $o_nonblock.";;
12502                 esac
12503         else
12504                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12505         fi
12506         ;;
12507 *) echo "Using $hint value $o_nonblock.";;
12508 esac
12509 $rm_try
12510
12511 echo " "
12512 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12513 case "$eagain" in
12514 '')
12515         case "$d_fork:$d_pipe" in
12516         define:define)
12517         $cat head.c > try.c
12518         $cat >>try.c <<EOCP
12519 #include <errno.h>
12520 #include <sys/types.h>
12521 #include <signal.h>
12522 #include <stdio.h>
12523 #$i_stdlib I_STDLIB
12524 #ifdef I_STDLIB
12525 #include <stdlib.h>
12526 #endif
12527 #$i_fcntl I_FCNTL
12528 #ifdef I_FCNTL
12529 #include <fcntl.h>
12530 #endif
12531 #define MY_O_NONBLOCK $o_nonblock
12532 #ifndef errno  /* XXX need better Configure test */
12533 extern int errno;
12534 #endif
12535 #$i_unistd I_UNISTD
12536 #ifdef I_UNISTD
12537 #include <unistd.h>
12538 #endif
12539 #$i_string I_STRING
12540 #ifdef I_STRING
12541 #include <string.h>
12542 #else
12543 #include <strings.h>
12544 #endif
12545 $signal_t blech(int x) { exit(3); }
12546 EOCP
12547         $cat >> try.c <<'EOCP'
12548 int main()
12549 {
12550         int pd[2];
12551         int pu[2];
12552         char buf[1];
12553         char string[100];
12554
12555         pipe(pd);       /* Down: child -> parent */
12556         pipe(pu);       /* Up: parent -> child */
12557         if (0 != fork()) {
12558                 int ret;
12559                 close(pd[1]);   /* Parent reads from pd[0] */
12560                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12561 #ifdef F_SETFL
12562                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12563                         exit(1);
12564 #else
12565                 exit(4);
12566 #endif
12567                 signal(SIGALRM, blech);
12568                 alarm(5);
12569                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12570                         exit(2);
12571                 sprintf(string, "%d\n", ret);
12572                 write(2, string, strlen(string));
12573                 alarm(0);
12574 #ifdef EAGAIN
12575                 if (errno == EAGAIN) {
12576                         printf("EAGAIN\n");
12577                         goto ok;
12578                 }
12579 #endif
12580 #ifdef EWOULDBLOCK
12581                 if (errno == EWOULDBLOCK)
12582                         printf("EWOULDBLOCK\n");
12583 #endif
12584         ok:
12585                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12586                 sleep(2);                               /* Give it time to close our pipe */
12587                 alarm(5);
12588                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12589                 alarm(0);
12590                 sprintf(string, "%d\n", ret);
12591                 write(4, string, strlen(string));
12592                 exit(0);
12593         }
12594
12595         close(pd[0]);                   /* We write to pd[1] */
12596         close(pu[1]);                   /* We read from pu[0] */
12597         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12598         close(pd[1]);                   /* Pipe pd is now fully closed! */
12599         exit(0);                                /* Bye bye, thank you for playing! */
12600 }
12601 EOCP
12602         set try
12603         if eval $compile_ok; then
12604                 echo "$startsh" >mtry
12605                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12606                 chmod +x mtry
12607                 ./mtry >/dev/null 2>&1
12608                 case $? in
12609                 0) eagain=`$cat try.out`;;
12610                 1) echo "Could not perform non-blocking setting!";;
12611                 2) echo "I did a successful read() for something that was not there!";;
12612                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12613                 4) echo "Could not find F_SETFL!";;
12614                 *) echo "Something terribly wrong happened during testing.";;
12615                 esac
12616                 rd_nodata=`$cat try.ret`
12617                 echo "A read() system call with no data present returns $rd_nodata."
12618                 case "$rd_nodata" in
12619                 0|-1) ;;
12620                 *)
12621                         echo "(That's peculiar, fixing that to be -1.)"
12622                         rd_nodata=-1
12623                         ;;
12624                 esac
12625                 case "$eagain" in
12626                 '')
12627                         echo "Forcing errno EAGAIN on read() with no data available."
12628                         eagain=EAGAIN
12629                         ;;
12630                 *)
12631                         echo "Your read() sets errno to $eagain when no data is available."
12632                         ;;
12633                 esac
12634                 status=`$cat try.err`
12635                 case "$status" in
12636                 0) echo "And it correctly returns 0 to signal EOF.";;
12637                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12638                 *) echo "However, your read() returns '$status' on EOF??";;
12639                 esac
12640                 val="$define"
12641                 if test "$status" = "$rd_nodata"; then
12642                         echo "WARNING: you can't distinguish between EOF and no data!"
12643                         val="$undef"
12644                 fi
12645         else
12646                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12647                 eagain=EAGAIN
12648         fi
12649         ;;
12650         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12651                 eagain=EAGAIN
12652                 val="$define"
12653                 ;;
12654         esac
12655         set d_eofnblk
12656         eval $setvar
12657         ;;
12658 *)
12659         echo "Using $hint value $eagain."
12660         echo "Your read() returns $rd_nodata when no data is present."
12661         case "$d_eofnblk" in
12662         "$define") echo "And you can see EOF because read() returns 0.";;
12663         "$undef") echo "But you can't see EOF status from read() returned value.";;
12664         *)
12665                 echo "(Assuming you can't see EOF status from read anyway.)"
12666                 d_eofnblk=$undef
12667                 ;;
12668         esac
12669         ;;
12670 esac
12671 $rm_try head.c mtry
12672
12673 : see if _ptr and _cnt from stdio act std
12674 echo " "
12675
12676 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12677         echo "(Looks like you have stdio.h from BSD.)"
12678         case "$stdio_ptr" in
12679         '') stdio_ptr='((fp)->_p)'
12680                 ptr_lval=$define
12681                 ;;
12682         *)      ptr_lval=$d_stdio_ptr_lval;;
12683         esac
12684         case "$stdio_cnt" in
12685         '') stdio_cnt='((fp)->_r)'
12686                 cnt_lval=$define
12687                 ;;
12688         *)      cnt_lval=$d_stdio_cnt_lval;;
12689         esac
12690         case "$stdio_base" in
12691         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12692         esac
12693         case "$stdio_bufsiz" in
12694         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12695         esac
12696 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12697         echo "(Looks like you have stdio.h from Linux.)"
12698         case "$stdio_ptr" in
12699         '') stdio_ptr='((fp)->_IO_read_ptr)'
12700                 ptr_lval=$define
12701                 ;;
12702         *)      ptr_lval=$d_stdio_ptr_lval;;
12703         esac
12704         case "$stdio_cnt" in
12705         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12706                 cnt_lval=$undef
12707                 ;;
12708         *)      cnt_lval=$d_stdio_cnt_lval;;
12709         esac
12710         case "$stdio_base" in
12711         '') stdio_base='((fp)->_IO_read_base)';;
12712         esac
12713         case "$stdio_bufsiz" in
12714         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12715         esac
12716 else
12717         case "$stdio_ptr" in
12718         '') stdio_ptr='((fp)->_ptr)'
12719                 ptr_lval=$define
12720                 ;;
12721         *)      ptr_lval=$d_stdio_ptr_lval;;
12722         esac
12723         case "$stdio_cnt" in
12724         '') stdio_cnt='((fp)->_cnt)'
12725                 cnt_lval=$define
12726                 ;;
12727         *)      cnt_lval=$d_stdio_cnt_lval;;
12728         esac
12729         case "$stdio_base" in
12730         '') stdio_base='((fp)->_base)';;
12731         esac
12732         case "$stdio_bufsiz" in
12733         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12734         esac
12735 fi
12736
12737 : test whether _ptr and _cnt really work
12738 echo "Checking how std your stdio is..." >&4
12739 $cat >try.c <<EOP
12740 #include <stdio.h>
12741 #$i_stdlib I_STDLIB
12742 #ifdef I_STDLIB
12743 #include <stdlib.h>
12744 #endif
12745 #define FILE_ptr(fp)    $stdio_ptr
12746 #define FILE_cnt(fp)    $stdio_cnt
12747 int main() {
12748         FILE *fp = fopen("try.c", "r");
12749         char c = getc(fp);
12750         if (
12751                 18 <= FILE_cnt(fp) &&
12752                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12753         )
12754                 exit(0);
12755         exit(1);
12756 }
12757 EOP
12758 val="$undef"
12759 set try
12760 if eval $compile && $to try.c; then
12761         if $run ./try; then
12762                 echo "Your stdio acts pretty std."
12763                 val="$define"
12764         else
12765                 echo "Your stdio isn't very std."
12766         fi
12767 else
12768         echo "Your stdio doesn't appear very std."
12769 fi
12770 $rm_try
12771
12772 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12773 # direct buffer manipulation no longer works.  The Configure tests
12774 # should be changed to correctly detect this, but until then,
12775 # the following check should at least let perl compile and run.
12776 # (This quick fix should be updated before 5.8.1.)
12777 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12778 # A. Dougherty, June 3, 2002.
12779 case "$d_gnulibc" in
12780 $define)
12781         case "$gnulibc_version" in
12782         2.[01]*)  ;;
12783         2.2) ;;
12784         2.2.[0-9]) ;;
12785         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12786                 val="$undef"
12787                 ;;
12788         esac
12789         ;;
12790 esac
12791 set d_stdstdio
12792 eval $setvar
12793
12794 : Can _ptr be used as an lvalue?
12795 case "$d_stdstdio$ptr_lval" in
12796 $define$define) val=$define ;;
12797 *) val=$undef ;;
12798 esac
12799 set d_stdio_ptr_lval
12800 eval $setvar
12801
12802 : Can _cnt be used as an lvalue?
12803 case "$d_stdstdio$cnt_lval" in
12804 $define$define) val=$define ;;
12805 *) val=$undef ;;
12806 esac
12807 set d_stdio_cnt_lval
12808 eval $setvar
12809
12810
12811 : test whether setting _ptr sets _cnt as a side effect
12812 d_stdio_ptr_lval_sets_cnt="$undef"
12813 d_stdio_ptr_lval_nochange_cnt="$undef"
12814 case "$d_stdio_ptr_lval$d_stdstdio" in
12815 $define$define)
12816         echo "Checking to see what happens if we set the stdio ptr..." >&4
12817 $cat >try.c <<EOP
12818 #include <stdio.h>
12819 /* Can we scream? */
12820 /* Eat dust sed :-) */
12821 /* In the buffer space, no one can hear you scream. */
12822 #$i_stdlib I_STDLIB
12823 #ifdef I_STDLIB
12824 #include <stdlib.h>
12825 #endif
12826 #define FILE_ptr(fp)    $stdio_ptr
12827 #define FILE_cnt(fp)    $stdio_cnt
12828 #include <sys/types.h>
12829 int main() {
12830         FILE *fp = fopen("try.c", "r");
12831         int c;
12832         char *ptr;
12833         size_t cnt;
12834         if (!fp) {
12835             puts("Fail even to read");
12836             exit(1);
12837         }
12838         c = getc(fp); /* Read away the first # */
12839         if (c == EOF) {
12840             puts("Fail even to read");
12841             exit(1);
12842         }
12843         if (!(
12844                 18 <= FILE_cnt(fp) &&
12845                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12846         )) {
12847                 puts("Fail even to read");
12848                 exit (1);
12849         }
12850         ptr = (char*) FILE_ptr(fp);
12851         cnt = (size_t)FILE_cnt(fp);
12852
12853         FILE_ptr(fp) += 42;
12854
12855         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12856                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12857                 exit (1);
12858         }
12859         if (FILE_cnt(fp) <= 20) {
12860                 printf ("Fail (<20 chars to test)");
12861                 exit (1);
12862         }
12863         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12864                 puts("Fail compare");
12865                 exit (1);
12866         }
12867         if (cnt == FILE_cnt(fp)) {
12868                 puts("Pass_unchanged");
12869                 exit (0);
12870         }
12871         if (FILE_cnt(fp) == (cnt - 42)) {
12872                 puts("Pass_changed");
12873                 exit (0);
12874         }
12875         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12876         return 1;
12877
12878 }
12879 EOP
12880         set try
12881         if eval $compile && $to try.c; then
12882                 case `$run ./try` in
12883                 Pass_changed)
12884                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12885                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12886                 Pass_unchanged)
12887                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12888                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12889                 Fail*)
12890                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12891                 *)
12892                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12893         esac
12894         else
12895                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12896         fi
12897         $rm_try
12898         ;;
12899 esac
12900
12901 : see if _base is also standard
12902 val="$undef"
12903 case "$d_stdstdio" in
12904 $define)
12905         $cat >try.c <<EOP
12906 #include <stdio.h>
12907 #$i_stdlib I_STDLIB
12908 #ifdef I_STDLIB
12909 #include <stdlib.h>
12910 #endif
12911 #define FILE_base(fp)   $stdio_base
12912 #define FILE_bufsiz(fp) $stdio_bufsiz
12913 int main() {
12914         FILE *fp = fopen("try.c", "r");
12915         char c = getc(fp);
12916         if (
12917                 19 <= FILE_bufsiz(fp) &&
12918                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12919         )
12920                 exit(0);
12921         exit(1);
12922 }
12923 EOP
12924         set try
12925         if eval $compile && $to try.c; then
12926                 if $run ./try; then
12927                         echo "And its _base field acts std."
12928                         val="$define"
12929                 else
12930                         echo "But its _base field isn't std."
12931                 fi
12932         else
12933                 echo "However, it seems to be lacking the _base field."
12934         fi
12935         $rm_try
12936         ;;
12937 esac
12938 set d_stdiobase
12939 eval $setvar
12940
12941 : see if fast_stdio exists
12942 val="$undef"
12943 case "$d_stdstdio:$d_stdio_ptr_lval" in
12944 "$define:$define")
12945         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12946         *$define*)
12947                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12948                 val="$define"
12949                 ;;
12950         esac
12951         ;;
12952 esac
12953 set d_faststdio
12954 eval $setvar
12955
12956
12957
12958 : see if fchdir exists
12959 set fchdir d_fchdir
12960 eval $inlibc
12961
12962 : see if fchmod exists
12963 set fchmod d_fchmod
12964 eval $inlibc
12965
12966 : see if fchown exists
12967 set fchown d_fchown
12968 eval $inlibc
12969
12970 : see if this is an fcntl system
12971 set fcntl d_fcntl
12972 eval $inlibc
12973
12974 : See if fcntl-based locking works.
12975 echo " "
12976 $cat >try.c <<EOCP
12977 #$i_stdlib I_STDLIB
12978 #ifdef I_STDLIB
12979 #include <stdlib.h>
12980 #endif
12981 #include <unistd.h>
12982 #include <fcntl.h>
12983 #include <signal.h>
12984 $signal_t blech(int x) { exit(3); }
12985 int main() {
12986 #if defined(F_SETLK) && defined(F_SETLKW)
12987      struct flock flock;
12988      int retval, fd;
12989      fd = open("try.c", O_RDONLY);
12990      flock.l_type = F_RDLCK;
12991      flock.l_whence = SEEK_SET;
12992      flock.l_start = flock.l_len = 0;
12993      signal(SIGALRM, blech);
12994      alarm(10);
12995      retval = fcntl(fd, F_SETLK, &flock);
12996      close(fd);
12997      (retval < 0 ? exit(2) : exit(0));
12998 #else
12999      exit(2);
13000 #endif
13001 }
13002 EOCP
13003 echo "Checking if fcntl-based file locking works... "
13004 case "$d_fcntl" in
13005 "$define")
13006         set try
13007         if eval $compile_ok; then
13008                 if $run ./try; then
13009                         echo "Yes, it seems to work."
13010                         val="$define"
13011                 else
13012                         echo "Nope, it didn't work."
13013                         val="$undef"
13014                         case "$?" in
13015                         3) $cat >&4 <<EOM
13016 ***
13017 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13018 *** This is (almost) impossible.
13019 *** If your NFS lock daemons are not feeling well, something like
13020 *** this may happen, please investigate.  Cannot continue, aborting.
13021 ***
13022 EOM
13023                                 exit 1
13024                                 ;;
13025                         esac
13026                 fi
13027         else
13028                 echo "I'm unable to compile the test program, so I'll assume not."
13029                 val="$undef"
13030         fi
13031         ;;
13032 *) val="$undef";
13033         echo "Nope, since you don't even have fcntl()."
13034         ;;
13035 esac
13036 set d_fcntl_can_lock
13037 eval $setvar
13038 $rm_try
13039
13040 : check for fd_set items
13041 $cat <<EOM
13042
13043 Checking to see how well your C compiler handles fd_set and friends ...
13044 EOM
13045 $cat >try.c <<EOCP
13046 #$i_stdlib I_STDLIB
13047 #ifdef I_STDLIB
13048 #include <stdlib.h>
13049 #endif
13050 #$i_systime I_SYS_TIME
13051 #$i_sysselct I_SYS_SELECT
13052 #$d_socket HAS_SOCKET
13053 #include <sys/types.h>
13054 #ifdef HAS_SOCKET
13055 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13056 #endif
13057 #ifdef I_SYS_TIME
13058 #include <sys/time.h>
13059 #endif
13060 #ifdef I_SYS_SELECT
13061 #include <sys/select.h>
13062 #endif
13063 int main() {
13064         fd_set fds;
13065
13066 #ifdef TRYBITS
13067         if(fds.fds_bits);
13068 #endif
13069
13070 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13071         exit(0);
13072 #else
13073         exit(1);
13074 #endif
13075 }
13076 EOCP
13077 set try -DTRYBITS
13078 if eval $compile; then
13079         d_fds_bits="$define"
13080         d_fd_set="$define"
13081         echo "Well, your system knows about the normal fd_set typedef..." >&4
13082         if $run ./try; then
13083                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13084                 d_fd_macros="$define"
13085         else
13086                 $cat >&4 <<'EOM'
13087 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13088 EOM
13089                 d_fd_macros="$undef"
13090         fi
13091 else
13092         $cat <<'EOM'
13093 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13094 EOM
13095         set try
13096         if eval $compile; then
13097                 d_fds_bits="$undef"
13098                 d_fd_set="$define"
13099                 echo "Well, your system has some sort of fd_set available..." >&4
13100                 if $run ./try; then
13101                         echo "and you have the normal fd_set macros." >&4
13102                         d_fd_macros="$define"
13103                 else
13104                         $cat <<'EOM'
13105 but not the normal fd_set macros!  Gross!  More work for me...
13106 EOM
13107                         d_fd_macros="$undef"
13108                 fi
13109         else
13110         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13111                 d_fd_set="$undef"
13112                 d_fds_bits="$undef"
13113                 d_fd_macros="$undef"
13114         fi
13115 fi
13116 $rm_try
13117
13118 : see if fgetpos exists
13119 set fgetpos d_fgetpos
13120 eval $inlibc
13121
13122 : see if finite exists
13123 set finite d_finite
13124 eval $inlibc
13125
13126 : see if finitel exists
13127 set finitel d_finitel
13128 eval $inlibc
13129
13130 : see if flock exists
13131 set flock d_flock
13132 eval $inlibc
13133
13134 : see if prototype for flock is available
13135 echo " "
13136 set d_flockproto flock $i_sysfile sys/file.h
13137 eval $hasproto
13138
13139 : see if fp_class exists
13140 set fp_class d_fp_class
13141 eval $inlibc
13142
13143 : see if pathconf exists
13144 set pathconf d_pathconf
13145 eval $inlibc
13146
13147 : see if fpathconf exists
13148 set fpathconf d_fpathconf
13149 eval $inlibc
13150
13151 : see if fpclass exists
13152 set fpclass d_fpclass
13153 eval $inlibc
13154
13155 : see if fpclassify exists
13156 set fpclassify d_fpclassify
13157 eval $inlibc
13158
13159 : see if fpclassl exists
13160 set fpclassl d_fpclassl
13161 eval $inlibc
13162
13163 : check for fpos64_t
13164 echo " "
13165 echo "Checking to see if you have fpos64_t..." >&4
13166 $cat >try.c <<EOCP
13167 #include <stdio.h>
13168 int main() { fpos64_t x = 7; }
13169 EOCP
13170 set try
13171 if eval $compile; then
13172         val="$define"
13173         echo "You have fpos64_t."
13174 else
13175         val="$undef"
13176         echo "You do not have fpos64_t."
13177         case "$fpossize" in
13178         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13179         esac
13180 fi
13181 $rm_try
13182 set d_fpos64_t
13183 eval $setvar
13184
13185 : see if frexpl exists
13186 set frexpl d_frexpl
13187 eval $inlibc
13188
13189 : see if this is a sys/param system
13190 set sys/param.h i_sysparam
13191 eval $inhdr
13192
13193 : see if this is a sys/mount.h system
13194 set sys/mount.h i_sysmount
13195 eval $inhdr
13196
13197 : Check for fs_data_s
13198 echo " "
13199 echo "Checking to see if your system supports struct fs_data..." >&4
13200 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13201 eval $hasstruct
13202 case "$d_fs_data_s" in
13203 "$define")      echo "Yes, it does."   ;;
13204 *)              echo "No, it doesn't." ;;
13205 esac
13206
13207 : see if fseeko exists
13208 set fseeko d_fseeko
13209 eval $inlibc
13210 case "$longsize" in
13211 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13212 esac
13213
13214 : see if fsetpos exists
13215 set fsetpos d_fsetpos
13216 eval $inlibc
13217
13218 : see if fstatfs exists
13219 set fstatfs d_fstatfs
13220 eval $inlibc
13221
13222 : see if statvfs exists
13223 set statvfs d_statvfs
13224 eval $inlibc
13225
13226 : see if fstatvfs exists
13227 set fstatvfs d_fstatvfs
13228 eval $inlibc
13229
13230
13231 : see if fsync exists
13232 set fsync d_fsync
13233 eval $inlibc
13234
13235 : see if ftello exists
13236 set ftello d_ftello
13237 eval $inlibc
13238 case "$longsize" in
13239 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13240 esac
13241
13242 : check for a working futimes
13243 d_futimes="$undef"
13244 echo " "
13245 echo "Checking if you have a working futimes()" >&4
13246 $cat >try.c <<EOCP
13247 #include <stdio.h>
13248 #include <sys/time.h>
13249 #include <errno.h>
13250 #include <fcntl.h>
13251
13252 int main ()
13253 {
13254     int fd, rv;
13255     fd = open ("try.c", O_RDWR);
13256     if (-1 == fd) exit (1);
13257     rv = futimes (fd, NULL);
13258     exit (rv == -1 ? errno : 0);
13259 }
13260 EOCP
13261 set try
13262 if eval $compile; then
13263     `$run ./try`
13264     rc=$?
13265     case "$rc" in
13266         0)  echo "Yes, you have" >&4
13267             d_futimes="$define"
13268             ;;
13269         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13270             ;;
13271     esac
13272 else
13273     echo "No, it does not (probably harmless)" >&4
13274 fi
13275 $rm_try
13276
13277 : see if getcwd exists
13278 set getcwd d_getcwd
13279 eval $inlibc
13280
13281 : see if getespwnam exists
13282 set getespwnam d_getespwnam
13283 eval $inlibc
13284
13285 : see if getfsstat exists
13286 set getfsstat d_getfsstat
13287 eval $inlibc
13288
13289 : see if getgrent exists
13290 set getgrent d_getgrent
13291 eval $inlibc
13292
13293 : see if getgrent_r exists
13294 set getgrent_r d_getgrent_r
13295 eval $inlibc
13296 case "$d_getgrent_r" in
13297 "$define")
13298         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13299         case "$d_getgrent_r_proto:$usethreads" in
13300         ":define")      d_getgrent_r_proto=define
13301                 set d_getgrent_r_proto getgrent_r $hdrs
13302                 eval $hasproto ;;
13303         *)      ;;
13304         esac
13305         case "$d_getgrent_r_proto" in
13306         define)
13307         case "$getgrent_r_proto" in
13308         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13309         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13310         esac
13311         case "$getgrent_r_proto" in
13312         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13313         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13314         esac
13315         case "$getgrent_r_proto" in
13316         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13317         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13318         esac
13319         case "$getgrent_r_proto" in
13320         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13321         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13322         esac
13323         case "$getgrent_r_proto" in
13324         ''|0) try='int getgrent_r(struct group*, char*, int);'
13325         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13326         esac
13327         case "$getgrent_r_proto" in
13328         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13329         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13330         esac
13331         case "$getgrent_r_proto" in
13332         ''|0)   d_getgrent_r=undef
13333                 getgrent_r_proto=0
13334                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13335         * )     case "$getgrent_r_proto" in
13336                 REENTRANT_PROTO*) ;;
13337                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13338                 esac
13339                 echo "Prototype: $try" ;;
13340         esac
13341         ;;
13342         *)      case "$usethreads" in
13343                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13344                 esac
13345                 d_getgrent_r=undef
13346                 getgrent_r_proto=0
13347                 ;;
13348         esac
13349         ;;
13350 *)      getgrent_r_proto=0
13351         ;;
13352 esac
13353
13354 : see if getgrgid_r exists
13355 set getgrgid_r d_getgrgid_r
13356 eval $inlibc
13357 case "$d_getgrgid_r" in
13358 "$define")
13359         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13360         case "$d_getgrgid_r_proto:$usethreads" in
13361         ":define")      d_getgrgid_r_proto=define
13362                 set d_getgrgid_r_proto getgrgid_r $hdrs
13363                 eval $hasproto ;;
13364         *)      ;;
13365         esac
13366         case "$d_getgrgid_r_proto" in
13367         define)
13368         case "$getgrgid_r_proto" in
13369         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13370         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13371         esac
13372         case "$getgrgid_r_proto" in
13373         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13374         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13375         esac
13376         case "$getgrgid_r_proto" in
13377         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13378         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13379         esac
13380         case "$getgrgid_r_proto" in
13381         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13382         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13383         esac
13384         case "$getgrgid_r_proto" in
13385         ''|0)   d_getgrgid_r=undef
13386                 getgrgid_r_proto=0
13387                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13388         * )     case "$getgrgid_r_proto" in
13389                 REENTRANT_PROTO*) ;;
13390                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13391                 esac
13392                 echo "Prototype: $try" ;;
13393         esac
13394         ;;
13395         *)      case "$usethreads" in
13396                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13397                 esac
13398                 d_getgrgid_r=undef
13399                 getgrgid_r_proto=0
13400                 ;;
13401         esac
13402         ;;
13403 *)      getgrgid_r_proto=0
13404         ;;
13405 esac
13406
13407 : see if getgrnam_r exists
13408 set getgrnam_r d_getgrnam_r
13409 eval $inlibc
13410 case "$d_getgrnam_r" in
13411 "$define")
13412         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13413         case "$d_getgrnam_r_proto:$usethreads" in
13414         ":define")      d_getgrnam_r_proto=define
13415                 set d_getgrnam_r_proto getgrnam_r $hdrs
13416                 eval $hasproto ;;
13417         *)      ;;
13418         esac
13419         case "$d_getgrnam_r_proto" in
13420         define)
13421         case "$getgrnam_r_proto" in
13422         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13423         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13424         esac
13425         case "$getgrnam_r_proto" in
13426         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13427         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13428         esac
13429         case "$getgrnam_r_proto" in
13430         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13431         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13432         esac
13433         case "$getgrnam_r_proto" in
13434         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13435         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13436         esac
13437         case "$getgrnam_r_proto" in
13438         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13439         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13440         esac
13441         case "$getgrnam_r_proto" in
13442         ''|0)   d_getgrnam_r=undef
13443                 getgrnam_r_proto=0
13444                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13445         * )     case "$getgrnam_r_proto" in
13446                 REENTRANT_PROTO*) ;;
13447                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13448                 esac
13449                 echo "Prototype: $try" ;;
13450         esac
13451         ;;
13452         *)      case "$usethreads" in
13453                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13454                 esac
13455                 d_getgrnam_r=undef
13456                 getgrnam_r_proto=0
13457                 ;;
13458         esac
13459         ;;
13460 *)      getgrnam_r_proto=0
13461         ;;
13462 esac
13463
13464 : see if gethostbyaddr exists
13465 set gethostbyaddr d_gethbyaddr
13466 eval $inlibc
13467
13468 : see if gethostbyname exists
13469 set gethostbyname d_gethbyname
13470 eval $inlibc
13471
13472 : see if gethostent exists
13473 set gethostent d_gethent
13474 eval $inlibc
13475
13476 : see how we will look up host name
13477 echo " "
13478 call=''
13479 if set gethostname val -f d_gethname; eval $csym; $val; then
13480         echo 'gethostname() found.' >&4
13481         d_gethname="$define"
13482         call=gethostname
13483 fi
13484 if set uname val -f d_uname; eval $csym; $val; then
13485         if ./xenix; then
13486                 $cat <<'EOM'
13487 uname() was found, but you're running xenix, and older versions of xenix
13488 have a broken uname(). If you don't really know whether your xenix is old
13489 enough to have a broken system call, use the default answer.
13490
13491 EOM
13492                 dflt=y
13493                 case "$d_uname" in
13494                 "$define") dflt=n;;
13495                 esac
13496                 rp='Is your uname() broken?'
13497                 . ./myread
13498                 case "$ans" in
13499                 n*) d_uname="$define"; call=uname;;
13500                 esac
13501         else
13502                 echo 'uname() found.' >&4
13503                 d_uname="$define"
13504                 case "$call" in
13505                 '') call=uname ;;
13506                 esac
13507         fi
13508 fi
13509 case "$d_gethname" in
13510 '') d_gethname="$undef";;
13511 esac
13512 case "$d_uname" in
13513 '') d_uname="$undef";;
13514 esac
13515 case "$d_uname$d_gethname" in
13516 *define*)
13517         dflt=n
13518         cat <<EOM
13519
13520 Every now and then someone has a $call() that lies about the hostname
13521 but can't be fixed for political or economic reasons.  If you wish, I can
13522 pretend $call() isn't there and maybe compute hostname at run-time
13523 thanks to the '$phostname' command.
13524
13525 EOM
13526         rp="Shall I ignore $call() from now on?"
13527         . ./myread
13528         case "$ans" in
13529         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13530         esac;;
13531 esac
13532 case "$phostname" in
13533 '') aphostname='';;
13534 *) case "$aphostname" in
13535         /*) ;;
13536         *) set X $phostname
13537                 shift
13538                 file=$1
13539                 shift
13540                 file=`./loc $file $file $pth`
13541                 aphostname=`echo $file $*`
13542                 ;;
13543         esac
13544         ;;
13545 esac
13546 case "$d_uname$d_gethname" in
13547 *define*) ;;
13548 *)
13549         case "$phostname" in
13550         '')
13551                 echo "There will be no way for $package to get your hostname." >&4;;
13552         *)
13553         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13554                 ;;
13555         esac;;
13556 esac
13557 case "$d_phostname" in
13558 '') d_phostname="$undef";;
13559 esac
13560
13561 : see if gethostbyaddr_r exists
13562 set gethostbyaddr_r d_gethostbyaddr_r
13563 eval $inlibc
13564 case "$d_gethostbyaddr_r" in
13565 "$define")
13566         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13567         case "$d_gethostbyaddr_r_proto:$usethreads" in
13568         ":define")      d_gethostbyaddr_r_proto=define
13569                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13570                 eval $hasproto ;;
13571         *)      ;;
13572         esac
13573         case "$d_gethostbyaddr_r_proto" in
13574         define)
13575         case "$gethostbyaddr_r_proto" in
13576         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13577         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13578         esac
13579         case "$gethostbyaddr_r_proto" in
13580         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13581         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13582         esac
13583         case "$gethostbyaddr_r_proto" in
13584         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13585         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13586         esac
13587         case "$gethostbyaddr_r_proto" in
13588         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13589         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13590         esac
13591         case "$gethostbyaddr_r_proto" in
13592         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13593         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13594         esac
13595         case "$gethostbyaddr_r_proto" in
13596         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13597         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13598         esac
13599         case "$gethostbyaddr_r_proto" in
13600         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13601         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13602         esac
13603         case "$gethostbyaddr_r_proto" in
13604         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13605         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13606         esac
13607         case "$gethostbyaddr_r_proto" in
13608         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13609         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13610         esac
13611         case "$gethostbyaddr_r_proto" in
13612         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13613         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13614         esac
13615         case "$gethostbyaddr_r_proto" in
13616         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13617         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13618         esac
13619         case "$gethostbyaddr_r_proto" in
13620         ''|0)   d_gethostbyaddr_r=undef
13621                 gethostbyaddr_r_proto=0
13622                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13623         * )     case "$gethostbyaddr_r_proto" in
13624                 REENTRANT_PROTO*) ;;
13625                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13626                 esac
13627                 echo "Prototype: $try" ;;
13628         esac
13629         ;;
13630         *)      case "$usethreads" in
13631                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13632                 esac
13633                 d_gethostbyaddr_r=undef
13634                 gethostbyaddr_r_proto=0
13635                 ;;
13636         esac
13637         ;;
13638 *)      gethostbyaddr_r_proto=0
13639         ;;
13640 esac
13641
13642 : see if gethostbyname_r exists
13643 set gethostbyname_r d_gethostbyname_r
13644 eval $inlibc
13645 case "$d_gethostbyname_r" in
13646 "$define")
13647         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13648         case "$d_gethostbyname_r_proto:$usethreads" in
13649         ":define")      d_gethostbyname_r_proto=define
13650                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13651                 eval $hasproto ;;
13652         *)      ;;
13653         esac
13654         case "$d_gethostbyname_r_proto" in
13655         define)
13656         case "$gethostbyname_r_proto" in
13657         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13658         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13659         esac
13660         case "$gethostbyname_r_proto" in
13661         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13662         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13663         esac
13664         case "$gethostbyname_r_proto" in
13665         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13666         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13667         esac
13668         case "$gethostbyname_r_proto" in
13669         ''|0)   d_gethostbyname_r=undef
13670                 gethostbyname_r_proto=0
13671                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13672         * )     case "$gethostbyname_r_proto" in
13673                 REENTRANT_PROTO*) ;;
13674                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13675                 esac
13676                 echo "Prototype: $try" ;;
13677         esac
13678         ;;
13679         *)      case "$usethreads" in
13680                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13681                 esac
13682                 d_gethostbyname_r=undef
13683                 gethostbyname_r_proto=0
13684                 ;;
13685         esac
13686         ;;
13687 *)      gethostbyname_r_proto=0
13688         ;;
13689 esac
13690
13691 : see if gethostent_r exists
13692 set gethostent_r d_gethostent_r
13693 eval $inlibc
13694 case "$d_gethostent_r" in
13695 "$define")
13696         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13697         case "$d_gethostent_r_proto:$usethreads" in
13698         ":define")      d_gethostent_r_proto=define
13699                 set d_gethostent_r_proto gethostent_r $hdrs
13700                 eval $hasproto ;;
13701         *)      ;;
13702         esac
13703         case "$d_gethostent_r_proto" in
13704         define)
13705         case "$gethostent_r_proto" in
13706         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13707         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13708         esac
13709         case "$gethostent_r_proto" in
13710         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13711         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13712         esac
13713         case "$gethostent_r_proto" in
13714         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13715         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13716         esac
13717         case "$gethostent_r_proto" in
13718         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13719         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13720         esac
13721         case "$gethostent_r_proto" in
13722         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13723         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13724         esac
13725         case "$gethostent_r_proto" in
13726         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13727         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13728         esac
13729         case "$gethostent_r_proto" in
13730         ''|0)   d_gethostent_r=undef
13731                 gethostent_r_proto=0
13732                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13733         * )     case "$gethostent_r_proto" in
13734                 REENTRANT_PROTO*) ;;
13735                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13736                 esac
13737                 echo "Prototype: $try" ;;
13738         esac
13739         ;;
13740         *)      case "$usethreads" in
13741                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13742                 esac
13743                 d_gethostent_r=undef
13744                 gethostent_r_proto=0
13745                 ;;
13746         esac
13747         ;;
13748 *)      gethostent_r_proto=0
13749         ;;
13750 esac
13751
13752 : see if prototypes for various gethostxxx netdb.h functions are available
13753 echo " "
13754 set d_gethostprotos gethostent $i_netdb netdb.h
13755 eval $hasproto
13756
13757 : see if getitimer exists
13758 set getitimer d_getitimer
13759 eval $inlibc
13760
13761 : see if getlogin exists
13762 set getlogin d_getlogin
13763 eval $inlibc
13764
13765 : see if getlogin_r exists
13766 set getlogin_r d_getlogin_r
13767 eval $inlibc
13768 case "$d_getlogin_r" in
13769 "$define")
13770         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13771         case "$d_getlogin_r_proto:$usethreads" in
13772         ":define")      d_getlogin_r_proto=define
13773                 set d_getlogin_r_proto getlogin_r $hdrs
13774                 eval $hasproto ;;
13775         *)      ;;
13776         esac
13777         case "$d_getlogin_r_proto" in
13778         define)
13779         case "$getlogin_r_proto" in
13780         ''|0) try='int getlogin_r(char*, size_t);'
13781         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13782         esac
13783         case "$getlogin_r_proto" in
13784         ''|0) try='int getlogin_r(char*, int);'
13785         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13786         esac
13787         case "$getlogin_r_proto" in
13788         ''|0) try='char* getlogin_r(char*, size_t);'
13789         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13790         esac
13791         case "$getlogin_r_proto" in
13792         ''|0) try='char* getlogin_r(char*, int);'
13793         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13794         esac
13795         case "$getlogin_r_proto" in
13796         ''|0)   d_getlogin_r=undef
13797                 getlogin_r_proto=0
13798                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13799         * )     case "$getlogin_r_proto" in
13800                 REENTRANT_PROTO*) ;;
13801                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13802                 esac
13803                 echo "Prototype: $try" ;;
13804         esac
13805         ;;
13806         *)      case "$usethreads" in
13807                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13808                 esac
13809                 d_getlogin_r=undef
13810                 getlogin_r_proto=0
13811                 ;;
13812         esac
13813         ;;
13814 *)      getlogin_r_proto=0
13815         ;;
13816 esac
13817
13818 : see if getmnt exists
13819 set getmnt d_getmnt
13820 eval $inlibc
13821
13822 : see if getmntent exists
13823 set getmntent d_getmntent
13824 eval $inlibc
13825
13826 : see if getnetbyaddr exists
13827 set getnetbyaddr d_getnbyaddr
13828 eval $inlibc
13829
13830 : see if getnetbyname exists
13831 set getnetbyname d_getnbyname
13832 eval $inlibc
13833
13834 : see if getnetent exists
13835 set getnetent d_getnent
13836 eval $inlibc
13837
13838 : see if getnetbyaddr_r exists
13839 set getnetbyaddr_r d_getnetbyaddr_r
13840 eval $inlibc
13841 case "$d_getnetbyaddr_r" in
13842 "$define")
13843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13844         case "$d_getnetbyaddr_r_proto:$usethreads" in
13845         ":define")      d_getnetbyaddr_r_proto=define
13846                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13847                 eval $hasproto ;;
13848         *)      ;;
13849         esac
13850         case "$d_getnetbyaddr_r_proto" in
13851         define)
13852         case "$getnetbyaddr_r_proto" in
13853         ''|0) try='int getnetbyaddr_r(unsigned long, 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) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13858         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13859         esac
13860         case "$getnetbyaddr_r_proto" in
13861         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13862         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13863         esac
13864         case "$getnetbyaddr_r_proto" in
13865         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13866         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13867         esac
13868         case "$getnetbyaddr_r_proto" in
13869         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13870         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13871         esac
13872         case "$getnetbyaddr_r_proto" in
13873         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13874         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13875         esac
13876         case "$getnetbyaddr_r_proto" in
13877         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13878         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13879         esac
13880         case "$getnetbyaddr_r_proto" in
13881         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13882         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13883         esac
13884         case "$getnetbyaddr_r_proto" in
13885         ''|0)   d_getnetbyaddr_r=undef
13886                 getnetbyaddr_r_proto=0
13887                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13888         * )     case "$getnetbyaddr_r_proto" in
13889                 REENTRANT_PROTO*) ;;
13890                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13891                 esac
13892                 echo "Prototype: $try" ;;
13893         esac
13894         ;;
13895         *)      case "$usethreads" in
13896                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13897                 esac
13898                 d_getnetbyaddr_r=undef
13899                 getnetbyaddr_r_proto=0
13900                 ;;
13901         esac
13902         ;;
13903 *)      getnetbyaddr_r_proto=0
13904         ;;
13905 esac
13906
13907 : see if getnetbyname_r exists
13908 set getnetbyname_r d_getnetbyname_r
13909 eval $inlibc
13910 case "$d_getnetbyname_r" in
13911 "$define")
13912         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13913         case "$d_getnetbyname_r_proto:$usethreads" in
13914         ":define")      d_getnetbyname_r_proto=define
13915                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13916                 eval $hasproto ;;
13917         *)      ;;
13918         esac
13919         case "$d_getnetbyname_r_proto" in
13920         define)
13921         case "$getnetbyname_r_proto" in
13922         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13923         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13924         esac
13925         case "$getnetbyname_r_proto" in
13926         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13927         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13928         esac
13929         case "$getnetbyname_r_proto" in
13930         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13931         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13932         esac
13933         case "$getnetbyname_r_proto" in
13934         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13935         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13936         esac
13937         case "$getnetbyname_r_proto" in
13938         ''|0)   d_getnetbyname_r=undef
13939                 getnetbyname_r_proto=0
13940                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13941         * )     case "$getnetbyname_r_proto" in
13942                 REENTRANT_PROTO*) ;;
13943                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13944                 esac
13945                 echo "Prototype: $try" ;;
13946         esac
13947         ;;
13948         *)      case "$usethreads" in
13949                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13950                 esac
13951                 d_getnetbyname_r=undef
13952                 getnetbyname_r_proto=0
13953                 ;;
13954         esac
13955         ;;
13956 *)      getnetbyname_r_proto=0
13957         ;;
13958 esac
13959
13960 : see if getnetent_r exists
13961 set getnetent_r d_getnetent_r
13962 eval $inlibc
13963 case "$d_getnetent_r" in
13964 "$define")
13965         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13966         case "$d_getnetent_r_proto:$usethreads" in
13967         ":define")      d_getnetent_r_proto=define
13968                 set d_getnetent_r_proto getnetent_r $hdrs
13969                 eval $hasproto ;;
13970         *)      ;;
13971         esac
13972         case "$d_getnetent_r_proto" in
13973         define)
13974         case "$getnetent_r_proto" in
13975         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13976         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13977         esac
13978         case "$getnetent_r_proto" in
13979         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13980         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13981         esac
13982         case "$getnetent_r_proto" in
13983         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13984         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13985         esac
13986         case "$getnetent_r_proto" in
13987         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13988         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13989         esac
13990         case "$getnetent_r_proto" in
13991         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13992         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13993         esac
13994         case "$getnetent_r_proto" in
13995         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13996         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13997         esac
13998         case "$getnetent_r_proto" in
13999         ''|0)   d_getnetent_r=undef
14000                 getnetent_r_proto=0
14001                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14002         * )     case "$getnetent_r_proto" in
14003                 REENTRANT_PROTO*) ;;
14004                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14005                 esac
14006                 echo "Prototype: $try" ;;
14007         esac
14008         ;;
14009         *)      case "$usethreads" in
14010                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14011                 esac
14012                 d_getnetent_r=undef
14013                 getnetent_r_proto=0
14014                 ;;
14015         esac
14016         ;;
14017 *)      getnetent_r_proto=0
14018         ;;
14019 esac
14020
14021 : see if prototypes for various getnetxxx netdb.h functions are available
14022 echo " "
14023 set d_getnetprotos getnetent $i_netdb netdb.h
14024 eval $hasproto
14025
14026 : see if getpagesize exists
14027 set getpagesize d_getpagsz
14028 eval $inlibc
14029
14030 : Optional checks for getprotobyname and getprotobynumber
14031
14032 : see if getprotobyname exists
14033 set getprotobyname d_getpbyname
14034 eval $inlibc
14035
14036 : see if getprotobynumber exists
14037 set getprotobynumber d_getpbynumber
14038 eval $inlibc
14039
14040 : see if getprotoent exists
14041 set getprotoent d_getpent
14042 eval $inlibc
14043
14044 : see if getpgid exists
14045 set getpgid d_getpgid
14046 eval $inlibc
14047
14048 : see if getpgrp2 exists
14049 set getpgrp2 d_getpgrp2
14050 eval $inlibc
14051
14052 : see if getppid exists
14053 set getppid d_getppid
14054 eval $inlibc
14055
14056 : see if getpriority exists
14057 set getpriority d_getprior
14058 eval $inlibc
14059
14060 : see if getprotobyname_r exists
14061 set getprotobyname_r d_getprotobyname_r
14062 eval $inlibc
14063 case "$d_getprotobyname_r" in
14064 "$define")
14065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14066         case "$d_getprotobyname_r_proto:$usethreads" in
14067         ":define")      d_getprotobyname_r_proto=define
14068                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14069                 eval $hasproto ;;
14070         *)      ;;
14071         esac
14072         case "$d_getprotobyname_r_proto" in
14073         define)
14074         case "$getprotobyname_r_proto" in
14075         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14076         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14077         esac
14078         case "$getprotobyname_r_proto" in
14079         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14080         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14081         esac
14082         case "$getprotobyname_r_proto" in
14083         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14084         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14085         esac
14086         case "$getprotobyname_r_proto" in
14087         ''|0)   d_getprotobyname_r=undef
14088                 getprotobyname_r_proto=0
14089                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14090         * )     case "$getprotobyname_r_proto" in
14091                 REENTRANT_PROTO*) ;;
14092                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14093                 esac
14094                 echo "Prototype: $try" ;;
14095         esac
14096         ;;
14097         *)      case "$usethreads" in
14098                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14099                 esac
14100                 d_getprotobyname_r=undef
14101                 getprotobyname_r_proto=0
14102                 ;;
14103         esac
14104         ;;
14105 *)      getprotobyname_r_proto=0
14106         ;;
14107 esac
14108
14109 : see if getprotobynumber_r exists
14110 set getprotobynumber_r d_getprotobynumber_r
14111 eval $inlibc
14112 case "$d_getprotobynumber_r" in
14113 "$define")
14114         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14115         case "$d_getprotobynumber_r_proto:$usethreads" in
14116         ":define")      d_getprotobynumber_r_proto=define
14117                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14118                 eval $hasproto ;;
14119         *)      ;;
14120         esac
14121         case "$d_getprotobynumber_r_proto" in
14122         define)
14123         case "$getprotobynumber_r_proto" in
14124         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14125         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14126         esac
14127         case "$getprotobynumber_r_proto" in
14128         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14129         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14130         esac
14131         case "$getprotobynumber_r_proto" in
14132         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14133         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14134         esac
14135         case "$getprotobynumber_r_proto" in
14136         ''|0)   d_getprotobynumber_r=undef
14137                 getprotobynumber_r_proto=0
14138                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14139         * )     case "$getprotobynumber_r_proto" in
14140                 REENTRANT_PROTO*) ;;
14141                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14142                 esac
14143                 echo "Prototype: $try" ;;
14144         esac
14145         ;;
14146         *)      case "$usethreads" in
14147                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14148                 esac
14149                 d_getprotobynumber_r=undef
14150                 getprotobynumber_r_proto=0
14151                 ;;
14152         esac
14153         ;;
14154 *)      getprotobynumber_r_proto=0
14155         ;;
14156 esac
14157
14158 : see if getprotoent_r exists
14159 set getprotoent_r d_getprotoent_r
14160 eval $inlibc
14161 case "$d_getprotoent_r" in
14162 "$define")
14163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14164         case "$d_getprotoent_r_proto:$usethreads" in
14165         ":define")      d_getprotoent_r_proto=define
14166                 set d_getprotoent_r_proto getprotoent_r $hdrs
14167                 eval $hasproto ;;
14168         *)      ;;
14169         esac
14170         case "$d_getprotoent_r_proto" in
14171         define)
14172         case "$getprotoent_r_proto" in
14173         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14174         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14175         esac
14176         case "$getprotoent_r_proto" in
14177         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14178         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14179         esac
14180         case "$getprotoent_r_proto" in
14181         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14182         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14183         esac
14184         case "$getprotoent_r_proto" in
14185         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14186         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14187         esac
14188         case "$getprotoent_r_proto" in
14189         ''|0)   d_getprotoent_r=undef
14190                 getprotoent_r_proto=0
14191                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14192         * )     case "$getprotoent_r_proto" in
14193                 REENTRANT_PROTO*) ;;
14194                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14195                 esac
14196                 echo "Prototype: $try" ;;
14197         esac
14198         ;;
14199         *)      case "$usethreads" in
14200                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14201                 esac
14202                 d_getprotoent_r=undef
14203                 getprotoent_r_proto=0
14204                 ;;
14205         esac
14206         ;;
14207 *)      getprotoent_r_proto=0
14208         ;;
14209 esac
14210
14211 : see if prototypes for various getprotoxxx netdb.h functions are available
14212 echo " "
14213 set d_getprotoprotos getprotoent $i_netdb netdb.h
14214 eval $hasproto
14215
14216 : see if getprpwnam exists
14217 set getprpwnam d_getprpwnam
14218 eval $inlibc
14219
14220 : see if getpwent exists
14221 set getpwent d_getpwent
14222 eval $inlibc
14223
14224 : see if getpwent_r exists
14225 set getpwent_r d_getpwent_r
14226 eval $inlibc
14227 case "$d_getpwent_r" in
14228 "$define")
14229         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14230         case "$d_getpwent_r_proto:$usethreads" in
14231         ":define")      d_getpwent_r_proto=define
14232                 set d_getpwent_r_proto getpwent_r $hdrs
14233                 eval $hasproto ;;
14234         *)      ;;
14235         esac
14236         case "$d_getpwent_r_proto" in
14237         define)
14238         case "$getpwent_r_proto" in
14239         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14240         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14241         esac
14242         case "$getpwent_r_proto" in
14243         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14244         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14245         esac
14246         case "$getpwent_r_proto" in
14247         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14248         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14249         esac
14250         case "$getpwent_r_proto" in
14251         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14252         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14253         esac
14254         case "$getpwent_r_proto" in
14255         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14256         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14257         esac
14258         case "$getpwent_r_proto" in
14259         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14260         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14261         esac
14262         case "$getpwent_r_proto" in
14263         ''|0)   d_getpwent_r=undef
14264                 getpwent_r_proto=0
14265                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14266         * )     case "$getpwent_r_proto" in
14267                 REENTRANT_PROTO*) ;;
14268                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14269                 esac
14270                 echo "Prototype: $try" ;;
14271         esac
14272         ;;
14273         *)      case "$usethreads" in
14274                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14275                 esac
14276                 d_getpwent_r=undef
14277                 getpwent_r_proto=0
14278                 ;;
14279         esac
14280         ;;
14281 *)      getpwent_r_proto=0
14282         ;;
14283 esac
14284
14285 : see if getpwnam_r exists
14286 set getpwnam_r d_getpwnam_r
14287 eval $inlibc
14288 case "$d_getpwnam_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14291         case "$d_getpwnam_r_proto:$usethreads" in
14292         ":define")      d_getpwnam_r_proto=define
14293                 set d_getpwnam_r_proto getpwnam_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_getpwnam_r_proto" in
14298         define)
14299         case "$getpwnam_r_proto" in
14300         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14301         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14302         esac
14303         case "$getpwnam_r_proto" in
14304         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14305         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14306         esac
14307         case "$getpwnam_r_proto" in
14308         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14309         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14310         esac
14311         case "$getpwnam_r_proto" in
14312         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14313         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14314         esac
14315         case "$getpwnam_r_proto" in
14316         ''|0)   d_getpwnam_r=undef
14317                 getpwnam_r_proto=0
14318                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14319         * )     case "$getpwnam_r_proto" in
14320                 REENTRANT_PROTO*) ;;
14321                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14322                 esac
14323                 echo "Prototype: $try" ;;
14324         esac
14325         ;;
14326         *)      case "$usethreads" in
14327                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14328                 esac
14329                 d_getpwnam_r=undef
14330                 getpwnam_r_proto=0
14331                 ;;
14332         esac
14333         ;;
14334 *)      getpwnam_r_proto=0
14335         ;;
14336 esac
14337
14338 : see if getpwuid_r exists
14339 set getpwuid_r d_getpwuid_r
14340 eval $inlibc
14341 case "$d_getpwuid_r" in
14342 "$define")
14343         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14344         case "$d_getpwuid_r_proto:$usethreads" in
14345         ":define")      d_getpwuid_r_proto=define
14346                 set d_getpwuid_r_proto getpwuid_r $hdrs
14347                 eval $hasproto ;;
14348         *)      ;;
14349         esac
14350         case "$d_getpwuid_r_proto" in
14351         define)
14352         case "$getpwuid_r_proto" in
14353         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14354         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14355         esac
14356         case "$getpwuid_r_proto" in
14357         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14358         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14359         esac
14360         case "$getpwuid_r_proto" in
14361         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14362         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14363         esac
14364         case "$getpwuid_r_proto" in
14365         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14366         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14367         esac
14368         case "$getpwuid_r_proto" in
14369         ''|0)   d_getpwuid_r=undef
14370                 getpwuid_r_proto=0
14371                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14372         * )     case "$getpwuid_r_proto" in
14373                 REENTRANT_PROTO*) ;;
14374                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14375                 esac
14376                 echo "Prototype: $try" ;;
14377         esac
14378         ;;
14379         *)      case "$usethreads" in
14380                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14381                 esac
14382                 d_getpwuid_r=undef
14383                 getpwuid_r_proto=0
14384                 ;;
14385         esac
14386         ;;
14387 *)      getpwuid_r_proto=0
14388         ;;
14389 esac
14390
14391 : Optional checks for getsbyname and getsbyport
14392
14393 : see if getservbyname exists
14394 set getservbyname d_getsbyname
14395 eval $inlibc
14396
14397 : see if getservbyport exists
14398 set getservbyport d_getsbyport
14399 eval $inlibc
14400
14401 : see if getservent exists
14402 set getservent d_getsent
14403 eval $inlibc
14404
14405 : see if getservbyname_r exists
14406 set getservbyname_r d_getservbyname_r
14407 eval $inlibc
14408 case "$d_getservbyname_r" in
14409 "$define")
14410         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14411         case "$d_getservbyname_r_proto:$usethreads" in
14412         ":define")      d_getservbyname_r_proto=define
14413                 set d_getservbyname_r_proto getservbyname_r $hdrs
14414                 eval $hasproto ;;
14415         *)      ;;
14416         esac
14417         case "$d_getservbyname_r_proto" in
14418         define)
14419         case "$getservbyname_r_proto" in
14420         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14421         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14422         esac
14423         case "$getservbyname_r_proto" in
14424         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14425         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14426         esac
14427         case "$getservbyname_r_proto" in
14428         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14429         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14430         esac
14431         case "$getservbyname_r_proto" in
14432         ''|0)   d_getservbyname_r=undef
14433                 getservbyname_r_proto=0
14434                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14435         * )     case "$getservbyname_r_proto" in
14436                 REENTRANT_PROTO*) ;;
14437                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14438                 esac
14439                 echo "Prototype: $try" ;;
14440         esac
14441         ;;
14442         *)      case "$usethreads" in
14443                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14444                 esac
14445                 d_getservbyname_r=undef
14446                 getservbyname_r_proto=0
14447                 ;;
14448         esac
14449         ;;
14450 *)      getservbyname_r_proto=0
14451         ;;
14452 esac
14453
14454 : see if getservbyport_r exists
14455 set getservbyport_r d_getservbyport_r
14456 eval $inlibc
14457 case "$d_getservbyport_r" in
14458 "$define")
14459         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14460         case "$d_getservbyport_r_proto:$usethreads" in
14461         ":define")      d_getservbyport_r_proto=define
14462                 set d_getservbyport_r_proto getservbyport_r $hdrs
14463                 eval $hasproto ;;
14464         *)      ;;
14465         esac
14466         case "$d_getservbyport_r_proto" in
14467         define)
14468         case "$getservbyport_r_proto" in
14469         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14470         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14471         esac
14472         case "$getservbyport_r_proto" in
14473         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14474         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14475         esac
14476         case "$getservbyport_r_proto" in
14477         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14478         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14479         esac
14480         case "$getservbyport_r_proto" in
14481         ''|0)   d_getservbyport_r=undef
14482                 getservbyport_r_proto=0
14483                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14484         * )     case "$getservbyport_r_proto" in
14485                 REENTRANT_PROTO*) ;;
14486                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14487                 esac
14488                 echo "Prototype: $try" ;;
14489         esac
14490         ;;
14491         *)      case "$usethreads" in
14492                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14493                 esac
14494                 d_getservbyport_r=undef
14495                 getservbyport_r_proto=0
14496                 ;;
14497         esac
14498         ;;
14499 *)      getservbyport_r_proto=0
14500         ;;
14501 esac
14502
14503 : see if getservent_r exists
14504 set getservent_r d_getservent_r
14505 eval $inlibc
14506 case "$d_getservent_r" in
14507 "$define")
14508         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14509         case "$d_getservent_r_proto:$usethreads" in
14510         ":define")      d_getservent_r_proto=define
14511                 set d_getservent_r_proto getservent_r $hdrs
14512                 eval $hasproto ;;
14513         *)      ;;
14514         esac
14515         case "$d_getservent_r_proto" in
14516         define)
14517         case "$getservent_r_proto" in
14518         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14519         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14520         esac
14521         case "$getservent_r_proto" in
14522         ''|0) try='int getservent_r(struct servent*, char*, int);'
14523         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14524         esac
14525         case "$getservent_r_proto" in
14526         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14527         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14528         esac
14529         case "$getservent_r_proto" in
14530         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14531         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14532         esac
14533         case "$getservent_r_proto" in
14534         ''|0)   d_getservent_r=undef
14535                 getservent_r_proto=0
14536                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14537         * )     case "$getservent_r_proto" in
14538                 REENTRANT_PROTO*) ;;
14539                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14540                 esac
14541                 echo "Prototype: $try" ;;
14542         esac
14543         ;;
14544         *)      case "$usethreads" in
14545                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14546                 esac
14547                 d_getservent_r=undef
14548                 getservent_r_proto=0
14549                 ;;
14550         esac
14551         ;;
14552 *)      getservent_r_proto=0
14553         ;;
14554 esac
14555
14556 : see if prototypes for various getservxxx netdb.h functions are available
14557 echo " "
14558 set d_getservprotos getservent $i_netdb netdb.h
14559 eval $hasproto
14560
14561 : see if getspnam exists
14562 set getspnam d_getspnam
14563 eval $inlibc
14564
14565 : see if this is a shadow.h system
14566 set shadow.h i_shadow
14567 eval $inhdr
14568
14569 : see if getspnam_r exists
14570 set getspnam_r d_getspnam_r
14571 eval $inlibc
14572 case "$d_getspnam_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14575         case "$d_getspnam_r_proto:$usethreads" in
14576         ":define")      d_getspnam_r_proto=define
14577                 set d_getspnam_r_proto getspnam_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getspnam_r_proto" in
14582         define)
14583         case "$getspnam_r_proto" in
14584         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14585         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14586         esac
14587         case "$getspnam_r_proto" in
14588         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14589         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14590         esac
14591         case "$getspnam_r_proto" in
14592         ''|0)   d_getspnam_r=undef
14593                 getspnam_r_proto=0
14594                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14595         * )     case "$getspnam_r_proto" in
14596                 REENTRANT_PROTO*) ;;
14597                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14598                 esac
14599                 echo "Prototype: $try" ;;
14600         esac
14601         ;;
14602         *)      case "$usethreads" in
14603                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14604                 esac
14605                 d_getspnam_r=undef
14606                 getspnam_r_proto=0
14607                 ;;
14608         esac
14609         ;;
14610 *)      getspnam_r_proto=0
14611         ;;
14612 esac
14613
14614 : see if gettimeofday or ftime exists
14615 set gettimeofday d_gettimeod
14616 eval $inlibc
14617 case "$d_gettimeod" in
14618 "$undef")
14619         set ftime d_ftime 
14620         eval $inlibc
14621         ;;
14622 *)
14623         val="$undef"; set d_ftime; eval $setvar
14624         ;;
14625 esac
14626 case "$d_gettimeod$d_ftime" in
14627 "$undef$undef")
14628         echo " "
14629         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14630         ;;
14631 esac
14632
14633 : see if gmtime_r exists
14634 set gmtime_r d_gmtime_r
14635 eval $inlibc
14636 case "$d_gmtime_r" in
14637 "$define")
14638         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14639         case "$d_gmtime_r_proto:$usethreads" in
14640         ":define")      d_gmtime_r_proto=define
14641                 set d_gmtime_r_proto gmtime_r $hdrs
14642                 eval $hasproto ;;
14643         *)      ;;
14644         esac
14645         case "$d_gmtime_r_proto" in
14646         define)
14647         case "$gmtime_r_proto" in
14648         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14649         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14650         esac
14651         case "$gmtime_r_proto" in
14652         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14653         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14654         esac
14655         case "$gmtime_r_proto" in
14656         ''|0)   d_gmtime_r=undef
14657                 gmtime_r_proto=0
14658                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14659         * )     case "$gmtime_r_proto" in
14660                 REENTRANT_PROTO*) ;;
14661                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14662                 esac
14663                 echo "Prototype: $try" ;;
14664         esac
14665         ;;
14666         *)      case "$usethreads" in
14667                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14668                 esac
14669                 d_gmtime_r=undef
14670                 gmtime_r_proto=0
14671                 ;;
14672         esac
14673         ;;
14674 *)      gmtime_r_proto=0
14675         ;;
14676 esac
14677
14678 : see if hasmntopt exists
14679 set hasmntopt d_hasmntopt
14680 eval $inlibc
14681
14682 : see if this is a netinet/in.h or sys/in.h system
14683 set netinet/in.h i_niin sys/in.h i_sysin
14684 eval $inhdr
14685
14686 : see if arpa/inet.h has to be included
14687 set arpa/inet.h i_arpainet
14688 eval $inhdr
14689
14690 : see if htonl --and friends-- exists
14691 val=''
14692 set htonl val
14693 eval $inlibc
14694
14695 : Maybe they are macros.
14696 case "$val" in
14697 $undef)
14698         $cat >htonl.c <<EOM
14699 #include <stdio.h>
14700 #include <sys/types.h>
14701 #$i_niin I_NETINET_IN
14702 #$i_sysin I_SYS_IN
14703 #$i_arpainet I_ARPA_INET
14704 #ifdef I_NETINET_IN
14705 #include <netinet/in.h>
14706 #endif
14707 #ifdef I_SYS_IN
14708 #include <sys/in.h>
14709 #endif
14710 #ifdef I_ARPA_INET
14711 #include <arpa/inet.h>
14712 #endif
14713 #ifdef htonl
14714 printf("Defined as a macro.");
14715 #endif
14716 EOM
14717         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14718         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14719                 val="$define"
14720                 echo "But it seems to be defined as a macro." >&4
14721         fi
14722         $rm -f htonl.?
14723         ;;
14724 esac
14725 set d_htonl
14726 eval $setvar
14727
14728 : see if ilogbl exists
14729 set ilogbl d_ilogbl
14730 eval $inlibc
14731
14732 : index or strchr
14733 echo " "
14734 if set index val -f; eval $csym; $val; then
14735         if set strchr val -f d_strchr; eval $csym; $val; then
14736                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14737                         val="$define"
14738                         vali="$undef"
14739                         echo "strchr() found." >&4
14740                 else
14741                         val="$undef"
14742                         vali="$define"
14743                         echo "index() found." >&4
14744                 fi
14745         else
14746                 val="$undef"
14747                 vali="$define"
14748                 echo "index() found." >&4
14749         fi
14750 else
14751         if set strchr val -f d_strchr; eval $csym; $val; then
14752                 val="$define"
14753                 vali="$undef"
14754                 echo "strchr() found." >&4
14755         else
14756                 echo "No index() or strchr() found!" >&4
14757                 val="$undef"
14758                 vali="$undef"
14759         fi
14760 fi
14761 set d_strchr; eval $setvar
14762 val="$vali"
14763 set d_index; eval $setvar
14764
14765 : check whether inet_aton exists
14766 set inet_aton d_inetaton
14767 eval $inlibc
14768
14769 : Look for isascii
14770 echo " "
14771 $cat >isascii.c <<EOCP
14772 #include <stdio.h>
14773 #include <ctype.h>
14774 #$i_stdlib I_STDLIB
14775 #ifdef I_STDLIB
14776 #include <stdlib.h>
14777 #endif
14778 int main() {
14779         int c = 'A';
14780         if (isascii(c))
14781                 exit(0);
14782         else
14783                 exit(1);
14784 }
14785 EOCP
14786 set isascii
14787 if eval $compile; then
14788         echo "isascii() found." >&4
14789         val="$define"
14790 else
14791         echo "isascii() NOT found." >&4
14792         val="$undef"
14793 fi
14794 set d_isascii
14795 eval $setvar
14796 $rm -f isascii*
14797
14798 : see if isfinite exists
14799 set isfinite d_isfinite
14800 eval $inlibc
14801
14802 : see if isinf exists
14803 set isinf d_isinf
14804 eval $inlibc
14805
14806 : see if isnan exists
14807 set isnan d_isnan
14808 eval $inlibc
14809
14810 : see if isnanl exists
14811 set isnanl d_isnanl
14812 eval $inlibc
14813
14814 : see if killpg exists
14815 set killpg d_killpg
14816 eval $inlibc
14817
14818 : see if lchown exists
14819 echo " "
14820 $cat > try.c <<'EOCP'
14821 /* System header to define __stub macros and hopefully few prototypes,
14822     which can conflict with char lchown(); below.  */
14823 #include <assert.h>
14824 /* Override any gcc2 internal prototype to avoid an error.  */
14825 /* We use char because int might match the return type of a gcc2
14826    builtin and then its argument prototype would still apply.  */
14827 char lchown();
14828 int main() {
14829     /*  The GNU C library defines this for functions which it implements
14830         to always fail with ENOSYS.  Some functions are actually named
14831         something starting with __ and the normal name is an alias.  */
14832 #if defined (__stub_lchown) || defined (__stub___lchown)
14833 choke me
14834 #else
14835 lchown();
14836 #endif
14837 ; return 0; }
14838 EOCP
14839 set try
14840 if eval $compile; then
14841     $echo "lchown() found." >&4
14842     val="$define"
14843 else
14844     $echo "lchown() NOT found." >&4
14845     val="$undef"
14846 fi
14847 set d_lchown
14848 eval $setvar
14849
14850 : See if number of significant digits in a double precision number is known
14851 echo " "
14852 $cat >ldbl_dig.c <<EOM
14853 #$i_limits I_LIMITS
14854 #$i_float I_FLOAT
14855 #ifdef I_LIMITS
14856 #include <limits.h>
14857 #endif
14858 #ifdef I_FLOAT
14859 #include <float.h>
14860 #endif
14861 #ifdef LDBL_DIG
14862 printf("Contains LDBL_DIG");
14863 #endif
14864 EOM
14865 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14866 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14867         echo "LDBL_DIG found." >&4
14868         val="$define"
14869 else
14870         echo "LDBL_DIG NOT found." >&4
14871         val="$undef"
14872 fi
14873 $rm -f ldbl_dig.?
14874 set d_ldbl_dig
14875 eval $setvar
14876
14877 : see if this is a math.h system
14878 set math.h i_math
14879 eval $inhdr
14880
14881 : check to see if math.h defines _LIB_VERSION
14882 d_libm_lib_version="$undef"
14883 case $i_math in
14884     $define)
14885         echo " "
14886         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14887         $cat >try.c <<EOCP
14888 #include <unistd.h>
14889 #include <math.h>
14890 int main (int argc, char *argv[])
14891 {
14892     printf ("%d\n", _LIB_VERSION);
14893     return (0);
14894     } /* main */
14895 EOCP
14896         set try
14897         if eval $compile; then
14898             foo=`$run ./try`
14899             echo "Yes, it does ($foo)" >&4
14900             d_libm_lib_version="$define"
14901         else
14902             echo "No, it does not (probably harmless)" >&4
14903             fi
14904         $rm_try
14905         ;;
14906
14907     esac
14908
14909 : see if link exists
14910 set link d_link
14911 eval $inlibc
14912
14913 : see if localtime_r exists
14914 set localtime_r d_localtime_r
14915 eval $inlibc
14916 case "$d_localtime_r" in
14917 "$define")
14918         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14919         case "$d_localtime_r_proto:$usethreads" in
14920         ":define")      d_localtime_r_proto=define
14921                 set d_localtime_r_proto localtime_r $hdrs
14922                 eval $hasproto ;;
14923         *)      ;;
14924         esac
14925         case "$d_localtime_r_proto" in
14926         define)
14927         case "$localtime_r_proto" in
14928         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14929         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14930         esac
14931         case "$localtime_r_proto" in
14932         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14933         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14934         esac
14935         case "$localtime_r_proto" in
14936         ''|0)   d_localtime_r=undef
14937                 localtime_r_proto=0
14938                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14939         * )     case "$localtime_r_proto" in
14940                 REENTRANT_PROTO*) ;;
14941                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14942                 esac
14943                 echo "Prototype: $try" ;;
14944         esac
14945         ;;
14946         *)      case "$usethreads" in
14947                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14948                 esac
14949                 d_localtime_r=undef
14950                 localtime_r_proto=0
14951                 ;;
14952         esac
14953         ;;
14954 *)      localtime_r_proto=0
14955         ;;
14956 esac
14957
14958 : see if localtime_r calls tzset
14959 case "$localtime_r_proto" in
14960 REENTRANT_PROTO*)
14961         $cat >try.c <<EOCP
14962 /*  Does our libc's localtime_r call tzset ?
14963  *  return 0 if so, 1 otherwise.
14964  */
14965 #include <sys/types.h>
14966 #include <unistd.h>
14967 #include <time.h>
14968 #include <string.h>
14969 #include <malloc.h>
14970 int main()
14971 {
14972     time_t t = time(0L);
14973     char w_tz[]="TZ" "=GMT+5",
14974          e_tz[]="TZ" "=GMT-5",
14975         *tz_e = (char*)malloc(16),
14976         *tz_w = (char*)malloc(16);
14977     struct tm tm_e, tm_w;
14978     memset(&tm_e,'\0',sizeof(struct tm));
14979     memset(&tm_w,'\0',sizeof(struct tm));
14980     strcpy(tz_e,e_tz);
14981     strcpy(tz_w,w_tz);
14982
14983     putenv(tz_e);
14984     localtime_r(&t, &tm_e);
14985
14986     putenv(tz_w);
14987     localtime_r(&t, &tm_w);
14988
14989     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14990         return 1;
14991     return 0;
14992 }
14993 EOCP
14994         set try
14995         if eval $compile; then
14996             if $run ./try; then
14997                 d_localtime_r_needs_tzset=undef;
14998             else
14999                 d_localtime_r_needs_tzset=define;
15000             fi;
15001         else
15002             d_localtime_r_needs_tzset=undef;
15003         fi;
15004      ;;
15005   *)
15006      d_localtime_r_needs_tzset=undef;
15007      ;;
15008 esac
15009 $rm_try
15010
15011 : see if localeconv exists
15012 set localeconv d_locconv
15013 eval $inlibc
15014
15015 : see if lockf exists
15016 set lockf d_lockf
15017 eval $inlibc
15018
15019 : see if prototype for lseek is available
15020 echo " "
15021 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15022 eval $hasproto
15023
15024 : see if lstat exists
15025 set lstat d_lstat
15026 eval $inlibc
15027
15028 : see if madvise exists
15029 set madvise d_madvise
15030 eval $inlibc
15031
15032 : see if malloc_size exists
15033 set malloc_size d_malloc_size
15034 eval $inlibc
15035
15036 : see if malloc_size_good exists
15037 set malloc_good_size d_malloc_good_size
15038 eval $inlibc
15039
15040 : see if mblen exists
15041 set mblen d_mblen
15042 eval $inlibc
15043
15044 : see if mbstowcs exists
15045 set mbstowcs d_mbstowcs
15046 eval $inlibc
15047
15048 : see if mbtowc exists
15049 set mbtowc d_mbtowc
15050 eval $inlibc
15051
15052 : see if memchr exists
15053 set memchr d_memchr
15054 eval $inlibc
15055
15056 : see if memcmp exists
15057 set memcmp d_memcmp
15058 eval $inlibc
15059
15060 : see if memcpy exists
15061 set memcpy d_memcpy
15062 eval $inlibc
15063
15064 : see if memmove exists
15065 set memmove d_memmove
15066 eval $inlibc
15067
15068 : see if memset exists
15069 set memset d_memset
15070 eval $inlibc
15071
15072 : see if mkdir exists
15073 set mkdir d_mkdir
15074 eval $inlibc
15075
15076 : see if mkdtemp exists
15077 set mkdtemp d_mkdtemp
15078 eval $inlibc
15079
15080 : see if mkfifo exists
15081 set mkfifo d_mkfifo
15082 eval $inlibc
15083
15084 : see if mkstemp exists
15085 set mkstemp d_mkstemp
15086 eval $inlibc
15087
15088 : see if mkstemps exists
15089 set mkstemps d_mkstemps
15090 eval $inlibc
15091
15092 : see if mktime exists
15093 set mktime d_mktime
15094 eval $inlibc
15095
15096 : see if this is a sys/mman.h system
15097 set sys/mman.h i_sysmman
15098 eval $inhdr
15099
15100 : see if mmap exists
15101 set mmap d_mmap
15102 eval $inlibc
15103 : see what shmat returns
15104 : default to something harmless
15105 mmaptype='void *'
15106 case "$i_sysmman$d_mmap" in
15107 "$define$define")
15108         $cat >mmap.c <<'END'
15109 #include <sys/mman.h>
15110 void *mmap();
15111 END
15112         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15113                 mmaptype='void *'
15114         else
15115                 mmaptype='caddr_t'
15116         fi
15117         echo "and it returns ($mmaptype)." >&4
15118         ;;
15119 esac
15120
15121
15122
15123 : see if sqrtl exists
15124 set sqrtl d_sqrtl
15125 eval $inlibc
15126
15127 : see if scalbnl exists
15128 set scalbnl d_scalbnl
15129 eval $inlibc
15130
15131 : see if modfl exists
15132 set modfl d_modfl
15133 eval $inlibc
15134
15135 : see if prototype for modfl is available
15136 echo " "
15137 set d_modflproto modfl $i_math math.h
15138 eval $hasproto
15139
15140 d_modfl_pow32_bug="$undef"
15141
15142 case "$d_longdbl$d_modfl" in
15143 $define$define)
15144         $cat <<EOM
15145 Checking to see whether your modfl() is okay for large values...
15146 EOM
15147 $cat >try.c <<EOCP
15148 #include <math.h>
15149 #include <stdio.h>
15150 EOCP
15151 if $test "X$d_modflproto" != "X$define"; then
15152         $cat >>try.c <<EOCP
15153 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15154 long double modfl (long double, long double *);
15155 EOCP
15156 fi
15157 $cat >>try.c <<EOCP
15158 int main() {
15159     long double nv = 4294967303.15;
15160     long double v, w;
15161     v = modfl(nv, &w);
15162 #ifdef __GLIBC__
15163     printf("glibc");
15164 #endif
15165     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15166     return 0;
15167 }
15168 EOCP
15169         case "$osname:$gccversion" in
15170         aix:)   saveccflags="$ccflags"
15171                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15172         esac
15173         set try
15174         if eval $compile; then
15175                 foo=`$run ./try`
15176                 case "$foo" in
15177                 *" 4294967303.150000 1.150000 4294967302.000000")
15178                         echo >&4 "Your modfl() is broken for large values."
15179                         d_modfl_pow32_bug="$define"
15180                         case "$foo" in
15181                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15182                         ;;
15183                         esac
15184                         ;;
15185                 *" 4294967303.150000 0.150000 4294967303.000000")
15186                         echo >&4 "Your modfl() seems okay for large values."
15187                         ;;
15188                 *)      echo >&4 "I don't understand your modfl() at all."
15189                         d_modfl="$undef"
15190                         ;;
15191                 esac
15192                 $rm_try
15193         else
15194                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15195                 d_modfl="$undef"
15196         fi
15197         case "$osname:$gccversion" in
15198         aix:)   ccflags="$saveccflags" ;; # restore
15199         esac
15200         ;;
15201 esac
15202
15203 if $test "$uselongdouble" = "$define"; then
15204     message=""
15205     if $test "$d_sqrtl" != "$define"; then
15206         message="$message sqrtl"
15207     fi
15208     if $test "$d_modfl" != "$define"; then
15209         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15210             echo "You have both aintl and copysignl, so I can emulate modfl."
15211         else
15212             message="$message modfl"
15213         fi
15214     fi
15215     if $test "$d_frexpl" != "$define"; then
15216         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15217             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15218         else
15219             message="$message frexpl"
15220         fi
15221     fi
15222
15223     if $test "$message" != ""; then
15224         $cat <<EOM >&4
15225
15226 *** You requested the use of long doubles but you do not seem to have
15227 *** the following mathematical functions needed for long double support:
15228 ***    $message
15229 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15230 *** Cannot continue, aborting.
15231
15232 EOM
15233
15234         exit 1
15235     fi
15236 fi
15237
15238 : see if mprotect exists
15239 set mprotect d_mprotect
15240 eval $inlibc
15241
15242 : see if msgctl exists
15243 set msgctl d_msgctl
15244 eval $inlibc
15245
15246 : see if msgget exists
15247 set msgget d_msgget
15248 eval $inlibc
15249
15250 : see if msgsnd exists
15251 set msgsnd d_msgsnd
15252 eval $inlibc
15253
15254 : see if msgrcv exists
15255 set msgrcv d_msgrcv
15256 eval $inlibc
15257
15258 : see how much of the 'msg*(2)' library is present.
15259 h_msg=true
15260 echo " "
15261 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15262 *"$undef"*) h_msg=false;;
15263 esac
15264 case "$osname" in
15265 freebsd)
15266     case "`ipcs 2>&1`" in
15267     "SVID messages"*"not configured"*)
15268         echo "Your $osname does not have the msg*(2) configured." >&4
15269         h_msg=false
15270         val="$undef"
15271         set msgctl d_msgctl
15272         eval $setvar
15273         set msgget d_msgget
15274         eval $setvar
15275         set msgsnd d_msgsnd
15276         eval $setvar
15277         set msgrcv d_msgrcv
15278         eval $setvar
15279         ;;
15280     esac
15281     ;;
15282 esac
15283 : we could also check for sys/ipc.h ...
15284 if $h_msg && $test `./findhdr sys/msg.h`; then
15285         echo "You have the full msg*(2) library." >&4
15286         val="$define"
15287 else
15288         echo "You don't have the full msg*(2) library." >&4
15289         val="$undef"
15290 fi
15291 set d_msg
15292 eval $setvar
15293
15294 : Check for msghdr_s
15295 echo " "
15296 echo "Checking to see if your system supports struct msghdr..." >&4
15297 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15298 eval $hasstruct
15299 case "$d_msghdr_s" in
15300 "$define")      echo "Yes, it does."   ;;
15301 *)              echo "No, it doesn't." ;;
15302 esac
15303
15304
15305 : see if msync exists
15306 set msync d_msync
15307 eval $inlibc
15308
15309 : see if munmap exists
15310 set munmap d_munmap
15311 eval $inlibc
15312
15313 : see if nice exists
15314 set nice d_nice
15315 eval $inlibc
15316
15317 : see if this is a langinfo.h system
15318 set langinfo.h i_langinfo
15319 eval $inhdr
15320
15321 : see if nl_langinfo exists
15322 set nl_langinfo d_nl_langinfo
15323 eval $inlibc
15324
15325 : check for volatile keyword
15326 echo " "
15327 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15328 $cat >try.c <<'EOCP'
15329 int main()
15330 {
15331         typedef struct _goo_struct goo_struct;
15332         goo_struct * volatile goo = ((goo_struct *)0);
15333         struct _goo_struct {
15334                 long long_int;
15335                 int reg_int;
15336                 char char_var;
15337         };
15338         typedef unsigned short foo_t;
15339         char *volatile foo;
15340         volatile int bar;
15341         volatile foo_t blech;
15342         foo = foo;
15343 }
15344 EOCP
15345 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15346         val="$define"
15347         echo "Yup, it does."
15348 else
15349         val="$undef"
15350         echo "Nope, it doesn't."
15351 fi
15352 set d_volatile
15353 eval $setvar
15354 $rm_try
15355
15356 : Check basic sizes
15357 echo " "
15358 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15359
15360 case "$use64bitint:$d_quad:$quadtype" in
15361 define:define:?*)
15362         ivtype="$quadtype"
15363         uvtype="$uquadtype"
15364         ivsize=8
15365         uvsize=8
15366         ;;
15367 *)      ivtype="long"
15368         uvtype="unsigned long"
15369         ivsize=$longsize
15370         uvsize=$longsize
15371         ;;
15372 esac
15373
15374 case "$uselongdouble:$d_longdbl" in
15375 define:define)
15376         nvtype="long double"
15377         nvsize=$longdblsize
15378         ;;
15379 *)      nvtype=double
15380         nvsize=$doublesize
15381         ;;
15382 esac
15383
15384 $echo "(IV will be "$ivtype", $ivsize bytes)"
15385 $echo "(UV will be "$uvtype", $uvsize bytes)"
15386 $echo "(NV will be "$nvtype", $nvsize bytes)"
15387
15388 $cat >try.c <<EOCP
15389 #$i_inttypes I_INTTYPES
15390 #ifdef I_INTTYPES
15391 #include <inttypes.h>
15392 #endif
15393 #include <stdio.h>
15394 int main() {
15395 #ifdef INT8
15396    int8_t i =  INT8_MAX;
15397   uint8_t u = UINT8_MAX;
15398   printf("int8_t\n");
15399 #endif
15400 #ifdef INT16
15401    int16_t i =  INT16_MAX;
15402   uint16_t i = UINT16_MAX;
15403   printf("int16_t\n");
15404 #endif
15405 #ifdef INT32
15406    int32_t i =  INT32_MAX;
15407   uint32_t u = UINT32_MAX;
15408   printf("int32_t\n");
15409 #endif
15410 }
15411 EOCP
15412
15413 i8type="signed char"
15414 u8type="unsigned char"
15415 i8size=1
15416 u8size=1
15417
15418 case "$i16type" in
15419 '')     case "$shortsize" in
15420         2)      i16type=short
15421                 u16type="unsigned short"
15422                 i16size=$shortsize
15423                 u16size=$shortsize
15424                 ;;
15425         esac
15426         ;;
15427 esac
15428 case "$i16type" in
15429 '')     set try -DINT16
15430         if eval $compile; then
15431                 case "`$run ./try`" in
15432                 int16_t)
15433                         i16type=int16_t
15434                         u16type=uint16_t
15435                         i16size=2
15436                         u16size=2
15437                         ;;
15438                 esac
15439         fi
15440         ;;
15441 esac
15442 case "$i16type" in
15443 '')     if $test $shortsize -ge 2; then
15444                 i16type=short
15445                 u16type="unsigned short"
15446                 i16size=$shortsize
15447                 u16size=$shortsize
15448         fi
15449         ;;
15450 esac
15451
15452 case "$i32type" in
15453 '')     case "$longsize" in
15454         4)      i32type=long
15455                 u32type="unsigned long"
15456                 i32size=$longsize
15457                 u32size=$longsize
15458                 ;;
15459         *)      case "$intsize" in
15460                 4)      i32type=int
15461                         u32type="unsigned int"
15462                         i32size=$intsize
15463                         u32size=$intsize
15464                         ;;
15465                 esac
15466                 ;;
15467         esac
15468         ;;
15469 esac
15470 case "$i32type" in
15471 '')     set try -DINT32
15472         if eval $compile; then
15473                 case "`$run ./try`" in
15474                 int32_t)
15475                         i32type=int32_t
15476                         u32type=uint32_t
15477                         i32size=4
15478                         u32size=4
15479                         ;;
15480                 esac
15481         fi
15482         ;;
15483 esac
15484 case "$i32type" in
15485 '')     if $test $intsize -ge 4; then
15486                 i32type=int
15487                 u32type="unsigned int"
15488                 i32size=$intsize
15489                 u32size=$intsize
15490         fi
15491         ;;
15492 esac
15493
15494 case "$i64type" in
15495 '')     case "$d_quad:$quadtype" in
15496         define:?*)
15497                 i64type="$quadtype"
15498                 u64type="$uquadtype"
15499                 i64size=8
15500                 u64size=8
15501                 ;;
15502         esac
15503         ;;
15504 esac
15505
15506 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15507 : volatile so that the compiler has to store it out to memory.
15508 if test X"$d_volatile" = X"$define"; then
15509         volatile=volatile
15510 fi
15511 $cat <<EOP >try.c
15512 #include <stdio.h>
15513 #$i_stdlib I_STDLIB
15514 #ifdef I_STDLIB
15515 #include <stdlib.h>
15516 #endif
15517 #include <sys/types.h>
15518 #include <signal.h>
15519 #ifdef SIGFPE
15520 $volatile int bletched = 0;
15521 $signal_t blech(int s) { bletched = 1; }
15522 #endif
15523 int main() {
15524     $uvtype u = 0;
15525     $nvtype d;
15526     int     n = 8 * $uvsize;
15527     int     i;
15528 #ifdef SIGFPE
15529     signal(SIGFPE, blech);
15530 #endif
15531
15532     for (i = 0; i < n; i++) {
15533       u = u << 1 | ($uvtype)1;
15534       d = ($nvtype)u;
15535       if (($uvtype)d != u)
15536         break;
15537       if (d <= 0)
15538         break;
15539       d = ($nvtype)(u - 1);
15540       if (($uvtype)d != (u - 1))
15541         break;
15542 #ifdef SIGFPE
15543       if (bletched)
15544         break;
15545 #endif
15546     }
15547     printf("%d\n", ((i == n) ? -n : i));
15548     exit(0);
15549 }
15550 EOP
15551 set try
15552
15553 d_nv_preserves_uv="$undef"
15554 if eval $compile; then
15555         nv_preserves_uv_bits="`$run ./try`"
15556 fi
15557 case "$nv_preserves_uv_bits" in
15558 \-[1-9]*)
15559         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15560         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15561         d_nv_preserves_uv="$define"
15562         ;;
15563 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15564         d_nv_preserves_uv="$undef" ;;
15565 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15566         nv_preserves_uv_bits="0" ;;
15567 esac
15568 $rm_try
15569
15570 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15571 : volatile so that the compiler has to store it out to memory.
15572 if test X"$d_volatile" = X"$define"; then
15573         volatile=volatile
15574 fi
15575 $cat <<EOP >try.c
15576 #include <stdio.h>
15577
15578 typedef $nvtype NV;
15579
15580 int
15581 main() {
15582   NV value = 2;
15583   int count = 1;
15584
15585   while(count < 256) {
15586     $volatile NV up = value + 1.0;
15587     $volatile NV negated = -value;
15588     $volatile NV down = negated - 1.0;
15589     $volatile NV got_up = up - value;
15590     int up_good = got_up == 1.0;
15591     int got_down = down - negated;
15592     int down_good = got_down == -1.0;
15593
15594     if (down_good != up_good) {
15595       fprintf(stderr,
15596               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15597               up_good, (double) got_up, down_good, (double) got_down,
15598               count, (double) value);
15599       return 1;
15600     }
15601     if (!up_good) {
15602       while (1) {
15603         if (count > 8) {
15604           count -= 8;
15605           fputs("256.0", stdout);
15606         } else {
15607           count--;
15608           fputs("2.0", stdout);
15609         }
15610         if (!count) {
15611           puts("");
15612           return 0;
15613         }
15614         fputs("*", stdout);
15615       }
15616     }
15617     value *= 2;
15618     ++count;
15619   }
15620   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15621           count, (double) value);
15622   return 1;
15623 }
15624 EOP
15625 set try
15626
15627 nv_overflows_integers_at='0'
15628 if eval $compile; then
15629     xxx="`$run ./try`"
15630     case "$?" in
15631         0)
15632             case "$xxx" in
15633                 2*)  cat >&4 <<EOM
15634 The largest integer your NVs can preserve is equal to $xxx
15635 EOM
15636                     nv_overflows_integers_at="$xxx"
15637                     ;;
15638                 *)  cat >&4 <<EOM
15639 Cannot determine the largest integer value your NVs can hold, unexpected output
15640 '$xxx'
15641 EOM
15642                     ;;
15643             esac
15644             ;;
15645         *)  cat >&4 <<EOM
15646 Cannot determine the largest integer value your NVs can hold
15647 EOM
15648             ;;
15649     esac
15650 fi
15651 $rm_try
15652
15653 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15654 : volatile so that the compiler has to store it out to memory.
15655 if test X"$d_volatile" = X"$define"; then
15656         volatile=volatile
15657 fi
15658 $cat <<EOP >try.c
15659 #include <stdio.h>
15660 #$i_stdlib I_STDLIB
15661 #ifdef I_STDLIB
15662 #include <stdlib.h>
15663 #endif
15664 #$i_string I_STRING
15665 #ifdef I_STRING
15666 #  include <string.h>
15667 #else
15668 #  include <strings.h>
15669 #endif
15670 #include <sys/types.h>
15671 #include <signal.h>
15672 #ifdef SIGFPE
15673 $volatile int bletched = 0;
15674 $signal_t blech(int s) { bletched = 1; }
15675 #endif
15676
15677 int checkit($nvtype d, char *where) {
15678     unsigned char *p = (char *)&d;
15679     unsigned char *end = p + sizeof(d);
15680     int fail = 0;
15681
15682     while (p < end)
15683         fail += *p++;
15684
15685     if (!fail)
15686         return 0;
15687
15688     p = (char *)&d;
15689     printf("No - %s: 0x", where);
15690     while (p < end)
15691         printf ("%02X", *p++);
15692     printf("\n");
15693     return 1;
15694 }
15695
15696 int main(int argc, char **argv) {
15697     $nvtype d = 0.0;
15698     int fail = 0;
15699     fail += checkit(d, "0.0");
15700
15701     /* The compiler shouldn't be assuming that bletched is 0  */
15702     d = bletched;
15703
15704     fail += checkit(d, "bleched");
15705
15706 #ifdef SIGFPE
15707     signal(SIGFPE, blech);
15708 #endif
15709
15710     /* Paranoia - the compiler should have no way of knowing that ANSI says
15711        that argv[argc] will always be NULL.  Actually, if it did assume this it
15712        would be buggy, as this is C and main() can be called from elsewhere in
15713        the program.  */
15714     d = argv[argc] ? 1 : 0;
15715
15716     if (d) {
15717         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15718     }
15719
15720     fail += checkit(d, "ternary");
15721
15722     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15723
15724     if (d != 0.0) {
15725         printf("No - memset doesn't give 0.0\n");
15726         /* This might just blow up:  */
15727         printf("(gives %g)\n", d);
15728         return 1;
15729     }
15730
15731 #ifdef SIGFPE
15732     if (bletched) {
15733         printf("No - something bleched\n");
15734         return 1;
15735     }
15736 #endif
15737     if (fail) {
15738       printf("No - %d fail(s)\n", fail);
15739       return 1;
15740     }
15741     printf("Yes\n");
15742     return 0;
15743 }
15744 EOP
15745 set try
15746
15747 d_nv_zero_is_allbits_zero="$undef"
15748 if eval $compile; then
15749     xxx="`$run ./try`"
15750     case "$?" in
15751         0)
15752             case "$xxx" in
15753                 Yes)  cat >&4 <<EOM
15754 0.0 is represented as all bits zero in memory
15755 EOM
15756                     d_nv_zero_is_allbits_zero="$define"
15757                     ;;
15758                 *)  cat >&4 <<EOM
15759 0.0 is not represented as all bits zero in memory
15760 EOM
15761                     d_nv_zero_is_allbits_zero="$undef"
15762                     ;;
15763             esac
15764             ;;
15765         *)  cat >&4 <<EOM
15766 0.0 is not represented as all bits zero in memory
15767 EOM
15768             d_nv_zero_is_allbits_zero="$undef"
15769             ;;
15770     esac
15771 fi
15772 $rm_try
15773
15774 : check for off64_t
15775 echo " "
15776 echo "Checking to see if you have off64_t..." >&4
15777 $cat >try.c <<EOCP
15778 #include <sys/types.h>
15779 #include <unistd.h>
15780 int main() { off64_t x = 7; }
15781 EOCP
15782 set try
15783 if eval $compile; then
15784         val="$define"
15785         echo "You have off64_t."
15786 else
15787         val="$undef"
15788         echo "You do not have off64_t."
15789         case "$lseeksize" in
15790         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15791         esac
15792 fi
15793 $rm_try
15794 set d_off64_t
15795 eval $setvar
15796
15797 : how to create joinable pthreads
15798 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15799         echo " "
15800         echo "Checking what constant to use for creating joinable pthreads..." >&4
15801         $cat >try.c <<'EOCP'
15802 #include <pthread.h>
15803 int main() {
15804     int detachstate = JOINABLE;
15805 }
15806 EOCP
15807         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15808         if eval $compile; then
15809                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15810                 val="$undef" # Yes, undef.
15811                 set d_old_pthread_create_joinable
15812                 eval $setvar
15813                 val=""
15814                 set old_pthread_create_joinable
15815                 eval $setvar
15816         else
15817                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15818                 if eval $compile; then
15819                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15820                         val="$define"
15821                         set d_old_pthread_create_joinable
15822                         eval $setvar
15823                         val=PTHREAD_CREATE_UNDETACHED
15824                         set old_pthread_create_joinable
15825                         eval $setvar
15826                 else
15827                         set try -DJOINABLE=__UNDETACHED
15828                         if eval $compile; then
15829                                 echo "You seem to use __UNDETACHED." >&4
15830                                 val="$define"
15831                                 set d_old_pthread_create_joinable
15832                                 eval $setvar
15833                                 val=__UNDETACHED
15834                                 set old_pthread_create_joinable
15835                                 eval $setvar
15836                         else
15837                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15838                                 val="$define"
15839                                 set d_old_pthread_create_joinable
15840                                 eval $setvar
15841                                 val=0
15842                                 set old_pthread_create_joinable
15843                                 eval $setvar
15844                         fi
15845                 fi
15846         fi
15847         $rm_try
15848 else
15849     d_old_pthread_create_joinable="$undef"
15850     old_pthread_create_joinable=""
15851 fi
15852
15853 : see if pause exists
15854 set pause d_pause
15855 eval $inlibc
15856
15857 : see if poll exists
15858 set poll d_poll
15859 eval $inlibc
15860
15861 : see if readlink exists
15862 set readlink d_readlink
15863 eval $inlibc
15864
15865 : Check if exe is symlink to abs path of executing program
15866 echo " "
15867 procselfexe=''
15868 val="$undef"
15869 case "$d_readlink" in
15870 "$define")
15871         if $issymlink /proc/self/exe ; then
15872                 $ls -l /proc/self/exe > reflect
15873                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15874                         echo "You have Linux-like /proc/self/exe."
15875                         procselfexe='"/proc/self/exe"'
15876                         val="$define"
15877                 fi
15878         fi
15879         if $issymlink /proc/curproc/file ; then
15880                 $ls -l /proc/curproc/file > reflect
15881                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15882                         echo "You have BSD-like /proc/curproc/file."
15883                         procselfexe='"/proc/curproc/file"'
15884                         val="$define"
15885                 fi
15886         fi
15887         ;;
15888 esac
15889 $rm -f reflect
15890 set d_procselfexe
15891 eval $setvar
15892
15893 : backward compatibility for d_hvfork
15894 if test X$d_hvfork != X; then
15895         d_vfork="$d_hvfork"
15896         d_hvfork=''
15897 fi
15898 : see if there is a vfork
15899 val=''
15900 set vfork val
15901 eval $inlibc
15902
15903 d_pseudofork=$undef
15904
15905 : Ok, but do we want to use it. vfork is reportedly unreliable in
15906 : perl on Solaris 2.x, and probably elsewhere.
15907 case "$val" in
15908 $define)
15909         echo " "
15910         case "$usevfork" in
15911         false) dflt='n';;
15912         *) dflt='y';;
15913         esac
15914         cat <<'EOM'
15915
15916 Perl can only use a vfork() that doesn't suffer from strict
15917 restrictions on calling functions or modifying global data in
15918 the child.  For example, glibc-2.1 contains such a vfork()
15919 that is unsuitable.  If your system provides a proper fork()
15920 call, chances are that you do NOT want perl to use vfork().
15921
15922 EOM
15923         rp="Do you still want to use vfork()?"
15924         . ./myread
15925         case "$ans" in
15926         y|Y) ;;
15927         *)
15928                 echo "Ok, we won't use vfork()."
15929                 val="$undef"
15930                 ;;
15931         esac
15932         ;;
15933 esac
15934 set d_vfork
15935 eval $setvar
15936 case "$d_vfork" in
15937 $define) usevfork='true';;
15938 *) usevfork='false';;
15939 esac
15940
15941 : see whether the pthread_atfork exists
15942 $cat >try.c <<EOP
15943 #include <pthread.h>
15944 #include <stdio.h>
15945 int main() {
15946 #ifdef  PTHREAD_ATFORK
15947         pthread_atfork(NULL,NULL,NULL);
15948 #endif
15949 }
15950 EOP
15951
15952 : see if pthread_atfork exists
15953 set try -DPTHREAD_ATFORK
15954 if eval $compile; then
15955     val="$define"
15956 else
15957     val="$undef"
15958 fi
15959 case "$usethreads" in
15960 $define)
15961         case "$val" in
15962         $define) echo 'pthread_atfork found.' >&4        ;;
15963         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15964         esac
15965 esac
15966 set d_pthread_atfork
15967 eval $setvar
15968
15969 : see if pthread_attr_setscope exists
15970 set pthread_attr_setscope d_pthread_attr_setscope
15971 eval $inlibc
15972
15973 : see whether the various POSIXish _yields exist
15974 $cat >try.c <<EOP
15975 #include <pthread.h>
15976 #include <stdio.h>
15977 int main() {
15978 #ifdef SCHED_YIELD
15979         sched_yield();
15980 #else
15981 #ifdef PTHREAD_YIELD
15982         pthread_yield();
15983 #else
15984 #ifdef PTHREAD_YIELD_NULL
15985         pthread_yield(NULL);
15986 #endif
15987 #endif
15988 #endif
15989 }
15990 EOP
15991 : see if sched_yield exists
15992 set try -DSCHED_YIELD
15993 if eval $compile; then
15994     val="$define"
15995     sched_yield='sched_yield()'
15996 else
15997     val="$undef"
15998 fi
15999 case "$usethreads" in
16000 $define)
16001         case "$val" in
16002         $define) echo 'sched_yield() found.' >&4        ;;
16003         *)       echo 'sched_yield() NOT found.' >&4    ;;
16004         esac
16005 esac
16006 set d_sched_yield
16007 eval $setvar
16008
16009 : see if pthread_yield exists
16010 set try -DPTHREAD_YIELD
16011 if eval $compile; then
16012     val="$define"
16013     case "$sched_yield" in
16014     '') sched_yield='pthread_yield()' ;;
16015     esac
16016 else
16017     set try -DPTHREAD_YIELD_NULL
16018     if eval $compile; then
16019         val="$define"
16020         case "$sched_yield" in
16021         '') sched_yield='pthread_yield(NULL)' ;;
16022         esac
16023     else
16024         val="$undef"
16025     fi
16026 fi
16027 case "$usethreads" in
16028 $define)
16029         case "$val" in
16030         $define) echo 'pthread_yield() found.' >&4      ;;
16031         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16032         esac
16033         ;;
16034 esac
16035 set d_pthread_yield
16036 eval $setvar
16037 case "$sched_yield" in
16038 '') sched_yield=undef ;;
16039 esac
16040 $rm_try
16041
16042 : see if random_r exists
16043 set random_r d_random_r
16044 eval $inlibc
16045 case "$d_random_r" in
16046 "$define")
16047         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16048         case "$d_random_r_proto:$usethreads" in
16049         ":define")      d_random_r_proto=define
16050                 set d_random_r_proto random_r $hdrs
16051                 eval $hasproto ;;
16052         *)      ;;
16053         esac
16054         case "$d_random_r_proto" in
16055         define)
16056         case "$random_r_proto" in
16057         ''|0) try='int random_r(int*, struct random_data*);'
16058         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16059         esac
16060         case "$random_r_proto" in
16061         ''|0) try='int random_r(long*, struct random_data*);'
16062         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16063         esac
16064         case "$random_r_proto" in
16065         ''|0) try='int random_r(struct random_data*, int32_t*);'
16066         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16067         esac
16068         case "$random_r_proto" in
16069         ''|0)   d_random_r=undef
16070                 random_r_proto=0
16071                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16072         * )     case "$random_r_proto" in
16073                 REENTRANT_PROTO*) ;;
16074                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16075                 esac
16076                 echo "Prototype: $try" ;;
16077         esac
16078         ;;
16079         *)      case "$usethreads" in
16080                 define) echo "random_r has no prototype, not using it." >&4 ;;
16081                 esac
16082                 d_random_r=undef
16083                 random_r_proto=0
16084                 ;;
16085         esac
16086         ;;
16087 *)      random_r_proto=0
16088         ;;
16089 esac
16090
16091 : see if readdir and friends exist
16092 set readdir d_readdir
16093 eval $inlibc
16094 set seekdir d_seekdir
16095 eval $inlibc
16096 set telldir d_telldir
16097 eval $inlibc
16098 set rewinddir d_rewinddir
16099 eval $inlibc
16100
16101 : see if readdir64_r exists
16102 set readdir64_r d_readdir64_r
16103 eval $inlibc
16104 case "$d_readdir64_r" in
16105 "$define")
16106         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16107         case "$d_readdir64_r_proto:$usethreads" in
16108         ":define")      d_readdir64_r_proto=define
16109                 set d_readdir64_r_proto readdir64_r $hdrs
16110                 eval $hasproto ;;
16111         *)      ;;
16112         esac
16113         case "$d_readdir64_r_proto" in
16114         define)
16115         case "$readdir64_r_proto" in
16116         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16117         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16118         esac
16119         case "$readdir64_r_proto" in
16120         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16121         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16122         esac
16123         case "$readdir64_r_proto" in
16124         ''|0)   d_readdir64_r=undef
16125                 readdir64_r_proto=0
16126                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16127         * )     case "$readdir64_r_proto" in
16128                 REENTRANT_PROTO*) ;;
16129                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16130                 esac
16131                 echo "Prototype: $try" ;;
16132         esac
16133         ;;
16134         *)      case "$usethreads" in
16135                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16136                 esac
16137                 d_readdir64_r=undef
16138                 readdir64_r_proto=0
16139                 ;;
16140         esac
16141         ;;
16142 *)      readdir64_r_proto=0
16143         ;;
16144 esac
16145
16146 : see if readdir_r exists
16147 set readdir_r d_readdir_r
16148 eval $inlibc
16149 case "$d_readdir_r" in
16150 "$define")
16151         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16152         case "$d_readdir_r_proto:$usethreads" in
16153         ":define")      d_readdir_r_proto=define
16154                 set d_readdir_r_proto readdir_r $hdrs
16155                 eval $hasproto ;;
16156         *)      ;;
16157         esac
16158         case "$d_readdir_r_proto" in
16159         define)
16160         case "$readdir_r_proto" in
16161         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16162         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16163         esac
16164         case "$readdir_r_proto" in
16165         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16166         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16167         esac
16168         case "$readdir_r_proto" in
16169         ''|0)   d_readdir_r=undef
16170                 readdir_r_proto=0
16171                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16172         * )     case "$readdir_r_proto" in
16173                 REENTRANT_PROTO*) ;;
16174                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16175                 esac
16176                 echo "Prototype: $try" ;;
16177         esac
16178         ;;
16179         *)      case "$usethreads" in
16180                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16181                 esac
16182                 d_readdir_r=undef
16183                 readdir_r_proto=0
16184                 ;;
16185         esac
16186         ;;
16187 *)      readdir_r_proto=0
16188         ;;
16189 esac
16190
16191 : see if readv exists
16192 set readv d_readv
16193 eval $inlibc
16194
16195 : see if recvmsg exists
16196 set recvmsg d_recvmsg
16197 eval $inlibc
16198
16199 : see if rename exists
16200 set rename d_rename
16201 eval $inlibc
16202
16203 : see if rmdir exists
16204 set rmdir d_rmdir
16205 eval $inlibc
16206
16207 : see if memory.h is available.
16208 val=''
16209 set memory.h val
16210 eval $inhdr
16211
16212 : See if it conflicts with string.h
16213 case "$val" in
16214 $define)
16215         case "$strings" in
16216         '') ;;
16217         *)
16218                 $cppstdin $cppflags $cppminus < $strings > mem.h
16219                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16220                         echo " "
16221                         echo "We won't be including <memory.h>."
16222                         val="$undef"
16223                 fi
16224                 $rm -f mem.h
16225                 ;;
16226         esac
16227 esac
16228 set i_memory
16229 eval $setvar
16230
16231 : can bcopy handle overlapping blocks?
16232 echo " "
16233 val="$undef"
16234 case "$d_memmove" in
16235 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16236 *)      case "$d_bcopy" in
16237         "$define")
16238                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16239                 $cat >try.c <<EOCP
16240 #$i_memory I_MEMORY
16241 #$i_stdlib I_STDLIB
16242 #$i_string I_STRING
16243 #$i_unistd I_UNISTD
16244 EOCP
16245         $cat >>try.c <<'EOCP'
16246 #include <stdio.h>
16247 #ifdef I_MEMORY
16248 #  include <memory.h>
16249 #endif
16250 #ifdef I_STDLIB
16251 #  include <stdlib.h>
16252 #endif
16253 #ifdef I_STRING
16254 #  include <string.h>
16255 #else
16256 #  include <strings.h>
16257 #endif
16258 #ifdef I_UNISTD
16259 #  include <unistd.h>  /* Needed for NetBSD */
16260 #endif
16261 int main()
16262 {
16263 char buf[128], abc[128];
16264 char *b;
16265 int len;
16266 int off;
16267 int align;
16268
16269 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16270    try to store the string in read-only memory. */
16271 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16272
16273 for (align = 7; align >= 0; align--) {
16274         for (len = 36; len; len--) {
16275                 b = buf+align;
16276                 bcopy(abc, b, len);
16277                 for (off = 1; off <= len; off++) {
16278                         bcopy(b, b+off, len);
16279                         bcopy(b+off, b, len);
16280                         if (bcmp(b, abc, len))
16281                                 exit(1);
16282                 }
16283         }
16284 }
16285 exit(0);
16286 }
16287 EOCP
16288                 set try
16289                 if eval $compile_ok; then
16290                         if $run ./try 2>/dev/null; then
16291                                 echo "Yes, it can."
16292                                 val="$define"
16293                         else
16294                                 echo "It can't, sorry."
16295                         fi
16296                 else
16297                         echo "(I can't compile the test program, so we'll assume not...)"
16298                 fi
16299                 ;;
16300         esac
16301         $rm_try
16302         ;;
16303 esac
16304 set d_safebcpy
16305 eval $setvar
16306
16307 : can memcpy handle overlapping blocks?
16308 echo " "
16309 val="$undef"
16310 case "$d_memmove" in
16311 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16312 *)      case "$d_memcpy" in
16313         "$define")
16314                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16315                 $cat >try.c <<EOCP
16316 #$i_memory I_MEMORY
16317 #$i_stdlib I_STDLIB
16318 #$i_string I_STRING
16319 #$i_unistd I_UNISTD
16320 EOCP
16321         $cat >>try.c <<'EOCP'
16322 #include <stdio.h>
16323 #ifdef I_MEMORY
16324 #  include <memory.h>
16325 #endif
16326 #ifdef I_STDLIB
16327 #  include <stdlib.h>
16328 #endif
16329 #ifdef I_STRING
16330 #  include <string.h>
16331 #else
16332 #  include <strings.h>
16333 #endif
16334 #ifdef I_UNISTD
16335 #  include <unistd.h>  /* Needed for NetBSD */
16336 #endif
16337 int main()
16338 {
16339 char buf[128], abc[128];
16340 char *b;
16341 int len;
16342 int off;
16343 int align;
16344
16345 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16346    try to store the string in read-only memory. */
16347 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16348
16349 for (align = 7; align >= 0; align--) {
16350         for (len = 36; len; len--) {
16351                 b = buf+align;
16352                 memcpy(b, abc, len);
16353                 for (off = 1; off <= len; off++) {
16354                         memcpy(b+off, b, len);
16355                         memcpy(b, b+off, len);
16356                         if (memcmp(b, abc, len))
16357                                 exit(1);
16358                 }
16359         }
16360 }
16361 exit(0);
16362 }
16363 EOCP
16364                 set try
16365                 if eval $compile_ok; then
16366                         if $run ./try 2>/dev/null; then
16367                                 echo "Yes, it can."
16368                                 val="$define"
16369                         else
16370                                 echo "It can't, sorry."
16371                         fi
16372                 else
16373                         echo "(I can't compile the test program, so we'll assume not...)"
16374                 fi
16375                 ;;
16376         esac
16377         $rm_try
16378         ;;
16379 esac
16380 set d_safemcpy
16381 eval $setvar
16382
16383 : can memcmp be trusted to compare relative magnitude?
16384 val="$undef"
16385 case "$d_memcmp" in
16386 "$define")
16387         echo " "
16388         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16389         $cat >try.c <<EOCP
16390 #$i_memory I_MEMORY
16391 #$i_stdlib I_STDLIB
16392 #$i_string I_STRING
16393 #$i_unistd I_UNISTD
16394 EOCP
16395         $cat >>try.c <<'EOCP'
16396 #include <stdio.h>
16397 #ifdef I_MEMORY
16398 #  include <memory.h>
16399 #endif
16400 #ifdef I_STDLIB
16401 #  include <stdlib.h>
16402 #endif
16403 #ifdef I_STRING
16404 #  include <string.h>
16405 #else
16406 #  include <strings.h>
16407 #endif
16408 #ifdef I_UNISTD
16409 #  include <unistd.h>  /* Needed for NetBSD */
16410 #endif
16411 int main()
16412 {
16413 char a = -1;
16414 char b = 0;
16415 if ((a < b) && memcmp(&a, &b, 1) < 0)
16416         exit(1);
16417 exit(0);
16418 }
16419 EOCP
16420         set try
16421         if eval $compile_ok; then
16422                 if $run ./try 2>/dev/null; then
16423                         echo "Yes, it can."
16424                         val="$define"
16425                 else
16426                         echo "No, it can't (it uses signed chars)."
16427                 fi
16428         else
16429                 echo "(I can't compile the test program, so we'll assume not...)"
16430         fi
16431         ;;
16432 esac
16433 $rm_try
16434 set d_sanemcmp
16435 eval $setvar
16436
16437 : see if prototype for sbrk is available
16438 echo " "
16439 set d_sbrkproto sbrk $i_unistd unistd.h
16440 eval $hasproto
16441
16442 : see if select exists
16443 set select d_select
16444 eval $inlibc
16445
16446 : see if semctl exists
16447 set semctl d_semctl
16448 eval $inlibc
16449
16450 : see if semget exists
16451 set semget d_semget
16452 eval $inlibc
16453
16454 : see if semop exists
16455 set semop d_semop
16456 eval $inlibc
16457
16458 : see how much of the 'sem*(2)' library is present.
16459 h_sem=true
16460 echo " "
16461 case "$d_semctl$d_semget$d_semop" in
16462 *"$undef"*) h_sem=false;;
16463 esac
16464 case "$osname" in
16465 freebsd)
16466     case "`ipcs 2>&1`" in
16467     "SVID messages"*"not configured"*)
16468         echo "Your $osname does not have the sem*(2) configured." >&4
16469         h_sem=false
16470         val="$undef"
16471         set semctl d_semctl
16472         eval $setvar
16473         set semget d_semget
16474         eval $setvar
16475         set semop d_semop
16476         eval $setvar
16477         ;;
16478     esac
16479     ;;
16480 esac
16481 : we could also check for sys/ipc.h ...
16482 if $h_sem && $test `./findhdr sys/sem.h`; then
16483         echo "You have the full sem*(2) library." >&4
16484         val="$define"
16485 else
16486         echo "You don't have the full sem*(2) library." >&4
16487         val="$undef"
16488 fi
16489 set d_sem
16490 eval $setvar
16491
16492 : see whether sys/sem.h defines union semun
16493 echo " "
16494 $cat > try.c <<'END'
16495 #include <sys/types.h>
16496 #include <sys/ipc.h>
16497 #include <sys/sem.h>
16498 int main () { union semun semun; semun.buf = 0; }
16499 END
16500 set try
16501 if eval $compile; then
16502     echo "You have union semun in <sys/sem.h>." >&4
16503     val="$define"
16504 else
16505     echo "You do not have union semun in <sys/sem.h>." >&4
16506     val="$undef"
16507 fi
16508 $rm_try
16509 set d_union_semun
16510 eval $setvar
16511
16512 : see how to do semctl IPC_STAT
16513 case "$d_sem" in
16514 $define)
16515     echo " "
16516     $cat > tryh.h <<END
16517 #ifndef S_IRUSR
16518 #   ifdef S_IREAD
16519 #       define S_IRUSR S_IREAD
16520 #       define S_IWUSR S_IWRITE
16521 #       define S_IXUSR S_IEXEC
16522 #   else
16523 #       define S_IRUSR 0400
16524 #       define S_IWUSR 0200
16525 #       define S_IXUSR 0100
16526 #   endif
16527 #   define S_IRGRP (S_IRUSR>>3)
16528 #   define S_IWGRP (S_IWUSR>>3)
16529 #   define S_IXGRP (S_IXUSR>>3)
16530 #   define S_IROTH (S_IRUSR>>6)
16531 #   define S_IWOTH (S_IWUSR>>6)
16532 #   define S_IXOTH (S_IXUSR>>6)
16533 #endif
16534 #ifndef S_IRWXU
16535 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16536 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16537 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16538 #endif
16539 END
16540     : see whether semctl IPC_STAT can use union semun
16541     case "$d_semctl_semun" in
16542     '')
16543       val="$undef"
16544       $cat > try.c <<END
16545 #include <sys/types.h>
16546 #include <sys/ipc.h>
16547 #include <sys/sem.h>
16548 #include <sys/stat.h>
16549 #include <stdio.h>
16550 #include <errno.h>
16551 #include "tryh.h"
16552 #ifndef errno
16553 extern int errno;
16554 #endif
16555 #$d_union_semun HAS_UNION_SEMUN
16556 int main() {
16557     union semun
16558 #ifndef HAS_UNION_SEMUN
16559     {
16560         int val;
16561         struct semid_ds *buf;
16562         unsigned short *array;
16563     }
16564 #endif
16565     arg;
16566     int sem, st;
16567
16568 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16569     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16570     if (sem > -1) {
16571         struct semid_ds argbuf;
16572         arg.buf = &argbuf;
16573 #       ifdef IPC_STAT
16574         st = semctl(sem, 0, IPC_STAT, arg);
16575         if (st == 0)
16576             printf("semun\n");
16577         else
16578 #       endif /* IPC_STAT */
16579             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16580 #       ifdef IPC_RMID
16581         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16582 #       endif /* IPC_RMID */
16583             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16584     } else
16585 #endif /* IPC_PRIVATE && ... */
16586         printf("semget failed: errno = %d\n", errno);
16587   return 0;
16588 }
16589 END
16590       set try
16591       if eval $compile; then
16592           xxx=`$run ./try`
16593           case "$xxx" in
16594           semun) val="$define" ;;
16595           esac
16596       fi
16597       $rm_try
16598       set d_semctl_semun
16599       eval $setvar
16600       ;;
16601     esac
16602     case "$d_semctl_semun" in
16603     $define)
16604         echo "You can use union semun for semctl IPC_STAT." >&4
16605         also='also'
16606         ;;
16607     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16608         also=''
16609         ;;
16610     esac
16611
16612     : see whether semctl IPC_STAT can use struct semid_ds pointer
16613     case "$d_semctl_semid_ds" in
16614     '')
16615       val="$undef"
16616       $cat > try.c <<'END'
16617 #include <sys/types.h>
16618 #include <sys/ipc.h>
16619 #include <sys/sem.h>
16620 #include <sys/stat.h>
16621 #include "tryh.h"
16622 #include <stdio.h>
16623 #include <errno.h>
16624 #ifndef errno
16625 extern int errno;
16626 #endif
16627 int main() {
16628     struct semid_ds arg;
16629     int sem, st;
16630
16631 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16632     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16633     if (sem > -1) {
16634 #       ifdef IPC_STAT
16635         st = semctl(sem, 0, IPC_STAT, &arg);
16636         if (st == 0)
16637             printf("semid_ds\n");
16638         else
16639 #       endif /* IPC_STAT */
16640             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16641 #       ifdef IPC_RMID
16642         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16643 #       endif /* IPC_RMID */
16644             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16645     } else
16646 #endif /* IPC_PRIVATE && ... */
16647         printf("semget failed: errno = %d\n", errno);
16648
16649     return 0;
16650 }
16651 END
16652       set try
16653       if eval $compile; then
16654           xxx=`$run ./try`
16655           case "$xxx" in
16656           semid_ds) val="$define" ;;
16657           esac
16658       fi
16659       $rm_try
16660       set d_semctl_semid_ds
16661       eval $setvar
16662       ;;
16663     esac
16664     case "$d_semctl_semid_ds" in
16665     $define)
16666         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16667         ;;
16668     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16669         ;;
16670     esac
16671     ;;
16672 *)  val="$undef"
16673
16674     # We do not have the full sem*(2) library, so assume we can not
16675     # use either.
16676
16677     set d_semctl_semun
16678     eval $setvar
16679
16680     set d_semctl_semid_ds
16681     eval $setvar
16682     ;;
16683 esac
16684 $rm_try tryh.h
16685
16686 : see if sendmsg exists
16687 set sendmsg d_sendmsg
16688 eval $inlibc
16689
16690 : see if setegid exists
16691 set setegid d_setegid
16692 eval $inlibc
16693
16694 : see if seteuid exists
16695 set seteuid d_seteuid
16696 eval $inlibc
16697
16698 : see if setgrent exists
16699 set setgrent d_setgrent
16700 eval $inlibc
16701
16702 : see if setgrent_r exists
16703 set setgrent_r d_setgrent_r
16704 eval $inlibc
16705 case "$d_setgrent_r" in
16706 "$define")
16707         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16708         case "$d_setgrent_r_proto:$usethreads" in
16709         ":define")      d_setgrent_r_proto=define
16710                 set d_setgrent_r_proto setgrent_r $hdrs
16711                 eval $hasproto ;;
16712         *)      ;;
16713         esac
16714         case "$d_setgrent_r_proto" in
16715         define)
16716         case "$setgrent_r_proto" in
16717         ''|0) try='int setgrent_r(FILE**);'
16718         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16719         esac
16720         case "$setgrent_r_proto" in
16721         ''|0) try='void setgrent_r(FILE**);'
16722         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16723         esac
16724         case "$setgrent_r_proto" in
16725         ''|0)   d_setgrent_r=undef
16726                 setgrent_r_proto=0
16727                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16728         * )     case "$setgrent_r_proto" in
16729                 REENTRANT_PROTO*) ;;
16730                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16731                 esac
16732                 echo "Prototype: $try" ;;
16733         esac
16734         ;;
16735         *)      case "$usethreads" in
16736                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16737                 esac
16738                 d_setgrent_r=undef
16739                 setgrent_r_proto=0
16740                 ;;
16741         esac
16742         ;;
16743 *)      setgrent_r_proto=0
16744         ;;
16745 esac
16746
16747 : see if sethostent exists
16748 set sethostent d_sethent
16749 eval $inlibc
16750
16751 : see if sethostent_r exists
16752 set sethostent_r d_sethostent_r
16753 eval $inlibc
16754 case "$d_sethostent_r" in
16755 "$define")
16756         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16757         case "$d_sethostent_r_proto:$usethreads" in
16758         ":define")      d_sethostent_r_proto=define
16759                 set d_sethostent_r_proto sethostent_r $hdrs
16760                 eval $hasproto ;;
16761         *)      ;;
16762         esac
16763         case "$d_sethostent_r_proto" in
16764         define)
16765         case "$sethostent_r_proto" in
16766         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16767         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16768         esac
16769         case "$sethostent_r_proto" in
16770         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16771         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16772         esac
16773         case "$sethostent_r_proto" in
16774         ''|0)   d_sethostent_r=undef
16775                 sethostent_r_proto=0
16776                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16777         * )     case "$sethostent_r_proto" in
16778                 REENTRANT_PROTO*) ;;
16779                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16780                 esac
16781                 echo "Prototype: $try" ;;
16782         esac
16783         ;;
16784         *)      case "$usethreads" in
16785                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16786                 esac
16787                 d_sethostent_r=undef
16788                 sethostent_r_proto=0
16789                 ;;
16790         esac
16791         ;;
16792 *)      sethostent_r_proto=0
16793         ;;
16794 esac
16795
16796 : see if setitimer exists
16797 set setitimer d_setitimer
16798 eval $inlibc
16799
16800 : see if setlinebuf exists
16801 set setlinebuf d_setlinebuf
16802 eval $inlibc
16803
16804 : see if setlocale exists
16805 set setlocale d_setlocale
16806 eval $inlibc
16807
16808 : see if locale.h is available
16809 set locale.h i_locale
16810 eval $inhdr
16811
16812 : see if setlocale_r exists
16813 set setlocale_r d_setlocale_r
16814 eval $inlibc
16815 case "$d_setlocale_r" in
16816 "$define")
16817         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16818         case "$d_setlocale_r_proto:$usethreads" in
16819         ":define")      d_setlocale_r_proto=define
16820                 set d_setlocale_r_proto setlocale_r $hdrs
16821                 eval $hasproto ;;
16822         *)      ;;
16823         esac
16824         case "$d_setlocale_r_proto" in
16825         define)
16826         case "$setlocale_r_proto" in
16827         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16828         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16829         esac
16830         case "$setlocale_r_proto" in
16831         ''|0)   d_setlocale_r=undef
16832                 setlocale_r_proto=0
16833                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16834         * )     case "$setlocale_r_proto" in
16835                 REENTRANT_PROTO*) ;;
16836                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16837                 esac
16838                 echo "Prototype: $try" ;;
16839         esac
16840         ;;
16841         *)      case "$usethreads" in
16842                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16843                 esac
16844                 d_setlocale_r=undef
16845                 setlocale_r_proto=0
16846                 ;;
16847         esac
16848         ;;
16849 *)      setlocale_r_proto=0
16850         ;;
16851 esac
16852
16853 : see if setnetent exists
16854 set setnetent d_setnent
16855 eval $inlibc
16856
16857 : see if setnetent_r exists
16858 set setnetent_r d_setnetent_r
16859 eval $inlibc
16860 case "$d_setnetent_r" in
16861 "$define")
16862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16863         case "$d_setnetent_r_proto:$usethreads" in
16864         ":define")      d_setnetent_r_proto=define
16865                 set d_setnetent_r_proto setnetent_r $hdrs
16866                 eval $hasproto ;;
16867         *)      ;;
16868         esac
16869         case "$d_setnetent_r_proto" in
16870         define)
16871         case "$setnetent_r_proto" in
16872         ''|0) try='int setnetent_r(int, struct netent_data*);'
16873         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16874         esac
16875         case "$setnetent_r_proto" in
16876         ''|0) try='void setnetent_r(int, struct netent_data*);'
16877         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16878         esac
16879         case "$setnetent_r_proto" in
16880         ''|0)   d_setnetent_r=undef
16881                 setnetent_r_proto=0
16882                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16883         * )     case "$setnetent_r_proto" in
16884                 REENTRANT_PROTO*) ;;
16885                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16886                 esac
16887                 echo "Prototype: $try" ;;
16888         esac
16889         ;;
16890         *)      case "$usethreads" in
16891                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16892                 esac
16893                 d_setnetent_r=undef
16894                 setnetent_r_proto=0
16895                 ;;
16896         esac
16897         ;;
16898 *)      setnetent_r_proto=0
16899         ;;
16900 esac
16901
16902 : see if setprotoent exists
16903 set setprotoent d_setpent
16904 eval $inlibc
16905
16906 : see if setpgid exists
16907 set setpgid d_setpgid
16908 eval $inlibc
16909
16910 : see if setpgrp2 exists
16911 set setpgrp2 d_setpgrp2
16912 eval $inlibc
16913
16914 : see if setpriority exists
16915 set setpriority d_setprior
16916 eval $inlibc
16917
16918 : see if setproctitle exists
16919 set setproctitle d_setproctitle
16920 eval $inlibc
16921
16922 : see if setprotoent_r exists
16923 set setprotoent_r d_setprotoent_r
16924 eval $inlibc
16925 case "$d_setprotoent_r" in
16926 "$define")
16927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16928         case "$d_setprotoent_r_proto:$usethreads" in
16929         ":define")      d_setprotoent_r_proto=define
16930                 set d_setprotoent_r_proto setprotoent_r $hdrs
16931                 eval $hasproto ;;
16932         *)      ;;
16933         esac
16934         case "$d_setprotoent_r_proto" in
16935         define)
16936         case "$setprotoent_r_proto" in
16937         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16938         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16939         esac
16940         case "$setprotoent_r_proto" in
16941         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16942         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16943         esac
16944         case "$setprotoent_r_proto" in
16945         ''|0)   d_setprotoent_r=undef
16946                 setprotoent_r_proto=0
16947                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16948         * )     case "$setprotoent_r_proto" in
16949                 REENTRANT_PROTO*) ;;
16950                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16951                 esac
16952                 echo "Prototype: $try" ;;
16953         esac
16954         ;;
16955         *)      case "$usethreads" in
16956                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16957                 esac
16958                 d_setprotoent_r=undef
16959                 setprotoent_r_proto=0
16960                 ;;
16961         esac
16962         ;;
16963 *)      setprotoent_r_proto=0
16964         ;;
16965 esac
16966
16967 : see if setpwent exists
16968 set setpwent d_setpwent
16969 eval $inlibc
16970
16971 : see if setpwent_r exists
16972 set setpwent_r d_setpwent_r
16973 eval $inlibc
16974 case "$d_setpwent_r" in
16975 "$define")
16976         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16977         case "$d_setpwent_r_proto:$usethreads" in
16978         ":define")      d_setpwent_r_proto=define
16979                 set d_setpwent_r_proto setpwent_r $hdrs
16980                 eval $hasproto ;;
16981         *)      ;;
16982         esac
16983         case "$d_setpwent_r_proto" in
16984         define)
16985         case "$setpwent_r_proto" in
16986         ''|0) try='int setpwent_r(FILE**);'
16987         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16988         esac
16989         case "$setpwent_r_proto" in
16990         ''|0) try='void setpwent_r(FILE**);'
16991         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16992         esac
16993         case "$setpwent_r_proto" in
16994         ''|0)   d_setpwent_r=undef
16995                 setpwent_r_proto=0
16996                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16997         * )     case "$setpwent_r_proto" in
16998                 REENTRANT_PROTO*) ;;
16999                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17000                 esac
17001                 echo "Prototype: $try" ;;
17002         esac
17003         ;;
17004         *)      case "$usethreads" in
17005                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17006                 esac
17007                 d_setpwent_r=undef
17008                 setpwent_r_proto=0
17009                 ;;
17010         esac
17011         ;;
17012 *)      setpwent_r_proto=0
17013         ;;
17014 esac
17015
17016 : see if setregid exists
17017 set setregid d_setregid
17018 eval $inlibc
17019 set setresgid d_setresgid
17020 eval $inlibc
17021
17022 : see if setreuid exists
17023 set setreuid d_setreuid
17024 eval $inlibc
17025 set setresuid d_setresuid
17026 eval $inlibc
17027
17028 : see if setrgid exists
17029 set setrgid d_setrgid
17030 eval $inlibc
17031
17032 : see if setruid exists
17033 set setruid d_setruid
17034 eval $inlibc
17035
17036 : see if setservent exists
17037 set setservent d_setsent
17038 eval $inlibc
17039
17040 : see if setservent_r exists
17041 set setservent_r d_setservent_r
17042 eval $inlibc
17043 case "$d_setservent_r" in
17044 "$define")
17045         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17046         case "$d_setservent_r_proto:$usethreads" in
17047         ":define")      d_setservent_r_proto=define
17048                 set d_setservent_r_proto setservent_r $hdrs
17049                 eval $hasproto ;;
17050         *)      ;;
17051         esac
17052         case "$d_setservent_r_proto" in
17053         define)
17054         case "$setservent_r_proto" in
17055         ''|0) try='int setservent_r(int, struct servent_data*);'
17056         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17057         esac
17058         case "$setservent_r_proto" in
17059         ''|0) try='void setservent_r(int, struct servent_data*);'
17060         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17061         esac
17062         case "$setservent_r_proto" in
17063         ''|0)   d_setservent_r=undef
17064                 setservent_r_proto=0
17065                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17066         * )     case "$setservent_r_proto" in
17067                 REENTRANT_PROTO*) ;;
17068                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17069                 esac
17070                 echo "Prototype: $try" ;;
17071         esac
17072         ;;
17073         *)      case "$usethreads" in
17074                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17075                 esac
17076                 d_setservent_r=undef
17077                 setservent_r_proto=0
17078                 ;;
17079         esac
17080         ;;
17081 *)      setservent_r_proto=0
17082         ;;
17083 esac
17084
17085 : see if setsid exists
17086 set setsid d_setsid
17087 eval $inlibc
17088
17089 : see if setvbuf exists
17090 set setvbuf d_setvbuf
17091 eval $inlibc
17092
17093 : see if sfio.h is available
17094 set sfio.h i_sfio
17095 eval $inhdr
17096
17097 : see if sfio library is available
17098 case "$i_sfio" in
17099 $define)
17100         val=''
17101         set sfreserve val
17102         eval $inlibc
17103         ;;
17104 *)
17105         val="$undef"
17106         ;;
17107 esac
17108 : Ok, but do we want to use it.
17109 case "$val" in
17110 $define)
17111         case "$usesfio" in
17112         true|$define|[yY]*) dflt='y';;
17113         *) dflt='n';;
17114         esac
17115         echo "$package can use the sfio library, but it is experimental."
17116         case "$useperlio" in
17117         "$undef")
17118             echo "For sfio also the PerlIO abstraction layer is needed."
17119             echo "Earlier you said you wouldn't want that."
17120             ;;
17121         esac
17122         rp="You seem to have sfio available, do you want to try using it?"
17123         . ./myread
17124         case "$ans" in
17125         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17126                 useperlio="$define"
17127                 val="$define"
17128                 ;;
17129         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17130                 val="$undef"
17131                 ;;
17132         esac
17133         ;;
17134 *)      case "$usesfio" in
17135         true|$define|[yY]*)
17136                 echo "Sorry, cannot find sfio on this machine." >&4
17137                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17138                 val="$undef"
17139                 ;;
17140         esac
17141         ;;
17142 esac
17143 set d_sfio
17144 eval $setvar
17145 case "$d_sfio" in
17146 $define) usesfio='true';;
17147 *) usesfio='false';;
17148 esac
17149 case "$d_sfio" in
17150 $define) ;;
17151 *)      : Remove sfio from list of libraries to use
17152         case "$libs" in
17153         *-lsfio*)
17154                 echo "Removing unneeded -lsfio from library list" >&4
17155                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17156                 shift
17157                 libs="$*"
17158                 echo "libs = $libs" >&4
17159                 ;;
17160         esac
17161 ;;
17162 esac
17163
17164
17165 : see if shmctl exists
17166 set shmctl d_shmctl
17167 eval $inlibc
17168
17169 : see if shmget exists
17170 set shmget d_shmget
17171 eval $inlibc
17172
17173 : see if shmat exists
17174 set shmat d_shmat
17175 eval $inlibc
17176 : see what shmat returns
17177 case "$d_shmat" in
17178 "$define")
17179         $cat >shmat.c <<'END'
17180 #include <sys/shm.h>
17181 void *shmat();
17182 END
17183         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17184                 shmattype='void *'
17185         else
17186                 shmattype='char *'
17187         fi
17188         echo "and it returns ($shmattype)." >&4
17189         : see if a prototype for shmat is available
17190         xxx=`./findhdr sys/shm.h`
17191         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17192         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17193                 val="$define"
17194         else
17195                 val="$undef"
17196         fi
17197         $rm -f shmat.[co]
17198         ;;
17199 *)
17200         val="$undef"
17201         ;;
17202 esac
17203 set d_shmatprototype
17204 eval $setvar
17205
17206 : see if shmdt exists
17207 set shmdt d_shmdt
17208 eval $inlibc
17209
17210 : see how much of the 'shm*(2)' library is present.
17211 h_shm=true
17212 echo " "
17213 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17214 *"$undef"*) h_shm=false;;
17215 esac
17216 case "$osname" in
17217 freebsd)
17218     case "`ipcs 2>&1`" in
17219     "SVID shared memory"*"not configured"*)
17220         echo "Your $osname does not have the shm*(2) configured." >&4
17221         h_shm=false
17222         val="$undef"
17223         set shmctl d_shmctl
17224         evat $setvar
17225         set shmget d_shmget
17226         evat $setvar
17227         set shmat d_shmat
17228         evat $setvar
17229         set shmdt d_shmdt
17230         evat $setvar
17231         ;;
17232     esac
17233     ;;
17234 esac
17235 : we could also check for sys/ipc.h ...
17236 if $h_shm && $test `./findhdr sys/shm.h`; then
17237         echo "You have the full shm*(2) library." >&4
17238         val="$define"
17239 else
17240         echo "You don't have the full shm*(2) library." >&4
17241         val="$undef"
17242 fi
17243 set d_shm
17244 eval $setvar
17245
17246 : see if we have sigaction
17247 echo " "
17248 if set sigaction val -f d_sigaction; eval $csym; $val; then
17249         echo 'sigaction() found.' >&4
17250         $cat > try.c <<EOP
17251 #include <stdio.h>
17252 #include <sys/types.h>
17253 #include <signal.h>
17254 #$i_stdlib I_STDLIB
17255 #ifdef I_STDLIB
17256 #include <stdlib.h>
17257 #endif
17258 int main()
17259 {
17260     struct sigaction act, oact;
17261     act.sa_flags = 0;
17262     oact.sa_handler = 0;
17263     /* so that act and oact are used */
17264     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17265 }
17266 EOP
17267         set try
17268         if eval $compile_ok; then
17269                 val="$define"
17270         else
17271                 echo "But you don't seem to have a useable struct sigaction." >&4
17272                 val="$undef"
17273         fi
17274 else
17275         echo 'sigaction NOT found.' >&4
17276         val="$undef"
17277 fi
17278 set d_sigaction; eval $setvar
17279 $rm_try
17280
17281 : see if this is a sunmath.h system
17282 set sunmath.h i_sunmath
17283 eval $inhdr
17284
17285 : see if signbit exists
17286 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17287 $cat >try.c <<EOCP
17288 #$i_math I_MATH
17289 #$i_sunmath I_SUNMATH
17290 #ifdef I_MATH
17291 #  include <math.h>
17292 #endif
17293 #ifdef I_SUNMATH  /* Solaris special math library */
17294 #  include <sunmath.h>
17295 #endif
17296 #define NV $nvtype
17297 int main(int argc, char **argv)
17298 {
17299     NV x = 0.0;
17300     NV y = -0.0;
17301     if ((signbit(x) == 0) && (signbit(y) != 0))
17302         return 0;
17303     else
17304         return 1;
17305 }
17306 EOCP
17307 val="$undef"
17308 set try
17309 if eval $compile; then
17310     if $run ./try; then
17311         $echo "Yes." >&4
17312         val="$define"
17313     else
17314         $echo "Signbit seems to be available, but doesn't work as I expected."
17315         $echo "I won't use it." >&4
17316         val="$undef"
17317     fi
17318 else
17319     $echo "Nope." >&4
17320     dflt="$undef"
17321 fi
17322 set d_signbit
17323 eval $setvar
17324 $rm_try
17325
17326 : see if sigprocmask exists
17327 set sigprocmask d_sigprocmask
17328 eval $inlibc
17329
17330 : see if sigsetjmp exists
17331 echo " "
17332 case "$d_sigsetjmp" in
17333 '')
17334         $cat >try.c <<EOP
17335 #include <setjmp.h>
17336 #$i_stdlib I_STDLIB
17337 #ifdef I_STDLIB
17338 #include <stdlib.h>
17339 #endif
17340 sigjmp_buf env;
17341 int set = 1;
17342 int main()
17343 {
17344         if (sigsetjmp(env,1))
17345                 exit(set);
17346         set = 0;
17347         siglongjmp(env, 1);
17348         exit(1);
17349 }
17350 EOP
17351         set try
17352         if eval $compile; then
17353                 if $run ./try >/dev/null 2>&1; then
17354                         echo "POSIX sigsetjmp found." >&4
17355                         val="$define"
17356                 else
17357                         $cat >&4 <<EOM
17358 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17359 I'll ignore them.
17360 EOM
17361                         val="$undef"
17362                 fi
17363         else
17364                 echo "sigsetjmp not found." >&4
17365                 val="$undef"
17366         fi
17367         ;;
17368 *) val="$d_sigsetjmp"
17369         case "$d_sigsetjmp" in
17370         $define) echo "POSIX sigsetjmp found." >&4;;
17371         $undef) echo "sigsetjmp not found." >&4;;
17372         esac
17373         ;;
17374 esac
17375 set d_sigsetjmp
17376 eval $setvar
17377 $rm_try
17378
17379 : see if snprintf exists
17380 set snprintf d_snprintf
17381 eval $inlibc
17382
17383 : see if vsnprintf exists
17384 set vsnprintf d_vsnprintf
17385 eval $inlibc
17386
17387 case "$d_snprintf-$d_vsnprintf" in
17388 "$define-$define")
17389     $cat <<EOM
17390 Checking whether your snprintf() and vsnprintf() work okay...
17391 EOM
17392     $cat >try.c <<'EOCP'
17393 /* v?snprintf testing logic courtesy of Russ Allbery.
17394  * According to C99:
17395  * - if the buffer is too short it still must be \0-terminated
17396  * - if the buffer is too short the potentially required length
17397  *   must be returned and not -1
17398  * - if the buffer is NULL the potentially required length
17399  *   must be returned and not -1 or core dump
17400  */
17401 #include <stdio.h>
17402 #include <stdarg.h>
17403
17404 char buf[2];
17405
17406 int test (char *format, ...)
17407 {
17408     va_list args;
17409     int count;
17410
17411     va_start (args, format);
17412     count = vsnprintf (buf, sizeof buf, format, args);
17413     va_end (args);
17414     return count;
17415 }
17416
17417 int main ()
17418 {
17419     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17420              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17421 }
17422 EOCP
17423     set try
17424     if eval $compile; then
17425         `$run ./try`
17426         case "$?" in
17427         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17428         *) cat <<EOM >&4
17429 Your snprintf() and snprintf() don't seem to be working okay.
17430 EOM
17431            d_snprintf="$undef"
17432            d_vsnprintf="$undef"
17433            ;;
17434         esac
17435     else
17436         echo "(I can't seem to compile the test program--assuming they don't)"
17437         d_snprintf="$undef"
17438         d_vsnprintf="$undef"
17439     fi
17440     $rm_try
17441     ;;
17442 esac
17443
17444 : see if sockatmark exists
17445 set sockatmark d_sockatmark
17446 eval $inlibc
17447
17448 : see if prototype for sockatmark is available
17449 echo " "
17450 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17451 eval $hasproto
17452
17453 : see if socks5_init exists
17454 set socks5_init d_socks5_init
17455 eval $inlibc
17456
17457 : see if sprintf returns the length of the string in the buffer as per ANSI
17458 $echo "Checking whether sprintf returns the length of the string..." >&4
17459 $cat <<EOP >try.c
17460 #include <stdio.h>
17461 #$i_stdlib I_STDLIB
17462 #ifdef I_STDLIB
17463 #include <stdlib.h>
17464 #endif
17465 #$i_string I_STRING
17466 #ifdef I_STRING
17467 #  include <string.h>
17468 #else
17469 #  include <strings.h>
17470 #endif
17471 #$i_math I_MATH
17472 #ifdef I_MATH
17473 #include <math.h>
17474 #endif
17475
17476 char buffer[256];
17477
17478 int check (size_t expect, int test) {
17479   size_t got = strlen(buffer);
17480   if (expect == got)
17481     return 0;
17482
17483   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17484        test, buffer);
17485   exit (test);
17486 }
17487
17488 int main(int argc, char **argv) {
17489   int test = 0;
17490
17491   check(sprintf(buffer, ""), ++test);
17492   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17493   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17494
17495   return 0;
17496 }
17497 EOP
17498 set try
17499
17500 if eval $compile; then
17501     xxx="`$run ./try`"
17502     case "$?" in
17503         0) cat >&4 <<EOM
17504 sprintf returns the length of the string (as ANSI says it should)
17505 EOM
17506         d_sprintf_returns_strlen="$define"
17507         ;;
17508         *) cat >&4 <<EOM
17509 sprintf does not return the length of the string (how old is this system?)
17510 EOM
17511         d_sprintf_returns_strlen="$undef"
17512         ;;
17513     esac
17514 else
17515     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17516     d_sprintf_returns_strlen="$undef"
17517 fi
17518 $rm_try
17519
17520 : see if srand48_r exists
17521 set srand48_r d_srand48_r
17522 eval $inlibc
17523 case "$d_srand48_r" in
17524 "$define")
17525         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17526         case "$d_srand48_r_proto:$usethreads" in
17527         ":define")      d_srand48_r_proto=define
17528                 set d_srand48_r_proto srand48_r $hdrs
17529                 eval $hasproto ;;
17530         *)      ;;
17531         esac
17532         case "$d_srand48_r_proto" in
17533         define)
17534         case "$srand48_r_proto" in
17535         ''|0) try='int srand48_r(long, struct drand48_data*);'
17536         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17537         esac
17538         case "$srand48_r_proto" in
17539         ''|0)   d_srand48_r=undef
17540                 srand48_r_proto=0
17541                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17542         * )     case "$srand48_r_proto" in
17543                 REENTRANT_PROTO*) ;;
17544                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17545                 esac
17546                 echo "Prototype: $try" ;;
17547         esac
17548         ;;
17549         *)      case "$usethreads" in
17550                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17551                 esac
17552                 d_srand48_r=undef
17553                 srand48_r_proto=0
17554                 ;;
17555         esac
17556         ;;
17557 *)      srand48_r_proto=0
17558         ;;
17559 esac
17560
17561 : see if srandom_r exists
17562 set srandom_r d_srandom_r
17563 eval $inlibc
17564 case "$d_srandom_r" in
17565 "$define")
17566         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17567         case "$d_srandom_r_proto:$usethreads" in
17568         ":define")      d_srandom_r_proto=define
17569                 set d_srandom_r_proto srandom_r $hdrs
17570                 eval $hasproto ;;
17571         *)      ;;
17572         esac
17573         case "$d_srandom_r_proto" in
17574         define)
17575         case "$srandom_r_proto" in
17576         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17577         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17578         esac
17579         case "$srandom_r_proto" in
17580         ''|0)   d_srandom_r=undef
17581                 srandom_r_proto=0
17582                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17583         * )     case "$srandom_r_proto" in
17584                 REENTRANT_PROTO*) ;;
17585                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17586                 esac
17587                 echo "Prototype: $try" ;;
17588         esac
17589         ;;
17590         *)      case "$usethreads" in
17591                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17592                 esac
17593                 d_srandom_r=undef
17594                 srandom_r_proto=0
17595                 ;;
17596         esac
17597         ;;
17598 *)      srandom_r_proto=0
17599         ;;
17600 esac
17601
17602 : see if prototype for setresgid is available
17603 echo " "
17604 set d_sresgproto setresgid $i_unistd unistd.h
17605 eval $hasproto
17606
17607 : see if prototype for setresuid is available
17608 echo " "
17609 set d_sresuproto setresuid $i_unistd unistd.h
17610 eval $hasproto
17611
17612 : see if sys/stat.h is available
17613 set sys/stat.h i_sysstat
17614 eval $inhdr
17615
17616 : see if stat knows about block sizes
17617 echo " "
17618 echo "Checking to see if your struct stat has st_blocks field..." >&4
17619 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17620 eval $hasfield
17621
17622 : see if this is a sys/vfs.h system
17623 set sys/vfs.h i_sysvfs
17624 eval $inhdr
17625
17626 : see if this is a sys/statfs.h system
17627 set sys/statfs.h i_sysstatfs
17628 eval $inhdr
17629
17630 : Check for statfs_s
17631 echo " "
17632 echo "Checking to see if your system supports struct statfs..." >&4
17633 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
17634 eval $hasstruct
17635 case "$d_statfs_s" in
17636 "$define")      echo "Yes, it does."   ;;
17637 *)              echo "No, it doesn't." ;;
17638 esac
17639
17640
17641 : see if struct statfs knows about f_flags
17642 case "$d_statfs_s" in
17643 define)
17644         echo " "
17645         echo "Checking to see if your struct statfs has f_flags field..." >&4
17646         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
17647         eval $hasfield
17648         ;;
17649 *)      val="$undef"
17650         set d_statfs_f_flags
17651         eval $setvar
17652         ;;
17653 esac
17654 case "$d_statfs_f_flags" in
17655 "$define")      echo "Yes, it does."   ;;
17656 *)              echo "No, it doesn't." ;;
17657 esac
17658
17659 : Check stream access
17660 $cat >&4 <<EOM
17661 Checking how to access stdio streams by file descriptor number...
17662 EOM
17663 case "$stdio_stream_array" in
17664 '')     $cat >try.c <<EOCP
17665 #include <stdio.h>
17666 int main() {
17667   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17668     printf("yes\n");
17669 }
17670 EOCP
17671         for s in _iob __iob __sF
17672         do
17673                 set try -DSTDIO_STREAM_ARRAY=$s
17674                 if eval $compile; then
17675                         case "`$run ./try`" in
17676                         yes)    stdio_stream_array=$s; break ;;
17677                         esac
17678                 fi
17679         done
17680         $rm_try
17681 esac
17682 case "$stdio_stream_array" in
17683 '')     $cat >&4 <<EOM
17684 I can't figure out how to access stdio streams by file descriptor number.
17685 EOM
17686         d_stdio_stream_array="$undef"
17687         ;;
17688 *)      $cat >&4 <<EOM
17689 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17690 EOM
17691         d_stdio_stream_array="$define"
17692         ;;
17693 esac
17694
17695 : see if strcoll exists
17696 set strcoll d_strcoll
17697 eval $inlibc
17698
17699 : check for structure copying
17700 echo " "
17701 echo "Checking to see if your C compiler can copy structs..." >&4
17702 $cat >try.c <<'EOCP'
17703 int main()
17704 {
17705         struct blurfl {
17706                 int dyick;
17707         } foo, bar;
17708
17709         foo = bar;
17710 }
17711 EOCP
17712 if $cc -c try.c >/dev/null 2>&1 ; then
17713         val="$define"
17714         echo "Yup, it can."
17715 else
17716         val="$undef"
17717         echo "Nope, it can't."
17718 fi
17719 set d_strctcpy
17720 eval $setvar
17721 $rm_try
17722
17723 : see if strerror and/or sys_errlist[] exist
17724 echo " "
17725 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17726     if set strerror val -f d_strerror; eval $csym; $val; then
17727                 echo 'strerror() found.' >&4
17728                 d_strerror="$define"
17729                 d_strerrm='strerror(e)'
17730                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17731                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17732                         d_syserrlst="$define"
17733                 else
17734                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17735                         d_syserrlst="$undef"
17736                 fi
17737     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17738                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17739                 echo 'strerror() found in string header.' >&4
17740                 d_strerror="$define"
17741                 d_strerrm='strerror(e)'
17742                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17743                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17744                                 d_syserrlst="$define"
17745                 else
17746                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17747                         d_syserrlst="$undef"
17748                 fi
17749     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17750                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17751                 d_strerror="$undef"
17752                 d_syserrlst="$define"
17753                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17754     else
17755                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17756                 d_strerror="$undef"
17757                 d_syserrlst="$undef"
17758                 d_strerrm='"unknown"'
17759     fi
17760 fi
17761
17762 : see if strerror_r exists
17763 set strerror_r d_strerror_r
17764 eval $inlibc
17765 case "$d_strerror_r" in
17766 "$define")
17767         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17768         case "$d_strerror_r_proto:$usethreads" in
17769         ":define")      d_strerror_r_proto=define
17770                 set d_strerror_r_proto strerror_r $hdrs
17771                 eval $hasproto ;;
17772         *)      ;;
17773         esac
17774         case "$d_strerror_r_proto" in
17775         define)
17776         case "$strerror_r_proto" in
17777         ''|0) try='int strerror_r(int, char*, size_t);'
17778         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17779         esac
17780         case "$strerror_r_proto" in
17781         ''|0) try='int strerror_r(int, char*, int);'
17782         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17783         esac
17784         case "$strerror_r_proto" in
17785         ''|0) try='char* strerror_r(int, char*, size_t);'
17786         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17787         esac
17788         case "$strerror_r_proto" in
17789         ''|0)   d_strerror_r=undef
17790                 strerror_r_proto=0
17791                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17792         * )     case "$strerror_r_proto" in
17793                 REENTRANT_PROTO*) ;;
17794                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17795                 esac
17796                 echo "Prototype: $try" ;;
17797         esac
17798         ;;
17799         *)      case "$usethreads" in
17800                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17801                 esac
17802                 d_strerror_r=undef
17803                 strerror_r_proto=0
17804                 ;;
17805         esac
17806         ;;
17807 *)      strerror_r_proto=0
17808         ;;
17809 esac
17810
17811 : see if strftime exists
17812 set strftime d_strftime
17813 eval $inlibc
17814
17815 : see if strlcat exists
17816 set strlcat d_strlcat
17817 eval $inlibc
17818
17819 : see if strlcpy exists
17820 set strlcpy d_strlcpy
17821 eval $inlibc
17822
17823 : see if strtod exists
17824 set strtod d_strtod
17825 eval $inlibc
17826
17827 : see if strtol exists
17828 set strtol d_strtol
17829 eval $inlibc
17830
17831 : see if strtold exists
17832 set strtold d_strtold
17833 eval $inlibc
17834
17835 : see if strtoll exists
17836 set strtoll d_strtoll
17837 eval $inlibc
17838
17839 case "$d_longlong-$d_strtoll" in
17840 "$define-$define")
17841         $cat <<EOM
17842 Checking whether your strtoll() works okay...
17843 EOM
17844         $cat >try.c <<'EOCP'
17845 #include <errno.h>
17846 #ifdef __hpux
17847 #define strtoll __strtoll
17848 #endif
17849 #ifdef __EMX__
17850 #define strtoll _strtoll
17851 #endif
17852 #include <stdio.h>
17853 extern long long int strtoll(char *s, char **, int);
17854 static int bad = 0;
17855 int check(char *s, long long ell, int een) {
17856         long long gll;
17857         errno = 0;
17858         gll = strtoll(s, 0, 10);
17859         if (!((gll == ell) && (errno == een)))
17860                 bad++;
17861 }
17862 int main() {
17863         check(" 1",                                      1LL, 0);
17864         check(" 0",                                      0LL, 0);
17865         check("-1",                                     -1LL, 0);
17866         check("-9223372036854775808", -9223372036854775808LL, 0);
17867         check("-9223372036854775808", -9223372036854775808LL, 0);
17868         check(" 9223372036854775807",  9223372036854775807LL, 0);
17869         check("-9223372036854775808", -9223372036854775808LL, 0);
17870         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17871         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17872         if (!bad)
17873                 printf("ok\n");
17874 }
17875 EOCP
17876         set try
17877         if eval $compile; then
17878                 yyy=`$run ./try`
17879                 case "$yyy" in
17880                 ok) echo "Your strtoll() seems to be working okay." ;;
17881                 *) cat <<EOM >&4
17882 Your strtoll() doesn't seem to be working okay.
17883 EOM
17884                    d_strtoll="$undef"
17885                    ;;
17886                 esac
17887         else
17888                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17889                 d_strtoll="$undef"
17890         fi
17891         ;;
17892 esac
17893
17894 : see if strtoq exists
17895 set strtoq d_strtoq
17896 eval $inlibc
17897
17898 : see if strtoul exists
17899 set strtoul d_strtoul
17900 eval $inlibc
17901
17902 case "$d_strtoul" in
17903 "$define")
17904         $cat <<EOM
17905 Checking whether your strtoul() works okay...
17906 EOM
17907         $cat >try.c <<'EOCP'
17908 #include <errno.h>
17909 #include <stdio.h>
17910 extern unsigned long int strtoul(char *s, char **, int);
17911 static int bad = 0;
17912 void check(char *s, unsigned long eul, int een) {
17913         unsigned long gul;
17914         errno = 0;
17915         gul = strtoul(s, 0, 10);
17916         if (!((gul == eul) && (errno == een)))
17917                 bad++;
17918 }
17919 int main() {
17920         check(" 1", 1L, 0);
17921         check(" 0", 0L, 0);
17922 EOCP
17923         case "$longsize" in
17924         8)
17925             $cat >>try.c <<'EOCP'
17926         check("18446744073709551615", 18446744073709551615UL, 0);
17927         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17928 #if 0 /* strtoul() for /^-/ strings is undefined. */
17929         check("-1", 18446744073709551615UL, 0);
17930         check("-18446744073709551614", 2, 0);
17931         check("-18446744073709551615", 1, 0);
17932         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17933         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17934 #endif
17935 EOCP
17936                 ;;
17937         4)
17938                     $cat >>try.c <<'EOCP'
17939         check("4294967295", 4294967295UL, 0);
17940         check("4294967296", 4294967295UL, ERANGE);
17941 #if 0 /* strtoul() for /^-/ strings is undefined. */
17942         check("-1", 4294967295UL, 0);
17943         check("-4294967294", 2, 0);
17944         check("-4294967295", 1, 0);
17945         check("-4294967296", 4294967295UL, ERANGE);
17946         check("-4294967297", 4294967295UL, ERANGE);
17947 #endif
17948 EOCP
17949                 ;;
17950         *)
17951 : Should we write these tests to be more portable by sprintf-ing
17952 : ~0 and then manipulating that char string as input for strtol?
17953                 ;;
17954         esac
17955         $cat >>try.c <<'EOCP'
17956         if (!bad)
17957                 printf("ok\n");
17958         return 0;
17959 }
17960 EOCP
17961         set try
17962         if eval $compile; then
17963                 case "`$run ./try`" in
17964                 ok) echo "Your strtoul() seems to be working okay." ;;
17965                 *) cat <<EOM >&4
17966 Your strtoul() doesn't seem to be working okay.
17967 EOM
17968                    d_strtoul="$undef"
17969                    ;;
17970                 esac
17971         else
17972                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17973                 d_strtoul="$undef"
17974         fi
17975         ;;
17976 esac
17977
17978 : see if strtoull exists
17979 set strtoull d_strtoull
17980 eval $inlibc
17981
17982 case "$d_longlong-$d_strtoull" in
17983 "$define-$define")
17984         $cat <<EOM
17985 Checking whether your strtoull() works okay...
17986 EOM
17987         $cat >try.c <<'EOCP'
17988 #include <errno.h>
17989 #ifdef __hpux
17990 #define strtoull __strtoull
17991 #endif
17992 #include <stdio.h>
17993 extern unsigned long long int strtoull(char *s, char **, int);
17994 static int bad = 0;
17995 int check(char *s, long long eull, int een) {
17996         long long gull;
17997         errno = 0;
17998         gull = strtoull(s, 0, 10);
17999         if (!((gull == eull) && (errno == een)))
18000                 bad++;
18001 }
18002 int main() {
18003         check(" 1",                                        1LL, 0);
18004         check(" 0",                                        0LL, 0);
18005         check("18446744073709551615",  18446744073709551615ULL, 0);
18006         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18007 #if 0 /* strtoull() for /^-/ strings is undefined. */
18008         check("-1",                    18446744073709551615ULL, 0);
18009         check("-18446744073709551614",                     2LL, 0);
18010         check("-18446744073709551615",                     1LL, 0);
18011         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18012         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18013 #endif
18014         if (!bad)
18015                 printf("ok\n");
18016 }
18017 EOCP
18018         set try
18019         if eval $compile; then
18020                 case "`$run ./try`" in
18021                 ok) echo "Your strtoull() seems to be working okay." ;;
18022                 *) cat <<EOM >&4
18023 Your strtoull() doesn't seem to be working okay.
18024 EOM
18025                    d_strtoull="$undef"
18026                    ;;
18027                 esac
18028         else
18029                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18030                 d_strtoull="$undef"
18031         fi
18032         ;;
18033 esac
18034
18035 : see if strtouq exists
18036 set strtouq d_strtouq
18037 eval $inlibc
18038
18039 case "$d_strtouq" in
18040 "$define")
18041         $cat <<EOM
18042 Checking whether your strtouq() works okay...
18043 EOM
18044         $cat >try.c <<'EOCP'
18045 #include <errno.h>
18046 #include <stdio.h>
18047 extern unsigned long long int strtouq(char *s, char **, int);
18048 static int bad = 0;
18049 void check(char *s, unsigned long long eull, int een) {
18050         unsigned long long gull;
18051         errno = 0;
18052         gull = strtouq(s, 0, 10);
18053         if (!((gull == eull) && (errno == een)))
18054                 bad++;
18055 }
18056 int main() {
18057         check(" 1",                                        1LL, 0);
18058         check(" 0",                                        0LL, 0);
18059         check("18446744073709551615",  18446744073709551615ULL, 0);
18060         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18061 #if 0 /* strtouq() for /^-/ strings is undefined. */
18062         check("-1",                    18446744073709551615ULL, 0);
18063         check("-18446744073709551614",                     2LL, 0);
18064         check("-18446744073709551615",                     1LL, 0);
18065         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18066         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18067 #endif
18068         if (!bad)
18069                 printf("ok\n");
18070         return 0;
18071 }
18072 EOCP
18073         set try
18074         if eval $compile; then
18075                 case "`$run ./try`" in
18076                 ok) echo "Your strtouq() seems to be working okay." ;;
18077                 *) cat <<EOM >&4
18078 Your strtouq() doesn't seem to be working okay.
18079 EOM
18080                    d_strtouq="$undef"
18081                    ;;
18082                 esac
18083         else
18084                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18085                 d_strtouq="$undef"
18086         fi
18087         ;;
18088 esac
18089
18090 : see if strxfrm exists
18091 set strxfrm d_strxfrm
18092 eval $inlibc
18093
18094 : see if symlink exists
18095 set symlink d_symlink
18096 eval $inlibc
18097
18098 : see if syscall exists
18099 set syscall d_syscall
18100 eval $inlibc
18101
18102 : see if prototype for syscall is available
18103 echo " "
18104 set d_syscallproto syscall $i_unistd unistd.h
18105 eval $hasproto
18106
18107 : see if sysconf exists
18108 set sysconf d_sysconf
18109 eval $inlibc
18110
18111 : see if system exists
18112 set system d_system
18113 eval $inlibc
18114
18115 : see if tcgetpgrp exists
18116 set tcgetpgrp d_tcgetpgrp
18117 eval $inlibc
18118
18119 : see if tcsetpgrp exists
18120 set tcsetpgrp d_tcsetpgrp
18121 eval $inlibc
18122
18123 : see if prototype for telldir is available
18124 echo " "
18125 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18126 eval $hasproto
18127
18128 : see if time exists
18129 echo " "
18130 if test "X$d_time" = X -o X"$timetype" = X; then
18131     if set time val -f d_time; eval $csym; $val; then
18132                 echo 'time() found.' >&4
18133                 val="$define"
18134                 rp="What is the type returned by time() on this system?"
18135                 set time_t timetype long stdio.h sys/types.h
18136                 eval $typedef_ask
18137     else
18138                 echo 'time() not found, hope that will do.' >&4
18139                 val="$undef"
18140                 timetype='int';
18141     fi
18142     set d_time
18143     eval $setvar
18144 fi
18145
18146 : see if timegm exists
18147 set timegm d_timegm
18148 eval $inlibc
18149
18150 : see if this is a sys/times.h system
18151 set sys/times.h i_systimes
18152 eval $inhdr
18153
18154 : see if times exists
18155 echo " "
18156 if set times val -f d_times; eval $csym; $val; then
18157         echo 'times() found.' >&4
18158         d_times="$define"
18159         inc=''
18160         case "$i_systimes" in
18161         "$define") inc='sys/times.h';;
18162         esac
18163         rp="What is the type returned by times() on this system?"
18164         set clock_t clocktype long stdio.h sys/types.h $inc
18165         eval $typedef_ask
18166 else
18167         echo 'times() NOT found, hope that will do.' >&4
18168         d_times="$undef"
18169         clocktype='int'
18170 fi
18171
18172 : see if tmpnam_r exists
18173 set tmpnam_r d_tmpnam_r
18174 eval $inlibc
18175 case "$d_tmpnam_r" in
18176 "$define")
18177         hdrs="$i_systypes sys/types.h define stdio.h "
18178         case "$d_tmpnam_r_proto:$usethreads" in
18179         ":define")      d_tmpnam_r_proto=define
18180                 set d_tmpnam_r_proto tmpnam_r $hdrs
18181                 eval $hasproto ;;
18182         *)      ;;
18183         esac
18184         case "$d_tmpnam_r_proto" in
18185         define)
18186         case "$tmpnam_r_proto" in
18187         ''|0) try='char* tmpnam_r(char*);'
18188         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18189         esac
18190         case "$tmpnam_r_proto" in
18191         ''|0)   d_tmpnam_r=undef
18192                 tmpnam_r_proto=0
18193                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18194         * )     case "$tmpnam_r_proto" in
18195                 REENTRANT_PROTO*) ;;
18196                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18197                 esac
18198                 echo "Prototype: $try" ;;
18199         esac
18200         ;;
18201         *)      case "$usethreads" in
18202                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18203                 esac
18204                 d_tmpnam_r=undef
18205                 tmpnam_r_proto=0
18206                 ;;
18207         esac
18208         ;;
18209 *)      tmpnam_r_proto=0
18210         ;;
18211 esac
18212
18213 : see if truncate exists
18214 set truncate d_truncate
18215 eval $inlibc
18216
18217 : see if ttyname_r exists
18218 set ttyname_r d_ttyname_r
18219 eval $inlibc
18220 case "$d_ttyname_r" in
18221 "$define")
18222         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18223         case "$d_ttyname_r_proto:$usethreads" in
18224         ":define")      d_ttyname_r_proto=define
18225                 set d_ttyname_r_proto ttyname_r $hdrs
18226                 eval $hasproto ;;
18227         *)      ;;
18228         esac
18229         case "$d_ttyname_r_proto" in
18230         define)
18231         case "$ttyname_r_proto" in
18232         ''|0) try='int ttyname_r(int, char*, size_t);'
18233         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18234         esac
18235         case "$ttyname_r_proto" in
18236         ''|0) try='int ttyname_r(int, char*, int);'
18237         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18238         esac
18239         case "$ttyname_r_proto" in
18240         ''|0) try='char* ttyname_r(int, char*, int);'
18241         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18242         esac
18243         case "$ttyname_r_proto" in
18244         ''|0)   d_ttyname_r=undef
18245                 ttyname_r_proto=0
18246                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18247         * )     case "$ttyname_r_proto" in
18248                 REENTRANT_PROTO*) ;;
18249                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18250                 esac
18251                 echo "Prototype: $try" ;;
18252         esac
18253         ;;
18254         *)      case "$usethreads" in
18255                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18256                 esac
18257                 d_ttyname_r=undef
18258                 ttyname_r_proto=0
18259                 ;;
18260         esac
18261         ;;
18262 *)      ttyname_r_proto=0
18263         ;;
18264 esac
18265
18266 : see if tzname[] exists
18267 echo " "
18268 if set tzname val -a d_tzname; eval $csym; $val; then
18269         val="$define"
18270         echo 'tzname[] found.' >&4
18271 else
18272         val="$undef"
18273         echo 'tzname[] NOT found.' >&4
18274 fi
18275 set d_tzname
18276 eval $setvar
18277
18278 : Check if is a multiplatform env
18279 case "$osname" in
18280 next|rhapsody|darwin) multiarch="$define" ;;
18281 esac
18282 case "$multiarch" in
18283 ''|[nN]*) multiarch="$undef" ;;
18284 esac
18285
18286 : check for ordering of bytes in a UV
18287 echo " "
18288 case "$usecrosscompile$multiarch" in
18289 *$define*)
18290         $cat <<EOM
18291 You seem to be either cross-compiling or doing a multiarchitecture build,
18292 skipping the byteorder check.
18293
18294 EOM
18295         byteorder='ffff'
18296         ;;
18297 *)
18298         case "$byteorder" in
18299         '')
18300                 $cat <<'EOM'
18301 In the following, larger digits indicate more significance.  A big-endian
18302 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18303 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18304 machines may have weird orders like 3412.  A Cray will report 87654321,
18305 an Alpha will report 12345678. If the test program works the default is
18306 probably right.
18307 I'm now running the test program...
18308 EOM
18309                 $cat >try.c <<EOCP
18310 #include <stdio.h>
18311 #$i_stdlib I_STDLIB
18312 #ifdef I_STDLIB
18313 #include <stdlib.h>
18314 #endif
18315 #include <sys/types.h>
18316 typedef $uvtype UV;
18317 int main()
18318 {
18319         int i;
18320         union {
18321                 UV l;
18322                 char c[$uvsize];
18323         } u;
18324
18325         if ($uvsize > 4)
18326                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18327         else
18328                 u.l = (UV)0x04030201;
18329         for (i = 0; i < $uvsize; i++)
18330                 printf("%c", u.c[i]+'0');
18331         printf("\n");
18332         exit(0);
18333 }
18334 EOCP
18335                 xxx_prompt=y
18336                 set try
18337                 if eval $compile && $run ./try > /dev/null; then
18338                         dflt=`$run ./try`
18339                         case "$dflt" in
18340                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18341                                 echo "(The test program ran ok.)"
18342                                 echo "byteorder=$dflt"
18343                                 xxx_prompt=n
18344                         ;;
18345                         ????|????????) echo "(The test program ran ok.)" ;;
18346                         *) echo "(The test program didn't run right for some reason.)" ;;
18347                         esac
18348                 else
18349                         dflt='4321'
18350                         cat <<'EOM'
18351 (I can't seem to compile the test program.  Guessing big-endian...)
18352 EOM
18353                 fi
18354                 case "$xxx_prompt" in
18355                 y)
18356                         rp="What is the order of bytes in $uvtype?"
18357                         . ./myread
18358                         byteorder="$ans"
18359                         ;;
18360                 *)      byteorder=$dflt
18361                         ;;
18362                 esac
18363                 ;;
18364         esac
18365         $rm_try
18366         ;;
18367 esac
18368
18369 : Checking 32bit aligndness
18370 $cat <<EOM
18371
18372 Checking to see whether you can access character data unalignedly...
18373 EOM
18374 case "$d_u32align" in
18375 '')   $cat >try.c <<EOCP
18376 #include <stdio.h>
18377 #$i_stdlib I_STDLIB
18378 #ifdef I_STDLIB
18379 #include <stdlib.h>
18380 #endif
18381 #define U32 $u32type
18382 #define BYTEORDER 0x$byteorder
18383 #define U8 $u8type
18384 #include <signal.h>
18385 #ifdef SIGBUS
18386 $signal_t bletch(int s) { exit(4); }
18387 #endif
18388 int main() {
18389 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18390     U8 buf[8];
18391     U32 *up;
18392     int i;
18393
18394     if (sizeof(U32) != 4) {
18395         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18396         exit(1);
18397     }
18398
18399     fflush(stdout);
18400
18401 #ifdef SIGBUS
18402     signal(SIGBUS, bletch);
18403 #endif
18404
18405     buf[0] = 0;
18406     buf[1] = 0;
18407     buf[2] = 0;
18408     buf[3] = 1;
18409     buf[4] = 0;
18410     buf[5] = 0;
18411     buf[6] = 0;
18412     buf[7] = 1;
18413
18414     for (i = 0; i < 4; i++) {
18415         up = (U32*)(buf + i);
18416         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18417                (*up == 1 << (8*(3-i)))  /* little-endian */
18418               )
18419            )
18420         {
18421             printf("read failed (%x)\n", *up);
18422             exit(2);
18423         }
18424     }
18425
18426     /* write test */
18427     for (i = 0; i < 4; i++) {
18428         up = (U32*)(buf + i);
18429         *up = 0xBeef;
18430         if (*up != 0xBeef) {
18431             printf("write failed (%x)\n", *up);
18432             exit(3);
18433         }
18434     }
18435
18436     exit(0);
18437 #else
18438     printf("1\n");
18439     exit(1);
18440 #endif
18441     return 0;
18442 }
18443 EOCP
18444 set try
18445 if eval $compile_ok; then
18446         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18447         $run ./try 2>&1 >/dev/null
18448         case "$?" in
18449         0)      cat >&4 <<EOM
18450 You can access character data pretty unalignedly.
18451 EOM
18452                 d_u32align="$undef"
18453                 ;;
18454         *)      cat >&4 <<EOM
18455 It seems that you must access character data in an aligned manner.
18456 EOM
18457                 d_u32align="$define"
18458                 ;;
18459         esac
18460 else
18461         rp='Can you access character data at unaligned addresses?'
18462         dflt='n'
18463         . ./myread
18464         case "$ans" in
18465         [yY]*)  d_u32align="$undef"  ;;
18466         *)      d_u32align="$define" ;;
18467         esac
18468 fi
18469 $rm_try
18470 ;;
18471 esac
18472
18473 : see if ualarm exists
18474 set ualarm d_ualarm
18475 eval $inlibc
18476
18477 : see if umask exists
18478 set umask d_umask
18479 eval $inlibc
18480
18481 : see if unordered exists
18482 set unordered d_unordered
18483 eval $inlibc
18484
18485 : see if unsetenv exists
18486 set unsetenv d_unsetenv
18487 eval $inlibc
18488
18489 : see if usleep exists
18490 set usleep d_usleep
18491 eval $inlibc
18492
18493 : see if prototype for usleep is available
18494 echo " "
18495 set d_usleepproto usleep $i_unistd unistd.h
18496 eval $hasproto
18497
18498 : see if ustat exists
18499 set ustat d_ustat
18500 eval $inlibc
18501
18502 : see if closedir exists
18503 set closedir d_closedir
18504 eval $inlibc
18505
18506 case "$d_closedir" in
18507 "$define")
18508         echo " "
18509         echo "Checking whether closedir() returns a status..." >&4
18510         cat > try.c <<EOM
18511 #$i_dirent I_DIRENT             /**/
18512 #$i_sysdir I_SYS_DIR            /**/
18513 #$i_sysndir I_SYS_NDIR          /**/
18514 #$i_systypes I_SYS_TYPES        /**/
18515
18516 #if defined(I_SYS_TYPES)
18517 #include <sys/types.h>
18518 #endif
18519 #if defined(I_DIRENT)
18520 #include <dirent.h>
18521 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18522 #include <sys/dir.h>
18523 #endif
18524 #else
18525 #ifdef I_SYS_NDIR
18526 #include <sys/ndir.h>
18527 #else
18528 #ifdef I_SYS_DIR
18529 #ifdef hp9000s500
18530 #include <ndir.h>       /* may be wrong in the future */
18531 #else
18532 #include <sys/dir.h>
18533 #endif
18534 #endif
18535 #endif
18536 #endif
18537 int main() { return closedir(opendir(".")); }
18538 EOM
18539         set try
18540         if eval $compile_ok; then
18541                 if $run ./try > /dev/null 2>&1 ; then
18542                         echo "Yes, it does."
18543                         val="$undef"
18544                 else
18545                         echo "No, it doesn't."
18546                         val="$define"
18547                 fi
18548         else
18549                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18550                 val="$define"
18551         fi
18552         ;;
18553 *)
18554         val="$undef";
18555         ;;
18556 esac
18557 set d_void_closedir
18558 eval $setvar
18559 $rm_try
18560
18561 : see if there is a wait4
18562 set wait4 d_wait4
18563 eval $inlibc
18564
18565 : see if waitpid exists
18566 set waitpid d_waitpid
18567 eval $inlibc
18568
18569 : see if wcstombs exists
18570 set wcstombs d_wcstombs
18571 eval $inlibc
18572
18573 : see if wctomb exists
18574 set wctomb d_wctomb
18575 eval $inlibc
18576
18577 : see if writev exists
18578 set writev d_writev
18579 eval $inlibc
18580
18581 : preserve RCS keywords in files with variable substitution, grrr
18582 Date='$Date'
18583 Id='$Id'
18584 Log='$Log'
18585 RCSfile='$RCSfile'
18586 Revision='$Revision'
18587
18588 : check for alignment requirements
18589 echo " "
18590 case "$usecrosscompile$multiarch" in
18591 *$define*)
18592         $cat <<EOM
18593 You seem to be either cross-compiling or doing a multiarchitecture build,
18594 skipping the memory alignment check.
18595
18596 EOM
18597         case "$alignbytes" in
18598         '') alignbytes=8 ;;
18599         esac
18600         ;;
18601 *)
18602         case "$alignbytes" in
18603         '') echo "Checking alignment constraints..." >&4
18604                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18605                         $cat >try.c <<'EOCP'
18606 typedef long double NV;
18607 EOCP
18608                 else
18609                         $cat >try.c <<'EOCP'
18610 typedef double NV;
18611 EOCP
18612                 fi
18613                 $cat >>try.c <<'EOCP'
18614 #include <stdio.h>
18615 struct foobar {
18616         char foo;
18617         NV bar;
18618 } try_algn;
18619 int main()
18620 {
18621     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18622     return(0);
18623 }
18624 EOCP
18625                 set try
18626                 if eval $compile_ok; then
18627                         dflt=`$run ./try`
18628                 else
18629                         dflt='8'
18630                         echo "(I can't seem to compile the test program...)"
18631                 fi
18632                 ;;
18633         *) dflt="$alignbytes"
18634                 ;;
18635         esac
18636         rp="Doubles must be aligned on a how-many-byte boundary?"
18637         . ./myread
18638         alignbytes="$ans"
18639         $rm_try
18640         ;;
18641 esac
18642
18643
18644 : set the base revision
18645 baserev=5.0
18646
18647 : how do we concatenate cpp tokens here?
18648 echo " "
18649 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18650 $cat >cpp_stuff.c <<'EOCP'
18651 #define RCAT(a,b)a/**/b
18652 #define ACAT(a,b)a ## b
18653 RCAT(Rei,ser)
18654 ACAT(Cir,cus)
18655 EOCP
18656 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18657 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18658         echo "Oh!  Smells like ANSI's been here." >&4
18659         echo "We can catify or stringify, separately or together!"
18660         cpp_stuff=42
18661 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18662         echo "Ah, yes!  The good old days!" >&4
18663         echo "However, in the good old days we don't know how to stringify and"
18664         echo "catify at the same time."
18665         cpp_stuff=1
18666 else
18667         $cat >&4 <<EOM
18668 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18669 You're going to have to edit the values of CAT[2-5] in config.h...
18670 EOM
18671         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18672 fi
18673 $rm -f cpp_stuff.*
18674
18675 : see if this is a db.h system
18676 set db.h i_db
18677 eval $inhdr
18678
18679 case "$i_db" in
18680 $define)
18681         : Check db version.
18682         echo " "
18683         echo "Checking Berkeley DB version ..." >&4
18684         $cat >try.c <<EOCP
18685 #$d_const HASCONST
18686 #ifndef HASCONST
18687 #define const
18688 #endif
18689 #include <sys/types.h>
18690 #include <stdio.h>
18691 #$i_stdlib I_STDLIB
18692 #ifdef I_STDLIB
18693 #include <stdlib.h>
18694 #endif
18695 #include <db.h>
18696 int main(int argc, char *argv[])
18697 {
18698 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18699     int Major, Minor, Patch ;
18700     unsigned long Version ;
18701     (void)db_version(&Major, &Minor, &Patch) ;
18702     if (argc == 2) {
18703         printf("%d %d %d %d %d %d\n",
18704                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18705                Major, Minor, Patch);
18706         exit(0);
18707     }
18708     printf("You have Berkeley DB Version 2 or greater.\n");
18709
18710     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18711                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18712     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18713                 Major, Minor, Patch) ;
18714
18715     /* check that db.h & libdb are compatible */
18716     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18717         printf("db.h and libdb are incompatible.\n") ;
18718         exit(3);
18719     }
18720
18721     printf("db.h and libdb are compatible.\n") ;
18722
18723     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18724                 + DB_VERSION_PATCH ;
18725
18726     /* needs to be >= 2.3.4 */
18727     if (Version < 2003004) {
18728     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18729         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18730         exit(2);
18731     }
18732
18733     exit(0);
18734 #else
18735 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18736     if (argc == 2) {
18737         printf("1 0 0\n");
18738         exit(0);
18739     }
18740     printf("You have Berkeley DB Version 1.\n");
18741     exit(0);    /* DB version < 2: the coast is clear. */
18742 #else
18743     exit(1);    /* <db.h> not Berkeley DB? */
18744 #endif
18745 #endif
18746 }
18747 EOCP
18748         set try
18749         if eval $compile_ok && $run ./try; then
18750                 echo 'Looks OK.' >&4
18751                 set `$run ./try 1`
18752                 db_version_major=$1
18753                 db_version_minor=$2
18754                 db_version_patch=$3
18755         else
18756                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18757                 i_db=$undef
18758                 case " $libs " in
18759                 *"-ldb "*)
18760                         : Remove db from list of libraries to use
18761                         echo "Removing unusable -ldb from library list" >&4
18762                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18763                         shift
18764                         libs="$*"
18765                         echo "libs = $libs" >&4
18766                         ;;
18767                 esac
18768         fi
18769         $rm_try
18770         ;;
18771 esac
18772
18773 case "$i_db" in
18774 define)
18775         : Check the return type needed for hash
18776         echo " "
18777         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18778         $cat >try.c <<EOCP
18779 #$d_const HASCONST
18780 #ifndef HASCONST
18781 #define const
18782 #endif
18783 #include <sys/types.h>
18784 #include <db.h>
18785
18786 #ifndef DB_VERSION_MAJOR
18787 u_int32_t hash_cb (ptr, size)
18788 const void *ptr;
18789 size_t size;
18790 {
18791 }
18792 HASHINFO info;
18793 int main()
18794 {
18795         info.hash = hash_cb;
18796 }
18797 #endif
18798 EOCP
18799         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18800                 if $contains warning try.out >>/dev/null 2>&1 ; then
18801                         db_hashtype='int'
18802                 else
18803                         db_hashtype='u_int32_t'
18804                 fi
18805         else
18806                 : XXX Maybe we should just give up here.
18807                 db_hashtype=u_int32_t
18808                 $cat try.out >&4
18809                 echo "Help:  I can't seem to compile the db test program." >&4
18810                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18811         fi
18812         $rm_try
18813         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18814         ;;
18815 *)      db_hashtype=u_int32_t
18816         ;;
18817 esac
18818 case "$i_db" in
18819 define)
18820         : Check the return type needed for prefix
18821         echo " "
18822         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18823         cat >try.c <<EOCP
18824 #$d_const HASCONST
18825 #ifndef HASCONST
18826 #define const
18827 #endif
18828 #include <sys/types.h>
18829 #include <db.h>
18830
18831 #ifndef DB_VERSION_MAJOR
18832 size_t prefix_cb (key1, key2)
18833 const DBT *key1;
18834 const DBT *key2;
18835 {
18836 }
18837 BTREEINFO info;
18838 int main()
18839 {
18840         info.prefix = prefix_cb;
18841 }
18842 #endif
18843 EOCP
18844         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18845                 if $contains warning try.out >>/dev/null 2>&1 ; then
18846                         db_prefixtype='int'
18847                 else
18848                         db_prefixtype='size_t'
18849                 fi
18850         else
18851                 db_prefixtype='size_t'
18852                 : XXX Maybe we should just give up here.
18853                 $cat try.out >&4
18854                 echo "Help:  I can't seem to compile the db test program." >&4
18855                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18856         fi
18857         $rm_try
18858         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18859         ;;
18860 *)      db_prefixtype='size_t'
18861         ;;
18862 esac
18863
18864 : How can we generate normalized random numbers ?
18865 echo " "
18866 echo "Looking for a random number function..." >&4
18867 case "$randfunc" in
18868 '')
18869         if set drand48 val -f; eval $csym; $val; then
18870                 dflt="drand48"
18871                 echo "Good, found drand48()." >&4
18872         elif set random val -f; eval $csym; $val; then
18873                 dflt="random"
18874                 echo "OK, found random()." >&4
18875         else
18876                 dflt="rand"
18877                 echo "Yick, looks like I have to use rand()." >&4
18878         fi
18879         echo " "
18880         ;;
18881 *)
18882         dflt="$randfunc"
18883         ;;
18884 esac
18885 cont=true
18886
18887 case "$ccflags" in
18888 *-Dmy_rand=*|*-Dmy_srand=*)
18889         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18890         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18891         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18892         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18893         ;;
18894 esac
18895
18896 while $test "$cont"; do
18897         rp="Use which function to generate random numbers?"
18898         . ./myread
18899         if $test "$ans" = "$dflt"; then
18900                 : null
18901         else
18902                 randbits=''
18903         fi
18904         randfunc="$ans"
18905         if set $ans val -f; eval $csym; $val; then
18906                 cont=''
18907         else
18908                 dflt=y
18909                 rp="I cannot find function $ans. Use that name anyway?"
18910                 . ./myread
18911                 dflt=rand
18912                 case "$ans" in
18913                         [yY]*) cont='';;
18914                 esac
18915         fi
18916         case "$cont" in
18917         '')
18918                 case "$randfunc" in
18919                 drand48)
18920                         drand01="drand48()"
18921                         seedfunc="srand48"
18922                         randbits=48
18923                         randseedtype=long
18924                         ;;
18925                 rand|random)
18926                         case "$randbits" in
18927                         '')
18928 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18929                                 $cat >try.c <<EOCP
18930 #$i_unistd I_UNISTD
18931 #$i_stdlib I_STDLIB
18932 #include <stdio.h>
18933 #ifdef I_UNISTD
18934 #  include <unistd.h>
18935 #endif
18936 #ifdef I_STDLIB
18937 #  include <stdlib.h>
18938 #endif
18939 int main()
18940 {
18941         register int i;
18942         register unsigned long tmp;
18943         register unsigned long max = 0L;
18944
18945         for (i = 1000; i; i--) {
18946                 tmp = (unsigned long) $randfunc();
18947                 if (tmp > max) max = tmp;
18948         }
18949         for (i = 0; max; i++)
18950                 max /= 2;
18951         printf("%d\n",i);
18952 }
18953 EOCP
18954                                 set try
18955                                 if eval $compile_ok; then
18956                                         dflt=`try`
18957                                 else
18958                                         dflt='?'
18959                                         echo "(I can't seem to compile the test program...)"
18960                                 fi
18961                                 ;;
18962                         *)
18963                                 dflt="$randbits"
18964                                 ;;
18965                         esac
18966                         rp="How many bits does your $randfunc() function produce?"
18967                         . ./myread
18968                         randbits="$ans"
18969                         $rm_try
18970                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18971                         seedfunc="s$randfunc"
18972                         randseedtype=unsigned
18973                         ;;
18974                 *)
18975                         dflt="31"
18976                         rp="How many bits does your $randfunc() function produce?"
18977                         . ./myread
18978                         randbits="$ans"
18979                         seedfunc="s$randfunc"
18980                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18981                         if set $seedfunc val -f; eval $csym; $val; then
18982                                 echo "(Using $seedfunc() to seed random generator)"
18983                         else
18984                                 echo "(Warning: no $seedfunc() to seed random generator)"
18985                                 seedfunc=rand
18986                         fi
18987                         randseedtype=unsigned
18988                         ;;
18989                 esac
18990                 ;;
18991         esac
18992 done
18993
18994 : Determine if this is an EBCDIC system
18995 echo " "
18996 echo "Determining whether or not we are on an EBCDIC system..." >&4
18997 $cat >try.c <<'EOM'
18998 int main()
18999 {
19000   if ('M'==0xd4) return 0;
19001   return 1;
19002 }
19003 EOM
19004
19005 val=$undef
19006 set try
19007 if eval $compile_ok; then
19008         if $run ./try; then
19009                 echo "You seem to speak EBCDIC." >&4
19010                 val="$define"
19011         else
19012                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19013         fi
19014 else
19015         echo "I'm unable to compile the test program." >&4
19016         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19017 fi
19018 $rm_try
19019 set ebcdic
19020 eval $setvar
19021
19022 : Check how to flush
19023 echo " "
19024 $cat >&4 <<EOM
19025 Checking how to flush all pending stdio output...
19026 EOM
19027 # I only know how to find the first 32 possibly open files on SunOS.
19028 # See also hints/sunos_4_1.sh and util.c  --AD
19029 case "$osname" in
19030 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19031 esac
19032 $cat >>try.c <<EOCP
19033 #include <stdio.h>
19034 #$i_stdlib I_STDLIB
19035 #ifdef I_STDLIB
19036 #include <stdlib.h>
19037 #endif
19038 #$i_unistd I_UNISTD
19039 #ifdef I_UNISTD
19040 # include <unistd.h>
19041 #endif
19042 #$d_sysconf HAS_SYSCONF
19043 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19044 #ifdef HAS_STDIO_STREAM_ARRAY
19045 # define STDIO_STREAM_ARRAY $stdio_stream_array
19046 #endif
19047 int main() {
19048   FILE* p;
19049   unlink("try.out");
19050   p = fopen("try.out", "w");
19051 #ifdef TRY_FPUTC
19052   fputc('x', p);
19053 #else
19054 # ifdef TRY_FPRINTF
19055   fprintf(p, "x");
19056 # endif
19057 #endif
19058 #ifdef TRY_FFLUSH_NULL
19059   fflush(NULL);
19060 #endif
19061 #ifdef TRY_FFLUSH_ALL
19062   {
19063     long open_max = -1;
19064 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19065     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19066 # else
19067 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19068     open_max = sysconf(_SC_OPEN_MAX);
19069 #  else
19070 #   ifdef FOPEN_MAX
19071     open_max = FOPEN_MAX;
19072 #   else
19073 #    ifdef OPEN_MAX
19074     open_max = OPEN_MAX;
19075 #    else
19076 #     ifdef _NFILE
19077     open_max = _NFILE;
19078 #     endif
19079 #    endif
19080 #   endif
19081 #  endif
19082 # endif
19083 # ifdef HAS_STDIO_STREAM_ARRAY
19084     if (open_max > 0) {
19085       long i;
19086       for (i = 0; i < open_max; i++)
19087             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19088                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19089                 STDIO_STREAM_ARRAY[i]._flag)
19090                 fflush(&STDIO_STREAM_ARRAY[i]);
19091     }
19092   }
19093 # endif
19094 #endif
19095   _exit(42);
19096 }
19097 EOCP
19098 : first we have to find out how _not_ to flush
19099 $to try.c
19100 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19101     output=''
19102     set try -DTRY_FPUTC
19103     if eval $compile; then
19104             $run ./try 2>/dev/null
19105             code="$?"
19106             $from try.out
19107             if $test ! -s try.out -a "X$code" = X42; then
19108                 output=-DTRY_FPUTC
19109             fi
19110     fi
19111     case "$output" in
19112     '')
19113             set try -DTRY_FPRINTF
19114             if eval $compile; then
19115                     $run ./try 2>/dev/null
19116                     code="$?"
19117                     $from try.out
19118                     if $test ! -s try.out -a "X$code" = X42; then
19119                         output=-DTRY_FPRINTF
19120                     fi
19121             fi
19122         ;;
19123     esac
19124 fi
19125 : check for fflush NULL behaviour
19126 case "$fflushNULL" in
19127 '')     set try -DTRY_FFLUSH_NULL $output
19128         if eval $compile; then
19129                 $run ./try 2>/dev/null
19130                 code="$?"
19131                 $from try.out
19132                 if $test -s try.out -a "X$code" = X42; then
19133                         fflushNULL="`$cat try.out`"
19134                 else
19135                         if $test "X$code" != X42; then
19136                                 $cat >&4 <<EOM
19137 (If this test failed, don't worry, we'll try another method shortly.)
19138 EOM
19139                         fi
19140                 fi
19141         fi
19142         $rm -f core try.core core.try.*
19143         case "$fflushNULL" in
19144         x)      $cat >&4 <<EOM
19145 Your fflush(NULL) works okay for output streams.
19146 Let's see if it clobbers input pipes...
19147 EOM
19148 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19149 # bug that improperly flushes the input end of pipes.  So we avoid the
19150 # autoflush on fork/system/exec support for now. :-(
19151 $cat >tryp.c <<EOCP
19152 #include <stdio.h>
19153 int
19154 main(int argc, char **argv)
19155 {
19156     char buf[1024];
19157     int i;
19158     char *bp = buf;
19159     while (1) {
19160         while ((i = getc(stdin)) != -1
19161                && (*bp++ = i) != '\n'
19162                && bp < &buf[1024])
19163         /* DO NOTHING */ ;
19164         *bp = '\0';
19165         fprintf(stdout, "%s", buf);
19166         fflush(NULL);
19167         if (i == -1)
19168             return 0;
19169         bp = buf;
19170     }
19171 }
19172 EOCP
19173                 fflushNULL="$define"
19174                 set tryp
19175                 if eval $compile; then
19176                     $rm -f tryp.out
19177                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19178                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19179                        $cat >&4 <<EOM
19180 fflush(NULL) seems to behave okay with input streams.
19181 EOM
19182                         fflushNULL="$define"
19183                     else
19184                         $cat >&4 <<EOM
19185 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19186 EOM
19187                         fflushNULL="$undef"
19188                     fi
19189                 fi
19190                 $rm -f core tryp.c tryp.core core.tryp.*
19191                 ;;
19192         '')     $cat >&4 <<EOM
19193 Your fflush(NULL) isn't working (contrary to ANSI C).
19194 EOM
19195                 fflushNULL="$undef"
19196                 ;;
19197         *)      $cat >&4 <<EOM
19198 Cannot figure out whether your fflush(NULL) works or not.
19199 I'm assuming it doesn't (contrary to ANSI C).
19200 EOM
19201                 fflushNULL="$undef"
19202                 ;;
19203         esac
19204         ;;
19205 $define|true|[yY]*)
19206         fflushNULL="$define"
19207         ;;
19208 *)
19209         fflushNULL="$undef"
19210         ;;
19211 esac
19212 : check explicit looping only if NULL did not work, and if the pipe
19213 : bug does not show up on an explicit flush too
19214 case "$fflushNULL" in
19215 "$undef")
19216         $cat >tryp.c <<EOCP
19217 #include <stdio.h>
19218 int
19219 main(int argc, char **argv)
19220 {
19221     char buf[1024];
19222     int i;
19223     char *bp = buf;
19224     while (1) {
19225         while ((i = getc(stdin)) != -1
19226                && (*bp++ = i) != '\n'
19227                && bp < &buf[1024])
19228         /* DO NOTHING */ ;
19229         *bp = '\0';
19230         fprintf(stdout, "%s", buf);
19231         fflush(stdin);
19232         if (i == -1)
19233             return 0;
19234         bp = buf;
19235     }
19236 }
19237 EOCP
19238         set tryp
19239         if eval $compile; then
19240             $rm -f tryp.out
19241             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19242             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19243                $cat >&4 <<EOM
19244 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19245 EOM
19246                 : now check for fflushall behaviour
19247                 case "$fflushall" in
19248                 '')     set try -DTRY_FFLUSH_ALL $output
19249                         if eval $compile; then
19250                                 $cat >&4 <<EOM
19251 (Now testing the other method--but note that this also may fail.)
19252 EOM
19253                                 $run ./try 2>/dev/null
19254                                 code=$?
19255                                 $from try.out
19256                                 if $test -s try.out -a "X$code" = X42; then
19257                                         fflushall="`$cat try.out`"
19258                                 fi
19259                         fi
19260                         $rm_try
19261                         case "$fflushall" in
19262                         x)      $cat >&4 <<EOM
19263 Whew. Flushing explicitly all the stdio streams works.
19264 EOM
19265                                 fflushall="$define"
19266                                 ;;
19267                         '')     $cat >&4 <<EOM
19268 Sigh. Flushing explicitly all the stdio streams doesn't work.
19269 EOM
19270                                 fflushall="$undef"
19271                                 ;;
19272                         *)      $cat >&4 <<EOM
19273 Cannot figure out whether flushing stdio streams explicitly works or not.
19274 I'm assuming it doesn't.
19275 EOM
19276                                 fflushall="$undef"
19277                                 ;;
19278                         esac
19279                         ;;
19280                 "$define"|true|[yY]*)
19281                         fflushall="$define"
19282                         ;;
19283                 *)
19284                         fflushall="$undef"
19285                         ;;
19286                 esac
19287             else
19288                 $cat >&4 <<EOM
19289 All is futile.  Even fflush(stdin) clobbers input pipes!
19290 EOM
19291                 fflushall="$undef"
19292             fi
19293         else
19294             fflushall="$undef"
19295         fi
19296         $rm -f core tryp.c tryp.core core.tryp.*
19297         ;;
19298 *)      fflushall="$undef"
19299         ;;
19300 esac
19301
19302 case "$fflushNULL$fflushall" in
19303 undefundef)
19304         $cat <<EOM
19305 OK, I give up.  I cannot figure out how to flush pending stdio output.
19306 We won't be flushing handles at all before fork/exec/popen.
19307 EOM
19308         ;;
19309 esac
19310 $rm_try tryp
19311
19312 : Store the full pathname to the ar program for use in the C program
19313 : Respect a hint or command line value for full_ar.
19314 case "$full_ar" in
19315 '') full_ar=$ar ;;
19316 esac
19317
19318 : Store the full pathname to the sed program for use in the C program
19319 full_sed=$sed
19320
19321 : see what type gids are declared as in the kernel
19322 echo " "
19323 echo "Looking for the type for group ids returned by getgid()."
19324 set gid_t gidtype xxx stdio.h sys/types.h
19325 eval $typedef
19326 case "$gidtype" in
19327 xxx)
19328         xxx=`./findhdr sys/user.h`
19329         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19330         case $1 in
19331         unsigned) dflt="$1 $2" ;;
19332         *) dflt="$1" ;;
19333         esac
19334         ;;
19335 *) dflt="$gidtype";;
19336 esac
19337 case "$gidtype" in
19338 gid_t) echo "gid_t found." ;;
19339 *)      rp="What is the type for group ids returned by getgid()?"
19340         . ./myread
19341         gidtype="$ans"
19342         ;;
19343 esac
19344
19345 : Check the size of GID
19346 echo " "
19347 case "$gidtype" in
19348 *_t) zzz="$gidtype"     ;;
19349 *)   zzz="gid"          ;;
19350 esac
19351 echo "Checking the size of $zzz..." >&4
19352 cat > try.c <<EOCP
19353 #include <sys/types.h>
19354 #include <stdio.h>
19355 #$i_stdlib I_STDLIB
19356 #ifdef I_STDLIB
19357 #include <stdlib.h>
19358 #endif
19359 int main() {
19360     printf("%d\n", (int)sizeof($gidtype));
19361     exit(0);
19362 }
19363 EOCP
19364 set try
19365 if eval $compile_ok; then
19366         yyy=`$run ./try`
19367         case "$yyy" in
19368         '')     gidsize=4
19369                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19370                 ;;
19371         *)      gidsize=$yyy
19372                 echo "Your $zzz is $gidsize bytes long."
19373                 ;;
19374         esac
19375 else
19376         gidsize=4
19377         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19378 fi
19379
19380
19381 : Check if GID is signed
19382 echo " "
19383 case "$gidtype" in
19384 *_t) zzz="$gidtype"     ;;
19385 *)   zzz="gid"          ;;
19386 esac
19387 echo "Checking the sign of $zzz..." >&4
19388 cat > try.c <<EOCP
19389 #include <sys/types.h>
19390 #include <stdio.h>
19391 int main() {
19392         $gidtype foo = -1;
19393         if (foo < 0)
19394                 printf("-1\n");
19395         else
19396                 printf("1\n");
19397 }
19398 EOCP
19399 set try
19400 if eval $compile; then
19401         yyy=`$run ./try`
19402         case "$yyy" in
19403         '')     gidsign=1
19404                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19405                 ;;
19406         *)      gidsign=$yyy
19407                 case "$gidsign" in
19408                  1) echo "Your $zzz is unsigned." ;;
19409                 -1) echo "Your $zzz is signed."   ;;
19410                 esac
19411                 ;;
19412         esac
19413 else
19414         gidsign=1
19415         echo "(I can't compile the test program--guessing unsigned.)" >&4
19416 fi
19417
19418
19419 : Check 64bit sizes
19420 echo " "
19421
19422 if $test X"$quadtype" != X; then
19423
19424 echo "Checking how to print 64-bit integers..." >&4
19425
19426 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19427         $cat >try.c <<'EOCP'
19428 #include <sys/types.h>
19429 #include <stdio.h>
19430 int main() {
19431   int q = 12345678901;
19432   printf("%ld\n", q);
19433 }
19434 EOCP
19435         set try
19436         if eval $compile; then
19437                 yyy=`$run ./try`
19438                 case "$yyy" in
19439                 12345678901)
19440                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19441                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19442                         echo "We will use %d."
19443                         ;;
19444                 esac
19445         fi
19446 fi
19447
19448 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19449         $cat >try.c <<'EOCP'
19450 #include <sys/types.h>
19451 #include <stdio.h>
19452 int main() {
19453   long q = 12345678901;
19454   printf("%ld\n", q);
19455 }
19456 EOCP
19457         set try
19458         if eval $compile; then
19459                 yyy=`$run ./try`
19460                 case "$yyy" in
19461                 12345678901)
19462                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19463                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19464                         echo "We will use %ld."
19465                         ;;
19466                 esac
19467         fi
19468 fi
19469
19470 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19471         $cat >try.c <<'EOCP'
19472 #include <sys/types.h>
19473 #include <inttypes.h>
19474 #include <stdio.h>
19475 int main() {
19476   int64_t q = 12345678901;
19477   printf("%" PRId64 "\n", q);
19478 }
19479 EOCP
19480         set try
19481         if eval $compile; then
19482                 yyy=`$run ./try`
19483                 case "$yyy" in
19484                 12345678901)
19485                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19486                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19487                         echo "We will use the C9X style."
19488                         ;;
19489                 esac
19490         fi
19491 fi
19492
19493 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19494         $cat >try.c <<EOCP
19495 #include <sys/types.h>
19496 #include <stdio.h>
19497 int main() {
19498   $quadtype q = 12345678901;
19499   printf("%Ld\n", q);
19500 }
19501 EOCP
19502         set try
19503         if eval $compile; then
19504                 yyy=`$run ./try`
19505                 case "$yyy" in
19506                 12345678901)
19507                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19508                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19509                         echo "We will use %Ld."
19510                         ;;
19511                 esac
19512         fi
19513 fi
19514
19515 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19516         $cat >try.c <<'EOCP'
19517 #include <sys/types.h>
19518 #include <stdio.h>
19519 int main() {
19520   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19521   printf("%lld\n", q);
19522 }
19523 EOCP
19524         set try
19525         if eval $compile; then
19526                 yyy=`$run ./try`
19527                 case "$yyy" in
19528                 12345678901)
19529                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19530                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19531                         echo "We will use the %lld style."
19532                         ;;
19533                 esac
19534         fi
19535 fi
19536
19537 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19538         $cat >try.c <<EOCP
19539 #include <sys/types.h>
19540 #include <stdio.h>
19541 int main() {
19542   $quadtype q = 12345678901;
19543   printf("%qd\n", q);
19544 }
19545 EOCP
19546         set try
19547         if eval $compile; then
19548                 yyy=`$run ./try`
19549                 case "$yyy" in
19550                 12345678901)
19551                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19552                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19553                         echo "We will use %qd."
19554                         ;;
19555                 esac
19556         fi
19557 fi
19558
19559 if $test X"$sPRId64" = X; then
19560         echo "Cannot figure out how to print 64-bit integers." >&4
19561 fi
19562 $rm_try
19563
19564 fi
19565
19566 case "$sPRId64" in
19567 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19568         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19569         ;;
19570 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19571         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19572         ;;
19573 esac
19574
19575 : Check format strings for internal types
19576 echo " "
19577 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19578
19579 if $test X"$ivsize" = X8; then
19580         ivdformat="$sPRId64"
19581         uvuformat="$sPRIu64"
19582         uvoformat="$sPRIo64"
19583         uvxformat="$sPRIx64"
19584         uvXUformat="$sPRIXU64"
19585 else
19586         if $test X"$ivsize" = X"$longsize"; then
19587                 ivdformat='"ld"'
19588                 uvuformat='"lu"'
19589                 uvoformat='"lo"'
19590                 uvxformat='"lx"'
19591                 uvXUformat='"lX"'
19592         else
19593                 if $test X"$ivsize" = X"$intsize"; then
19594                         ivdformat='"d"'
19595                         uvuformat='"u"'
19596                         uvoformat='"o"'
19597                         uvxformat='"x"'
19598                         uvXUformat='"X"'
19599                 else
19600                         : far out
19601                         if $test X"$ivsize" = X"$shortsize"; then
19602                                 ivdformat='"hd"'
19603                                 uvuformat='"hu"'
19604                                 uvoformat='"ho"'
19605                                 uvxformat='"hx"'
19606                                 uvXUformat='"hX"'
19607                         fi
19608                 fi
19609         fi
19610 fi
19611
19612 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19613         nveformat="$sPRIeldbl"
19614         nvfformat="$sPRIfldbl"
19615         nvgformat="$sPRIgldbl"
19616         nvEUformat="$sPRIEUldbl"
19617         nvFUformat="$sPRIFUldbl"
19618         nvGUformat="$sPRIGUldbl"
19619 else
19620         nveformat='"e"'
19621         nvfformat='"f"'
19622         nvgformat='"g"'
19623         nvEUformat='"E"'
19624         nvFUformat='"F"'
19625         nvGUformat='"G"'
19626 fi
19627
19628 case "$ivdformat" in
19629 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19630     exit 1
19631     ;;
19632 esac
19633
19634 : Check format string for GID
19635
19636 echo " "
19637 $echo "Checking the format string to be used for gids..." >&4
19638
19639 case "$gidsign" in
19640 -1)     if $test X"$gidsize" = X"$ivsize"; then
19641                 gidformat="$ivdformat"
19642         else
19643                 if $test X"$gidsize" = X"$longsize"; then
19644                         gidformat='"ld"'
19645                 else
19646                         if $test X"$gidsize" = X"$intsize"; then
19647                                 gidformat='"d"'
19648                         else
19649                                 if $test X"$gidsize" = X"$shortsize"; then
19650                                         gidformat='"hd"'
19651                                 fi
19652                         fi
19653                 fi
19654         fi
19655         ;;
19656 *)      if $test X"$gidsize" = X"$uvsize"; then
19657                 gidformat="$uvuformat"
19658         else
19659                 if $test X"$gidsize" = X"$longsize"; then
19660                         gidformat='"lu"'
19661                 else
19662                         if $test X"$gidsize" = X"$intsize"; then
19663                                 gidformat='"u"'
19664                         else
19665                                 if $test X"$gidsize" = X"$shortsize"; then
19666                                         gidformat='"hu"'
19667                                 fi
19668                         fi
19669                 fi
19670         fi
19671         ;;
19672 esac
19673
19674 : see if getgroups exists
19675 set getgroups d_getgrps
19676 eval $inlibc
19677
19678 : see if setgroups exists
19679 set setgroups d_setgrps
19680 eval $inlibc
19681
19682 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19683 echo " "
19684 case "$d_getgrps$d_setgrps" in
19685 *define*)
19686         case "$groupstype" in
19687         '') dflt="$gidtype" ;;
19688         *)  dflt="$groupstype" ;;
19689         esac
19690         $cat <<EOM
19691 What type of pointer is the second argument to getgroups() and setgroups()?
19692 Usually this is the same as group ids, $gidtype, but not always.
19693
19694 EOM
19695         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19696         . ./myread
19697         groupstype="$ans"
19698         ;;
19699 *)  groupstype="$gidtype";;
19700 esac
19701
19702 : MAD = Misc Attribute Definition
19703
19704 if $test $patchlevel -lt 9; then
19705 : MAD is not available in 5.8.x or earlier.
19706     ans=n;
19707 else
19708     case "$mad" in
19709     $define|true|[yY]*) dflt='y' ;;
19710     *)                  dflt='n' ;;
19711     esac
19712     cat <<EOM
19713
19714 Would you like to build with Misc Attribute Decoration? This is development
19715 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19716 overhead on the interpreter.
19717
19718 If this doesn't make any sense to you, just accept the default '$dflt'.
19719 EOM
19720     rp='Build Perl with MAD?'
19721     . ./myread
19722 fi
19723 case "$ans" in
19724 y|Y)    val="$define"
19725         madlyh='madly.h madly.act madly.tab'
19726         madlysrc='madly.c'
19727         madlyobj="madly$_o" ;;
19728 *)      val="$undef"
19729         madlyh=''
19730         madlysrc=''
19731         madlyobj='' ;;
19732 esac
19733 set mad
19734 eval $setvar
19735
19736 : check whether make sets MAKE
19737 echo " "
19738 echo "Checking if your $make program sets \$(MAKE)..." >&4
19739 case "$make_set_make" in
19740 '')
19741         $sed 's/^X //' > testmake.mak << 'EOF'
19742 Xall:
19743 X       @echo 'maketemp="$(MAKE)"'
19744 EOF
19745         case "`$make -f testmake.mak 2>/dev/null`" in
19746         *maketemp=*) make_set_make='#' ;;
19747         *)      make_set_make="MAKE=$make" ;;
19748         esac
19749         $rm -f testmake.mak
19750         ;;
19751 esac
19752 case "$make_set_make" in
19753 '#') echo "Yup, it does.";;
19754 *) echo "Nope, it doesn't.";;
19755 esac
19756
19757 : see what type is used for mode_t
19758 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19759 set mode_t modetype int stdio.h sys/types.h
19760 eval $typedef_ask
19761
19762 : see if we need va_copy
19763 echo " "
19764 case "$i_stdarg" in
19765 "$define")
19766         $cat >try.c <<EOCP
19767 #include <stdarg.h>
19768 #include <stdio.h>
19769 #$i_stdlib I_STDLIB
19770 #ifdef I_STDLIB
19771 #include <stdlib.h>
19772 #endif
19773 #include <signal.h>
19774
19775 int
19776 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19777 {
19778   return vfprintf(f, fmt, *valp);
19779 }
19780
19781 int
19782 myvfprintf(FILE *f, const  char *fmt, va_list val)
19783 {
19784   return ivfprintf(f, fmt, &val);
19785 }
19786
19787 int
19788 myprintf(char *fmt, ...)
19789 {
19790   va_list val;
19791   va_start(val, fmt);
19792   return myvfprintf(stdout, fmt, val);
19793 }
19794
19795 int
19796 main(int ac, char **av)
19797 {
19798   signal(SIGSEGV, exit);
19799
19800   myprintf("%s%cs all right, then\n", "that", '\'');
19801   exit(0);
19802 }
19803 EOCP
19804         set try
19805         if eval $compile && $run ./try 2>&1 >/dev/null; then
19806                 case "`$run ./try`" in
19807                 "that's all right, then")
19808                         okay=yes
19809                         ;;
19810                 esac
19811         fi
19812         case "$okay" in
19813         yes)    echo "It seems that you don't need va_copy()." >&4
19814                 need_va_copy="$undef"
19815                 ;;
19816         *)      echo "It seems that va_copy() or similar will be needed." >&4
19817                 need_va_copy="$define"
19818                 ;;
19819         esac
19820         $rm_try
19821         ;;
19822 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19823         ;;
19824 esac
19825
19826 : see what type is used for size_t
19827 rp="What is the type used for the length parameter for string functions?"
19828 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19829 eval $typedef_ask
19830
19831 : check for type of arguments to gethostbyaddr. 
19832 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19833         case "$d_gethbyaddr" in
19834         $define)
19835                 $cat <<EOM
19836
19837 Checking to see what type of arguments are accepted by gethostbyaddr().
19838 EOM
19839                 hdrs="$define sys/types.h
19840                         $d_socket sys/socket.h 
19841                         $i_niin netinet/in.h 
19842                         $i_netdb netdb.h
19843                         $i_unistd unistd.h"
19844                 : The first arg can 'char *' or 'void *'
19845                 : The second arg is some of integral type
19846                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19847                         for yyy in size_t long int; do
19848                                 case "$netdb_host_type" in
19849                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19850                                         if ./protochk "$try" $hdrs; then
19851                                                 echo "Your system accepts $xxx for the first arg."
19852                                                 echo "...and $yyy for the second arg."
19853                                                 netdb_host_type="$xxx"
19854                                                 netdb_hlen_type="$yyy"
19855                                         fi
19856                                         ;;
19857                                 esac
19858                         done
19859                 done
19860                 : In case none of those worked, prompt the user.
19861                 case "$netdb_host_type" in
19862                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19863                         dflt='char *'
19864                         . ./myread
19865                         netdb_host_type=$ans
19866                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19867                         dflt="$sizetype"
19868                         . ./myread
19869                         netdb_hlen_type=$ans
19870                         ;;
19871                 esac
19872                 ;;
19873         *)      : no gethostbyaddr, so pick harmless defaults
19874                 netdb_host_type='char *'
19875                 netdb_hlen_type="$sizetype"
19876                 ;;
19877         esac
19878         # Remove the "const" if needed. -- but then we'll have a 
19879         # prototype clash!
19880         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19881 fi
19882
19883 : check for type of argument to gethostbyname. 
19884 if test "X$netdb_name_type" = X ; then
19885         case "$d_gethbyname" in
19886         $define)
19887                 $cat <<EOM
19888
19889 Checking to see what type of argument is accepted by gethostbyname().
19890 EOM
19891                 hdrs="$define sys/types.h
19892                         $d_socket sys/socket.h 
19893                         $i_niin netinet/in.h 
19894                         $i_netdb netdb.h
19895                         $i_unistd unistd.h"
19896                 for xxx in "const char *" "char *"; do
19897                         case "$netdb_name_type" in
19898                         '')     try="extern struct hostent *gethostbyname($xxx);"
19899                                 if ./protochk "$try" $hdrs; then
19900                                         echo "Your system accepts $xxx."
19901                                         netdb_name_type="$xxx"
19902                                 fi
19903                                 ;;
19904                         esac
19905                 done
19906                 : In case none of those worked, prompt the user.
19907                 case "$netdb_name_type" in
19908                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19909                         dflt='char *'
19910                         . ./myread
19911                         netdb_name_type=$ans
19912                         ;;
19913                 esac
19914                 ;;
19915         *)      : no gethostbyname, so pick harmless default
19916                 netdb_name_type='char *'
19917                 ;;
19918         esac
19919 fi
19920
19921 : check for type of 1st argument to getnetbyaddr. 
19922 if test "X$netdb_net_type" = X ; then
19923         case "$d_getnbyaddr" in
19924         $define)
19925                 $cat <<EOM
19926
19927 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19928 EOM
19929                 hdrs="$define sys/types.h
19930                         $d_socket sys/socket.h 
19931                         $i_niin netinet/in.h 
19932                         $i_netdb netdb.h
19933                         $i_unistd unistd.h"
19934                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19935                         case "$netdb_net_type" in
19936                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19937                                 if ./protochk "$try" $hdrs; then
19938                                         echo "Your system accepts $xxx."
19939                                         netdb_net_type="$xxx"
19940                                 fi
19941                                 ;;
19942                         esac
19943                 done
19944                 : In case none of those worked, prompt the user.
19945                 case "$netdb_net_type" in
19946                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19947                         dflt='long'
19948                         . ./myread
19949                         netdb_net_type=$ans
19950                         ;;
19951                 esac
19952                 ;;
19953         *)      : no getnetbyaddr, so pick harmless default
19954                 netdb_net_type='long'
19955                 ;;
19956         esac
19957 fi
19958 : locate the preferred pager for this system
19959 fn=f/
19960 case "$pager" in
19961 '')
19962         dflt=''
19963         case "$pg" in
19964         /*) dflt=$pg;;
19965         [a-zA-Z]:/*) dflt=$pg;;
19966         esac
19967         case "$more" in
19968         /*) dflt=$more;;
19969         [a-zA-Z]:/*) dflt=$more;;
19970         esac
19971         case "$less" in
19972         /*) dflt=$less;;
19973         [a-zA-Z]:/*) dflt=$less;;
19974         esac
19975         case "$dflt" in
19976         '') dflt=/usr/ucb/more;;
19977         esac
19978         ;;
19979 *)      dflt="$pager"
19980         fn="f/($pager)"
19981         ;;
19982 esac
19983 echo " "
19984 rp='What pager is used on your system?'
19985 . ./getfile
19986 pager="$ans"
19987
19988 : see what type pids are declared as in the kernel
19989 rp="What is the type of process ids on this system?"
19990 set pid_t pidtype int stdio.h sys/types.h
19991 eval $typedef_ask
19992
19993 : see if ar generates random libraries by itself
19994 echo " "
19995 echo "Checking how to generate random libraries on your machine..." >&4
19996 echo 'int bar1() { return bar2(); }' > bar1.c
19997 echo 'int bar2() { return 2; }' > bar2.c
19998 $cat > foo.c <<EOP
19999 #$i_stdlib I_STDLIB
20000 #ifdef I_STDLIB
20001 #include <stdlib.h>
20002 #endif
20003 int main() { printf("%d\n", bar1()); exit(0); }
20004 EOP
20005 $cc $ccflags -c bar1.c >/dev/null 2>&1
20006 $cc $ccflags -c bar2.c >/dev/null 2>&1
20007 $cc $ccflags -c foo.c >/dev/null 2>&1
20008 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20009 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20010         $run ./foobar >/dev/null 2>&1; then
20011         echo "$ar appears to generate random libraries itself."
20012         orderlib=false
20013         if [ "X$ranlib" = "X" ]; then
20014             ranlib=":"
20015         fi
20016 elif $ar s bar$_a >/dev/null 2>&1 &&
20017         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20018         $run ./foobar >/dev/null 2>&1; then
20019                 echo "a table of contents needs to be added with '$ar s'."
20020                 orderlib=false
20021                 ranlib="$ar s"
20022 elif $ar ts bar$_a >/dev/null 2>&1 &&
20023         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20024         $run ./foobar >/dev/null 2>&1; then
20025                 echo "a table of contents needs to be added with '$ar ts'."
20026                 orderlib=false
20027                 ranlib="$ar ts"
20028 else
20029         case "$ranlib" in
20030         :) ranlib='';;
20031         '')
20032                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20033                 $test -f $ranlib || ranlib=''
20034                 ;;
20035         esac
20036         if $test -n "$ranlib"; then
20037                 echo "your system has '$ranlib'; we'll use that."
20038                 orderlib=false
20039         else
20040                 echo "your system doesn't seem to support random libraries"
20041                 echo "so we'll use lorder and tsort to order the libraries."
20042                 orderlib=true
20043                 ranlib=":"
20044         fi
20045 fi
20046 $rm -f foo* bar*
20047
20048 : see if this is a values.h system
20049 set values.h i_values
20050 eval $inhdr
20051
20052 : Check the max offset that gmtime and localtime accept
20053 echo "Checking max offsets that gmtime () accepts"
20054
20055 case $i_values in
20056     define) yyy="#include <values.h>" ;;
20057     *)      yyy="" ;;
20058     esac
20059
20060 case "$sGMTIME_min/$sGMTIME_max" in
20061     0/0|/)
20062         $cat >try.c <<EOCP
20063 #include <sys/types.h>
20064 #include <stdio.h>
20065 #include <time.h>
20066 $yyy
20067
20068 int i;
20069 struct tm *tmp;
20070 time_t pt;
20071
20072 void gm_check (time_t t)
20073 {
20074     tmp = gmtime (&t);
20075     if (tmp == NULL || tmp->tm_year < -1900)
20076         tmp = NULL;
20077     else
20078         pt = t;
20079     } /* gm_check */
20080
20081 int check_max ()
20082 {
20083     tmp = NULL;
20084     pt  = 0;
20085 #ifdef MAXLONG
20086     gm_check (MAXLONG);
20087 #endif
20088     if (tmp == NULL || tmp->tm_year < 0) {
20089         for (i = 63; i >= 0; i--) {
20090             time_t x = pt | ((time_t)1 << i);
20091             if (x < 0) continue;
20092             gm_check (x);
20093             }
20094         }
20095     printf ("sGMTIME_max=%ld\n", pt);
20096     return (0);
20097   } /* check_max */
20098
20099 int check_min ()
20100 {
20101     tmp = NULL;
20102     pt  = 0;
20103 #ifdef MINLONG
20104     gm_check (MINLONG);
20105 #endif
20106     if (tmp == NULL) {
20107         for (i = 36; i >= 0; i--) {
20108             time_t x = pt - ((time_t)1 << i);
20109             if (x > 0) continue;
20110             gm_check (x);
20111             }
20112         }
20113     printf ("sGMTIME_min=%ld\n", pt);
20114     return (0);
20115     } /* check_min */
20116
20117 int main (int argc, char *argv[])
20118 {
20119     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20120     check_max ();
20121     check_min ();
20122     return (0);
20123     } /* main */
20124 EOCP
20125         set try
20126         if eval $compile; then
20127             eval `$run ./try`
20128         else
20129             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20130             fi
20131         $rm_try
20132         ;;
20133     esac
20134
20135 echo "Checking max offsets that localtime () accepts"
20136
20137 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20138     0/0|/)
20139         $cat >try.c <<EOCP
20140 #include <sys/types.h>
20141 #include <stdio.h>
20142 #include <time.h>
20143 $yyy
20144
20145 int i;
20146 struct tm *tmp;
20147 time_t pt;
20148
20149 void local_check (time_t t)
20150 {
20151     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20152         tmp = NULL;
20153     else
20154         tmp = localtime (&t);
20155     if (tmp == NULL || tmp->tm_year < -1900)
20156         tmp = NULL;
20157     else
20158         pt = t;
20159     } /* local_check */
20160
20161 int check_max ()
20162 {
20163     tmp = NULL;
20164     pt  = 0;
20165 #ifdef MAXLONG
20166     local_check (MAXLONG);
20167 #endif
20168     if (tmp == NULL || tmp->tm_year < 0) {
20169         for (i = 63; i >= 0; i--) {
20170             time_t x = pt | ((time_t)1 << i);
20171             if (x < 0) continue;
20172             local_check (x);
20173             }
20174         }
20175     printf ("sLOCALTIME_max=%ld\n", pt);
20176     return (0);
20177   } /* check_max */
20178
20179 int check_min ()
20180 {
20181     tmp = NULL;
20182     pt  = 0;
20183 #ifdef MINLONG
20184     local_check (MINLONG);
20185 #endif
20186     if (tmp == NULL) {
20187         for (i = 36; i >= 0; i--) {
20188             time_t x = pt - ((time_t)1 << i);
20189             if (x > 0) continue;
20190             local_check (x);
20191             }
20192         }
20193     printf ("sLOCALTIME_min=%ld\n", pt);
20194     return (0);
20195     } /* check_min */
20196
20197 int main (int argc, char *argv[])
20198 {
20199     check_max ();
20200     check_min ();
20201     return (0);
20202     } /* main */
20203 EOCP
20204         set try
20205         if eval $compile; then
20206             eval `$run ./try`
20207         else
20208             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20209             fi
20210         $rm_try
20211         ;;
20212     esac
20213
20214 : check for type of arguments to select.
20215 case "$selecttype" in
20216 '') case "$d_select" in
20217         $define)
20218                 echo " "
20219                 $cat <<EOM
20220 Checking to see what type of arguments are accepted by select().
20221 EOM
20222                 hdrs="$define sys/types.h
20223                         $i_systime sys/time.h
20224                         $i_sysselct sys/select.h
20225                         $d_socket sys/socket.h"
20226                 : The first arg can be int, unsigned, or size_t
20227                 : The last arg may or may not be 'const'
20228                 val=''
20229                 : void pointer has been seen but using that
20230                 : breaks the selectminbits test
20231                 for xxx in 'fd_set *' 'int *'; do
20232                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20233                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20234                                         case "$val" in
20235                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20236                                                 if ./protochk "$try" $hdrs; then
20237                                                         echo "Your system accepts $xxx."
20238                                                         val="$xxx"
20239                                                 fi
20240                                                 ;;
20241                                         esac
20242                                 done
20243                         done
20244                 done
20245                 case "$val" in
20246                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20247                         case "$d_fd_set" in
20248                                 $define) dflt="fd_set *" ;;
20249                                 *)              dflt="int *" ;;
20250                         esac
20251                         . ./myread
20252                         val=$ans
20253                         ;;
20254                 esac
20255                 selecttype="$val"
20256                 ;;
20257         *)      : no select, so pick a harmless default
20258                 selecttype='int *'
20259                 ;;
20260         esac
20261         ;;
20262 esac
20263
20264 : check for the select 'width'
20265 case "$selectminbits" in
20266 '') safebits=`expr $ptrsize \* 8`
20267     case "$d_select" in
20268         $define)
20269                 $cat <<EOM
20270
20271 Checking to see on how many bits at a time your select() operates...
20272 EOM
20273                 $cat >try.c <<EOCP
20274 #include <sys/types.h>
20275 #$i_time I_TIME
20276 #$i_systime I_SYS_TIME
20277 #$i_systimek I_SYS_TIME_KERNEL
20278 #ifdef I_TIME
20279 #   include <time.h>
20280 #endif
20281 #ifdef I_SYS_TIME
20282 #   ifdef I_SYS_TIME_KERNEL
20283 #       define KERNEL
20284 #   endif
20285 #   include <sys/time.h>
20286 #   ifdef I_SYS_TIME_KERNEL
20287 #       undef KERNEL
20288 #   endif
20289 #endif
20290 #$i_sysselct I_SYS_SELECT
20291 #ifdef I_SYS_SELECT
20292 #include <sys/select.h>
20293 #endif
20294 #$d_socket HAS_SOCKET
20295 #ifdef HAS_SOCKET
20296 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20297 #endif
20298 #include <stdio.h>
20299 #$i_stdlib I_STDLIB
20300 #ifdef I_STDLIB
20301 #include <stdlib.h>
20302 #endif
20303 $selecttype b;
20304 #define S sizeof(*(b))
20305 #define MINBITS 64
20306 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20307 #define NBITS  (NBYTES * 8)
20308 int main() {
20309     char *s = (char *)malloc(NBYTES);
20310     struct timeval t;
20311     int i;
20312     FILE* fp;
20313     int fd;
20314
20315     if (!s)
20316         exit(1);
20317     fclose(stdin);
20318     fp = fopen("try.c", "r");
20319     if (fp == 0)
20320       exit(2);
20321     fd = fileno(fp);
20322     if (fd < 0)
20323       exit(3);
20324     b = ($selecttype)s;
20325     for (i = 0; i < NBITS; i++)
20326         FD_SET(i, b);
20327     t.tv_sec  = 0;
20328     t.tv_usec = 0;
20329     select(fd + 1, b, 0, 0, &t);
20330     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20331     free(s);
20332     printf("%d\n", i + 1);
20333     return 0;
20334 }
20335 EOCP
20336                 set try
20337                 if eval $compile_ok; then
20338                         selectminbits=`$run ./try`
20339                         case "$selectminbits" in
20340                         '')     cat >&4 <<EOM
20341 Cannot figure out on how many bits at a time your select() operates.
20342 I'll play safe and guess it is $safebits bits.
20343 EOM
20344                                 selectminbits=$safebits
20345                                 bits="$safebits bits"
20346                                 ;;
20347                         1)      bits="1 bit" ;;
20348                         *)      bits="$selectminbits bits" ;;
20349                         esac
20350                         echo "Your select() operates on $bits at a time." >&4
20351                 else
20352                         rp='What is the minimum number of bits your select() operates on?'
20353                         case "$byteorder" in
20354                         12345678)       dflt=64 ;;
20355                         1234)           dflt=32 ;;
20356                         *)              dflt=1  ;;
20357                         esac
20358                         . ./myread
20359                         val=$ans
20360                         selectminbits="$val"
20361                 fi
20362                 $rm_try
20363                 ;;
20364         *)      : no select, so pick a harmless default
20365                 selectminbits=$safebits
20366                 ;;
20367         esac
20368         ;;
20369 esac
20370
20371 : Trace out the files included by signal.h, then look for SIGxxx names.
20372 if [ "X$fieldn" = X ]; then
20373         : Just make some guesses.  We check them later.
20374         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20375 else
20376         xxx=`echo '#include <signal.h>' |
20377         $cppstdin $cppminus $cppflags 2>/dev/null |
20378         $grep '^[       ]*#.*include' |
20379         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20380                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20381 fi
20382 xxxfiles=''
20383 for xx in $xxx /dev/null ; do
20384         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20385 done
20386 case "$xxxfiles" in
20387 '')     xxxfiles=`./findhdr signal.h` ;;
20388 esac
20389 xxx=`awk '
20390 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20391         print substr($2, 4, 20)
20392 }
20393 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20394         print substr($3, 4, 20)
20395 }' $xxxfiles`
20396 : Append some common names just in case the awk scan failed.
20397 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20398 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20399 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20400 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20401 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20402
20403 : generate a few handy files for later
20404 $cat > signal.c <<EOCP
20405 #include <sys/types.h>
20406 #include <signal.h>
20407 #$i_stdlib I_STDLIB
20408 #ifdef I_STDLIB
20409 #include <stdlib.h>
20410 #endif
20411 #include <stdio.h>
20412 int main() {
20413
20414 /* Strange style to avoid deeply-nested #if/#else/#endif */
20415 #ifndef NSIG
20416 #  ifdef _NSIG
20417 #    define NSIG (_NSIG)
20418 #  endif
20419 #endif
20420
20421 #ifndef NSIG
20422 #  ifdef SIGMAX
20423 #    define NSIG (SIGMAX+1)
20424 #  endif
20425 #endif
20426
20427 #ifndef NSIG
20428 #  ifdef SIG_MAX
20429 #    define NSIG (SIG_MAX+1)
20430 #  endif
20431 #endif
20432
20433 #ifndef NSIG
20434 #  ifdef _SIG_MAX
20435 #    define NSIG (_SIG_MAX+1)
20436 #  endif
20437 #endif
20438
20439 #ifndef NSIG
20440 #  ifdef MAXSIG
20441 #    define NSIG (MAXSIG+1)
20442 #  endif
20443 #endif
20444
20445 #ifndef NSIG
20446 #  ifdef MAX_SIG
20447 #    define NSIG (MAX_SIG+1)
20448 #  endif
20449 #endif
20450
20451 #ifndef NSIG
20452 #  ifdef SIGARRAYSIZE
20453 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20454 #  endif
20455 #endif
20456
20457 #ifndef NSIG
20458 #  ifdef _sys_nsig
20459 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20460 #  endif
20461 #endif
20462
20463 /* Default to some arbitrary number that's big enough to get most
20464    of the common signals.
20465 */
20466 #ifndef NSIG
20467 #    define NSIG 50
20468 #endif
20469
20470 printf("NSIG %d\n", NSIG);
20471
20472 #ifndef JUST_NSIG
20473
20474 EOCP
20475
20476 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20477 {
20478         printf "#ifdef SIG"; printf $1; printf "\n"
20479         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20480         printf $1; printf ");\n"
20481         printf "#endif\n"
20482 }
20483 END {
20484         printf "#endif /* JUST_NSIG */\n";
20485         printf "exit(0);\n}\n";
20486 }
20487 ' >>signal.c
20488 $cat >signal.awk <<'EOP'
20489 BEGIN { ndups = 0 }
20490 $1 ~ /^NSIG$/ { nsig = $2 }
20491 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20492     if ($2 > maxsig) { maxsig = $2 }
20493     if (sig_name[$2]) {
20494         dup_name[ndups] = $1
20495         dup_num[ndups] = $2
20496         ndups++
20497     }
20498     else {
20499         sig_name[$2] = $1
20500         sig_num[$2] = $2
20501     }
20502 }
20503 END {
20504     if (nsig == 0) {
20505         nsig = maxsig + 1
20506     }
20507     printf("NSIG %d\n", nsig);
20508     for (n = 1; n < nsig; n++) {
20509         if (sig_name[n]) {
20510             printf("%s %d\n", sig_name[n], sig_num[n])
20511         }
20512         else {
20513             printf("NUM%d %d\n", n, n)
20514         }
20515     }
20516     for (n = 0; n < ndups; n++) {
20517         printf("%s %d\n", dup_name[n], dup_num[n])
20518     }
20519 }
20520 EOP
20521 $cat >signal_cmd <<EOS
20522 $startsh
20523 if $test -s signal.lst; then
20524     echo "Using your existing signal.lst file"
20525         exit 0
20526 fi
20527 xxx="$xxx"
20528 EOS
20529 $cat >>signal_cmd <<'EOS'
20530
20531 set signal
20532 if eval $compile_ok; then
20533         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20534                 $uniq | $awk -f signal.awk >signal.lst
20535 else
20536         echo "(I can't seem be able to compile the whole test program)" >&4
20537         echo "(I'll try it in little pieces.)" >&4
20538         set signal -DJUST_NSIG
20539         if eval $compile_ok; then
20540                 $run ./signal$_exe > signal.nsg
20541                 $cat signal.nsg
20542         else
20543                 echo "I can't seem to figure out how many signals you have." >&4
20544                 echo "Guessing 50." >&4
20545                 echo 'NSIG 50' > signal.nsg
20546         fi
20547         : Now look at all the signal names, one at a time.
20548         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20549                 $cat > signal.c <<EOCP
20550 #include <sys/types.h>
20551 #include <signal.h>
20552 #include <stdio.h>
20553 int main() {
20554 printf("$xx %d\n", SIG${xx});
20555 return 0;
20556 }
20557 EOCP
20558                 set signal
20559                 if eval $compile; then
20560                         echo "SIG${xx} found."
20561                         $run ./signal$_exe  >> signal.ls1
20562                 else
20563                         echo "SIG${xx} NOT found."
20564                 fi
20565         done
20566         if $test -s signal.ls1; then
20567                 $cat signal.nsg signal.ls1 |
20568                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20569         fi
20570
20571 fi
20572 if $test -s signal.lst; then
20573         :
20574 else
20575         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20576         echo 'kill -l' >signal
20577         set X `csh -f <signal`
20578         $rm -f signal
20579         shift
20580         case $# in
20581         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20582         esac
20583         echo $@ | $tr ' ' $trnl | \
20584             $awk '{ printf "%s %d\n", $1, ++s; }
20585                   END { printf "NSIG %d\n", ++s }' >signal.lst
20586 fi
20587 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20588 EOS
20589 chmod a+x signal_cmd
20590 $eunicefix signal_cmd
20591
20592 : generate list of signal names
20593 echo " "
20594 case "$sig_name_init" in
20595 '') doinit=yes ;;
20596 *)  case "$sig_num_init" in
20597     ''|*,*) doinit=yes ;;
20598     esac ;;
20599 esac
20600 case "$doinit" in
20601 yes)
20602         echo "Generating a list of signal names and numbers..." >&4
20603         . ./signal_cmd
20604         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20605         sig_name=`$awk 'BEGIN { printf "ZERO " }
20606                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20607         sig_num=`$awk  'BEGIN { printf "0 " }
20608                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20609         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20610                              !/^NSIG/   { printf "\"%s\", ", $1 }
20611                              END        { printf "0\n" }' signal.lst`
20612         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20613                              !/^NSIG/   { printf "%d, ", $2}
20614                              END        { printf "0\n"}' signal.lst`
20615         ;;
20616 esac
20617 echo "The following $sig_count signals are available:"
20618 echo " "
20619 echo $sig_name | $awk \
20620 'BEGIN { linelen = 0 }
20621 {
20622         for (i = 1; i <= NF; i++) {
20623                 name = "SIG" $i " "
20624                 linelen = linelen + length(name)
20625                 if (linelen > 70) {
20626                         printf "\n"
20627                         linelen = length(name)
20628                 }
20629                 printf "%s", name
20630         }
20631         printf "\n"
20632 }'
20633 sig_size=`echo $sig_name | awk '{print NF}'`
20634 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20635
20636 : Check size of size
20637 echo " "
20638 case "$sizetype" in
20639 *_t) zzz="$sizetype"    ;;
20640 *)   zzz="filesize"     ;;
20641 esac
20642 echo "Checking the size of $zzz..." >&4
20643 cat > try.c <<EOCP
20644 #include <sys/types.h>
20645 #include <stdio.h>
20646 #$i_stdlib I_STDLIB
20647 #ifdef I_STDLIB
20648 #include <stdlib.h>
20649 #endif
20650 int main() {
20651     printf("%d\n", (int)sizeof($sizetype));
20652     exit(0);
20653 }
20654 EOCP
20655 set try
20656 if eval $compile_ok; then
20657         yyy=`$run ./try`
20658         case "$yyy" in
20659         '')     sizesize=4
20660                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20661                 ;;
20662         *)      sizesize=$yyy
20663                 echo "Your $zzz size is $sizesize bytes."
20664                 ;;
20665         esac
20666 else
20667         sizesize=4
20668         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20669 fi
20670
20671
20672 : check for socklen_t
20673 echo " "
20674 echo "Checking to see if you have socklen_t..." >&4
20675 $cat >try.c <<EOCP
20676 #include <sys/types.h>
20677 #$d_socket HAS_SOCKET
20678 #ifdef HAS_SOCKET
20679 #include <sys/socket.h>
20680 #endif
20681 int main() { socklen_t x = 16; }
20682 EOCP
20683 set try
20684 if eval $compile; then
20685         val="$define"
20686         echo "You have socklen_t."
20687 else
20688         val="$undef"
20689         echo "You do not have socklen_t."
20690         case "$sizetype" in
20691         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20692         esac
20693 fi
20694 $rm_try
20695 set d_socklen_t
20696 eval $setvar
20697
20698 : see if this is a socks.h system
20699 set socks.h i_socks
20700 eval $inhdr
20701
20702 : check for type of the size argument to socket calls
20703 case "$d_socket" in
20704 "$define")
20705         $cat <<EOM
20706
20707 Checking to see what type is the last argument of accept().
20708 EOM
20709         yyy=''
20710         case "$d_socklen_t" in
20711         "$define") yyy="$yyy socklen_t"
20712         esac
20713         yyy="$yyy $sizetype int long unsigned"
20714         for xxx in $yyy; do
20715                 case "$socksizetype" in
20716                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20717                         case "$usesocks" in
20718                         "$define")
20719                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20720                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20721                                         socksizetype="$xxx"
20722                                 fi
20723                                 ;;
20724                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20725                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20726                                         socksizetype="$xxx"
20727                                 fi
20728                                 ;;
20729                         esac
20730                         ;;
20731                 esac
20732         done
20733 : In case none of those worked, prompt the user.
20734         case "$socksizetype" in
20735         '')     rp='What is the type for socket address structure sizes?'
20736                 dflt='int'
20737                 . ./myread
20738                 socksizetype=$ans
20739                 ;;
20740         esac
20741         ;;
20742 *)      : no sockets, so pick relatively harmless default
20743         socksizetype='int'
20744         ;;
20745 esac
20746
20747 : see what type is used for signed size_t
20748 set ssize_t ssizetype int stdio.h sys/types.h
20749 eval $typedef
20750 dflt="$ssizetype"
20751 $cat > try.c <<EOM
20752 #include <stdio.h>
20753 #$i_stdlib I_STDLIB
20754 #ifdef I_STDLIB
20755 #include <stdlib.h>
20756 #endif
20757 #include <sys/types.h>
20758 #define Size_t $sizetype
20759 #define SSize_t $dflt
20760 int main()
20761 {
20762         if (sizeof(Size_t) == sizeof(SSize_t))
20763                 printf("$dflt\n");
20764         else if (sizeof(Size_t) == sizeof(int))
20765                 printf("int\n");
20766         else
20767                 printf("long\n");
20768         exit(0);
20769 }
20770 EOM
20771 echo " "
20772 set try
20773 if eval $compile_ok && $run ./try > /dev/null; then
20774         ssizetype=`$run ./try`
20775         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20776 else
20777         $cat >&4 <<EOM
20778 Help! I can't compile and run the ssize_t test program: please enlighten me!
20779 (This is probably a misconfiguration in your system or libraries, and
20780 you really ought to fix it.  Still, I'll try anyway.)
20781
20782 I need a type that is the same size as $sizetype, but is guaranteed to
20783 be signed.  Common values are ssize_t, int and long.
20784
20785 EOM
20786         rp="What signed type is the same size as $sizetype?"
20787         . ./myread
20788         ssizetype="$ans"
20789 fi
20790 $rm_try
20791
20792 : see what type of char stdio uses.
20793 echo " "
20794 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20795 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20796         echo "Your stdio uses unsigned chars." >&4
20797         stdchar="unsigned char"
20798 else
20799         echo "Your stdio uses signed chars." >&4
20800         stdchar="char"
20801 fi
20802 $rm -f stdioh
20803
20804 : see what type uids are declared as in the kernel
20805 echo " "
20806 echo "Looking for the type for user ids returned by getuid()."
20807 set uid_t uidtype xxx stdio.h sys/types.h
20808 eval $typedef
20809 case "$uidtype" in
20810 xxx)
20811         xxx=`./findhdr sys/user.h`
20812         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20813         case $1 in
20814         unsigned) dflt="$1 $2" ;;
20815         *) dflt="$1" ;;
20816         esac
20817         ;;
20818 *) dflt="$uidtype";;
20819 esac
20820 case "$uidtype" in
20821 uid_t)  echo "uid_t found." ;;
20822 *)      rp="What is the type for user ids returned by getuid()?"
20823         . ./myread
20824         uidtype="$ans"
20825         ;;
20826 esac
20827
20828 : Check size of UID
20829 echo " "
20830 case "$uidtype" in
20831 *_t) zzz="$uidtype"     ;;
20832 *)   zzz="uid"          ;;
20833 esac
20834 echo "Checking the size of $zzz..." >&4
20835 cat > try.c <<EOCP
20836 #include <sys/types.h>
20837 #include <stdio.h>
20838 #$i_stdlib I_STDLIB
20839 #ifdef I_STDLIB
20840 #include <stdlib.h>
20841 #endif
20842 int main() {
20843     printf("%d\n", (int)sizeof($uidtype));
20844     exit(0);
20845 }
20846 EOCP
20847 set try
20848 if eval $compile_ok; then
20849         yyy=`$run ./try`
20850         case "$yyy" in
20851         '')     uidsize=4
20852                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20853                 ;;
20854         *)      uidsize=$yyy
20855                 echo "Your $zzz is $uidsize bytes long."
20856                 ;;
20857         esac
20858 else
20859         uidsize=4
20860         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20861 fi
20862
20863 : Check if UID is signed
20864 echo " "
20865 case "$uidtype" in
20866 *_t) zzz="$uidtype"     ;;
20867 *)   zzz="uid"          ;;
20868 esac
20869 echo "Checking the sign of $zzz..." >&4
20870 cat > try.c <<EOCP
20871 #include <sys/types.h>
20872 #include <stdio.h>
20873 int main() {
20874         $uidtype foo = -1;
20875         if (foo < 0)
20876                 printf("-1\n");
20877         else
20878                 printf("1\n");
20879 }
20880 EOCP
20881 set try
20882 if eval $compile; then
20883         yyy=`$run ./try`
20884         case "$yyy" in
20885         '')     uidsign=1
20886                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20887                 ;;
20888         *)      uidsign=$yyy
20889                 case "$uidsign" in
20890                  1) echo "Your $zzz is unsigned." ;;
20891                 -1) echo "Your $zzz is signed."   ;;
20892                 esac
20893                 ;;
20894         esac
20895 else
20896         uidsign=1
20897         echo "(I can't compile the test program--guessing unsigned.)" >&4
20898 fi
20899
20900
20901 : Check format string for UID
20902 echo " "
20903 $echo "Checking the format string to be used for uids..." >&4
20904
20905 case "$uidsign" in
20906 -1)     if $test X"$uidsize" = X"$ivsize"; then
20907                 uidformat="$ivdformat"
20908         else
20909                 if $test X"$uidsize" = X"$longsize"; then
20910                         uidformat='"ld"'
20911                 else
20912                         if $test X"$uidsize" = X"$intsize"; then
20913                                 uidformat='"d"'
20914                         else
20915                                 if $test X"$uidsize" = X"$shortsize"; then
20916                                         uidformat='"hd"'
20917                                 fi
20918                         fi
20919                 fi
20920         fi
20921         ;;
20922 *)      if $test X"$uidsize" = X"$uvsize"; then
20923                 uidformat="$uvuformat"
20924         else
20925                 if $test X"$uidsize" = X"$longsize"; then
20926                         uidformat='"lu"'
20927                 else
20928                         if $test X"$uidsize" = X"$intsize"; then
20929                                 uidformat='"u"'
20930                         else
20931                                 if $test X"$uidsize" = X"$shortsize"; then
20932                                         uidformat='"hu"'
20933                                 fi
20934                         fi
20935                 fi
20936         fi
20937         ;;
20938 esac
20939
20940 : Check if site customization support was requested
20941 case "$usesitecustomize" in
20942     $define|true|[Yy]*)
20943         usesitecustomize="$define"
20944         ;;
20945     *)
20946         usesitecustomize="$undef"
20947         ;;
20948     esac
20949
20950 : determine compiler compiler
20951 case "$yacc" in
20952 '')
20953         dflt=yacc;;
20954 *)
20955         dflt="$yacc";;
20956 esac
20957 echo " "
20958 comp='yacc'
20959 if $test -f "$byacc$_exe"; then
20960         dflt="$byacc"
20961         comp="byacc or $comp"
20962 fi
20963 if $test -f "$bison$_exe"; then
20964         comp="$comp or bison -y"
20965 fi
20966 rp="Which compiler compiler ($comp) shall I use?"
20967 . ./myread
20968 yacc="$ans"
20969 case "$yacc" in
20970 *bis*)
20971         case "$yacc" in
20972         *-y*) ;;
20973         *)
20974                 yacc="$yacc -y"
20975                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20976                 ;;
20977         esac
20978         ;;
20979 esac
20980
20981 : see if this is a assert.h system
20982 set assert.h i_assert
20983 eval $inhdr
20984
20985 : see if this is a fp.h system
20986 set fp.h i_fp
20987 eval $inhdr
20988
20989 : see if this is a fp_class.h system
20990 set fp_class.h i_fp_class
20991 eval $inhdr
20992
20993 : see if gdbm.h is available
20994 set gdbm.h t_gdbm
20995 eval $inhdr
20996 case "$t_gdbm" in
20997 $define)
20998         : see if gdbm_open exists
20999         set gdbm_open d_gdbm_open
21000         eval $inlibc
21001         case "$d_gdbm_open" in
21002         $undef)
21003                 t_gdbm="$undef"
21004                 echo "We won't be including <gdbm.h>"
21005                 ;;
21006         esac
21007         ;;
21008 esac
21009 val="$t_gdbm"
21010 set i_gdbm
21011 eval $setvar
21012
21013 : see if ndbm.h is available
21014 set ndbm.h i_ndbm
21015 eval $inhdr
21016 : Compatibility location for RedHat 7.1
21017 set gdbm/ndbm.h i_gdbmndbm
21018 eval $inhdr
21019 : Compatibility location for Debian 4.0
21020 set gdbm-ndbm.h i_gdbm_ndbm
21021 eval $inhdr
21022
21023 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
21024         : see if dbm_open exists
21025         set dbm_open d_dbm_open
21026         eval $inlibc
21027         case "$d_dbm_open" in
21028         $undef)
21029                 i_ndbm="$undef"
21030                 i_gdbmndbm="$undef"
21031                 i_gdbm_ndbm="$undef"
21032                 echo "We won't be including <ndbm.h>"
21033             val="$undef"
21034                 ;;
21035         *) val="$define"
21036            ;;
21037         esac
21038 fi
21039 set d_ndbm
21040 eval $setvar
21041
21042 : see if this is a ieeefp.h system
21043 case "$i_ieeefp" in
21044 '' ) set ieeefp.h i_ieeefp
21045      eval $inhdr
21046      ;;
21047 esac
21048
21049 : see if this is a libutil.h system
21050 set libutil.h i_libutil
21051 eval $inhdr
21052
21053 : see if mach cthreads are available
21054 if test "X$usethreads" = "X$define"; then
21055         set mach/cthreads.h i_machcthr
21056         eval $inhdr
21057 else
21058         i_machcthr="$undef"
21059 fi
21060
21061 : see if this is a mntent.h system
21062 set mntent.h i_mntent
21063 eval $inhdr
21064
21065 : see if net/errno.h is available
21066 val=''
21067 set net/errno.h val
21068 eval $inhdr
21069
21070 : Unfortunately, it causes problems on some systems.  Arrgh.
21071 case "$val" in
21072 $define)
21073         cat > try.c <<'EOM'
21074 #include <stdio.h>
21075 #include <errno.h>
21076 #include <net/errno.h>
21077 int func()
21078 {
21079         return ENOTSOCK;
21080 }
21081 EOM
21082         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21083                 echo "We'll be including <net/errno.h>." >&4
21084         else
21085                 echo "We won't be including <net/errno.h>." >&4
21086                 val="$undef"
21087         fi
21088         $rm_try
21089         ;;
21090 esac
21091 set i_neterrno
21092 eval $setvar
21093
21094 : see if netinet/tcp.h is available
21095 set netinet/tcp.h i_netinettcp
21096 eval $inhdr
21097
21098 : see if this is a poll.h system
21099 set poll.h i_poll
21100 eval $inhdr
21101
21102 : see if this is a prot.h system
21103 set prot.h i_prot
21104 eval $inhdr
21105
21106 : Preprocessor symbols
21107 echo " "
21108 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21109 $cat <<'EOSH' > Cppsym.know
21110 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21111 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21112 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21113 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21114 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21115 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21116 bull c cadmus clipper CMU COFF COMPILER_VERSION
21117 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21118 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21119 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21120 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21121 GLIBC GLIBC_MINOR
21122 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21123 H3050R H3050RX hbullx20 hcx host_mips
21124 hp200 hp300 hp700 HP700 hp800 hp9000
21125 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21126 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21127 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21128 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21129 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21130 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21131 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21132 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21133 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21134 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21135 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21136 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21137 MATH_HAS_NO_SIDE_EFFECTS
21138 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21139 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21140 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21141 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21142 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21143 NetBSD news1500 news1700 news1800 news1900 news3700
21144 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21145 ns32016 ns32332 ns32k nsc32000
21146 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21147 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21148 pc532 pdp11 PGC PIC plexus PORTAR posix
21149 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21150 POSIX_C_SOURCE POSIX_SOURCE POWER
21151 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21152 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21153 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21154 sony sony_news sonyrisc sparc sparclite spectrum
21155 stardent stdc STDC_EXT stratos sun sun3 sun386
21156 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21157 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21158 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21159 sysV68 sysV88 Tek4132 Tek4300 titan
21160 TM3200 TM5400 TM5600
21161 tower tower32 tower32_200 tower32_600 tower32_700
21162 tower32_800 tower32_850 tss
21163 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21164 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21165 unix UNIX95 UNIX99 unixpc unos
21166 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21167 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21168 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21169 USGr4 USGr4_2
21170 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21171 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21172 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21173 z8000
21174 EOSH
21175 # Maybe put other stuff here too.
21176 cat <<EOSH >>Cppsym.know
21177 $osname
21178 EOSH
21179 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21180 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21181 $cat Cppsym.know > Cppsym.c
21182 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21183 $rm -f Cppsym.a Cppsym.b Cppsym.c
21184 cat <<EOSH > Cppsym
21185 $startsh
21186 if $test \$# -gt 0; then
21187     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21188     if $test -s Cppsym.got; then
21189         $rm -f Cppsym.got
21190         exit 0
21191     fi
21192     $rm -f Cppsym.got
21193     exit 1
21194 else
21195     $tr " " "$trnl" | ./Cppsym.try
21196     exit 0
21197 fi
21198 EOSH
21199 chmod +x Cppsym
21200 $eunicefix Cppsym
21201 cat <<EOSH > Cppsym.try
21202 $startsh
21203 cat <<'EOCP' > try.c
21204 #include <stdio.h>
21205 #if cpp_stuff == 1
21206 #define STRINGIFY(a)    "a"
21207 #endif
21208 #if cpp_stuff == 42
21209 #define StGiFy(a)  #a
21210 #define STRINGIFY(a)    StGiFy(a)
21211 #endif
21212 #if $cpp_stuff != 1 && $cpp_stuff != 42
21213 #   include "Bletch: How does this C preprocessor stringify macros?"
21214 #endif
21215 int main() {
21216 EOCP
21217 $awk \\
21218 EOSH
21219 cat <<'EOSH' >> Cppsym.try
21220 'length($1) > 0 {
21221     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21222     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21223     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21224     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21225 }'       >> try.c
21226 echo 'return 0;}' >> try.c
21227 EOSH
21228 cat <<EOSH >> Cppsym.try
21229 ccflags="$ccflags"
21230 case "$osname-$gccversion" in
21231 irix-) ccflags="\$ccflags -woff 1178" ;;
21232 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21233 esac
21234 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21235 EOSH
21236 chmod +x Cppsym.try
21237 $eunicefix Cppsym.try
21238 ./Cppsym < Cppsym.know > Cppsym.true
21239 : Add in any linux cpp "predefined macros":
21240 case "$osname::$gccversion" in
21241   *linux*::*.*)
21242     tHdrH=_tmpHdr
21243     rm -f $tHdrH'.h' $tHdrH
21244     touch $tHdrH'.h'
21245     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21246        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21247        if [ -s $tHdrH'_cppsym.real' ]; then
21248           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21249        fi
21250     fi
21251     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21252   ;;
21253 esac
21254 : now check the C compiler for additional symbols
21255 postprocess_cc_v=''
21256 case "$osname" in
21257 aix) postprocess_cc_v="|$tr , ' '" ;;
21258 esac
21259 $cat >ccsym <<EOS
21260 $startsh
21261 $cat >tmp.c <<EOF
21262 extern int foo;
21263 EOF
21264 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21265 do
21266         case "\$i" in
21267         -D*) echo "\$i" | $sed 's/^-D//';;
21268         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21269         esac
21270 done
21271 $rm_try
21272 EOS
21273 postprocess_cc_v=''
21274 chmod +x ccsym
21275 $eunicefix ccsym
21276 ./ccsym > ccsym1.raw
21277 if $test -s ccsym1.raw; then
21278        $sort ccsym1.raw | $uniq >ccsym.raw
21279 else
21280        mv ccsym1.raw ccsym.raw
21281 fi
21282
21283 $awk '/\=/ { print $0; next }
21284         { print $0"=1" }' ccsym.raw >ccsym.list
21285 $comm -13 Cppsym.true ccsym.list >ccsym.own
21286 $comm -12 Cppsym.true ccsym.list >ccsym.com
21287 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21288 also=''
21289 if $test -z ccsym.raw; then
21290         echo "Your C compiler doesn't seem to define any symbols!" >&4
21291         echo " "
21292         echo "However, your C preprocessor defines the following symbols:"
21293         $cat Cppsym.true
21294         ccsymbols=''
21295         cppsymbols=`$cat Cppsym.true`
21296         cppsymbols=`echo $cppsymbols`
21297         cppccsymbols="$cppsymbols"
21298 else
21299         if $test -s ccsym.com; then
21300                 echo "Your C compiler and pre-processor define these symbols:"
21301                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21302                 also='also '
21303                 symbols='ones'
21304                 cppccsymbols=`$cat ccsym.com`
21305                 cppccsymbols=`echo $cppccsymbols`
21306                 $test "$silent" || sleep 1
21307         fi
21308         if $test -s ccsym.cpp; then
21309                 $test "$also" && echo " "
21310                 echo "Your C pre-processor ${also}defines the following symbols:"
21311                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21312                 also='further '
21313                 cppsymbols=`$cat ccsym.cpp`
21314                 cppsymbols=`echo $cppsymbols`
21315                 $test "$silent" || sleep 1
21316         fi
21317         if $test -s ccsym.own; then
21318                 $test "$also" && echo " "
21319                 echo "Your C compiler ${also}defines the following cpp symbols:"
21320                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21321                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21322                 ccsymbols=`$cat ccsym.own`
21323                 ccsymbols=`echo $ccsymbols`
21324                 $test "$silent" || sleep 1
21325         fi
21326 fi
21327
21328 : see if this is a termio system
21329 val="$undef"
21330 val2="$undef"
21331 val3="$undef"
21332 if $test `./findhdr termios.h`; then
21333         set tcsetattr i_termios
21334         eval $inlibc
21335         val3="$i_termios"
21336 fi
21337 echo " "
21338 case "$val3" in
21339 "$define") echo "You have POSIX termios.h... good!" >&4;;
21340 *) if ./Cppsym pyr; then
21341                 case "`/bin/universe`" in
21342                 ucb) if $test `./findhdr sgtty.h`; then
21343                                 val2="$define"
21344                                 echo "<sgtty.h> found." >&4
21345                         else
21346                                 echo "System is pyramid with BSD universe."
21347                                 ./warn "<sgtty.h> not found--you could have problems."
21348                         fi;;
21349                 *) if $test `./findhdr termio.h`; then
21350                                 val="$define"
21351                                 echo "<termio.h> found." >&4
21352                         else
21353                                 echo "System is pyramid with USG universe."
21354                                 ./warn "<termio.h> not found--you could have problems."
21355                         fi;;
21356                 esac
21357         elif ./usg; then
21358                 if $test `./findhdr termio.h`; then
21359                         echo "<termio.h> found." >&4
21360                         val="$define"
21361                 elif $test `./findhdr sgtty.h`; then
21362                         echo "<sgtty.h> found." >&4
21363                         val2="$define"
21364                 else
21365                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21366                 fi
21367         else
21368                 if $test `./findhdr sgtty.h`; then
21369                         echo "<sgtty.h> found." >&4
21370                         val2="$define"
21371                 elif $test `./findhdr termio.h`; then
21372                         echo "<termio.h> found." >&4
21373                         val="$define"
21374                 else
21375                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21376                 fi
21377         fi;;
21378 esac
21379 set i_termio; eval $setvar
21380 val=$val2; set i_sgtty; eval $setvar
21381 val=$val3; set i_termios; eval $setvar
21382
21383 : see if stddef is available
21384 set stddef.h i_stddef
21385 eval $inhdr
21386
21387 : see if sys/access.h is available
21388 set sys/access.h i_sysaccess
21389 eval $inhdr
21390
21391 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21392 set sys/filio.h i_sysfilio
21393 eval $inhdr
21394 echo " "
21395 if $test `./findhdr sys/ioctl.h`; then
21396         val="$define"
21397         echo '<sys/ioctl.h> found.' >&4
21398 else
21399         val="$undef"
21400         if $test $i_sysfilio = "$define"; then
21401             echo '<sys/ioctl.h> NOT found.' >&4
21402         else
21403                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21404                 $test $i_termio = "$define" && xxx="termio.h"
21405                 $test $i_termios = "$define" && xxx="termios.h"
21406 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21407         fi
21408 fi
21409 set i_sysioctl
21410 eval $setvar
21411
21412 : see if socket ioctl defs are in sys/sockio.h
21413 echo " "
21414 xxx=`./findhdr sys/sockio.h`
21415 if $test "$xxx"; then
21416         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21417                 val="$define"
21418                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21419         else
21420                 val="$undef"
21421                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21422         fi
21423 else
21424         val="$undef"
21425         $cat <<EOM
21426 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21427 EOM
21428 fi
21429 set i_syssockio
21430 eval $setvar
21431
21432 : see if this is a syslog.h system
21433 set syslog.h i_syslog
21434 eval $inhdr
21435
21436 : see if this is a sys/mode.h system
21437 set sys/mode.h i_sysmode
21438 eval $inhdr
21439
21440 : see if there is a sys/poll.h file
21441 set sys/poll.h i_syspoll
21442 eval $inhdr
21443
21444 : see if sys/resource.h has to be included
21445 set sys/resource.h i_sysresrc
21446 eval $inhdr
21447
21448 : see if sys/security.h is available
21449 set sys/security.h i_syssecrt
21450 eval $inhdr
21451
21452 : see if this is a sys/statvfs.h system
21453 set sys/statvfs.h i_sysstatvfs
21454 eval $inhdr
21455
21456 : see if this is a sys/un.h system
21457 set sys/un.h i_sysun
21458 eval $inhdr
21459
21460 : see if this is a sys/utsname.h system
21461 set sys/utsname.h i_sysutsname
21462 eval $inhdr
21463
21464 : see if this is a syswait system
21465 set sys/wait.h i_syswait
21466 eval $inhdr
21467
21468 : see if this is a ustat.h system
21469 set ustat.h i_ustat
21470 eval $inhdr
21471
21472 : see if this is an utime system
21473 set utime.h i_utime
21474 eval $inhdr
21475
21476 : see if this is a vfork system
21477 case "$d_vfork" in
21478 "$define")
21479         set vfork.h i_vfork
21480         eval $inhdr
21481         ;;
21482 *)
21483         i_vfork="$undef"
21484         ;;
21485 esac
21486
21487 : Check extensions
21488 echo " "
21489 echo "Looking for extensions..." >&4
21490 : If we are using the old config.sh, known_extensions may contain
21491 : old or inaccurate or duplicate values.
21492 known_extensions=''
21493 nonxs_extensions=''
21494 : We do not use find because it might not be available.
21495 : We do not just use MANIFEST because the user may have dropped
21496 : some additional extensions into the source tree and expect them
21497 : to be built.
21498
21499 : Function to recursively find available extensions, ignoring DynaLoader
21500 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21501 find_extensions='
21502     for xxx in *; do
21503         case "$xxx" in
21504             DynaLoader|dynaload) ;;
21505             *)
21506             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21507                 known_extensions="$known_extensions $1$xxx";
21508             elif $test -f $xxx/Makefile.PL; then
21509                 nonxs_extensions="$nonxs_extensions $1$xxx";
21510             else
21511                 if $test -d $xxx -a $# -lt 10; then
21512                     set $1$xxx/ $*;
21513                     cd "$xxx";
21514                     eval $find_extensions;
21515                     cd ..;
21516                     shift;
21517                 fi;
21518             fi
21519             ;;
21520         esac;
21521     done'
21522 tdir=`pwd`
21523 cd "$rsrc/ext"
21524 set X
21525 shift
21526 eval $find_extensions
21527 # Special case:  Add in modules that nest beyond the first level.
21528 # Currently threads/shared and Hash/Util/FieldHash, since they are
21529 # not picked up by the recursive find above (and adding in general
21530 # recursive finding breaks SDBM_File/sdbm).
21531 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21532 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21533 set X $known_extensions
21534 shift
21535 known_extensions="$*"
21536 set X $nonxs_extensions
21537 shift
21538 nonxs_extensions="$*"
21539 cd "$tdir"
21540
21541 : Now see which are supported on this system.
21542 avail_ext=''
21543 for xxx in $known_extensions ; do
21544         case "$xxx" in
21545         DB_File|db_file)
21546                 case "$i_db" in
21547                 $define) avail_ext="$avail_ext $xxx" ;;
21548                 esac
21549                 ;;
21550         GDBM_File|gdbm_fil)
21551                 case "$i_gdbm" in
21552                 $define) avail_ext="$avail_ext $xxx" ;;
21553                 esac
21554                 ;;
21555         I18N/Langinfo|i18n_lan)
21556                 case "$i_langinfo$d_nl_langinfo" in
21557                 $define$define) avail_ext="$avail_ext $xxx" ;;
21558                 esac
21559                 ;;
21560         IPC/SysV|ipc/sysv)
21561                 : XXX Do we need a useipcsysv variable here
21562                 case "${d_msg}${d_sem}${d_shm}" in
21563                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21564                 esac
21565                 ;;
21566         NDBM_File|ndbm_fil)
21567                 case "$i_ndbm" in
21568                 $define)
21569                     case "$osname-$use64bitint" in
21570                     hpux-define)
21571                         case "$libs" in
21572                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21573                         esac
21574                         ;;
21575                     *) avail_ext="$avail_ext $xxx" ;;
21576                     esac
21577                     ;;
21578                 esac
21579                 ;;
21580         ODBM_File|odbm_fil)
21581                 case "${i_dbm}${i_rpcsvcdbm}" in
21582                 *"${define}"*)
21583                     case "$d_cplusplus" in
21584                     define) ;; # delete as a function name will not work
21585                     *)  case "$osname-$use64bitint" in
21586                         hpux-define)
21587                             case "$libs" in
21588                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21589                             esac
21590                             ;;
21591                         *) avail_ext="$avail_ext $xxx" ;;
21592                         esac
21593                         ;;
21594                     esac
21595                     ;;
21596                 esac
21597                 ;;
21598         Opcode|opcode)
21599                 case "$useopcode" in
21600                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21601                 esac
21602                 ;;
21603         POSIX|posix)
21604                 case "$useposix" in
21605                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21606                 esac
21607                 ;;
21608         Socket|socket)
21609                 case "$d_socket" in
21610                 true|$define|y)
21611                     case "$osname" in
21612                     beos) ;; # not unless BONE
21613                     *) avail_ext="$avail_ext $xxx" ;;
21614                     esac
21615                     ;;
21616                 esac
21617                 ;;
21618         Sys/Syslog|sys/syslog)
21619                 : XXX syslog requires socket
21620                 case "$d_socket" in
21621                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21622                 esac
21623                 ;;
21624         Thread|thread)
21625                 case "$usethreads" in
21626                 true|$define|y)
21627                         case "$use5005threads" in
21628                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21629                         esac
21630                 esac
21631                 ;;
21632         threads|threads/shared)
21633                 # threads and threads::shared are special cases.
21634                 # To stop people from asking "Perl 5.8.0 was supposed
21635                 # to have this new fancy threads implementation but my
21636                 # perl doesn't have it" and from people trying to
21637                 # (re)install the threads module using CPAN.pm and
21638                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21639                 # the threads.pm and threads/shared.pm will always be
21640                 # there, croaking informatively ("you need to rebuild
21641                 # all of Perl with threads, sorry") when threads haven't
21642                 # been compiled in.
21643                 # --jhi
21644                 avail_ext="$avail_ext $xxx"
21645                 ;;
21646         Win32*)
21647                 case "$osname" in
21648                 cygwin) avail_ext="$avail_ext $xxx" ;;
21649                 esac
21650                 ;;
21651         XS/APItest|xs/apitest)
21652                 # This is just for testing.  Skip it unless we have dynamic loading.
21653
21654                 case "$usedl" in
21655                 $define) avail_ext="$avail_ext $xxx" ;;
21656                 esac
21657                 ;;
21658         XS/Typemap|xs/typemap)
21659                 # This is just for testing.  Skip it unless we have dynamic loading.
21660                 case "$usedl" in
21661                 $define) avail_ext="$avail_ext $xxx" ;;
21662                 esac
21663                 ;;
21664         *)      avail_ext="$avail_ext $xxx"
21665                 ;;
21666         esac
21667 done
21668
21669 set X $avail_ext
21670 shift
21671 avail_ext="$*"
21672
21673 case "$onlyextensions" in
21674 '') ;;
21675 *)  keepextensions=''
21676     echo "You have requested that only certains extensions be included..." >&4
21677     for i in $onlyextensions; do
21678         case " $avail_ext " in
21679         *" $i "*)
21680             echo "Keeping extension $i."
21681             keepextensions="$keepextensions $i"
21682             ;;
21683         *) echo "Ignoring extension $i." ;;
21684         esac
21685     done
21686     avail_ext="$keepextensions"
21687     ;;
21688 esac
21689
21690 case "$noextensions" in
21691 '') ;;
21692 *)  keepextensions=''
21693     echo "You have requested that certain extensions be ignored..." >&4
21694     for i in $avail_ext; do
21695         case " $noextensions " in
21696         *" $i "*) echo "Ignoring extension $i." ;;
21697         *) echo "Keeping extension $i.";
21698            keepextensions="$keepextensions $i"
21699            ;;
21700         esac
21701     done
21702     avail_ext="$keepextensions"
21703     ;;
21704 esac
21705
21706 : Now see which nonxs extensions are supported on this system.
21707 : For now assume all are.
21708 nonxs_ext=''
21709 for xxx in $nonxs_extensions ; do
21710         case "$xxx" in
21711         *)      nonxs_ext="$nonxs_ext $xxx"
21712                 ;;
21713         esac
21714 done
21715
21716 set X $nonxs_ext
21717 shift
21718 nonxs_ext="$*"
21719
21720 case $usedl in
21721 $define)
21722         $cat <<EOM
21723 A number of extensions are supplied with $package.  You may choose to
21724 compile these extensions for dynamic loading (the default), compile
21725 them into the $package executable (static loading), or not include
21726 them at all.  Answer "none" to include no extensions.
21727 Note that DynaLoader is always built and need not be mentioned here.
21728
21729 EOM
21730         case "$dynamic_ext" in
21731         '')
21732                 : Exclude those listed in static_ext
21733                 dflt=''
21734                 for xxx in $avail_ext; do
21735                         case " $static_ext " in
21736                         *" $xxx "*) ;;
21737                         *) dflt="$dflt $xxx" ;;
21738                         esac
21739                 done
21740                 set X $dflt
21741                 shift
21742                 dflt="$*"
21743                 ;;
21744         *)      dflt="$dynamic_ext"
21745                 # Perhaps we are reusing an old out-of-date config.sh.
21746                 case "$hint" in
21747                 previous)
21748                         if test X"$dynamic_ext" != X"$avail_ext"; then
21749                                 $cat <<EOM
21750 NOTICE:  Your previous config.sh list may be incorrect.
21751 The extensions now available to you are
21752         ${avail_ext}
21753 but the default list from your previous config.sh is
21754         ${dynamic_ext}
21755
21756 EOM
21757                         fi
21758                         ;;
21759                 esac
21760                 ;;
21761         esac
21762         case "$dflt" in
21763         '')     dflt=none;;
21764         esac
21765         rp="What extensions do you wish to load dynamically?"
21766         . ./myread
21767         case "$ans" in
21768         none) dynamic_ext=' ' ;;
21769         *) dynamic_ext="$ans" ;;
21770         esac
21771
21772         case "$static_ext" in
21773         '')
21774                 : Exclude those already listed in dynamic linking
21775                 dflt=''
21776                 for xxx in $avail_ext; do
21777                         case " $dynamic_ext " in
21778                         *" $xxx "*) ;;
21779                         *) dflt="$dflt $xxx" ;;
21780                         esac
21781                 done
21782                 set X $dflt
21783                 shift
21784                 dflt="$*"
21785                 ;;
21786         *)  dflt="$static_ext"
21787                 ;;
21788         esac
21789
21790         case "$dflt" in
21791         '')     dflt=none;;
21792         esac
21793         rp="What extensions do you wish to load statically?"
21794         . ./myread
21795         case "$ans" in
21796         none) static_ext=' ' ;;
21797         *) static_ext="$ans" ;;
21798         esac
21799         ;;
21800 *)
21801         $cat <<EOM
21802 A number of extensions are supplied with $package.  Answer "none"
21803 to include no extensions.
21804 Note that DynaLoader is always built and need not be mentioned here.
21805
21806 EOM
21807         case "$static_ext" in
21808         '') dflt="$avail_ext" ;;
21809         *)      dflt="$static_ext"
21810                 # Perhaps we are reusing an old out-of-date config.sh.
21811                 case "$hint" in
21812                 previous)
21813                         if test X"$static_ext" != X"$avail_ext"; then
21814                                 $cat <<EOM
21815 NOTICE:  Your previous config.sh list may be incorrect.
21816 The extensions now available to you are
21817         ${avail_ext}
21818 but the default list from your previous config.sh is
21819         ${static_ext}
21820
21821 EOM
21822                         fi
21823                         ;;
21824                 esac
21825                 ;;
21826         esac
21827         : Exclude those that are not xs extensions
21828         case "$dflt" in
21829         '')     dflt=none;;
21830         esac
21831         rp="What extensions do you wish to include?"
21832         . ./myread
21833         case "$ans" in
21834         none) static_ext=' ' ;;
21835         *) static_ext="$ans" ;;
21836         esac
21837         ;;
21838 esac
21839 #
21840 # Encode is a special case.  If we are building Encode as a static
21841 # extension, we need to explicitly list its subextensions as well.
21842 # For other nested extensions, this is handled automatically by
21843 # the appropriate Makefile.PL.
21844 case " $static_ext " in
21845         *" Encode "*) # Add the subextensions of Encode
21846         cd "$rsrc/ext"
21847         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21848                 static_ext="$static_ext Encode/$xxx"
21849         done
21850         cd "$tdir"
21851         ;;
21852 esac
21853
21854 set X $dynamic_ext $static_ext $nonxs_ext
21855 shift
21856 extensions="$*"
21857
21858 # Sanity check:  We require an extension suitable for use with
21859 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21860 # should show up as failures in the test suite, but it's helpful to
21861 # catch them now.) The 'extensions' list is normally sorted
21862 # alphabetically, so we need to accept either
21863 #    DB_File ... Fcntl ... IO  ....
21864 # or something like
21865 #    Fcntl ... NDBM_File ... IO  ....
21866 case " $extensions"  in
21867 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21868 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21869 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21870 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21871    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21872    ;;
21873 esac
21874
21875 : Remove libraries needed only for extensions
21876 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21877 : The exception is SunOS 4.x, which needs them.
21878 case "${osname}X${osvers}" in
21879 sunos*X4*)
21880     perllibs="$libs"
21881     ;;
21882 *) case "$usedl" in
21883     $define|true|[yY]*)
21884             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21885             shift
21886             perllibs="$*"
21887             ;;
21888     *)  perllibs="$libs"
21889             ;;
21890     esac
21891     ;;
21892 esac
21893
21894 : Remove build directory name from cppstdin so it can be used from
21895 : either the present location or the final installed location.
21896 echo " "
21897 : Get out of the UU directory to get correct path name.
21898 cd ..
21899 case "$cppstdin" in
21900 `pwd`/cppstdin)
21901         echo "Stripping down cppstdin path name"
21902         cppstdin=cppstdin
21903         ;;
21904 esac
21905 cd UU
21906
21907 : end of configuration questions
21908 echo " "
21909 echo "End of configuration questions."
21910 echo " "
21911
21912 : back to where it started
21913 if test -d ../UU; then
21914         cd ..
21915 fi
21916
21917 : configuration may be unconditionally patched via a 'config.arch' file
21918 if $test -f config.arch; then
21919         echo "I see a config.arch file, loading it." >&4
21920         . ./config.arch
21921 fi
21922
21923 : configuration may be patched via a 'config.over' file
21924 if $test -f config.over; then
21925         echo " "
21926         dflt=y
21927         rp='I see a config.over file.  Do you wish to load it?'
21928         . UU/myread
21929         case "$ans" in
21930         n*) echo "OK, I'll ignore it.";;
21931         *)      . ./config.over
21932                 echo "Configuration override changes have been loaded."
21933                 ;;
21934         esac
21935 fi
21936
21937 : in case they want portability, strip down executable paths
21938 case "$d_portable" in
21939 "$define")
21940         echo " "
21941         echo "Stripping down executable paths..." >&4
21942         for file in $loclist $trylist; do
21943                 eval temp=\$$file
21944                 eval $file=`basename $temp`
21945         done
21946         ;;
21947 esac
21948
21949 : create config.sh file
21950 echo " "
21951 echo "Creating config.sh..." >&4
21952 $spitshell <<EOT >config.sh
21953 $startsh
21954 #
21955 # This file was produced by running the Configure script. It holds all the
21956 # definitions figured out by Configure. Should you modify one of these values,
21957 # do not forget to propagate your changes by running "Configure -der". You may
21958 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21959 #
21960
21961 # Package name      : $package
21962 # Source directory  : $src
21963 # Configuration time: $cf_time
21964 # Configured by     : $cf_by
21965 # Target system     : $myuname
21966
21967 EOT
21968 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21969 $spitshell <<EOT >>config.sh
21970
21971 Author='$Author'
21972 Date='$Date'
21973 Header='$Header'
21974 Id='$Id'
21975 Locker='$Locker'
21976 Log='$Log'
21977 RCSfile='$RCSfile'
21978 Revision='$Revision'
21979 Source='$Source'
21980 State='$State'
21981 _a='$_a'
21982 _exe='$_exe'
21983 _o='$_o'
21984 afs='$afs'
21985 afsroot='$afsroot'
21986 alignbytes='$alignbytes'
21987 ansi2knr='$ansi2knr'
21988 aphostname='$aphostname'
21989 api_revision='$api_revision'
21990 api_subversion='$api_subversion'
21991 api_version='$api_version'
21992 api_versionstring='$api_versionstring'
21993 ar='$ar'
21994 archlib='$archlib'
21995 archlibexp='$archlibexp'
21996 archname64='$archname64'
21997 archname='$archname'
21998 archobjs='$archobjs'
21999 asctime_r_proto='$asctime_r_proto'
22000 awk='$awk'
22001 baserev='$baserev'
22002 bash='$bash'
22003 bin='$bin'
22004 binexp='$binexp'
22005 bison='$bison'
22006 byacc='$byacc'
22007 byteorder='$byteorder'
22008 c='$c'
22009 castflags='$castflags'
22010 cat='$cat'
22011 cc='$cc'
22012 cccdlflags='$cccdlflags'
22013 ccdlflags='$ccdlflags'
22014 ccflags='$ccflags'
22015 ccflags_uselargefiles='$ccflags_uselargefiles'
22016 ccname='$ccname'
22017 ccsymbols='$ccsymbols'
22018 ccversion='$ccversion'
22019 cf_by='$cf_by'
22020 cf_email='$cf_email'
22021 cf_time='$cf_time'
22022 chgrp='$chgrp'
22023 chmod='$chmod'
22024 chown='$chown'
22025 clocktype='$clocktype'
22026 comm='$comm'
22027 compress='$compress'
22028 contains='$contains'
22029 cp='$cp'
22030 cpio='$cpio'
22031 cpp='$cpp'
22032 cpp_stuff='$cpp_stuff'
22033 cppccsymbols='$cppccsymbols'
22034 cppflags='$cppflags'
22035 cpplast='$cpplast'
22036 cppminus='$cppminus'
22037 cpprun='$cpprun'
22038 cppstdin='$cppstdin'
22039 cppsymbols='$cppsymbols'
22040 crypt_r_proto='$crypt_r_proto'
22041 cryptlib='$cryptlib'
22042 csh='$csh'
22043 ctermid_r_proto='$ctermid_r_proto'
22044 ctime_r_proto='$ctime_r_proto'
22045 d_Gconvert='$d_Gconvert'
22046 d_PRIEUldbl='$d_PRIEUldbl'
22047 d_PRIFUldbl='$d_PRIFUldbl'
22048 d_PRIGUldbl='$d_PRIGUldbl'
22049 d_PRIXU64='$d_PRIXU64'
22050 d_PRId64='$d_PRId64'
22051 d_PRIeldbl='$d_PRIeldbl'
22052 d_PRIfldbl='$d_PRIfldbl'
22053 d_PRIgldbl='$d_PRIgldbl'
22054 d_PRIi64='$d_PRIi64'
22055 d_PRIo64='$d_PRIo64'
22056 d_PRIu64='$d_PRIu64'
22057 d_PRIx64='$d_PRIx64'
22058 d_SCNfldbl='$d_SCNfldbl'
22059 d__fwalk='$d__fwalk'
22060 d_access='$d_access'
22061 d_accessx='$d_accessx'
22062 d_aintl='$d_aintl'
22063 d_alarm='$d_alarm'
22064 d_archlib='$d_archlib'
22065 d_asctime64='$d_asctime64'
22066 d_asctime_r='$d_asctime_r'
22067 d_atolf='$d_atolf'
22068 d_atoll='$d_atoll'
22069 d_attribute_format='$d_attribute_format'
22070 d_attribute_malloc='$d_attribute_malloc'
22071 d_attribute_nonnull='$d_attribute_nonnull'
22072 d_attribute_noreturn='$d_attribute_noreturn'
22073 d_attribute_pure='$d_attribute_pure'
22074 d_attribute_unused='$d_attribute_unused'
22075 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22076 d_bcmp='$d_bcmp'
22077 d_bcopy='$d_bcopy'
22078 d_bsd='$d_bsd'
22079 d_bsdgetpgrp='$d_bsdgetpgrp'
22080 d_bsdsetpgrp='$d_bsdsetpgrp'
22081 d_builtin_choose_expr='$d_builtin_choose_expr'
22082 d_builtin_expect='$d_builtin_expect'
22083 d_bzero='$d_bzero'
22084 d_c99_variadic_macros='$d_c99_variadic_macros'
22085 d_casti32='$d_casti32'
22086 d_castneg='$d_castneg'
22087 d_charvspr='$d_charvspr'
22088 d_chown='$d_chown'
22089 d_chroot='$d_chroot'
22090 d_chsize='$d_chsize'
22091 d_class='$d_class'
22092 d_clearenv='$d_clearenv'
22093 d_closedir='$d_closedir'
22094 d_cmsghdr_s='$d_cmsghdr_s'
22095 d_const='$d_const'
22096 d_copysignl='$d_copysignl'
22097 d_cplusplus='$d_cplusplus'
22098 d_crypt='$d_crypt'
22099 d_crypt_r='$d_crypt_r'
22100 d_csh='$d_csh'
22101 d_ctermid='$d_ctermid'
22102 d_ctermid_r='$d_ctermid_r'
22103 d_ctime64='$d_ctime64'
22104 d_ctime_r='$d_ctime_r'
22105 d_cuserid='$d_cuserid'
22106 d_dbl_dig='$d_dbl_dig'
22107 d_dbminitproto='$d_dbminitproto'
22108 d_difftime64='$d_difftime64'
22109 d_difftime='$d_difftime'
22110 d_dir_dd_fd='$d_dir_dd_fd'
22111 d_dirfd='$d_dirfd'
22112 d_dirnamlen='$d_dirnamlen'
22113 d_dlerror='$d_dlerror'
22114 d_dlopen='$d_dlopen'
22115 d_dlsymun='$d_dlsymun'
22116 d_dosuid='$d_dosuid'
22117 d_drand48_r='$d_drand48_r'
22118 d_drand48proto='$d_drand48proto'
22119 d_dup2='$d_dup2'
22120 d_eaccess='$d_eaccess'
22121 d_endgrent='$d_endgrent'
22122 d_endgrent_r='$d_endgrent_r'
22123 d_endhent='$d_endhent'
22124 d_endhostent_r='$d_endhostent_r'
22125 d_endnent='$d_endnent'
22126 d_endnetent_r='$d_endnetent_r'
22127 d_endpent='$d_endpent'
22128 d_endprotoent_r='$d_endprotoent_r'
22129 d_endpwent='$d_endpwent'
22130 d_endpwent_r='$d_endpwent_r'
22131 d_endsent='$d_endsent'
22132 d_endservent_r='$d_endservent_r'
22133 d_eofnblk='$d_eofnblk'
22134 d_eunice='$d_eunice'
22135 d_faststdio='$d_faststdio'
22136 d_fchdir='$d_fchdir'
22137 d_fchmod='$d_fchmod'
22138 d_fchown='$d_fchown'
22139 d_fcntl='$d_fcntl'
22140 d_fcntl_can_lock='$d_fcntl_can_lock'
22141 d_fd_macros='$d_fd_macros'
22142 d_fd_set='$d_fd_set'
22143 d_fds_bits='$d_fds_bits'
22144 d_fgetpos='$d_fgetpos'
22145 d_finite='$d_finite'
22146 d_finitel='$d_finitel'
22147 d_flexfnam='$d_flexfnam'
22148 d_flock='$d_flock'
22149 d_flockproto='$d_flockproto'
22150 d_fork='$d_fork'
22151 d_fp_class='$d_fp_class'
22152 d_fpathconf='$d_fpathconf'
22153 d_fpclass='$d_fpclass'
22154 d_fpclassify='$d_fpclassify'
22155 d_fpclassl='$d_fpclassl'
22156 d_fpos64_t='$d_fpos64_t'
22157 d_frexpl='$d_frexpl'
22158 d_fs_data_s='$d_fs_data_s'
22159 d_fseeko='$d_fseeko'
22160 d_fsetpos='$d_fsetpos'
22161 d_fstatfs='$d_fstatfs'
22162 d_fstatvfs='$d_fstatvfs'
22163 d_fsync='$d_fsync'
22164 d_ftello='$d_ftello'
22165 d_ftime='$d_ftime'
22166 d_futimes='$d_futimes'
22167 d_getcwd='$d_getcwd'
22168 d_getespwnam='$d_getespwnam'
22169 d_getfsstat='$d_getfsstat'
22170 d_getgrent='$d_getgrent'
22171 d_getgrent_r='$d_getgrent_r'
22172 d_getgrgid_r='$d_getgrgid_r'
22173 d_getgrnam_r='$d_getgrnam_r'
22174 d_getgrps='$d_getgrps'
22175 d_gethbyaddr='$d_gethbyaddr'
22176 d_gethbyname='$d_gethbyname'
22177 d_gethent='$d_gethent'
22178 d_gethname='$d_gethname'
22179 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22180 d_gethostbyname_r='$d_gethostbyname_r'
22181 d_gethostent_r='$d_gethostent_r'
22182 d_gethostprotos='$d_gethostprotos'
22183 d_getitimer='$d_getitimer'
22184 d_getlogin='$d_getlogin'
22185 d_getlogin_r='$d_getlogin_r'
22186 d_getmnt='$d_getmnt'
22187 d_getmntent='$d_getmntent'
22188 d_getnbyaddr='$d_getnbyaddr'
22189 d_getnbyname='$d_getnbyname'
22190 d_getnent='$d_getnent'
22191 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22192 d_getnetbyname_r='$d_getnetbyname_r'
22193 d_getnetent_r='$d_getnetent_r'
22194 d_getnetprotos='$d_getnetprotos'
22195 d_getpagsz='$d_getpagsz'
22196 d_getpbyname='$d_getpbyname'
22197 d_getpbynumber='$d_getpbynumber'
22198 d_getpent='$d_getpent'
22199 d_getpgid='$d_getpgid'
22200 d_getpgrp2='$d_getpgrp2'
22201 d_getpgrp='$d_getpgrp'
22202 d_getppid='$d_getppid'
22203 d_getprior='$d_getprior'
22204 d_getprotobyname_r='$d_getprotobyname_r'
22205 d_getprotobynumber_r='$d_getprotobynumber_r'
22206 d_getprotoent_r='$d_getprotoent_r'
22207 d_getprotoprotos='$d_getprotoprotos'
22208 d_getprpwnam='$d_getprpwnam'
22209 d_getpwent='$d_getpwent'
22210 d_getpwent_r='$d_getpwent_r'
22211 d_getpwnam_r='$d_getpwnam_r'
22212 d_getpwuid_r='$d_getpwuid_r'
22213 d_getsbyname='$d_getsbyname'
22214 d_getsbyport='$d_getsbyport'
22215 d_getsent='$d_getsent'
22216 d_getservbyname_r='$d_getservbyname_r'
22217 d_getservbyport_r='$d_getservbyport_r'
22218 d_getservent_r='$d_getservent_r'
22219 d_getservprotos='$d_getservprotos'
22220 d_getspnam='$d_getspnam'
22221 d_getspnam_r='$d_getspnam_r'
22222 d_gettimeod='$d_gettimeod'
22223 d_gmtime64='$d_gmtime64'
22224 d_gmtime_r='$d_gmtime_r'
22225 d_gnulibc='$d_gnulibc'
22226 d_grpasswd='$d_grpasswd'
22227 d_hasmntopt='$d_hasmntopt'
22228 d_htonl='$d_htonl'
22229 d_ilogbl='$d_ilogbl'
22230 d_inc_version_list='$d_inc_version_list'
22231 d_index='$d_index'
22232 d_inetaton='$d_inetaton'
22233 d_int64_t='$d_int64_t'
22234 d_isascii='$d_isascii'
22235 d_isfinite='$d_isfinite'
22236 d_isinf='$d_isinf'
22237 d_isnan='$d_isnan'
22238 d_isnanl='$d_isnanl'
22239 d_killpg='$d_killpg'
22240 d_lchown='$d_lchown'
22241 d_ldbl_dig='$d_ldbl_dig'
22242 d_libm_lib_version='$d_libm_lib_version'
22243 d_link='$d_link'
22244 d_localtime64='$d_localtime64'
22245 d_localtime_r='$d_localtime_r'
22246 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22247 d_locconv='$d_locconv'
22248 d_lockf='$d_lockf'
22249 d_longdbl='$d_longdbl'
22250 d_longlong='$d_longlong'
22251 d_lseekproto='$d_lseekproto'
22252 d_lstat='$d_lstat'
22253 d_madvise='$d_madvise'
22254 d_malloc_good_size='$d_malloc_good_size'
22255 d_malloc_size='$d_malloc_size'
22256 d_mblen='$d_mblen'
22257 d_mbstowcs='$d_mbstowcs'
22258 d_mbtowc='$d_mbtowc'
22259 d_memchr='$d_memchr'
22260 d_memcmp='$d_memcmp'
22261 d_memcpy='$d_memcpy'
22262 d_memmove='$d_memmove'
22263 d_memset='$d_memset'
22264 d_mkdir='$d_mkdir'
22265 d_mkdtemp='$d_mkdtemp'
22266 d_mkfifo='$d_mkfifo'
22267 d_mkstemp='$d_mkstemp'
22268 d_mkstemps='$d_mkstemps'
22269 d_mktime64='$d_mktime64'
22270 d_mktime='$d_mktime'
22271 d_mmap='$d_mmap'
22272 d_modfl='$d_modfl'
22273 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22274 d_modflproto='$d_modflproto'
22275 d_mprotect='$d_mprotect'
22276 d_msg='$d_msg'
22277 d_msg_ctrunc='$d_msg_ctrunc'
22278 d_msg_dontroute='$d_msg_dontroute'
22279 d_msg_oob='$d_msg_oob'
22280 d_msg_peek='$d_msg_peek'
22281 d_msg_proxy='$d_msg_proxy'
22282 d_msgctl='$d_msgctl'
22283 d_msgget='$d_msgget'
22284 d_msghdr_s='$d_msghdr_s'
22285 d_msgrcv='$d_msgrcv'
22286 d_msgsnd='$d_msgsnd'
22287 d_msync='$d_msync'
22288 d_munmap='$d_munmap'
22289 d_mymalloc='$d_mymalloc'
22290 d_ndbm='$d_ndbm'
22291 d_nice='$d_nice'
22292 d_nl_langinfo='$d_nl_langinfo'
22293 d_nv_preserves_uv='$d_nv_preserves_uv'
22294 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22295 d_off64_t='$d_off64_t'
22296 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22297 d_oldpthreads='$d_oldpthreads'
22298 d_oldsock='$d_oldsock'
22299 d_open3='$d_open3'
22300 d_pathconf='$d_pathconf'
22301 d_pause='$d_pause'
22302 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22303 d_phostname='$d_phostname'
22304 d_pipe='$d_pipe'
22305 d_poll='$d_poll'
22306 d_portable='$d_portable'
22307 d_printf_format_null='$d_printf_format_null'
22308 d_procselfexe='$d_procselfexe'
22309 d_pseudofork='$d_pseudofork'
22310 d_pthread_atfork='$d_pthread_atfork'
22311 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22312 d_pthread_yield='$d_pthread_yield'
22313 d_pwage='$d_pwage'
22314 d_pwchange='$d_pwchange'
22315 d_pwclass='$d_pwclass'
22316 d_pwcomment='$d_pwcomment'
22317 d_pwexpire='$d_pwexpire'
22318 d_pwgecos='$d_pwgecos'
22319 d_pwpasswd='$d_pwpasswd'
22320 d_pwquota='$d_pwquota'
22321 d_qgcvt='$d_qgcvt'
22322 d_quad='$d_quad'
22323 d_random_r='$d_random_r'
22324 d_readdir64_r='$d_readdir64_r'
22325 d_readdir='$d_readdir'
22326 d_readdir_r='$d_readdir_r'
22327 d_readlink='$d_readlink'
22328 d_readv='$d_readv'
22329 d_recvmsg='$d_recvmsg'
22330 d_rename='$d_rename'
22331 d_rewinddir='$d_rewinddir'
22332 d_rmdir='$d_rmdir'
22333 d_safebcpy='$d_safebcpy'
22334 d_safemcpy='$d_safemcpy'
22335 d_sanemcmp='$d_sanemcmp'
22336 d_sbrkproto='$d_sbrkproto'
22337 d_scalbnl='$d_scalbnl'
22338 d_sched_yield='$d_sched_yield'
22339 d_scm_rights='$d_scm_rights'
22340 d_seekdir='$d_seekdir'
22341 d_select='$d_select'
22342 d_sem='$d_sem'
22343 d_semctl='$d_semctl'
22344 d_semctl_semid_ds='$d_semctl_semid_ds'
22345 d_semctl_semun='$d_semctl_semun'
22346 d_semget='$d_semget'
22347 d_semop='$d_semop'
22348 d_sendmsg='$d_sendmsg'
22349 d_setegid='$d_setegid'
22350 d_seteuid='$d_seteuid'
22351 d_setgrent='$d_setgrent'
22352 d_setgrent_r='$d_setgrent_r'
22353 d_setgrps='$d_setgrps'
22354 d_sethent='$d_sethent'
22355 d_sethostent_r='$d_sethostent_r'
22356 d_setitimer='$d_setitimer'
22357 d_setlinebuf='$d_setlinebuf'
22358 d_setlocale='$d_setlocale'
22359 d_setlocale_r='$d_setlocale_r'
22360 d_setnent='$d_setnent'
22361 d_setnetent_r='$d_setnetent_r'
22362 d_setpent='$d_setpent'
22363 d_setpgid='$d_setpgid'
22364 d_setpgrp2='$d_setpgrp2'
22365 d_setpgrp='$d_setpgrp'
22366 d_setprior='$d_setprior'
22367 d_setproctitle='$d_setproctitle'
22368 d_setprotoent_r='$d_setprotoent_r'
22369 d_setpwent='$d_setpwent'
22370 d_setpwent_r='$d_setpwent_r'
22371 d_setregid='$d_setregid'
22372 d_setresgid='$d_setresgid'
22373 d_setresuid='$d_setresuid'
22374 d_setreuid='$d_setreuid'
22375 d_setrgid='$d_setrgid'
22376 d_setruid='$d_setruid'
22377 d_setsent='$d_setsent'
22378 d_setservent_r='$d_setservent_r'
22379 d_setsid='$d_setsid'
22380 d_setvbuf='$d_setvbuf'
22381 d_sfio='$d_sfio'
22382 d_shm='$d_shm'
22383 d_shmat='$d_shmat'
22384 d_shmatprototype='$d_shmatprototype'
22385 d_shmctl='$d_shmctl'
22386 d_shmdt='$d_shmdt'
22387 d_shmget='$d_shmget'
22388 d_sigaction='$d_sigaction'
22389 d_signbit='$d_signbit'
22390 d_sigprocmask='$d_sigprocmask'
22391 d_sigsetjmp='$d_sigsetjmp'
22392 d_sitearch='$d_sitearch'
22393 d_snprintf='$d_snprintf'
22394 d_sockatmark='$d_sockatmark'
22395 d_sockatmarkproto='$d_sockatmarkproto'
22396 d_socket='$d_socket'
22397 d_socklen_t='$d_socklen_t'
22398 d_sockpair='$d_sockpair'
22399 d_socks5_init='$d_socks5_init'
22400 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22401 d_sqrtl='$d_sqrtl'
22402 d_srand48_r='$d_srand48_r'
22403 d_srandom_r='$d_srandom_r'
22404 d_sresgproto='$d_sresgproto'
22405 d_sresuproto='$d_sresuproto'
22406 d_statblks='$d_statblks'
22407 d_statfs_f_flags='$d_statfs_f_flags'
22408 d_statfs_s='$d_statfs_s'
22409 d_statvfs='$d_statvfs'
22410 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22411 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22412 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22413 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22414 d_stdio_stream_array='$d_stdio_stream_array'
22415 d_stdiobase='$d_stdiobase'
22416 d_stdstdio='$d_stdstdio'
22417 d_strchr='$d_strchr'
22418 d_strcoll='$d_strcoll'
22419 d_strctcpy='$d_strctcpy'
22420 d_strerrm='$d_strerrm'
22421 d_strerror='$d_strerror'
22422 d_strerror_r='$d_strerror_r'
22423 d_strftime='$d_strftime'
22424 d_strlcat='$d_strlcat'
22425 d_strlcpy='$d_strlcpy'
22426 d_strtod='$d_strtod'
22427 d_strtol='$d_strtol'
22428 d_strtold='$d_strtold'
22429 d_strtoll='$d_strtoll'
22430 d_strtoq='$d_strtoq'
22431 d_strtoul='$d_strtoul'
22432 d_strtoull='$d_strtoull'
22433 d_strtouq='$d_strtouq'
22434 d_strxfrm='$d_strxfrm'
22435 d_suidsafe='$d_suidsafe'
22436 d_symlink='$d_symlink'
22437 d_syscall='$d_syscall'
22438 d_syscallproto='$d_syscallproto'
22439 d_sysconf='$d_sysconf'
22440 d_sysernlst='$d_sysernlst'
22441 d_syserrlst='$d_syserrlst'
22442 d_system='$d_system'
22443 d_tcgetpgrp='$d_tcgetpgrp'
22444 d_tcsetpgrp='$d_tcsetpgrp'
22445 d_telldir='$d_telldir'
22446 d_telldirproto='$d_telldirproto'
22447 d_time='$d_time'
22448 d_timegm='$d_timegm'
22449 d_times='$d_times'
22450 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22451 d_tm_tm_zone='$d_tm_tm_zone'
22452 d_tmpnam_r='$d_tmpnam_r'
22453 d_truncate='$d_truncate'
22454 d_ttyname_r='$d_ttyname_r'
22455 d_tzname='$d_tzname'
22456 d_u32align='$d_u32align'
22457 d_ualarm='$d_ualarm'
22458 d_umask='$d_umask'
22459 d_uname='$d_uname'
22460 d_union_semun='$d_union_semun'
22461 d_unordered='$d_unordered'
22462 d_unsetenv='$d_unsetenv'
22463 d_usleep='$d_usleep'
22464 d_usleepproto='$d_usleepproto'
22465 d_ustat='$d_ustat'
22466 d_vendorarch='$d_vendorarch'
22467 d_vendorbin='$d_vendorbin'
22468 d_vendorlib='$d_vendorlib'
22469 d_vendorscript='$d_vendorscript'
22470 d_vfork='$d_vfork'
22471 d_void_closedir='$d_void_closedir'
22472 d_voidsig='$d_voidsig'
22473 d_voidtty='$d_voidtty'
22474 d_volatile='$d_volatile'
22475 d_vprintf='$d_vprintf'
22476 d_vsnprintf='$d_vsnprintf'
22477 d_wait4='$d_wait4'
22478 d_waitpid='$d_waitpid'
22479 d_wcstombs='$d_wcstombs'
22480 d_wctomb='$d_wctomb'
22481 d_writev='$d_writev'
22482 d_xenix='$d_xenix'
22483 date='$date'
22484 db_hashtype='$db_hashtype'
22485 db_prefixtype='$db_prefixtype'
22486 db_version_major='$db_version_major'
22487 db_version_minor='$db_version_minor'
22488 db_version_patch='$db_version_patch'
22489 defvoidused='$defvoidused'
22490 direntrytype='$direntrytype'
22491 dlext='$dlext'
22492 dlsrc='$dlsrc'
22493 doublesize='$doublesize'
22494 drand01='$drand01'
22495 drand48_r_proto='$drand48_r_proto'
22496 dtrace='$dtrace'
22497 dynamic_ext='$dynamic_ext'
22498 eagain='$eagain'
22499 ebcdic='$ebcdic'
22500 echo='$echo'
22501 egrep='$egrep'
22502 emacs='$emacs'
22503 endgrent_r_proto='$endgrent_r_proto'
22504 endhostent_r_proto='$endhostent_r_proto'
22505 endnetent_r_proto='$endnetent_r_proto'
22506 endprotoent_r_proto='$endprotoent_r_proto'
22507 endpwent_r_proto='$endpwent_r_proto'
22508 endservent_r_proto='$endservent_r_proto'
22509 eunicefix='$eunicefix'
22510 exe_ext='$exe_ext'
22511 expr='$expr'
22512 extensions='$extensions'
22513 extras='$extras'
22514 fflushNULL='$fflushNULL'
22515 fflushall='$fflushall'
22516 find='$find'
22517 firstmakefile='$firstmakefile'
22518 flex='$flex'
22519 fpossize='$fpossize'
22520 fpostype='$fpostype'
22521 freetype='$freetype'
22522 from='$from'
22523 full_ar='$full_ar'
22524 full_csh='$full_csh'
22525 full_sed='$full_sed'
22526 gccansipedantic='$gccansipedantic'
22527 gccosandvers='$gccosandvers'
22528 gccversion='$gccversion'
22529 getgrent_r_proto='$getgrent_r_proto'
22530 getgrgid_r_proto='$getgrgid_r_proto'
22531 getgrnam_r_proto='$getgrnam_r_proto'
22532 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22533 gethostbyname_r_proto='$gethostbyname_r_proto'
22534 gethostent_r_proto='$gethostent_r_proto'
22535 getlogin_r_proto='$getlogin_r_proto'
22536 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22537 getnetbyname_r_proto='$getnetbyname_r_proto'
22538 getnetent_r_proto='$getnetent_r_proto'
22539 getprotobyname_r_proto='$getprotobyname_r_proto'
22540 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22541 getprotoent_r_proto='$getprotoent_r_proto'
22542 getpwent_r_proto='$getpwent_r_proto'
22543 getpwnam_r_proto='$getpwnam_r_proto'
22544 getpwuid_r_proto='$getpwuid_r_proto'
22545 getservbyname_r_proto='$getservbyname_r_proto'
22546 getservbyport_r_proto='$getservbyport_r_proto'
22547 getservent_r_proto='$getservent_r_proto'
22548 getspnam_r_proto='$getspnam_r_proto'
22549 gidformat='$gidformat'
22550 gidsign='$gidsign'
22551 gidsize='$gidsize'
22552 gidtype='$gidtype'
22553 glibpth='$glibpth'
22554 gmake='$gmake'
22555 gmtime_r_proto='$gmtime_r_proto'
22556 gnulibc_version='$gnulibc_version'
22557 grep='$grep'
22558 groupcat='$groupcat'
22559 groupstype='$groupstype'
22560 gzip='$gzip'
22561 h_fcntl='$h_fcntl'
22562 h_sysfile='$h_sysfile'
22563 hint='$hint'
22564 hostcat='$hostcat'
22565 html1dir='$html1dir'
22566 html1direxp='$html1direxp'
22567 html3dir='$html3dir'
22568 html3direxp='$html3direxp'
22569 i16size='$i16size'
22570 i16type='$i16type'
22571 i32size='$i32size'
22572 i32type='$i32type'
22573 i64size='$i64size'
22574 i64type='$i64type'
22575 i8size='$i8size'
22576 i8type='$i8type'
22577 i_arpainet='$i_arpainet'
22578 i_assert='$i_assert'
22579 i_bsdioctl='$i_bsdioctl'
22580 i_crypt='$i_crypt'
22581 i_db='$i_db'
22582 i_dbm='$i_dbm'
22583 i_dirent='$i_dirent'
22584 i_dld='$i_dld'
22585 i_dlfcn='$i_dlfcn'
22586 i_fcntl='$i_fcntl'
22587 i_float='$i_float'
22588 i_fp='$i_fp'
22589 i_fp_class='$i_fp_class'
22590 i_gdbm='$i_gdbm'
22591 i_gdbm_ndbm='$i_gdbm_ndbm'
22592 i_gdbmndbm='$i_gdbmndbm'
22593 i_grp='$i_grp'
22594 i_ieeefp='$i_ieeefp'
22595 i_inttypes='$i_inttypes'
22596 i_langinfo='$i_langinfo'
22597 i_libutil='$i_libutil'
22598 i_limits='$i_limits'
22599 i_locale='$i_locale'
22600 i_machcthr='$i_machcthr'
22601 i_malloc='$i_malloc'
22602 i_mallocmalloc='$i_mallocmalloc'
22603 i_math='$i_math'
22604 i_memory='$i_memory'
22605 i_mntent='$i_mntent'
22606 i_ndbm='$i_ndbm'
22607 i_netdb='$i_netdb'
22608 i_neterrno='$i_neterrno'
22609 i_netinettcp='$i_netinettcp'
22610 i_niin='$i_niin'
22611 i_poll='$i_poll'
22612 i_prot='$i_prot'
22613 i_pthread='$i_pthread'
22614 i_pwd='$i_pwd'
22615 i_rpcsvcdbm='$i_rpcsvcdbm'
22616 i_sfio='$i_sfio'
22617 i_sgtty='$i_sgtty'
22618 i_shadow='$i_shadow'
22619 i_socks='$i_socks'
22620 i_stdarg='$i_stdarg'
22621 i_stddef='$i_stddef'
22622 i_stdlib='$i_stdlib'
22623 i_string='$i_string'
22624 i_sunmath='$i_sunmath'
22625 i_sysaccess='$i_sysaccess'
22626 i_sysdir='$i_sysdir'
22627 i_sysfile='$i_sysfile'
22628 i_sysfilio='$i_sysfilio'
22629 i_sysin='$i_sysin'
22630 i_sysioctl='$i_sysioctl'
22631 i_syslog='$i_syslog'
22632 i_sysmman='$i_sysmman'
22633 i_sysmode='$i_sysmode'
22634 i_sysmount='$i_sysmount'
22635 i_sysndir='$i_sysndir'
22636 i_sysparam='$i_sysparam'
22637 i_syspoll='$i_syspoll'
22638 i_sysresrc='$i_sysresrc'
22639 i_syssecrt='$i_syssecrt'
22640 i_sysselct='$i_sysselct'
22641 i_syssockio='$i_syssockio'
22642 i_sysstat='$i_sysstat'
22643 i_sysstatfs='$i_sysstatfs'
22644 i_sysstatvfs='$i_sysstatvfs'
22645 i_systime='$i_systime'
22646 i_systimek='$i_systimek'
22647 i_systimes='$i_systimes'
22648 i_systypes='$i_systypes'
22649 i_sysuio='$i_sysuio'
22650 i_sysun='$i_sysun'
22651 i_sysutsname='$i_sysutsname'
22652 i_sysvfs='$i_sysvfs'
22653 i_syswait='$i_syswait'
22654 i_termio='$i_termio'
22655 i_termios='$i_termios'
22656 i_time='$i_time'
22657 i_unistd='$i_unistd'
22658 i_ustat='$i_ustat'
22659 i_utime='$i_utime'
22660 i_values='$i_values'
22661 i_varargs='$i_varargs'
22662 i_varhdr='$i_varhdr'
22663 i_vfork='$i_vfork'
22664 ignore_versioned_solibs='$ignore_versioned_solibs'
22665 inc_version_list='$inc_version_list'
22666 inc_version_list_init='$inc_version_list_init'
22667 incpath='$incpath'
22668 inews='$inews'
22669 initialinstalllocation='$initialinstalllocation'
22670 installarchlib='$installarchlib'
22671 installbin='$installbin'
22672 installhtml1dir='$installhtml1dir'
22673 installhtml3dir='$installhtml3dir'
22674 installman1dir='$installman1dir'
22675 installman3dir='$installman3dir'
22676 installprefix='$installprefix'
22677 installprefixexp='$installprefixexp'
22678 installprivlib='$installprivlib'
22679 installscript='$installscript'
22680 installsitearch='$installsitearch'
22681 installsitebin='$installsitebin'
22682 installsitehtml1dir='$installsitehtml1dir'
22683 installsitehtml3dir='$installsitehtml3dir'
22684 installsitelib='$installsitelib'
22685 installsiteman1dir='$installsiteman1dir'
22686 installsiteman3dir='$installsiteman3dir'
22687 installsitescript='$installsitescript'
22688 installstyle='$installstyle'
22689 installusrbinperl='$installusrbinperl'
22690 installvendorarch='$installvendorarch'
22691 installvendorbin='$installvendorbin'
22692 installvendorhtml1dir='$installvendorhtml1dir'
22693 installvendorhtml3dir='$installvendorhtml3dir'
22694 installvendorlib='$installvendorlib'
22695 installvendorman1dir='$installvendorman1dir'
22696 installvendorman3dir='$installvendorman3dir'
22697 installvendorscript='$installvendorscript'
22698 intsize='$intsize'
22699 issymlink='$issymlink'
22700 ivdformat='$ivdformat'
22701 ivsize='$ivsize'
22702 ivtype='$ivtype'
22703 known_extensions='$known_extensions'
22704 ksh='$ksh'
22705 ld='$ld'
22706 lddlflags='$lddlflags'
22707 ldflags='$ldflags'
22708 ldflags_uselargefiles='$ldflags_uselargefiles'
22709 ldlibpthname='$ldlibpthname'
22710 less='$less'
22711 lib_ext='$lib_ext'
22712 libc='$libc'
22713 libperl='$libperl'
22714 libpth='$libpth'
22715 libs='$libs'
22716 libsdirs='$libsdirs'
22717 libsfiles='$libsfiles'
22718 libsfound='$libsfound'
22719 libspath='$libspath'
22720 libswanted='$libswanted'
22721 libswanted_uselargefiles='$libswanted_uselargefiles'
22722 line='$line'
22723 lint='$lint'
22724 lkflags='$lkflags'
22725 ln='$ln'
22726 lns='$lns'
22727 localtime_r_proto='$localtime_r_proto'
22728 locincpth='$locincpth'
22729 loclibpth='$loclibpth'
22730 longdblsize='$longdblsize'
22731 longlongsize='$longlongsize'
22732 longsize='$longsize'
22733 lp='$lp'
22734 lpr='$lpr'
22735 ls='$ls'
22736 lseeksize='$lseeksize'
22737 lseektype='$lseektype'
22738 mad='$mad'
22739 madlyh='$madlyh'
22740 madlyobj='$madlyobj'
22741 madlysrc='$madlysrc'
22742 mail='$mail'
22743 mailx='$mailx'
22744 make='$make'
22745 make_set_make='$make_set_make'
22746 mallocobj='$mallocobj'
22747 mallocsrc='$mallocsrc'
22748 malloctype='$malloctype'
22749 man1dir='$man1dir'
22750 man1direxp='$man1direxp'
22751 man1ext='$man1ext'
22752 man3dir='$man3dir'
22753 man3direxp='$man3direxp'
22754 man3ext='$man3ext'
22755 mips_type='$mips_type'
22756 mistrustnm='$mistrustnm'
22757 mkdir='$mkdir'
22758 mmaptype='$mmaptype'
22759 modetype='$modetype'
22760 more='$more'
22761 multiarch='$multiarch'
22762 mv='$mv'
22763 myarchname='$myarchname'
22764 mydomain='$mydomain'
22765 myhostname='$myhostname'
22766 myuname='$myuname'
22767 n='$n'
22768 need_va_copy='$need_va_copy'
22769 netdb_hlen_type='$netdb_hlen_type'
22770 netdb_host_type='$netdb_host_type'
22771 netdb_name_type='$netdb_name_type'
22772 netdb_net_type='$netdb_net_type'
22773 nm='$nm'
22774 nm_opt='$nm_opt'
22775 nm_so_opt='$nm_so_opt'
22776 nonxs_ext='$nonxs_ext'
22777 nroff='$nroff'
22778 nvEUformat='$nvEUformat'
22779 nvFUformat='$nvFUformat'
22780 nvGUformat='$nvGUformat'
22781 nv_overflows_integers_at='$nv_overflows_integers_at'
22782 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22783 nveformat='$nveformat'
22784 nvfformat='$nvfformat'
22785 nvgformat='$nvgformat'
22786 nvsize='$nvsize'
22787 nvtype='$nvtype'
22788 o_nonblock='$o_nonblock'
22789 obj_ext='$obj_ext'
22790 old_pthread_create_joinable='$old_pthread_create_joinable'
22791 optimize='$optimize'
22792 orderlib='$orderlib'
22793 osname='$osname'
22794 osvers='$osvers'
22795 otherlibdirs='$otherlibdirs'
22796 package='$package'
22797 pager='$pager'
22798 passcat='$passcat'
22799 patchlevel='$patchlevel'
22800 path_sep='$path_sep'
22801 perl5='$perl5'
22802 perl='$perl'
22803 perl_patchlevel='$perl_patchlevel'
22804 perladmin='$perladmin'
22805 perllibs='$perllibs'
22806 perlpath='$perlpath'
22807 pg='$pg'
22808 phostname='$phostname'
22809 pidtype='$pidtype'
22810 plibpth='$plibpth'
22811 pmake='$pmake'
22812 pr='$pr'
22813 prefix='$prefix'
22814 prefixexp='$prefixexp'
22815 privlib='$privlib'
22816 privlibexp='$privlibexp'
22817 procselfexe='$procselfexe'
22818 prototype='$prototype'
22819 ptrsize='$ptrsize'
22820 quadkind='$quadkind'
22821 quadtype='$quadtype'
22822 randbits='$randbits'
22823 randfunc='$randfunc'
22824 random_r_proto='$random_r_proto'
22825 randseedtype='$randseedtype'
22826 ranlib='$ranlib'
22827 rd_nodata='$rd_nodata'
22828 readdir64_r_proto='$readdir64_r_proto'
22829 readdir_r_proto='$readdir_r_proto'
22830 revision='$revision'
22831 rm='$rm'
22832 rm_try='$rm_try'
22833 rmail='$rmail'
22834 run='$run'
22835 runnm='$runnm'
22836 sGMTIME_max='$sGMTIME_max'
22837 sGMTIME_min='$sGMTIME_min'
22838 sLOCALTIME_max='$sLOCALTIME_max'
22839 sLOCALTIME_min='$sLOCALTIME_min'
22840 sPRIEUldbl='$sPRIEUldbl'
22841 sPRIFUldbl='$sPRIFUldbl'
22842 sPRIGUldbl='$sPRIGUldbl'
22843 sPRIXU64='$sPRIXU64'
22844 sPRId64='$sPRId64'
22845 sPRIeldbl='$sPRIeldbl'
22846 sPRIfldbl='$sPRIfldbl'
22847 sPRIgldbl='$sPRIgldbl'
22848 sPRIi64='$sPRIi64'
22849 sPRIo64='$sPRIo64'
22850 sPRIu64='$sPRIu64'
22851 sPRIx64='$sPRIx64'
22852 sSCNfldbl='$sSCNfldbl'
22853 sched_yield='$sched_yield'
22854 scriptdir='$scriptdir'
22855 scriptdirexp='$scriptdirexp'
22856 sed='$sed'
22857 seedfunc='$seedfunc'
22858 selectminbits='$selectminbits'
22859 selecttype='$selecttype'
22860 sendmail='$sendmail'
22861 setgrent_r_proto='$setgrent_r_proto'
22862 sethostent_r_proto='$sethostent_r_proto'
22863 setlocale_r_proto='$setlocale_r_proto'
22864 setnetent_r_proto='$setnetent_r_proto'
22865 setprotoent_r_proto='$setprotoent_r_proto'
22866 setpwent_r_proto='$setpwent_r_proto'
22867 setservent_r_proto='$setservent_r_proto'
22868 sh='$sh'
22869 shar='$shar'
22870 sharpbang='$sharpbang'
22871 shmattype='$shmattype'
22872 shortsize='$shortsize'
22873 shrpenv='$shrpenv'
22874 shsharp='$shsharp'
22875 sig_count='$sig_count'
22876 sig_name='$sig_name'
22877 sig_name_init='$sig_name_init'
22878 sig_num='$sig_num'
22879 sig_num_init='$sig_num_init'
22880 sig_size='$sig_size'
22881 signal_t='$signal_t'
22882 sitearch='$sitearch'
22883 sitearchexp='$sitearchexp'
22884 sitebin='$sitebin'
22885 sitebinexp='$sitebinexp'
22886 sitehtml1dir='$sitehtml1dir'
22887 sitehtml1direxp='$sitehtml1direxp'
22888 sitehtml3dir='$sitehtml3dir'
22889 sitehtml3direxp='$sitehtml3direxp'
22890 sitelib='$sitelib'
22891 sitelib_stem='$sitelib_stem'
22892 sitelibexp='$sitelibexp'
22893 siteman1dir='$siteman1dir'
22894 siteman1direxp='$siteman1direxp'
22895 siteman3dir='$siteman3dir'
22896 siteman3direxp='$siteman3direxp'
22897 siteprefix='$siteprefix'
22898 siteprefixexp='$siteprefixexp'
22899 sitescript='$sitescript'
22900 sitescriptexp='$sitescriptexp'
22901 sizesize='$sizesize'
22902 sizetype='$sizetype'
22903 sleep='$sleep'
22904 smail='$smail'
22905 so='$so'
22906 sockethdr='$sockethdr'
22907 socketlib='$socketlib'
22908 socksizetype='$socksizetype'
22909 sort='$sort'
22910 spackage='$spackage'
22911 spitshell='$spitshell'
22912 srand48_r_proto='$srand48_r_proto'
22913 srandom_r_proto='$srandom_r_proto'
22914 src='$src'
22915 ssizetype='$ssizetype'
22916 startperl='$startperl'
22917 startsh='$startsh'
22918 static_ext='$static_ext'
22919 stdchar='$stdchar'
22920 stdio_base='$stdio_base'
22921 stdio_bufsiz='$stdio_bufsiz'
22922 stdio_cnt='$stdio_cnt'
22923 stdio_filbuf='$stdio_filbuf'
22924 stdio_ptr='$stdio_ptr'
22925 stdio_stream_array='$stdio_stream_array'
22926 strerror_r_proto='$strerror_r_proto'
22927 strings='$strings'
22928 submit='$submit'
22929 subversion='$subversion'
22930 sysman='$sysman'
22931 tail='$tail'
22932 tar='$tar'
22933 targetarch='$targetarch'
22934 tbl='$tbl'
22935 tee='$tee'
22936 test='$test'
22937 timeincl='$timeincl'
22938 timetype='$timetype'
22939 tmpnam_r_proto='$tmpnam_r_proto'
22940 to='$to'
22941 touch='$touch'
22942 tr='$tr'
22943 trnl='$trnl'
22944 troff='$troff'
22945 ttyname_r_proto='$ttyname_r_proto'
22946 u16size='$u16size'
22947 u16type='$u16type'
22948 u32size='$u32size'
22949 u32type='$u32type'
22950 u64size='$u64size'
22951 u64type='$u64type'
22952 u8size='$u8size'
22953 u8type='$u8type'
22954 uidformat='$uidformat'
22955 uidsign='$uidsign'
22956 uidsize='$uidsize'
22957 uidtype='$uidtype'
22958 uname='$uname'
22959 uniq='$uniq'
22960 uquadtype='$uquadtype'
22961 use5005threads='$use5005threads'
22962 use64bitall='$use64bitall'
22963 use64bitint='$use64bitint'
22964 usecrosscompile='$usecrosscompile'
22965 usedl='$usedl'
22966 usedtrace='$usedtrace'
22967 usefaststdio='$usefaststdio'
22968 useithreads='$useithreads'
22969 uselargefiles='$uselargefiles'
22970 uselongdouble='$uselongdouble'
22971 usemallocwrap='$usemallocwrap'
22972 usemorebits='$usemorebits'
22973 usemultiplicity='$usemultiplicity'
22974 usemymalloc='$usemymalloc'
22975 usenm='$usenm'
22976 useopcode='$useopcode'
22977 useperlio='$useperlio'
22978 useposix='$useposix'
22979 usereentrant='$usereentrant'
22980 userelocatableinc='$userelocatableinc'
22981 usesfio='$usesfio'
22982 useshrplib='$useshrplib'
22983 usesitecustomize='$usesitecustomize'
22984 usesocks='$usesocks'
22985 usethreads='$usethreads'
22986 usevendorprefix='$usevendorprefix'
22987 usevfork='$usevfork'
22988 usrinc='$usrinc'
22989 uuname='$uuname'
22990 uvXUformat='$uvXUformat'
22991 uvoformat='$uvoformat'
22992 uvsize='$uvsize'
22993 uvtype='$uvtype'
22994 uvuformat='$uvuformat'
22995 uvxformat='$uvxformat'
22996 vendorarch='$vendorarch'
22997 vendorarchexp='$vendorarchexp'
22998 vendorbin='$vendorbin'
22999 vendorbinexp='$vendorbinexp'
23000 vendorhtml1dir='$vendorhtml1dir'
23001 vendorhtml1direxp='$vendorhtml1direxp'
23002 vendorhtml3dir='$vendorhtml3dir'
23003 vendorhtml3direxp='$vendorhtml3direxp'
23004 vendorlib='$vendorlib'
23005 vendorlib_stem='$vendorlib_stem'
23006 vendorlibexp='$vendorlibexp'
23007 vendorman1dir='$vendorman1dir'
23008 vendorman1direxp='$vendorman1direxp'
23009 vendorman3dir='$vendorman3dir'
23010 vendorman3direxp='$vendorman3direxp'
23011 vendorprefix='$vendorprefix'
23012 vendorprefixexp='$vendorprefixexp'
23013 vendorscript='$vendorscript'
23014 vendorscriptexp='$vendorscriptexp'
23015 version='$version'
23016 version_patchlevel_string='$version_patchlevel_string'
23017 versiononly='$versiononly'
23018 vi='$vi'
23019 voidflags='$voidflags'
23020 xlibpth='$xlibpth'
23021 yacc='$yacc'
23022 yaccflags='$yaccflags'
23023 zcat='$zcat'
23024 zip='$zip'
23025 EOT
23026
23027 : Add in command line options if available
23028 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23029
23030 : add special variables
23031 $test -f $src/patchlevel.h && \
23032 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23033 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23034 echo "PERL_CONFIG_SH=true" >>config.sh
23035
23036 : propagate old symbols
23037 if $test -f UU/config.sh; then
23038         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23039         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23040                 config.sh config.sh UU/oldconfig.sh |\
23041                 $sort | $uniq -u >UU/oldsyms
23042         set X `cat UU/oldsyms`
23043         shift
23044         case $# in
23045         0) ;;
23046         *)
23047                 cat <<EOM
23048 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23049 EOM
23050                 echo ": Variables propagated from previous config.sh file." >>config.sh
23051                 for sym in `cat UU/oldsyms`; do
23052                         echo "    Propagating $hint variable "'$'"$sym..."
23053                         eval 'tmp="$'"${sym}"'"'
23054                         echo "$tmp" | \
23055                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23056                 done
23057                 ;;
23058         esac
23059 fi
23060
23061 : Finish up by extracting the .SH files
23062 case "$alldone" in
23063 exit)
23064         $rm -rf UU
23065         echo "Extraction done."
23066         exit 0
23067         ;;
23068 cont)
23069         ;;
23070 '')
23071         dflt=''
23072         nostick=true
23073         $cat <<EOM
23074
23075 If you'd like to make any changes to the config.sh file before I begin
23076 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23077
23078 EOM
23079         rp="Press return or use a shell escape to edit config.sh:"
23080         . UU/myread
23081         nostick=''
23082         case "$ans" in
23083         '') ;;
23084         *) : in case they cannot read
23085                 sh 1>&4 -c "$ans";;
23086         esac
23087         ;;
23088 esac
23089
23090 : if this fails, just run all the .SH files by hand
23091 . ./config.sh
23092
23093 echo " "
23094 exec 1>&4
23095 pwd=`pwd`
23096 . ./UU/extract
23097 cd "$pwd"
23098
23099 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23100         dflt=y
23101         case "$silent" in
23102         true) ;;
23103         *)
23104                 $cat <<EOM
23105
23106 Now you need to generate make dependencies by running "$make depend".
23107 You might prefer to run it in background: "$make depend > makedepend.out &"
23108 It can take a while, so you might not want to run it right now.
23109
23110 EOM
23111                 ;;
23112         esac
23113         rp="Run $make depend now?"
23114         . UU/myread
23115         case "$ans" in
23116         y*)
23117                 $make depend && echo "Now you must run '$make'."
23118                 ;;
23119         *)
23120                 echo "You must run '$make depend' then '$make'."
23121                 ;;
23122         esac
23123 elif test -f [Mm]akefile; then
23124         echo " "
23125         echo "Now you must run a $make."
23126 else
23127         echo "Configure done."
23128 fi
23129
23130 if $test -f Policy.sh; then
23131     $cat <<EOM
23132
23133 If you compile $package on a different machine or from a different object
23134 directory, copy the Policy.sh file from this object directory to the
23135 new one before you run Configure -- this will help you with most of
23136 the policy defaults.
23137
23138 EOM
23139 fi
23140 if $test -f config.msg; then
23141     echo "Hmm.  I also noted the following information while running:"
23142     echo " "
23143     $cat config.msg >&4
23144     $rm -f config.msg
23145 fi
23146 $rm -f kit*isdone ark*isdone
23147 $rm -rf UU
23148
23149 : End of Configure
23150