WIN32 preprocessor symbols is usually tested with #ifdef, not #if
[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 Wed May  6 14:01:08 CEST 2009 [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 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_deprecated=''
365 d_attribute_format=''
366 d_attribute_malloc=''
367 d_attribute_nonnull=''
368 d_attribute_noreturn=''
369 d_attribute_pure=''
370 d_attribute_unused=''
371 d_attribute_warn_unused_result=''
372 d_printf_format_null=''
373 d_bcmp=''
374 d_bcopy=''
375 d_builtin_choose_expr=''
376 d_builtin_expect=''
377 d_bzero=''
378 d_c99_variadic_macros=''
379 d_casti32=''
380 castflags=''
381 d_castneg=''
382 d_chown=''
383 d_chroot=''
384 d_chsize=''
385 d_class=''
386 d_clearenv=''
387 d_closedir=''
388 d_void_closedir=''
389 d_cmsghdr_s=''
390 d_const=''
391 d_copysignl=''
392 d_cplusplus=''
393 cryptlib=''
394 d_crypt=''
395 crypt_r_proto=''
396 d_crypt_r=''
397 d_csh=''
398 full_csh=''
399 d_ctermid=''
400 ctermid_r_proto=''
401 d_ctermid_r=''
402 ctime_r_proto=''
403 d_ctime_r=''
404 d_cuserid=''
405 d_dbl_dig=''
406 d_dbminitproto=''
407 d_difftime=''
408 d_dir_dd_fd=''
409 d_dirfd=''
410 d_dlerror=''
411 d_dlopen=''
412 d_dlsymun=''
413 d_dosuid=''
414 d_suidsafe=''
415 d_drand48_r=''
416 drand48_r_proto=''
417 d_drand48proto=''
418 d_dup2=''
419 d_eaccess=''
420 d_endgrent=''
421 d_endgrent_r=''
422 endgrent_r_proto=''
423 d_endhent=''
424 d_endhostent_r=''
425 endhostent_r_proto=''
426 d_endnent=''
427 d_endnetent_r=''
428 endnetent_r_proto=''
429 d_endpent=''
430 d_endprotoent_r=''
431 endprotoent_r_proto=''
432 d_endpwent=''
433 d_endpwent_r=''
434 endpwent_r_proto=''
435 d_endsent=''
436 d_endservent_r=''
437 endservent_r_proto=''
438 d_faststdio=''
439 d_fchdir=''
440 d_fchmod=''
441 d_fchown=''
442 d_fcntl=''
443 d_fcntl_can_lock=''
444 d_fd_macros=''
445 d_fd_set=''
446 d_fds_bits=''
447 d_fgetpos=''
448 d_finite=''
449 d_finitel=''
450 d_flexfnam=''
451 d_flock=''
452 d_flockproto=''
453 d_fork=''
454 d_fp_class=''
455 d_fpclass=''
456 d_fpclassify=''
457 d_fpclassl=''
458 d_fpos64_t=''
459 d_frexpl=''
460 d_fs_data_s=''
461 d_fseeko=''
462 d_fsetpos=''
463 d_fstatfs=''
464 d_fsync=''
465 d_ftello=''
466 d_ftime=''
467 d_gettimeod=''
468 d_futimes=''
469 d_Gconvert=''
470 d_getaddrinfo=''
471 d_getcwd=''
472 d_getespwnam=''
473 d_getfsstat=''
474 d_getgrent=''
475 d_getgrent_r=''
476 getgrent_r_proto=''
477 d_getgrgid_r=''
478 getgrgid_r_proto=''
479 d_getgrnam_r=''
480 getgrnam_r_proto=''
481 d_getgrps=''
482 d_gethbyaddr=''
483 d_gethbyname=''
484 d_gethent=''
485 aphostname=''
486 d_gethname=''
487 d_phostname=''
488 d_uname=''
489 d_gethostbyaddr_r=''
490 gethostbyaddr_r_proto=''
491 d_gethostbyname_r=''
492 gethostbyname_r_proto=''
493 d_gethostent_r=''
494 gethostent_r_proto=''
495 d_gethostprotos=''
496 d_getitimer=''
497 d_getlogin=''
498 d_getlogin_r=''
499 getlogin_r_proto=''
500 d_getmnt=''
501 d_getmntent=''
502 d_getnameinfo=''
503 d_getnbyaddr=''
504 d_getnbyname=''
505 d_getnent=''
506 d_getnetbyaddr_r=''
507 getnetbyaddr_r_proto=''
508 d_getnetbyname_r=''
509 getnetbyname_r_proto=''
510 d_getnetent_r=''
511 getnetent_r_proto=''
512 d_getnetprotos=''
513 d_getpagsz=''
514 d_getpent=''
515 d_getpgid=''
516 d_getpgrp2=''
517 d_bsdgetpgrp=''
518 d_getpgrp=''
519 d_getppid=''
520 d_getprior=''
521 d_getpbyname=''
522 d_getpbynumber=''
523 d_getprotobyname_r=''
524 getprotobyname_r_proto=''
525 d_getprotobynumber_r=''
526 getprotobynumber_r_proto=''
527 d_getprotoent_r=''
528 getprotoent_r_proto=''
529 d_getprotoprotos=''
530 d_getprpwnam=''
531 d_getpwent=''
532 d_getpwent_r=''
533 getpwent_r_proto=''
534 d_getpwnam_r=''
535 getpwnam_r_proto=''
536 d_getpwuid_r=''
537 getpwuid_r_proto=''
538 d_getsent=''
539 d_getservbyname_r=''
540 getservbyname_r_proto=''
541 d_getservbyport_r=''
542 getservbyport_r_proto=''
543 d_getservent_r=''
544 getservent_r_proto=''
545 d_getservprotos=''
546 d_getspnam=''
547 d_getspnam_r=''
548 getspnam_r_proto=''
549 d_getsbyname=''
550 d_getsbyport=''
551 d_gmtime_r=''
552 gmtime_r_proto=''
553 d_gnulibc=''
554 gnulibc_version=''
555 d_hasmntopt=''
556 d_htonl=''
557 d_ilogbl=''
558 d_inetaton=''
559 d_inetntop=''
560 d_inetpton=''
561 d_int64_t=''
562 d_isascii=''
563 d_isfinite=''
564 d_isinf=''
565 d_isnan=''
566 d_isnanl=''
567 d_killpg=''
568 d_lchown=''
569 d_ldbl_dig=''
570 d_libm_lib_version=''
571 d_link=''
572 d_localtime_r=''
573 d_localtime_r_needs_tzset=''
574 localtime_r_proto=''
575 d_locconv=''
576 d_lockf=''
577 d_longdbl=''
578 longdblsize=''
579 d_longlong=''
580 longlongsize=''
581 d_lseekproto=''
582 d_lstat=''
583 d_madvise=''
584 d_malloc_good_size=''
585 d_malloc_size=''
586 d_mblen=''
587 d_mbstowcs=''
588 d_mbtowc=''
589 d_memchr=''
590 d_memcmp=''
591 d_memcpy=''
592 d_memmove=''
593 d_memset=''
594 d_mkdir=''
595 d_mkdtemp=''
596 d_mkfifo=''
597 d_mkstemp=''
598 d_mkstemps=''
599 d_mktime=''
600 d_mmap=''
601 mmaptype=''
602 d_modfl=''
603 d_modfl_pow32_bug=''
604 d_modflproto=''
605 d_mprotect=''
606 d_msg=''
607 d_msgctl=''
608 d_msgget=''
609 d_msghdr_s=''
610 d_msgrcv=''
611 d_msgsnd=''
612 d_msync=''
613 d_munmap=''
614 d_nice=''
615 d_nl_langinfo=''
616 d_off64_t=''
617 d_open3=''
618 d_fpathconf=''
619 d_pathconf=''
620 d_pause=''
621 d_pipe=''
622 d_poll=''
623 d_portable=''
624 d_procselfexe=''
625 procselfexe=''
626 d_old_pthread_create_joinable=''
627 old_pthread_create_joinable=''
628 d_pthread_atfork=''
629 d_pthread_attr_setscope=''
630 d_pthread_yield=''
631 d_sched_yield=''
632 sched_yield=''
633 d_qgcvt=''
634 d_random_r=''
635 random_r_proto=''
636 d_readdir64_r=''
637 readdir64_r_proto=''
638 d_readdir=''
639 d_rewinddir=''
640 d_seekdir=''
641 d_telldir=''
642 d_readdir_r=''
643 readdir_r_proto=''
644 d_readlink=''
645 d_readv=''
646 d_recvmsg=''
647 d_rename=''
648 d_rmdir=''
649 d_safebcpy=''
650 d_safemcpy=''
651 d_sanemcmp=''
652 d_sbrkproto=''
653 d_scalbnl=''
654 d_select=''
655 d_sem=''
656 d_semctl=''
657 d_semget=''
658 d_semop=''
659 d_sendmsg=''
660 d_setegid=''
661 d_seteuid=''
662 d_setgrent=''
663 d_setgrent_r=''
664 setgrent_r_proto=''
665 d_setgrps=''
666 d_sethent=''
667 d_sethostent_r=''
668 sethostent_r_proto=''
669 d_setitimer=''
670 d_setlinebuf=''
671 d_setlocale=''
672 d_setlocale_r=''
673 setlocale_r_proto=''
674 d_setnent=''
675 d_setnetent_r=''
676 setnetent_r_proto=''
677 d_setpent=''
678 d_setpgid=''
679 d_setpgrp2=''
680 d_bsdsetpgrp=''
681 d_setpgrp=''
682 d_setprior=''
683 d_setproctitle=''
684 d_setprotoent_r=''
685 setprotoent_r_proto=''
686 d_setpwent=''
687 d_setpwent_r=''
688 setpwent_r_proto=''
689 d_setregid=''
690 d_setresgid=''
691 d_setresuid=''
692 d_setreuid=''
693 d_setrgid=''
694 d_setruid=''
695 d_setsent=''
696 d_setservent_r=''
697 setservent_r_proto=''
698 d_setsid=''
699 d_setvbuf=''
700 d_sfio=''
701 usesfio=''
702 d_shm=''
703 d_shmat=''
704 d_shmatprototype=''
705 shmattype=''
706 d_shmctl=''
707 d_shmdt=''
708 d_shmget=''
709 d_sigaction=''
710 d_signbit=''
711 d_sigprocmask=''
712 d_sigsetjmp=''
713 usesitecustomize=''
714 d_snprintf=''
715 d_vsnprintf=''
716 d_sockatmark=''
717 d_sockatmarkproto=''
718 d_msg_ctrunc=''
719 d_msg_dontroute=''
720 d_msg_oob=''
721 d_msg_peek=''
722 d_msg_proxy=''
723 d_oldsock=''
724 d_scm_rights=''
725 d_socket=''
726 d_sockpair=''
727 sockethdr=''
728 socketlib=''
729 d_socklen_t=''
730 d_socks5_init=''
731 d_sprintf_returns_strlen=''
732 d_sqrtl=''
733 d_srand48_r=''
734 srand48_r_proto=''
735 d_srandom_r=''
736 srandom_r_proto=''
737 d_sresgproto=''
738 d_sresuproto=''
739 d_statblks=''
740 d_statfs_f_flags=''
741 d_statfs_s=''
742 d_fstatvfs=''
743 d_statvfs=''
744 d_stdio_cnt_lval=''
745 d_stdio_ptr_lval=''
746 d_stdio_ptr_lval_nochange_cnt=''
747 d_stdio_ptr_lval_sets_cnt=''
748 d_stdiobase=''
749 d_stdstdio=''
750 stdio_base=''
751 stdio_bufsiz=''
752 stdio_cnt=''
753 stdio_filbuf=''
754 stdio_ptr=''
755 d_index=''
756 d_strchr=''
757 d_strcoll=''
758 d_strctcpy=''
759 d_strerrm=''
760 d_strerror=''
761 d_sysernlst=''
762 d_syserrlst=''
763 d_strerror_r=''
764 strerror_r_proto=''
765 d_strftime=''
766 d_strlcat=''
767 d_strlcpy=''
768 d_strtod=''
769 d_strtol=''
770 d_strtold=''
771 d_strtoll=''
772 d_strtoq=''
773 d_strtoul=''
774 d_strtoull=''
775 d_strtouq=''
776 d_strxfrm=''
777 d_symlink=''
778 d_syscall=''
779 d_syscallproto=''
780 d_sysconf=''
781 d_system=''
782 d_tcgetpgrp=''
783 d_tcsetpgrp=''
784 d_telldirproto=''
785 d_time=''
786 timetype=''
787 d_asctime64=''
788 d_ctime64=''
789 d_difftime64=''
790 d_gmtime64=''
791 d_localtime64=''
792 d_mktime64=''
793 d_timegm=''
794 clocktype=''
795 d_times=''
796 d_tmpnam_r=''
797 tmpnam_r_proto=''
798 d_truncate=''
799 d_ttyname_r=''
800 ttyname_r_proto=''
801 d_tzname=''
802 d_u32align=''
803 d_ualarm=''
804 d_umask=''
805 d_semctl_semid_ds=''
806 d_semctl_semun=''
807 d_union_semun=''
808 d_unordered=''
809 d_unsetenv=''
810 d_usleep=''
811 d_usleepproto=''
812 d_ustat=''
813 d_pseudofork=''
814 d_vfork=''
815 usevfork=''
816 d_voidsig=''
817 signal_t=''
818 d_volatile=''
819 d_charvspr=''
820 d_vprintf=''
821 d_wait4=''
822 d_waitpid=''
823 d_wcstombs=''
824 d_wctomb=''
825 d_writev=''
826 dlext=''
827 cccdlflags=''
828 ccdlflags=''
829 dlsrc=''
830 ld=''
831 lddlflags=''
832 usedl=''
833 doublesize=''
834 ebcdic=''
835 fflushNULL=''
836 fflushall=''
837 fpossize=''
838 fpostype=''
839 gccansipedantic=''
840 gccosandvers=''
841 gccversion=''
842 gidformat=''
843 gidsign=''
844 gidsize=''
845 gidtype=''
846 groupstype=''
847 h_fcntl=''
848 h_sysfile=''
849 html1dir=''
850 html1direxp=''
851 installhtml1dir=''
852 html3dir=''
853 html3direxp=''
854 installhtml3dir=''
855 i_arpainet=''
856 i_assert=''
857 i_crypt=''
858 db_hashtype=''
859 db_prefixtype=''
860 db_version_major=''
861 db_version_minor=''
862 db_version_patch=''
863 i_db=''
864 i_dbm=''
865 i_rpcsvcdbm=''
866 d_dirnamlen=''
867 direntrytype=''
868 i_dirent=''
869 i_dld=''
870 i_dlfcn=''
871 i_fcntl=''
872 i_float=''
873 i_fp=''
874 i_fp_class=''
875 i_gdbm=''
876 d_grpasswd=''
877 i_grp=''
878 i_ieeefp=''
879 i_inttypes=''
880 i_langinfo=''
881 i_libutil=''
882 i_limits=''
883 i_locale=''
884 i_machcthr=''
885 i_malloc=''
886 i_mallocmalloc=''
887 i_math=''
888 i_memory=''
889 i_mntent=''
890 d_gdbm_ndbm_h_uses_prototypes=''
891 d_gdbmndbm_h_uses_prototypes=''
892 d_ndbm=''
893 d_ndbm_h_uses_prototypes=''
894 i_gdbm_ndbm=''
895 i_gdbmndbm=''
896 i_ndbm=''
897 i_netdb=''
898 i_neterrno=''
899 i_netinettcp=''
900 i_niin=''
901 i_sysin=''
902 i_poll=''
903 i_prot=''
904 i_pthread=''
905 d_pwage=''
906 d_pwchange=''
907 d_pwclass=''
908 d_pwcomment=''
909 d_pwexpire=''
910 d_pwgecos=''
911 d_pwpasswd=''
912 d_pwquota=''
913 i_pwd=''
914 i_sfio=''
915 i_shadow=''
916 i_socks=''
917 i_stddef=''
918 i_stdlib=''
919 i_string=''
920 strings=''
921 i_sunmath=''
922 i_sysaccess=''
923 i_sysdir=''
924 i_sysfile=''
925 d_voidtty=''
926 i_bsdioctl=''
927 i_sysfilio=''
928 i_sysioctl=''
929 i_syssockio=''
930 i_syslog=''
931 i_sysmman=''
932 i_sysmode=''
933 i_sysmount=''
934 i_sysndir=''
935 i_sysparam=''
936 i_syspoll=''
937 i_sysresrc=''
938 i_syssecrt=''
939 i_sysselct=''
940 i_sysstat=''
941 i_sysstatfs=''
942 i_sysstatvfs=''
943 i_systimes=''
944 i_systypes=''
945 i_sysuio=''
946 i_sysun=''
947 i_sysutsname=''
948 i_sysvfs=''
949 i_syswait=''
950 i_sgtty=''
951 i_termio=''
952 i_termios=''
953 d_tm_tm_gmtoff=''
954 d_tm_tm_zone=''
955 i_systime=''
956 i_systimek=''
957 i_time=''
958 timeincl=''
959 i_unistd=''
960 i_ustat=''
961 i_utime=''
962 i_values=''
963 i_stdarg=''
964 i_varargs=''
965 i_varhdr=''
966 i_vfork=''
967 d_inc_version_list=''
968 inc_version_list=''
969 inc_version_list_init=''
970 installprefix=''
971 installprefixexp=''
972 installstyle=''
973 installusrbinperl=''
974 intsize=''
975 longsize=''
976 shortsize=''
977 issymlink=''
978 libc=''
979 ldlibpthname=''
980 libperl=''
981 shrpenv=''
982 useshrplib=''
983 glibpth=''
984 libpth=''
985 loclibpth=''
986 plibpth=''
987 xlibpth=''
988 ignore_versioned_solibs=''
989 libs=''
990 libsdirs=''
991 libsfiles=''
992 libsfound=''
993 libspath=''
994 lns=''
995 d_PRIEUldbl=''
996 d_PRIFUldbl=''
997 d_PRIGUldbl=''
998 d_PRIeldbl=''
999 d_PRIfldbl=''
1000 d_PRIgldbl=''
1001 d_SCNfldbl=''
1002 sPRIEUldbl=''
1003 sPRIFUldbl=''
1004 sPRIGUldbl=''
1005 sPRIeldbl=''
1006 sPRIfldbl=''
1007 sPRIgldbl=''
1008 sSCNfldbl=''
1009 lseeksize=''
1010 lseektype=''
1011 mad=''
1012 madlyh=''
1013 madlyobj=''
1014 madlysrc=''
1015 make_set_make=''
1016 d_mymalloc=''
1017 freetype=''
1018 mallocobj=''
1019 mallocsrc=''
1020 malloctype=''
1021 usemallocwrap=''
1022 usemymalloc=''
1023 installman1dir=''
1024 man1dir=''
1025 man1direxp=''
1026 man1ext=''
1027 installman3dir=''
1028 man3dir=''
1029 man3direxp=''
1030 man3ext=''
1031 modetype=''
1032 multiarch=''
1033 mydomain=''
1034 myhostname=''
1035 phostname=''
1036 c=''
1037 n=''
1038 d_eofnblk=''
1039 eagain=''
1040 o_nonblock=''
1041 rd_nodata=''
1042 need_va_copy=''
1043 netdb_hlen_type=''
1044 netdb_host_type=''
1045 netdb_name_type=''
1046 netdb_net_type=''
1047 groupcat=''
1048 hostcat=''
1049 passcat=''
1050 orderlib=''
1051 ranlib=''
1052 d_perl_otherlibdirs=''
1053 otherlibdirs=''
1054 package=''
1055 spackage=''
1056 pager=''
1057 api_revision=''
1058 api_subversion=''
1059 api_version=''
1060 api_versionstring=''
1061 patchlevel=''
1062 perl_patchlevel=''
1063 revision=''
1064 subversion=''
1065 version=''
1066 version_patchlevel_string=''
1067 perl5=''
1068 perladmin=''
1069 perlpath=''
1070 d_nv_preserves_uv=''
1071 d_nv_zero_is_allbits_zero=''
1072 i16size=''
1073 i16type=''
1074 i32size=''
1075 i32type=''
1076 i64size=''
1077 i64type=''
1078 i8size=''
1079 i8type=''
1080 ivsize=''
1081 ivtype=''
1082 nv_overflows_integers_at=''
1083 nv_preserves_uv_bits=''
1084 nvsize=''
1085 nvtype=''
1086 u16size=''
1087 u16type=''
1088 u32size=''
1089 u32type=''
1090 u64size=''
1091 u64type=''
1092 u8size=''
1093 u8type=''
1094 uvsize=''
1095 uvtype=''
1096 ivdformat=''
1097 nvEUformat=''
1098 nvFUformat=''
1099 nvGUformat=''
1100 nveformat=''
1101 nvfformat=''
1102 nvgformat=''
1103 uvXUformat=''
1104 uvoformat=''
1105 uvuformat=''
1106 uvxformat=''
1107 pidtype=''
1108 prefix=''
1109 prefixexp=''
1110 installprivlib=''
1111 privlib=''
1112 privlibexp=''
1113 prototype=''
1114 ptrsize=''
1115 d_PRIXU64=''
1116 d_PRId64=''
1117 d_PRIi64=''
1118 d_PRIo64=''
1119 d_PRIu64=''
1120 d_PRIx64=''
1121 sPRIXU64=''
1122 sPRId64=''
1123 sPRIi64=''
1124 sPRIo64=''
1125 sPRIu64=''
1126 sPRIx64=''
1127 d_quad=''
1128 quadkind=''
1129 quadtype=''
1130 uquadtype=''
1131 drand01=''
1132 randbits=''
1133 randfunc=''
1134 randseedtype=''
1135 seedfunc=''
1136 installscript=''
1137 scriptdir=''
1138 scriptdirexp=''
1139 selectminbits=''
1140 selecttype=''
1141 sh=''
1142 sig_count=''
1143 sig_name=''
1144 sig_name_init=''
1145 sig_num=''
1146 sig_num_init=''
1147 sig_size=''
1148 d_sitearch=''
1149 installsitearch=''
1150 sitearch=''
1151 sitearchexp=''
1152 installsitebin=''
1153 sitebin=''
1154 sitebinexp=''
1155 installsitehtml1dir=''
1156 sitehtml1dir=''
1157 sitehtml1direxp=''
1158 installsitehtml3dir=''
1159 sitehtml3dir=''
1160 sitehtml3direxp=''
1161 installsitelib=''
1162 sitelib=''
1163 sitelib_stem=''
1164 sitelibexp=''
1165 installsiteman1dir=''
1166 siteman1dir=''
1167 siteman1direxp=''
1168 installsiteman3dir=''
1169 siteman3dir=''
1170 siteman3direxp=''
1171 siteprefix=''
1172 siteprefixexp=''
1173 installsitescript=''
1174 sitescript=''
1175 sitescriptexp=''
1176 sizesize=''
1177 sizetype=''
1178 so=''
1179 socksizetype=''
1180 sharpbang=''
1181 shsharp=''
1182 spitshell=''
1183 src=''
1184 ssizetype=''
1185 startperl=''
1186 startsh=''
1187 stdchar=''
1188 d_stdio_stream_array=''
1189 stdio_stream_array=''
1190 sysman=''
1191 sGMTIME_max=''
1192 sGMTIME_min=''
1193 sLOCALTIME_max=''
1194 sLOCALTIME_min=''
1195 trnl=''
1196 uidformat=''
1197 uidsign=''
1198 uidsize=''
1199 uidtype=''
1200 archname64=''
1201 use64bitall=''
1202 use64bitint=''
1203 dtrace=''
1204 usedtrace=''
1205 usefaststdio=''
1206 ccflags_uselargefiles=''
1207 ldflags_uselargefiles=''
1208 libswanted_uselargefiles=''
1209 uselargefiles=''
1210 uselongdouble=''
1211 usemorebits=''
1212 usemultiplicity=''
1213 nm_opt=''
1214 nm_so_opt=''
1215 runnm=''
1216 usenm=''
1217 useperlio=''
1218 usesocks=''
1219 d_oldpthreads=''
1220 use5005threads=''
1221 useithreads=''
1222 usereentrant=''
1223 usethreads=''
1224 incpath=''
1225 mips_type=''
1226 usrinc=''
1227 d_vendorarch=''
1228 installvendorarch=''
1229 vendorarch=''
1230 vendorarchexp=''
1231 d_vendorbin=''
1232 installvendorbin=''
1233 vendorbin=''
1234 vendorbinexp=''
1235 installvendorhtml1dir=''
1236 vendorhtml1dir=''
1237 vendorhtml1direxp=''
1238 installvendorhtml3dir=''
1239 vendorhtml3dir=''
1240 vendorhtml3direxp=''
1241 d_vendorlib=''
1242 installvendorlib=''
1243 vendorlib=''
1244 vendorlib_stem=''
1245 vendorlibexp=''
1246 installvendorman1dir=''
1247 vendorman1dir=''
1248 vendorman1direxp=''
1249 installvendorman3dir=''
1250 vendorman3dir=''
1251 vendorman3direxp=''
1252 usevendorprefix=''
1253 vendorprefix=''
1254 vendorprefixexp=''
1255 d_vendorscript=''
1256 installvendorscript=''
1257 vendorscript=''
1258 vendorscriptexp=''
1259 versiononly=''
1260 defvoidused=''
1261 voidflags=''
1262 yacc=''
1263 yaccflags=''
1264 CONFIG=''
1265
1266 : Detect odd OSs
1267 define='define'
1268 undef='undef'
1269 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1270 rmlist=''
1271
1272 : We must find out about Eunice early
1273 eunicefix=':'
1274 if test -f /etc/unixtovms; then
1275         eunicefix=/etc/unixtovms
1276 fi
1277 if test -f /etc/unixtovms.exe; then
1278         eunicefix=/etc/unixtovms.exe
1279 fi
1280
1281 : Set executable suffix now -- needed before hints available
1282 if test -f "/libs/version.library"; then
1283 : Amiga OS
1284     _exe=""
1285 elif test -f "/system/gnu_library/bin/ar.pm"; then
1286 : Stratus VOS
1287     _exe=".pm"
1288 elif test -n "$DJGPP"; then
1289 : DOS DJGPP
1290     _exe=".exe"
1291 elif test -d c:/. -o -n "$is_os2" ; then
1292 : OS/2 or cygwin
1293     _exe=".exe"
1294 fi
1295
1296 groupstype=''
1297 i_whoami=''
1298 : Trailing extension.  Override this in a hint file, if needed.
1299 : Extra object files, if any, needed on this platform.
1300 archobjs=''
1301 archname=''
1302 libnames=''
1303 : change the next line if compiling for Xenix/286 on Xenix/386
1304 xlibpth='/usr/lib/386 /lib/386'
1305 : Possible local library directories to search.
1306 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1307 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1308
1309 : general looking path for locating libraries
1310 glibpth="/lib /usr/lib $xlibpth"
1311 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1312 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1313 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1314 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1315
1316 : Private path used by Configure to find libraries.  Its value
1317 : is prepended to libpth. This variable takes care of special
1318 : machines, like the mips.  Usually, it should be empty.
1319 plibpth=''
1320
1321 : default library list
1322 libswanted=''
1323 : some systems want to use only the non-versioned libso:s
1324 ignore_versioned_solibs=''
1325 : set usethreads on the Configure command line to enable threads.
1326 usereentrant='undef'
1327 : full support for void wanted by default
1328 defvoidused=15
1329
1330 : Possible local include directories to search.
1331 : Set locincpth to "" in a hint file to defeat local include searches.
1332 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1333 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1334 :
1335 : no include file wanted by default
1336 inclwanted=''
1337
1338 : Enable -DEBUGGING and -DDEBUGGING from the command line
1339 EBUGGING=''
1340 DEBUGGING=old
1341
1342 ccname=''
1343 ccversion=''
1344 perllibs=''
1345 : set useposix=false in your hint file to disable the POSIX extension.
1346 useposix=true
1347 : set useopcode=false in your hint file to disable the Opcode extension.
1348 useopcode=true
1349 archname64=''
1350 ccflags_uselargefiles=''
1351 ldflags_uselargefiles=''
1352 libswanted_uselargefiles=''
1353 : set usemultiplicity on the Configure command line to enable multiplicity.
1354 : set usesocks on the Configure command line to enable socks.
1355 : List of libraries we want.
1356 : If anyone needs extra -lxxx, put those in a hint file.
1357 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1358 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1359 : We probably want to search /usr/shlib before most other libraries.
1360 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1361 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1362 glibpth="/usr/shlib $glibpth"
1363 : Do not use vfork unless overridden by a hint file.
1364 usevfork=false
1365
1366 : Find the basic shell for Bourne shell scripts
1367 case "$sh" in
1368 '')
1369         case "$SYSTYPE" in
1370         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1371         *) xxx='/bin/sh';;
1372         esac
1373         if test -f "$xxx"; then
1374                 sh="$xxx"
1375         else
1376                 : Build up a list and do a single loop so we can 'break' out.
1377                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1378                 for xxx in sh bash ksh pdksh ash; do
1379                         for p in $pth; do
1380                                 try="$try ${p}/${xxx}"
1381                         done
1382                 done
1383                 for xxx in $try; do
1384                         if test -f "$xxx"; then
1385                                 sh="$xxx";
1386                                 break
1387                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1388                                 sh="$xxx";
1389                                 break
1390                         elif test -f "$xxx.exe"; then
1391                                 sh="$xxx";
1392                                 break
1393                         fi
1394                 done
1395         fi
1396         ;;
1397 esac
1398
1399 case "$sh" in
1400 '')     cat >&2 <<EOM
1401 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1402
1403 Usually it's in /bin/sh.  How did you even get this far?
1404 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1405 we'll try to straighten this all out.
1406 EOM
1407         exit 1
1408         ;;
1409 esac
1410
1411 : see if sh knows # comments
1412 if `$sh -c '#' >/dev/null 2>&1`; then
1413         shsharp=true
1414         spitshell=cat
1415         xcat=/bin/cat
1416         test -f $xcat$_exe || xcat=/usr/bin/cat
1417         if test ! -f $xcat$_exe; then
1418                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1419                         if test -f $p/cat$_exe; then
1420                                 xcat=$p/cat
1421                                 break
1422                         fi
1423                 done
1424                 if test ! -f $xcat$_exe; then
1425                         echo "Can't find cat anywhere!"
1426                         exit 1
1427                 fi
1428         fi
1429         echo "#!$xcat" >sharp
1430         $eunicefix sharp
1431         chmod +x sharp
1432         ./sharp > today 2>/dev/null
1433         if test -s today; then
1434                 sharpbang='#!'
1435         else
1436                 echo "#! $xcat" > sharp
1437                 $eunicefix sharp
1438                 chmod +x sharp
1439                 ./sharp > today 2>/dev/null
1440                 if test -s today; then
1441                         sharpbang='#! '
1442                 else
1443                         sharpbang=': use '
1444                 fi
1445         fi
1446 else
1447         echo " "
1448         echo "Your $sh doesn't grok # comments--I will strip them later on."
1449         shsharp=false
1450         cd ..
1451         echo "exec grep -v '^[  ]*#'" >spitshell
1452         chmod +x spitshell
1453         $eunicefix spitshell
1454         spitshell=`pwd`/spitshell
1455         cd UU
1456         echo "I presume that if # doesn't work, #! won't work either!"
1457         sharpbang=': use '
1458 fi
1459 rm -f sharp today
1460
1461 : figure out how to guarantee sh startup
1462 case "$startsh" in
1463 '') startsh=${sharpbang}${sh} ;;
1464 *)
1465 esac
1466 cat >sharp <<EOSS
1467 $startsh
1468 set abc
1469 test "$?abc" != 1
1470 EOSS
1471
1472 chmod +x sharp
1473 $eunicefix sharp
1474 if ./sharp; then
1475         : echo "Yup, it does."
1476 else
1477         echo "Hmm... '$startsh' does not guarantee sh startup..."
1478         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1479 fi
1480 rm -f sharp
1481
1482 : Save command line options in file UU/cmdline.opt for later use in
1483 : generating config.sh.
1484 cat > cmdline.opt <<EOSH
1485 : Configure command line arguments.
1486 config_arg0='$0'
1487 config_args='$*'
1488 config_argc=$#
1489 EOSH
1490 argn=1
1491 args_exp=''
1492 args_sep=''
1493 for arg in "$@"; do
1494         cat >>cmdline.opt <<EOSH
1495 config_arg$argn='$arg'
1496 EOSH
1497         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1498 $arg
1499 EOC
1500         arg_exp=`cat cmdl.opt`
1501         args_exp="$args_exp$args_sep'$arg_exp'"
1502         argn=`expr $argn + 1`
1503         args_sep=' '
1504 done
1505 rm -f cmdl.opt
1506
1507 : produce awk script to parse command line options
1508 cat >options.awk <<'EOF'
1509 BEGIN {
1510         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1511
1512         len = length(optstr);
1513         for (i = 1; i <= len; i++) {
1514                 c = substr(optstr, i, 1);
1515                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1516                 if (a == ":") {
1517                         arg[c] = 1;
1518                         i++;
1519                 }
1520                 opt[c] = 1;
1521         }
1522 }
1523 {
1524         expect = 0;
1525         str = $0;
1526         if (substr(str, 1, 1) != "-") {
1527                 printf("'%s'\n", str);
1528                 next;
1529         }
1530         len = length($0);
1531         for (i = 2; i <= len; i++) {
1532                 c = substr(str, i, 1);
1533                 if (!opt[c]) {
1534                         printf("-%s\n", substr(str, i));
1535                         next;
1536                 }
1537                 printf("-%s\n", c);
1538                 if (arg[c]) {
1539                         if (i < len)
1540                                 printf("'%s'\n", substr(str, i + 1));
1541                         else
1542                                 expect = 1;
1543                         next;
1544                 }
1545         }
1546 }
1547 END {
1548         if (expect)
1549                 print "?";
1550 }
1551 EOF
1552
1553 : process the command line options
1554 set X `for arg in "$@"; do echo "X$arg"; done |
1555         sed -e s/X// | awk -f options.awk`
1556 eval "set $*"
1557 shift
1558 rm -f options.awk
1559
1560 : set up default values
1561 fastread=''
1562 reuseval=false
1563 config_sh=''
1564 alldone=''
1565 error=''
1566 silent=''
1567 extractsh=''
1568 override=''
1569 knowitall=''
1570 rm -f optdef.sh posthint.sh
1571 cat >optdef.sh <<EOS
1572 $startsh
1573 EOS
1574
1575
1576 : option parsing
1577 while test $# -gt 0; do
1578         case "$1" in
1579         -d) shift; fastread=yes;;
1580         -e) shift; alldone=cont;;
1581         -f)
1582                 shift
1583                 cd ..
1584                 if test -r "$1"; then
1585                         config_sh="$1"
1586                 else
1587                         echo "$me: cannot read config file $1." >&2
1588                         error=true
1589                 fi
1590                 cd UU
1591                 shift;;
1592         --help|\
1593         -h) shift; error=true;;
1594         -r) shift; reuseval=true;;
1595         -s) shift; silent=true; realsilent=true;;
1596         -E) shift; alldone=exit;;
1597         -K) shift; knowitall=true;;
1598         -O) shift; override=true;;
1599         -S) shift; silent=true; extractsh=true;;
1600         -D)
1601                 shift
1602                 case "$1" in
1603                 *=)
1604                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1605                         echo "$me: ignoring -D $1" >&2
1606                         ;;
1607                 *=*) echo "$1" | \
1608                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1609                 *) echo "$1='define'" >> optdef.sh;;
1610                 esac
1611                 shift
1612                 ;;
1613         -U)
1614                 shift
1615                 case "$1" in
1616                 *=) echo "$1" >> optdef.sh;;
1617                 *=*)
1618                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1619                         echo "$me: ignoring -U $1" >&2
1620                         ;;
1621                 *) echo "$1='undef'" >> optdef.sh;;
1622                 esac
1623                 shift
1624                 ;;
1625         -A)
1626             shift
1627             xxx=''
1628             yyy="$1"
1629             zzz=''
1630             uuu=undef
1631             case "$yyy" in
1632             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1633                  case "$zzz" in
1634                  *:*) zzz='' ;;
1635                  *)   xxx=append
1636                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1637                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1638                  esac
1639                  ;;
1640             esac
1641             case "$xxx" in
1642             '')  case "$yyy" in
1643                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1644                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1645                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1648                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1649                  esac
1650                  ;;
1651             esac
1652             case "$xxx" in
1653             append)
1654                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1655             clear)
1656                 echo "$yyy=''"                  >> posthint.sh ;;
1657             define)
1658                 case "$zzz" in
1659                 '') zzz=define ;;
1660                 esac
1661                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1662             eval)
1663                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1664             prepend)
1665                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1666             undef)
1667                 case "$zzz" in
1668                 '') zzz="$uuu" ;;
1669                 esac
1670                 echo "$yyy=$zzz"                >> posthint.sh ;;
1671             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1672             esac
1673             shift
1674             ;;
1675         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1676             exit 0;;
1677         --) break;;
1678         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1679         *) break;;
1680         esac
1681 done
1682
1683 case "$error" in
1684 true)
1685         cat >&2 <<EOM
1686 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1687                  [-U symbol] [-U symbol=] [-A command:symbol...]
1688   -d : use defaults for all answers.
1689   -e : go on without questioning past the production of config.sh.
1690   -f : specify an alternate default configuration file.
1691   -h : print this help message and exit (with an error status).
1692   -r : reuse C symbols value if possible (skips costly nm extraction).
1693   -s : silent mode, only echoes questions and essential information.
1694   -D : define symbol to have some value:
1695          -D symbol         symbol gets the value 'define'
1696          -D symbol=value   symbol gets the value 'value'
1697        common used examples (see INSTALL for more info):
1698          -Duse64bitint            use 64bit integers
1699          -Duse64bitall            use 64bit integers and pointers
1700          -Dusethreads             use thread support
1701          -Dinc_version_list=none  do not include older perl trees in @INC
1702          -DEBUGGING=none          DEBUGGING options
1703          -Dcc=gcc                 choose your compiler
1704          -Dprefix=/opt/perl5      choose your destination
1705   -E : stop at the end of questions, after having produced config.sh.
1706   -K : do not use unless you know what you are doing.
1707   -O : let -D and -U override definitions from loaded configuration file.
1708   -S : perform variable substitutions on all .SH files (can mix with -f)
1709   -U : undefine symbol:
1710          -U symbol    symbol gets the value 'undef'
1711          -U symbol=   symbol gets completely empty
1712        e.g.:  -Uversiononly
1713   -A : manipulate symbol after the platform specific hints have been applied:
1714          -A append:symbol=value   append value to symbol
1715          -A symbol=value          like append:, but with a separating space
1716          -A define:symbol=value   define symbol to have value
1717          -A clear:symbol          define symbol to be ''
1718          -A define:symbol         define symbol to be 'define'
1719          -A eval:symbol=value     define symbol to be eval of value
1720          -A prepend:symbol=value  prepend value to symbol
1721          -A undef:symbol          define symbol to be 'undef'
1722          -A undef:symbol=         define symbol to be ''
1723        e.g.:  -A prepend:libswanted='cl pthread '
1724               -A ccflags=-DSOME_MACRO
1725   -V : print version number and exit (with a zero status).
1726 EOM
1727         exit 1
1728         ;;
1729 esac
1730
1731 : Sanity checks
1732 case "$fastread$alldone" in
1733 yescont|yesexit) ;;
1734 *)
1735         case "$extractsh" in
1736         true) ;;
1737         *)
1738                 if test ! -t 0; then
1739                         echo "Say 'sh Configure', not 'sh <Configure'"
1740                         exit 1
1741                 fi
1742                 ;;
1743         esac
1744         ;;
1745 esac
1746
1747 exec 4>&1
1748 case "$silent" in
1749 true) exec 1>/dev/null;;
1750 esac
1751
1752 : run the defines and the undefines, if any, but leave the file out there...
1753 touch optdef.sh
1754 . ./optdef.sh
1755 : create the posthint manipulation script and leave the file out there...
1756 touch posthint.sh
1757
1758 : set package name
1759 package='perl5'
1760 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1761 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1762 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1763 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1764 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1765 esac
1766
1767 : Some greps do not return status, grrr.
1768 echo "grimblepritz" >grimble
1769 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1770         contains=contains
1771 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1772         contains=grep
1773 else
1774         contains=contains
1775 fi
1776 rm -f grimble
1777 : the following should work in any shell
1778 case "$contains" in
1779 contains*)
1780         echo " "
1781         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1782         cat >contains <<'EOSS'
1783 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1784 EOSS
1785 chmod +x contains
1786 esac
1787
1788 : Find the path to the source tree
1789 case "$src" in
1790 '') case "$0" in
1791     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1792          case "$src" in
1793          /*)    ;;
1794          .)     ;;
1795          *)     src=`cd ../$src && pwd` ;;
1796          esac
1797          ;;
1798     *)   src='.';;
1799     esac;;
1800 esac
1801 case "$src" in
1802 '')     src=/
1803         rsrc=/
1804         ;;
1805 /*)     rsrc="$src";;
1806 *)      rsrc="../$src";;
1807 esac
1808 if test -f $rsrc/Configure && \
1809         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1810 then
1811    : found it, so we are ok.
1812 else
1813         rsrc=''
1814         for src in . .. ../.. ../../.. ../../../..; do
1815                 if test -f ../$src/Configure && \
1816                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1817                 then
1818                         rsrc=../$src
1819                         break
1820                 fi
1821         done
1822 fi
1823 case "$rsrc" in
1824 '')
1825         cat <<EOM >&4
1826
1827 Sorry, I can't seem to locate the source dir for $package.  Please start
1828 Configure with an explicit path -- i.e. /some/path/Configure.
1829
1830 EOM
1831         exit 1
1832         ;;
1833 ../.)   rsrc='..';;
1834 *)
1835         echo " "
1836         echo "Sources for $package found in \"$src\"." >&4
1837         ;;
1838 esac
1839
1840 : script used to extract .SH files with variable substitutions
1841 cat >extract <<'EOS'
1842 PERL_CONFIG_SH=true
1843 echo "Doing variable substitutions on .SH files..."
1844 if test -f MANIFEST; then
1845         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1846 else
1847         echo "(Looking for .SH files under the source directory.)"
1848         set x `(cd "$src"; find . -name "*.SH" -print)`
1849 fi
1850 shift
1851 case $# in
1852 0) set x `(cd "$src"; echo *.SH)`; shift;;
1853 esac
1854 if test ! -f "$src/$1"; then
1855         shift
1856 fi
1857 mkdir_p='
1858 name=$1;
1859 create="";
1860 while test $name; do
1861         if test ! -d "$name"; then
1862                 create="$name $create";
1863                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1864                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1865         else
1866                 name="";
1867         fi;
1868 done;
1869 for file in $create; do
1870         mkdir $file;
1871 done
1872 '
1873 for file in $*; do
1874         case "$src" in
1875         ".")
1876                 case "$file" in
1877                 */*)
1878                         dir=`expr X$file : 'X\(.*\)/'`
1879                         file=`expr X$file : 'X.*/\(.*\)'`
1880                         (cd "$dir" && . ./$file)
1881                         ;;
1882                 *)
1883                         . ./$file
1884                         ;;
1885                 esac
1886                 ;;
1887         *)
1888                 case "$file" in
1889                 */*)
1890                         dir=`expr X$file : 'X\(.*\)/'`
1891                         file=`expr X$file : 'X.*/\(.*\)'`
1892                         (set x $dir; shift; eval $mkdir_p)
1893                         sh <"$src/$dir/$file"
1894                         ;;
1895                 *)
1896                         sh <"$src/$file"
1897                         ;;
1898                 esac
1899                 ;;
1900         esac
1901 done
1902 if test -f "$src/config_h.SH"; then
1903         if test ! -f config.h; then
1904         : oops, they left it out of MANIFEST, probably, so do it anyway.
1905         . "$src/config_h.SH"
1906         fi
1907 fi
1908 EOS
1909
1910 : extract files and exit if asked to do so
1911 case "$extractsh" in
1912 true)
1913         case "$realsilent" in
1914         true) ;;
1915         *) exec 1>&4;;
1916         esac
1917         case "$config_sh" in
1918         '') config_sh='config.sh';;
1919         esac
1920         echo " "
1921         echo "Fetching answers from $config_sh..."
1922         cd ..
1923         . $config_sh
1924         test "$override" && . ./optdef.sh
1925         echo " "
1926         . UU/extract
1927         rm -rf UU
1928         echo "Extraction done."
1929         exit 0
1930         ;;
1931 esac
1932
1933 : Eunice requires " " instead of "", can you believe it
1934 echo " "
1935 : Here we go...
1936 echo "Beginning of configuration questions for $package."
1937
1938 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1939
1940 : first determine how to suppress newline on echo command
1941 echo " "
1942 echo "Checking echo to see how to suppress newlines..."
1943 (echo "hi there\c" ; echo " ") >.echotmp
1944 if $contains c .echotmp >/dev/null 2>&1 ; then
1945         echo "...using -n."
1946         n='-n'
1947         c=''
1948 else
1949         cat <<'EOM'
1950 ...using \c
1951 EOM
1952         n=''
1953         c='\c'
1954 fi
1955 echo $n "The star should be here-->$c"
1956 echo '*'
1957 rm -f .echotmp
1958
1959 : Now test for existence of everything in MANIFEST
1960 echo " "
1961 if test -f "$rsrc/MANIFEST"; then
1962         echo "First let's make sure your kit is complete.  Checking..." >&4
1963         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1964                 (split -l 50 2>/dev/null || split -50)
1965         rm -f missing
1966         tmppwd=`pwd`
1967         for filelist in x??; do
1968                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1969                         >/dev/null 2>>"$tmppwd/missing")
1970         done
1971         if test -s missing; then
1972                 cat missing >&4
1973                 cat >&4 <<'EOM'
1974
1975 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1976
1977 You have the option of continuing the configuration process, despite the
1978 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1979 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1980 and contact the author (perlbug@perl.org).
1981
1982 EOM
1983                 echo $n "Continue? [n] $c" >&4
1984                 read ans
1985                 case "$ans" in
1986                 y*)
1987                         echo "Continuing..." >&4
1988                         rm -f missing
1989                         ;;
1990                 *)
1991                         echo "ABORTING..." >&4
1992                         kill $$
1993                         ;;
1994                 esac
1995         else
1996                 echo "Looks good..."
1997         fi
1998 else
1999         echo "There is no MANIFEST file.  I hope your kit is complete !"
2000 fi
2001 rm -f missing x??
2002
2003 : Find the appropriate value for a newline for tr
2004 echo " "
2005 if test -n "$DJGPP"; then
2006        trnl='\012'
2007 fi
2008 if test X"$trnl" = X; then
2009         case "`echo foo|tr '\n' x 2>/dev/null`" in
2010         foox) trnl='\n' ;;
2011         esac
2012 fi
2013 if test X"$trnl" = X; then
2014         case "`echo foo|tr '\012' x 2>/dev/null`" in
2015         foox) trnl='\012' ;;
2016         esac
2017 fi
2018 if test X"$trnl" = X; then
2019        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2020        fooxy) trnl='\n\r' ;;
2021        esac
2022 fi
2023 if test X"$trnl" = X; then
2024         cat <<EOM >&2
2025
2026 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2027
2028 EOM
2029         exit 1
2030 fi
2031
2032 : compute the number of columns on the terminal for proper question formatting
2033 case "$COLUMNS" in
2034 '') COLUMNS='80';;
2035 esac
2036
2037 : set up the echo used in my read
2038 myecho="case \"\$xxxm\" in
2039 '') echo $n \"\$rp $c\" >&4;;
2040 *) case \"\$rp\" in
2041         '') echo $n \"[\$xxxm] $c\";;
2042         *)
2043                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2044                         echo \"\$rp\" >&4
2045                         echo $n \"[\$xxxm] $c\" >&4
2046                 else
2047                         echo $n \"\$rp [\$xxxm] $c\" >&4
2048                 fi
2049                 ;;
2050         esac;;
2051 esac"
2052
2053 : now set up to do reads with possible shell escape and default assignment
2054 cat <<EOSC >myread
2055 $startsh
2056 xxxm=\$dflt
2057 $myecho
2058 ans='!'
2059 case "\$fastread" in
2060 yes) case "\$dflt" in
2061         '') ;;
2062         *) ans='';
2063                 case "\$silent-\$rp" in
2064                 true-) ;;
2065                 *) echo " " >&4;;
2066                 esac;;
2067         esac;;
2068 *) case "\$silent" in
2069         true) case "\$rp" in
2070                 '') ans='';;
2071                 esac;;
2072         esac;;
2073 esac
2074 while expr "X\$ans" : "X!" >/dev/null; do
2075         read answ
2076         set x \$xxxm
2077         shift
2078         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2079         case  "\$answ" in
2080         "!")
2081                 sh 1>&4
2082                 echo " "
2083                 $myecho
2084                 ;;
2085         !*)
2086                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2087                 shift
2088                 sh 1>&4 -c "\$*"
2089                 echo " "
2090                 $myecho
2091                 ;;
2092         "\$ans")
2093                 case "\$ans" in
2094                 \\&*)
2095                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2096                         shift
2097                         case "\$1" in
2098                         -d)
2099                                 fastread=yes
2100                                 echo "(OK, I'll run with -d after this question.)" >&4
2101                                 ;;
2102                         -*)
2103                                 echo "*** Sorry, \$1 not supported yet." >&4
2104                                 ;;
2105                         esac
2106                         $myecho
2107                         ans=!
2108                         ;;
2109                 esac;;
2110         *)
2111                 case "\$aok" in
2112                 y)
2113                         echo "*** Substitution done -- please confirm."
2114                         xxxm="\$ans"
2115                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2116                         xxxm="\$ans"
2117                         ans=!
2118                         ;;
2119                 *)
2120                         echo "*** Error -- try again."
2121                         ans=!
2122                         ;;
2123                 esac
2124                 $myecho
2125                 ;;
2126         esac
2127         case "\$ans\$xxxm\$nostick" in
2128         '')
2129                 ans=!
2130                 $myecho
2131                 ;;
2132         esac
2133 done
2134 case "\$ans" in
2135 '') ans="\$xxxm";;
2136 esac
2137 EOSC
2138
2139 : create .config dir to save info across Configure sessions
2140 test -d ../.config || mkdir ../.config
2141 cat >../.config/README <<EOF
2142 This directory created by Configure to save information that should
2143 persist across sessions for $package.
2144
2145 You may safely delete it if you wish.
2146 EOF
2147
2148 : See if we are using a devel version and want that
2149 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2150 case "$usedevel" in
2151 $define|true|[yY]*)
2152     usedevel="$define" ;;
2153 *) case "$xversion" in
2154    *[13579])
2155         cat >&4 <<EOH
2156 *** WHOA THERE!!! ***
2157
2158     This is an UNSTABLE DEVELOPMENT release.
2159     The version of this $package distribution is $xversion, that is, odd,
2160     (as opposed to even) and that signifies a development release.
2161     If you want a maintenance release, you want an even-numbered version.
2162
2163     Do ***NOT*** install this into production use.
2164     Data corruption and crashes are possible.
2165
2166     It is most seriously suggested that you do not continue any further
2167     unless you want to help in developing and debugging Perl.
2168
2169     If you *still* want to build perl, you can answer 'y' now,
2170     or pass -Dusedevel to Configure.
2171
2172 EOH
2173         rp='Do you really want to continue?'
2174         dflt='n'
2175         . ./myread
2176         case "$ans" in
2177         [yY]) echo >&4 "Okay, continuing."
2178               usedevel="$define" ;;
2179         *) echo >&4 "Okay, bye."
2180            exit 1
2181            ;;
2182         esac
2183         ;;
2184     esac
2185     usedevel="$undef"
2186     ;;
2187 esac
2188 case "$usedevel" in
2189 $define|true|[yY]*)
2190         case "$versiononly" in
2191         '') versiononly="$define" ;;
2192         esac
2193         case "$installusrbinperl" in
2194         '') installusrbinperl="$undef" ;;
2195         esac
2196         ;;
2197 esac
2198
2199 : general instructions
2200 needman=true
2201 firsttime=true
2202 user=`(logname) 2>/dev/null`
2203 case "$user" in
2204 '') user=`whoami 2>&1`;;
2205 esac
2206 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2207         firsttime=false
2208         echo " "
2209         rp='Would you like to see the instructions?'
2210         dflt=n
2211         . ./myread
2212         case "$ans" in
2213         [yY]*) ;;
2214         *) needman=false;;
2215         esac
2216 fi
2217 if $needman; then
2218         cat <<EOH
2219
2220 This installation shell script will examine your system and ask you questions
2221 to determine how the perl5 package should be installed. If you get
2222 stuck on a question, you may use a ! shell escape to start a subshell or
2223 execute a command.  Many of the questions will have default answers in square
2224 brackets; typing carriage return will give you the default.
2225
2226 On some of the questions which ask for file or directory names you are allowed
2227 to use the ~name construct to specify the login directory belonging to "name",
2228 even if you don't have a shell which knows about that.  Questions where this is
2229 allowed will be marked "(~name ok)".
2230
2231 EOH
2232         rp=''
2233         dflt='Type carriage return to continue'
2234         . ./myread
2235         cat <<'EOH'
2236
2237 The prompter used in this script allows you to use shell variables and
2238 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2239 in the default answer, as if the default line was a set of arguments given to a
2240 script shell.  This means you may also use $* to repeat the whole default line,
2241 so you do not have to re-type everything to add something to the default.
2242
2243 Everytime there is a substitution, you will have to confirm.  If there is an
2244 error (e.g. an unmatched backtick), the default answer will remain unchanged
2245 and you will be prompted again.
2246
2247 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2248 the questions and use the computed defaults (or the previous answers if there
2249 was already a config.sh file). Type 'Configure -h' for a list of options.
2250 You may also start interactively and then answer '& -d' at any prompt to turn
2251 on the non-interactive behaviour for the remainder of the execution.
2252
2253 EOH
2254         . ./myread
2255         cat <<EOH
2256
2257 Much effort has been expended to ensure that this shell script will run on any
2258 Unix system.  If despite that it blows up on yours, your best bet is to edit
2259 Configure and run it again.  If you can't run Configure for some reason,
2260 you'll have to generate a config.sh file by hand.  Whatever problems you
2261 have, let me (perlbug@perl.org) know how I blew it.
2262
2263 This installation script affects things in two ways:
2264
2265 1) it may do direct variable substitutions on some of the files included
2266    in this kit.
2267 2) it builds a config.h file for inclusion in C programs.  You may edit
2268    any of these files as the need arises after running this script.
2269
2270 If you make a mistake on a question, there is no easy way to back up to it
2271 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2272 files.  Configure will offer to let you do this before it runs the SH files.
2273
2274 EOH
2275         dflt='Type carriage return to continue'
2276         . ./myread
2277         case "$firsttime" in
2278         true) echo $user >>../.config/instruct;;
2279         esac
2280 fi
2281
2282 : find out where common programs are
2283 echo " "
2284 echo "Locating common programs..." >&4
2285 cat <<EOSC >loc
2286 $startsh
2287 case \$# in
2288 0) exit 1;;
2289 esac
2290 thing=\$1
2291 shift
2292 dflt=\$1
2293 shift
2294 for dir in \$*; do
2295         case "\$thing" in
2296         .)
2297         if test -d \$dir/\$thing; then
2298                 echo \$dir
2299                 exit 0
2300         fi
2301         ;;
2302         *)
2303         for thisthing in \$dir/\$thing; do
2304                 : just loop through to pick last item
2305         done
2306         if test -f \$thisthing; then
2307                 echo \$thisthing
2308                 exit 0
2309         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2310                 echo \$thisthing
2311                 exit 0
2312         elif test -f \$dir/\$thing.exe; then
2313                 if test -n "$DJGPP"; then
2314                         echo \$dir/\$thing.exe
2315                 elif test "$eunicefix" != ":"; then
2316                         : on Eunice apparently
2317                         echo \$dir/\$thing
2318                 fi
2319                 exit 0
2320         fi
2321         ;;
2322         esac
2323 done
2324 echo \$dflt
2325 exit 1
2326 EOSC
2327 chmod +x loc
2328 $eunicefix loc
2329 loclist="
2330 awk
2331 cat
2332 chmod
2333 comm
2334 cp
2335 echo
2336 expr
2337 grep
2338 ls
2339 mkdir
2340 rm
2341 sed
2342 sort
2343 touch
2344 tr
2345 uniq
2346 "
2347 trylist="
2348 ar
2349 bison
2350 byacc
2351 cpp
2352 csh
2353 date
2354 egrep
2355 gmake
2356 gzip
2357 less
2358 ln
2359 make
2360 more
2361 nm
2362 nroff
2363 pg
2364 test
2365 uname
2366 zip
2367 "
2368 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2369 pth="$pth /lib /usr/lib"
2370 for file in $loclist; do
2371         eval xxx=\$$file
2372         case "$xxx" in
2373         /*|?:[\\/]*)
2374                 if test -f "$xxx"; then
2375                         : ok
2376                 else
2377                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2378                         xxx=`./loc $file $file $pth`
2379                 fi
2380                 ;;
2381         '') xxx=`./loc $file $file $pth`;;
2382         *) xxx=`./loc $xxx $xxx $pth`;;
2383         esac
2384         eval $file=$xxx$_exe
2385         eval _$file=$xxx
2386         case "$xxx" in
2387         /*)
2388                 echo $file is in $xxx.
2389                 ;;
2390         ?:[\\/]*)
2391                 echo $file is in $xxx.
2392                 ;;
2393         *)
2394                 echo "I don't know where '$file' is, and my life depends on it." >&4
2395                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2396                 exit 1
2397                 ;;
2398         esac
2399 done
2400 echo " "
2401 echo "Don't worry if any of the following aren't found..."
2402 say=offhand
2403 for file in $trylist; do
2404         eval xxx=\$$file
2405         case "$xxx" in
2406         /*|?:[\\/]*)
2407                 if test -f "$xxx"; then
2408                         : ok
2409                 else
2410                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2411                         xxx=`./loc $file $file $pth`
2412                 fi
2413                 ;;
2414         '') xxx=`./loc $file $file $pth`;;
2415         *) xxx=`./loc $xxx $xxx $pth`;;
2416         esac
2417         eval $file=$xxx$_exe
2418         eval _$file=$xxx
2419         case "$xxx" in
2420         /*)
2421                 echo $file is in $xxx.
2422                 ;;
2423         ?:[\\/]*)
2424                 echo $file is in $xxx.
2425                 ;;
2426         *)
2427                 echo "I don't see $file out there, $say."
2428                 say=either
2429                 ;;
2430         esac
2431 done
2432 case "$egrep" in
2433 egrep)
2434         echo "Substituting grep for egrep."
2435         egrep=$grep
2436         _egrep=$grep
2437         ;;
2438 esac
2439 case "$ln" in
2440 ln)
2441         echo "Substituting cp for ln."
2442         ln=$cp
2443         _ln=$cp
2444         ;;
2445 esac
2446 case "$make" in
2447 make)
2448         case "$gmake" in
2449         gmake)
2450         echo "I can't find make or gmake, and my life depends on it." >&4
2451         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2452         exit 1
2453         ;;
2454         esac
2455         ;;
2456 esac
2457 case "$gmake" in
2458 gmake)  ;;
2459 *)      # We can't have osname yet.
2460         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2461                 # Assume that gmake, if found, is definitely GNU make
2462                 # and prefer it over the system make.
2463                 echo "Substituting gmake for make."
2464                 make=$gmake
2465                 _make=$gmake
2466         fi
2467         ;;
2468 esac
2469 case "$test" in
2470 test)
2471         echo "Hopefully test is built into your sh."
2472         ;;
2473 *)
2474         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2475                 echo "Using the test built into your sh."
2476                 test=test
2477                 _test=test
2478         fi
2479         ;;
2480 esac
2481 case "$echo" in
2482 echo)
2483         echo "Hopefully echo is built into your sh."
2484         ;;
2485 '') ;;
2486 *)
2487         echo " "
2488 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2489         $echo $n "hi there$c" >foo1
2490         echo $n "hi there$c" >foo2
2491         if cmp foo1 foo2 >/dev/null 2>&1; then
2492                 echo "They are compatible.  In fact, they may be identical."
2493         else
2494                 case "$n" in
2495                 '-n') n='' c='\c';;
2496                 *) n='-n' c='';;
2497                 esac
2498                 cat <<FOO
2499 They are not compatible!  You are probably running ksh on a non-USG system.
2500 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2501 have echo built in and we may have to run some Bourne shell scripts.  That
2502 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2503
2504 FOO
2505                 $echo $n "The star should be here-->$c"
2506                 $echo "*"
2507         fi
2508         $rm -f foo1 foo2
2509         ;;
2510 esac
2511
2512 # This question was auctioned at YAPC::Europe-2007 in Vienna
2513 # I never promised you could answer it. I only auctioned the question.
2514 cat <<FOO
2515 The following message is sponsored by
2516
2517   Dresden.pm<--The stars should be here.
2518
2519 Dear Perl user, system administrator or package
2520 maintainer, the Perl community sends greetings to
2521 you. Do you (emblematical) greet back [Y/n]? n
2522
2523 FOO
2524
2525 : Check what type of C compiler we use
2526 cat <<EOS >trygcc
2527 $startsh
2528 EOS
2529 cat <<'EOSC' >>trygcc
2530 case "$cc" in
2531 '') ;;
2532 *)  $rm -f try try.*
2533     $cat >try.c <<EOM
2534 int main(int argc, char *argv[]) {
2535   return 0;
2536 }
2537 EOM
2538     if $cc -o try $ccflags $ldflags try.c; then
2539        :
2540     else
2541         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2542         despair=yes
2543         trygcc=yes
2544         case "$cc" in
2545         *gcc*) trygcc=no ;;
2546         esac
2547         # Skip this test because it gives a false match on output like:
2548         #    ./trygcc: line 23: cc: command not found
2549         # case "`$cc -v -c try.c 2>&1`" in
2550         # *gcc*) trygcc=no ;;
2551         # esac
2552         if $test X"$trygcc" = Xyes; then
2553             if gcc -o try -c try.c; then
2554                 echo " "
2555                 echo "You seem to have a working gcc, though." >&4
2556                 # Switching compilers may undo the work of hints files.
2557                 # The most common problem is -D_REENTRANT for threads.
2558                 # This heuristic catches that case, but gets false positives
2559                 # if -Dusethreads was not actually specified.  Better to
2560                 # bail out here with a useful message than fail 
2561                 # mysteriously later. Should we perhaps just try to
2562                 # re-invoke Configure -Dcc=gcc config_args ?
2563                 if $test -f usethreads.cbu; then
2564                         $cat >&4 <<EOM 
2565
2566 *** However, any setting of the C compiler flags (e.g. for thread support)
2567 *** will be lost.  It may be necessary for you to restart Configure and
2568 *** add -Dcc=gcc to your Configure command line.
2569
2570 EOM
2571                         rp="Would you like to go ahead and try gcc anyway?"
2572                         dflt=n
2573                 else
2574                         rp="Would you like to use it?"
2575                         dflt=y
2576                 fi
2577                 if $test -f myread; then
2578                     . ./myread
2579                 else
2580                     if $test -f UU/myread; then
2581                         . ./UU/myread
2582                     else
2583                         echo "Cannot find myread, sorry.  Aborting." >&2
2584                         exit 1
2585                     fi
2586                 fi  
2587                 case "$ans" in
2588                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2589                 esac
2590             fi
2591         fi
2592     fi
2593     $rm -f try try.*
2594     ;;
2595 esac
2596 EOSC
2597
2598 cat <<EOS >checkcc
2599 $startsh
2600 EOS
2601 cat <<'EOSC' >>checkcc
2602 case "$cc" in        
2603 '') ;;
2604 *)  $rm -f try try.*              
2605     $cat >try.c <<EOM
2606 int main(int argc, char *argv[]) {
2607   return 0;
2608 }
2609 EOM
2610     if $cc -o try $ccflags $ldflags try.c; then
2611        :
2612     else
2613         if $test X"$despair" = Xyes; then
2614            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2615         fi
2616         $cat >&4 <<EOM         
2617 You need to find a working C compiler.
2618 Either (purchase and) install the C compiler supplied by your OS vendor,
2619 or for a free C compiler try http://gcc.gnu.org/
2620 I cannot continue any further, aborting.
2621 EOM
2622         exit 1
2623     fi
2624     $rm -f try try.*
2625     ;;
2626 esac
2627 EOSC
2628
2629 : determine whether symbolic links are supported
2630 echo " "
2631 $touch blurfl
2632 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2633         echo "Symbolic links are supported." >&4
2634         lns="$ln -s"
2635 else
2636         echo "Symbolic links are NOT supported." >&4
2637         lns="$ln"
2638 fi
2639 $rm -f blurfl sym
2640
2641 : determine whether symbolic links are supported
2642 echo " "
2643 case "$lns" in
2644 *"ln"*" -s")
2645         echo "Checking how to test for symbolic links..." >&4
2646         $lns blurfl sym
2647         if $test "X$issymlink" = X; then
2648                 case "$newsh" in
2649                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2650                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2651                 esac
2652                 if test $? = 0; then
2653                         issymlink="test -h"
2654                 else
2655                         echo "Your builtin 'test -h' may be broken." >&4
2656                         case "$test" in
2657                         /*)     ;;
2658                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2659                                 for p in $pth
2660                                 do
2661                                         if test -f "$p/$test"; then
2662                                                 test="$p/$test"
2663                                                 break
2664                                         fi
2665                                 done
2666                                 ;;
2667                         esac
2668                         case "$test" in
2669                         /*)
2670                                 echo "Trying external '$test -h'." >&4
2671                                 issymlink="$test -h"
2672                                 if $test ! -h sym >/dev/null 2>&1; then
2673                                         echo "External '$test -h' is broken, too." >&4
2674                                         issymlink=''
2675                                 fi
2676                                 ;;
2677                         *)      issymlink='' ;;
2678                         esac
2679                 fi              
2680         fi
2681         if $test "X$issymlink" = X; then
2682                 if $test -L sym 2>/dev/null; then
2683                         issymlink="$test -L"
2684                         echo "The builtin '$test -L' worked." >&4
2685                 fi
2686         fi
2687         if $test "X$issymlink" != X; then
2688                 echo "You can test for symbolic links with '$issymlink'." >&4
2689         else
2690                 echo "I do not know how you can test for symbolic links." >&4
2691         fi
2692         $rm -f blurfl sym
2693         ;;
2694 *)      echo "No symbolic links, so not testing for their testing..." >&4
2695         ;;
2696 esac
2697 echo " "
2698
2699 : Make symlinks util
2700 case "$mksymlinks" in
2701 $define|true|[yY]*)
2702         case "$src" in
2703         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2704                 exit 1
2705                 ;;
2706         *)      case "$lns:$issymlink" in
2707                 *"ln"*" -s:"*"test -"?)
2708                         echo "Creating the symbolic links..." >&4
2709                         echo "(First creating the subdirectories...)" >&4
2710                         cd ..
2711                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2712                                 read directory
2713                                 test -z "$directory" && break
2714                                 mkdir -p $directory
2715                         done
2716                         # Sanity check 1.
2717                         if test ! -d t/base; then
2718                                 echo "Failed to create the subdirectories.  Aborting." >&4
2719                                 exit 1
2720                         fi
2721                         echo "(Then creating the symlinks...)" >&4
2722                         awk '{print $1}' $src/MANIFEST | while true; do
2723                                 read filename
2724                                 test -z "$filename" && break
2725                                 if test -f $filename; then
2726                                         if $issymlink $filename; then
2727                                                 rm -f $filename
2728                                         fi
2729                                 fi
2730                                 if test -f $filename; then
2731                                         echo "$filename already exists, not symlinking."
2732                                 else
2733                                         ln -s $src/$filename $filename
2734                                 fi
2735                         done
2736                         # Sanity check 2.
2737                         if test ! -f t/base/lex.t; then
2738                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2739                                 exit 1
2740                         fi
2741                         cd UU
2742                         ;;
2743                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2744                         ;;
2745                 esac
2746                 ;;
2747         esac
2748         ;;
2749 esac
2750
2751 : Check for Cross-Compilation
2752 case "$usecrosscompile" in
2753 $define|true|[yY]*)
2754         $echo "Cross-compiling..."
2755         croak=''
2756         case "$cc" in
2757         *-*-gcc) # A cross-compiling gcc, probably.
2758             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2759             ar=$targetarch-ar
2760             # leave out ld, choosing it is more complex
2761             nm=$targetarch-nm
2762             ranlib=$targetarch-ranlib
2763             $echo 'extern int foo;' > try.c
2764             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2765             shift
2766             if $test $# -gt 0; then
2767                 incpth="$incpth $*"
2768                 incpth="`$echo $incpth|$sed 's/^ //'`"
2769                 echo "Guessing incpth '$incpth'." >&4
2770                 for i in $*; do
2771                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2772                     if $test -d $j; then
2773                         libpth="$libpth $j"
2774                     fi
2775                 done   
2776                 libpth="`$echo $libpth|$sed 's/^ //'`"
2777                 echo "Guessing libpth '$libpth'." >&4
2778             fi
2779             $rm -f try.c
2780             ;;
2781         esac
2782         case "$targetarch" in
2783         '') echo "Targetarch not defined." >&4; croak=y ;;
2784         *)  echo "Using targetarch $targetarch." >&4 ;;
2785         esac
2786         case "$incpth" in
2787         '') echo "Incpth not defined." >&4; croak=y ;;
2788         *)  echo "Using incpth '$incpth'." >&4 ;;
2789         esac
2790         case "$libpth" in
2791         '') echo "Libpth not defined." >&4; croak=y ;;
2792         *)  echo "Using libpth '$libpth'." >&4 ;;
2793         esac
2794         case "$usrinc" in
2795         '') for i in $incpth; do
2796                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2797                     usrinc=$i
2798                     echo "Guessing usrinc $usrinc." >&4
2799                     break
2800                 fi
2801             done
2802             case "$usrinc" in
2803             '') echo "Usrinc not defined." >&4; croak=y ;;
2804             esac
2805             ;;
2806         *)  echo "Using usrinc $usrinc." >&4 ;;
2807         esac
2808         case "$targethost" in
2809         '') echo "Targethost not defined." >&4; croak=y ;;
2810         *)  echo "Using targethost $targethost." >&4
2811         esac
2812         locincpth=' '
2813         loclibpth=' '
2814         case "$croak" in
2815         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2816         esac
2817         case "$src" in
2818         /*) run=$src/Cross/run
2819             targetmkdir=$src/Cross/mkdir
2820             to=$src/Cross/to
2821             from=$src/Cross/from
2822             ;;
2823         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2824             run=$pwd/Cross/run
2825             targetmkdir=$pwd/Cross/mkdir
2826             to=$pwd/Cross/to
2827             from=$pwd/Cross/from
2828             ;;
2829         esac
2830         case "$targetrun" in
2831         '') targetrun=ssh ;;
2832         esac
2833         case "$targetto" in
2834         '') targetto=scp ;;
2835         esac
2836         case "$targetfrom" in
2837         '') targetfrom=scp ;;
2838         esac
2839         run=$run-$targetrun
2840         to=$to-$targetto
2841         from=$from-$targetfrom
2842         case "$targetdir" in
2843         '')  targetdir=/tmp
2844              echo "Guessing targetdir $targetdir." >&4
2845              ;;
2846         esac
2847         case "$targetuser" in
2848         '')  targetuser=root
2849              echo "Guessing targetuser $targetuser." >&4
2850              ;;
2851         esac
2852         case "$targetfrom" in
2853         scp)    q=-q ;;
2854         *)      q='' ;;
2855         esac
2856         case "$targetrun" in
2857         ssh|rsh)
2858             cat >$run <<EOF
2859 #!/bin/sh
2860 case "\$1" in
2861 -cwd)
2862   shift
2863   cwd=\$1
2864   shift
2865   ;;
2866 esac
2867 case "\$cwd" in
2868 '') cwd=$targetdir ;;
2869 esac
2870 exe=\$1
2871 shift
2872 if $test ! -f \$exe.xok; then
2873   $to \$exe
2874   $touch \$exe.xok
2875 fi
2876 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2877 EOF
2878             ;;
2879         *)  echo "Unknown targetrun '$targetrun'" >&4
2880             exit 1
2881             ;;
2882         esac
2883         case "$targetmkdir" in
2884         */Cross/mkdir)
2885             cat >$targetmkdir <<EOF
2886 #!/bin/sh
2887 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2888 EOF
2889             $chmod a+rx $targetmkdir
2890             ;;
2891         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2892             exit 1
2893             ;;
2894         esac
2895         case "$targetto" in
2896         scp|rcp)
2897             cat >$to <<EOF
2898 #!/bin/sh
2899 for f in \$@
2900 do
2901   case "\$f" in
2902   /*)
2903     $targetmkdir \`dirname \$f\`
2904     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2905     ;;
2906   *)
2907     $targetmkdir $targetdir/\`dirname \$f\`
2908     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2909     ;;
2910   esac
2911 done
2912 exit 0
2913 EOF
2914             ;;
2915         cp) cat >$to <<EOF
2916 #!/bin/sh
2917 for f in \$@
2918 do
2919   case "\$f" in
2920   /*)
2921     $mkdir -p $targetdir/\`dirname \$f\`
2922     $cp \$f $targetdir/\$f || exit 1
2923     ;;
2924   *)
2925     $targetmkdir $targetdir/\`dirname \$f\`
2926     $cp \$f $targetdir/\$f || exit 1
2927     ;;
2928   esac
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetto '$targetto'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         case "$targetfrom" in
2938         scp|rcp)
2939           cat >$from <<EOF
2940 #!/bin/sh
2941 for f in \$@
2942 do
2943   $rm -f \$f
2944   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2945 done
2946 exit 0
2947 EOF
2948             ;;
2949         cp) cat >$from <<EOF
2950 #!/bin/sh
2951 for f in \$@
2952 do
2953   $rm -f \$f
2954   cp $targetdir/\$f . || exit 1
2955 done
2956 exit 0
2957 EOF
2958             ;;
2959         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2960             exit 1
2961             ;;
2962         esac
2963         if $test ! -f $run; then
2964             echo "Target 'run' script '$run' not found." >&4
2965         else
2966             $chmod a+rx $run
2967         fi
2968         if $test ! -f $to; then
2969             echo "Target 'to' script '$to' not found." >&4
2970         else
2971             $chmod a+rx $to
2972         fi
2973         if $test ! -f $from; then
2974             echo "Target 'from' script '$from' not found." >&4
2975         else
2976             $chmod a+rx $from
2977         fi
2978         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2979             exit 1
2980         fi
2981         cat >&4 <<EOF
2982 Using '$run' for remote execution,
2983 and '$from' and '$to'
2984 for remote file transfer.
2985 EOF
2986         ;;
2987 *)      run=''
2988         to=:
2989         from=:
2990         usecrosscompile='undef'
2991         targetarch=''
2992         ;;
2993 esac
2994
2995 : see whether [:lower:] and [:upper:] are supported character classes
2996 echo " "
2997 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2998 ABYZ)
2999         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3000         up='[:upper:]'
3001         low='[:lower:]'
3002         ;;
3003 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3004         # (0xd9 and 0xe2), therefore that is a nice testing point.
3005         if test "X$up" = X -o "X$low" = X; then
3006             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3007             rs) up='[A-Z]'
3008                 low='[a-z]'
3009                 ;;
3010             esac
3011         fi
3012         if test "X$up" = X -o "X$low" = X; then
3013             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3014             rs) up='A-Z'
3015                 low='a-z'
3016                 ;;
3017             esac
3018         fi
3019         if test "X$up" = X -o "X$low" = X; then
3020             case "`echo RS | od -x 2>/dev/null`" in
3021             *D9E2*|*d9e2*)
3022                 echo "Hey, this might be EBCDIC." >&4
3023                 if test "X$up" = X -o "X$low" = X; then
3024                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3025                     rs) up='[A-IJ-RS-Z]'
3026                         low='[a-ij-rs-z]'
3027                         ;;
3028                     esac
3029                 fi
3030                 if test "X$up" = X -o "X$low" = X; then
3031                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3032                     rs) up='A-IJ-RS-Z'
3033                         low='a-ij-rs-z'
3034                         ;;
3035                     esac
3036                 fi
3037                 ;;
3038             esac
3039         fi
3040 esac
3041 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3042 rs)
3043     echo "Using $up and $low to convert case." >&4
3044     ;;
3045 *)
3046     echo "I don't know how to translate letters from upper to lower case." >&4
3047     echo "Your tr is not acting any way I know of." >&4
3048     exit 1
3049     ;;
3050 esac
3051 : set up the translation script tr, must be called with ./tr of course
3052 cat >tr <<EOSC
3053 $startsh
3054 case "\$1\$2" in
3055 '[A-Z][a-z]') exec $tr '$up' '$low';;
3056 '[a-z][A-Z]') exec $tr '$low' '$up';;
3057 esac
3058 exec $tr "\$@"
3059 EOSC
3060 chmod +x tr
3061 $eunicefix tr
3062
3063 : Try to determine whether config.sh was made on this system
3064 case "$config_sh" in
3065 '')
3066 myuname=`$uname -a 2>/dev/null`
3067 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3068 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3069 # because the A-Z/a-z are not consecutive.
3070 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3071         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3072 newmyuname="$myuname"
3073 dflt=n
3074 case "$knowitall" in
3075 '')
3076         if test -f ../config.sh; then
3077                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3078                         eval "`grep myuname= ../config.sh`"
3079                 fi
3080                 if test "X$myuname" = "X$newmyuname"; then
3081                         dflt=y
3082                 fi
3083         fi
3084         ;;
3085 *) dflt=y;;
3086 esac
3087
3088 : Get old answers from old config file if Configure was run on the
3089 : same system, otherwise use the hints.
3090 hint=default
3091 cd ..
3092 if test -f config.sh; then
3093         echo " "
3094         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3095         . UU/myread
3096         case "$ans" in
3097         n*|N*) echo "OK, I'll ignore it."
3098                 mv config.sh config.sh.old
3099                 myuname="$newmyuname"
3100                 ;;
3101         *)  echo "Fetching default answers from your old config.sh file..." >&4
3102                 tmp_n="$n"
3103                 tmp_c="$c"
3104                 tmp_sh="$sh"
3105                 . ./config.sh
3106                 cp config.sh UU
3107                 n="$tmp_n"
3108                 c="$tmp_c"
3109                 : Older versions did not always set $sh.  Catch re-use of such
3110                 : an old config.sh.
3111                 case "$sh" in
3112                 '') sh="$tmp_sh" ;;
3113                 esac
3114                 hint=previous
3115                 ;;
3116         esac
3117 fi
3118 . ./UU/checkcc
3119 if test ! -f config.sh; then
3120         $cat <<EOM
3121
3122 First time through, eh?  I have some defaults handy for some systems
3123 that need some extra help getting the Configure answers right:
3124
3125 EOM
3126         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3127         dflt=''
3128         : Half the following guesses are probably wrong... If you have better
3129         : tests or hints, please send them to perlbug@perl.org
3130         : The metaconfig authors would also appreciate a copy...
3131         $test -f /irix && osname=irix
3132         $test -f /xenix && osname=sco_xenix
3133         $test -f /dynix && osname=dynix
3134         $test -f /dnix && osname=dnix
3135         $test -f /lynx.os && osname=lynxos
3136         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3137         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3138         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3139         $test -f /bin/mips && /bin/mips && osname=mips
3140         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3141                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3142         $test -d /usr/apollo/bin && osname=apollo
3143         $test -f /etc/saf/_sactab && osname=svr4
3144         $test -d /usr/include/minix && osname=minix
3145         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3146         if $test -d /MachTen -o -d /MachTen_Folder; then
3147                 osname=machten
3148                 if $test -x /sbin/version; then
3149                         osvers=`/sbin/version | $awk '{print $2}' |
3150                         $sed -e 's/[A-Za-z]$//'`
3151                 elif $test -x /usr/etc/version; then
3152                         osvers=`/usr/etc/version | $awk '{print $2}' |
3153                         $sed -e 's/[A-Za-z]$//'`
3154                 else
3155                         osvers="$2.$3"
3156                 fi
3157         fi
3158
3159         $test -f /sys/posix.dll &&
3160                 $test -f /usr/bin/what &&
3161                 set X `/usr/bin/what /sys/posix.dll` &&
3162                 $test "$3" = UWIN &&
3163                 osname=uwin &&
3164                 osvers="$5"
3165
3166         if $test -f $uname; then
3167                 set X $myuname
3168                 shift
3169
3170                 case "$5" in
3171                 fps*) osname=fps ;;
3172                 mips*)
3173                         case "$4" in
3174                         umips) osname=umips ;;
3175                         *) osname=mips ;;
3176                         esac;;
3177                 [23]100) osname=mips ;;
3178                 next*) osname=next ;;
3179                 i386*)
3180                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3181                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3182                                 osname='sco'
3183                                 osvers=$tmp
3184                         elif $test -f /etc/kconfig; then
3185                                 osname=isc
3186                                 if test "$lns" = "$ln -s"; then
3187                                         osvers=4
3188                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3189                                         osvers=3
3190                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3191                                         osvers=2
3192                                 fi
3193                         fi
3194                         tmp=''
3195                         ;;
3196                 pc*)
3197                         if test -n "$DJGPP"; then
3198                                 osname=dos
3199                                 osvers=djgpp
3200                         fi
3201                         ;;
3202                 esac
3203
3204                 case "$1" in
3205                 aix) osname=aix
3206                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3207                         case "$tmp" in
3208                         # oslevel can fail with:
3209                         # oslevel: Unable to acquire lock.
3210                         *not\ found) osvers="$4"."$3" ;;
3211                         '<3240'|'<>3240') osvers=3.2.0 ;;
3212                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3213                         '=3250'|'>3250') osvers=3.2.5 ;;
3214                         *) osvers=$tmp;;
3215                         esac
3216                         ;;
3217                 bsd386) osname=bsd386
3218                         osvers=`$uname -r`
3219                         ;;
3220                 cygwin*) osname=cygwin
3221                         osvers="$3"
3222                         ;;
3223                 *dc.osx) osname=dcosx
3224                         osvers="$3"
3225                         ;;
3226                 dnix) osname=dnix
3227                         osvers="$3"
3228                         ;;
3229                 domainos) osname=apollo
3230                         osvers="$3"
3231                         ;;
3232                 dgux)   osname=dgux
3233                         osvers="$3"
3234                         ;;
3235                 dragonfly) osname=dragonfly
3236                         osvers="$3"
3237                         ;;
3238                 dynixptx*) osname=dynixptx
3239                         osvers=`echo "$4"|sed 's/^v//'`
3240                         ;;
3241                 freebsd) osname=freebsd
3242                         osvers="$3" ;;
3243                 genix)  osname=genix ;;
3244                 gnu)    osname=gnu
3245                         osvers="$3" ;;
3246                 hp*)    osname=hpux
3247                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3248                         ;;
3249                 irix*)  osname=irix
3250                         case "$3" in
3251                         4*) osvers=4 ;;
3252                         5*) osvers=5 ;;
3253                         *)      osvers="$3" ;;
3254                         esac
3255                         ;;
3256                 linux)  osname=linux
3257                         case "$3" in
3258                         *)      osvers="$3" ;;
3259                         esac
3260                         ;;
3261                 MiNT)   osname=mint
3262                         ;;
3263                 netbsd*) osname=netbsd
3264                         osvers="$3"
3265                         ;;
3266                 news-os) osvers="$3"
3267                         case "$3" in
3268                         4*) osname=newsos4 ;;
3269                         *) osname=newsos ;;
3270                         esac
3271                         ;;
3272                 next*) osname=next ;;
3273                 nonstop-ux) osname=nonstopux ;;
3274                 openbsd) osname=openbsd
3275                         osvers="$3"
3276                         ;;
3277                 os2)    osname=os2
3278                         osvers="$4"
3279                         ;;
3280                 POSIX-BC | posix-bc ) osname=posix-bc
3281                         osvers="$3"
3282                         ;;
3283                 powerux | power_ux | powermax_os | powermaxos | \
3284                 powerunix | power_unix) osname=powerux
3285                         osvers="$3"
3286                         ;;
3287                 qnx) osname=qnx
3288                         osvers="$4"
3289                         ;;
3290                 solaris) osname=solaris
3291                         case "$3" in
3292                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3293                         *)      osvers="$3" ;;
3294                         esac
3295                         ;;
3296                 sunos) osname=sunos
3297                         case "$3" in
3298                         5*) osname=solaris
3299                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3300                         *)      osvers="$3" ;;
3301                         esac
3302                         ;;
3303                 titanos) osname=titanos
3304                         case "$3" in
3305                         1*) osvers=1 ;;
3306                         2*) osvers=2 ;;
3307                         3*) osvers=3 ;;
3308                         4*) osvers=4 ;;
3309                         *)      osvers="$3" ;;
3310                         esac
3311                         ;;
3312                 ultrix) osname=ultrix
3313                         osvers="$3"
3314                         ;;
3315                 osf1|mls+)      case "$5" in
3316                                 alpha)
3317                                         osname=dec_osf
3318                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3319                                         case "$osvers" in
3320                                         [1-9].[0-9]*) ;;
3321                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3322                                         esac
3323                                         ;;
3324                         hp*)    osname=hp_osf1  ;;
3325                         mips)   osname=mips_osf1 ;;
3326                         esac
3327                         ;;
3328                 # UnixWare 7.1.2 is known as Open UNIX 8
3329                 openunix|unixware) osname=svr5
3330                         osvers="$4"
3331                         ;;
3332                 uts)    osname=uts
3333                         osvers="$3"
3334                         ;;
3335                 vos) osvers="$3"
3336                         ;;
3337                 $2) case "$osname" in
3338                         *isc*) ;;
3339                         *freebsd*) ;;
3340                         svr*)
3341                                 : svr4.x or possibly later
3342                                 case "svr$3" in
3343                                 ${osname}*)
3344                                         osname=svr$3
3345                                         osvers=$4
3346                                         ;;
3347                                 esac
3348                                 case "$osname" in
3349                                 svr4.0)
3350                                         : Check for ESIX
3351                                         if test -f /stand/boot ; then
3352                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3353                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3354                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3355                                                         if test -n "$isesix"; then
3356                                                                 osname=esix4
3357                                                         fi
3358                                                 fi
3359                                         fi
3360                                         ;;
3361                                 esac
3362                                 ;;
3363                         *)      if test -f /etc/systemid; then
3364                                         osname=sco
3365                                         set `echo $3 | $sed 's/\./ /g'` $4
3366                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3367                                                 osvers=$1.$2.$3
3368                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3369                                                 osvers=$1.$2
3370                                         elif $test -f $src/hints/sco_$1.sh; then
3371                                                 osvers=$1
3372                                         fi
3373                                 else
3374                                         case "$osname" in
3375                                         '') : Still unknown.  Probably a generic Sys V.
3376                                                 osname="sysv"
3377                                                 osvers="$3"
3378                                                 ;;
3379                                         esac
3380                                 fi
3381                                 ;;
3382                         esac
3383                         ;;
3384                 *)      case "$osname" in
3385                         '') : Still unknown.  Probably a generic BSD.
3386                                 osname="$1"
3387                                 osvers="$3"
3388                                 ;;
3389                         esac
3390                         ;;
3391                 esac
3392         else
3393                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3394                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3395                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3396                                 osname=news_os
3397                         fi
3398                         $rm -f UU/kernel.what
3399                 elif test -d c:/. -o -n "$is_os2" ; then
3400                         set X $myuname
3401                         osname=os2
3402                         osvers="$5"
3403                 fi
3404         fi
3405
3406         case "$targetarch" in
3407         '') ;;
3408         *)  hostarch=$osname
3409             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3410             osvers=''
3411             ;;
3412         esac
3413
3414         : Now look for a hint file osname_osvers, unless one has been
3415         : specified already.
3416         case "$hintfile" in
3417         ''|' ')
3418                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3419                 : Also try without trailing minor version numbers.
3420                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3421                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3422                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3423                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3424                 case "$file" in
3425                 '') dflt=none ;;
3426                 *)  case "$osvers" in
3427                         '') dflt=$file
3428                                 ;;
3429                         *)  if $test -f $src/hints/$file.sh ; then
3430                                         dflt=$file
3431                                 elif $test -f $src/hints/$xfile.sh ; then
3432                                         dflt=$xfile
3433                                 elif $test -f $src/hints/$xxfile.sh ; then
3434                                         dflt=$xxfile
3435                                 elif $test -f $src/hints/$xxxfile.sh ; then
3436                                         dflt=$xxxfile
3437                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3438                                         dflt=$xxxxfile
3439                                 elif $test -f "$src/hints/${osname}.sh" ; then
3440                                         dflt="${osname}"
3441                                 else
3442                                         dflt=none
3443                                 fi
3444                                 ;;
3445                         esac
3446                         ;;
3447                 esac
3448                 if $test -f Policy.sh ; then
3449                         case "$dflt" in
3450                         *Policy*) ;;
3451                         none) dflt="Policy" ;;
3452                         *) dflt="Policy $dflt" ;;
3453                         esac
3454                 fi
3455                 ;;
3456         *)
3457                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3458                 ;;
3459         esac
3460
3461         if $test -f Policy.sh ; then
3462                 $cat <<EOM
3463
3464 There's also a Policy hint file available, which should make the
3465 site-specific (policy) questions easier to answer.
3466 EOM
3467
3468         fi
3469
3470         $cat <<EOM
3471
3472 You may give one or more space-separated answers, or "none" if appropriate.
3473 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3474 previous run of Configure, you may specify it as well as or instead of
3475 OS-specific hints.  If hints are provided for your OS, you should use them:
3476 although Perl can probably be built without hints on many platforms, using
3477 hints often improve performance and may enable features that Configure can't
3478 set up on its own. If there are no hints that match your OS, specify "none";
3479 DO NOT give a wrong version or a wrong OS.
3480
3481 EOM
3482
3483         rp="Which of these apply, if any?"
3484         . UU/myread
3485         tans=$ans
3486         for file in $tans; do
3487                 if $test X$file = XPolicy -a -f Policy.sh; then
3488                         . Policy.sh
3489                         $cat Policy.sh >> UU/config.sh
3490                 elif $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"$tans" = X -o X"$tans" = Xnone ; then
3494                         : nothing
3495                 else
3496                         : Give one chance to correct a possible typo.
3497                         echo "$file.sh does not exist"
3498                         dflt=$file
3499                         rp="hint to use instead?"
3500                         . UU/myread
3501                         for file in $ans; do
3502                                 if $test -f "$src/hints/$file.sh"; then
3503                                         . $src/hints/$file.sh
3504                                         $cat $src/hints/$file.sh >> UU/config.sh
3505                                 elif $test X$ans = X -o X$ans = Xnone ; then
3506                                         : nothing
3507                                 else
3508                                         echo "$file.sh does not exist -- ignored."
3509                                 fi
3510                         done
3511                 fi
3512         done
3513
3514         hint=recommended
3515         : Remember our hint file for later.
3516         if $test -f "$src/hints/$file.sh" ; then
3517                 hintfile="$file"
3518         else
3519                 hintfile=''
3520         fi
3521 fi
3522 cd UU
3523 ;;
3524 *)
3525         echo " "
3526         echo "Fetching default answers from $config_sh..." >&4
3527         tmp_n="$n"
3528         tmp_c="$c"
3529         cd ..
3530         cp $config_sh config.sh 2>/dev/null
3531         chmod +w config.sh
3532         . ./config.sh
3533         cd UU
3534         cp ../config.sh .
3535         n="$tmp_n"
3536         c="$tmp_c"
3537         hint=previous
3538         ;;
3539 esac
3540 test "$override" && . ./optdef.sh
3541
3542 : Restore computed paths
3543 for file in $loclist $trylist; do
3544         eval $file="\$_$file"
3545 done
3546
3547 cat << EOM
3548
3549 Configure uses the operating system name and version to set some defaults.
3550 The default value is probably right if the name rings a bell. Otherwise,
3551 since spelling matters for me, either accept the default or answer "none"
3552 to leave it blank.
3553
3554 EOM
3555 case "$osname" in
3556         ''|' ')
3557                 case "$hintfile" in
3558                 ''|' '|none) dflt=none ;;
3559                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3560                 esac
3561                 ;;
3562         *) dflt="$osname" ;;
3563 esac
3564 rp="Operating system name?"
3565 . ./myread
3566 case "$ans" in
3567 none)  osname='' ;;
3568 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3569 esac
3570 echo " "
3571 case "$osvers" in
3572         ''|' ')
3573                 case "$hintfile" in
3574                 ''|' '|none) dflt=none ;;
3575                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3576                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3577                         case "$dflt" in
3578                         ''|' ') dflt=none ;;
3579                         esac
3580                         ;;
3581                 esac
3582                 ;;
3583         *) dflt="$osvers" ;;
3584 esac
3585 rp="Operating system version?"
3586 . ./myread
3587 case "$ans" in
3588 none)  osvers='' ;;
3589 *) osvers="$ans" ;;
3590 esac
3591
3592
3593 . ./posthint.sh
3594
3595 : who configured the system
3596 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3597 case "$cf_by" in
3598 "")
3599         cf_by=`(logname) 2>/dev/null`
3600         case "$cf_by" in
3601         "")
3602                 cf_by=`(whoami) 2>/dev/null`
3603                 case "$cf_by" in
3604                 "") cf_by=unknown ;;
3605                 esac ;;
3606         esac ;;
3607 esac
3608
3609 : decide how portable to be.  Allow command line overrides.
3610 case "$d_portable" in
3611 "$undef") ;;
3612 *)      d_portable="$define" ;;
3613 esac
3614
3615 : set up shell script to do ~ expansion
3616 cat >filexp <<EOSS
3617 $startsh
3618 : expand filename
3619 case "\$1" in
3620  \~/*|\~)
3621         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3622         ;;
3623  \~*)
3624         if $test -f /bin/csh; then
3625                 /bin/csh -f -c "glob \$1"
3626                 failed=\$?
3627                 echo ""
3628                 exit \$failed
3629         else
3630                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3631                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3632                 if $test ! -d "\$dir"; then
3633                         me=\`basename \$0\`
3634                         echo "\$me: can't locate home directory for: \$name" >&2
3635                         exit 1
3636                 fi
3637                 case "\$1" in
3638                 */*)
3639                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3640                         ;;
3641                 *)
3642                         echo \$dir
3643                         ;;
3644                 esac
3645         fi
3646         ;;
3647 *)
3648         echo \$1
3649         ;;
3650 esac
3651 EOSS
3652 chmod +x filexp
3653 $eunicefix filexp
3654
3655 : now set up to get a file name
3656 cat <<EOS >getfile
3657 $startsh
3658 EOS
3659 cat <<'EOSC' >>getfile
3660 tilde=''
3661 fullpath=''
3662 already=''
3663 skip=''
3664 none_ok=''
3665 exp_file=''
3666 nopath_ok=''
3667 orig_rp="$rp"
3668 orig_dflt="$dflt"
3669 case "$gfpth" in
3670 '') gfpth='.' ;;
3671 esac
3672
3673 case "$fn" in
3674 *\(*)
3675         : getfile will accept an answer from the comma-separated list
3676         : enclosed in parentheses even if it does not meet other criteria.
3677         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3678         fn=`echo $fn | sed 's/(.*)//'`
3679         ;;
3680 esac
3681
3682 case "$fn" in
3683 *:*)
3684         loc_file=`expr $fn : '.*:\(.*\)'`
3685         fn=`expr $fn : '\(.*\):.*'`
3686         ;;
3687 esac
3688
3689 case "$fn" in
3690 *~*) tilde=true;;
3691 esac
3692 case "$fn" in
3693 */*) fullpath=true;;
3694 esac
3695 case "$fn" in
3696 *+*) skip=true;;
3697 esac
3698 case "$fn" in
3699 *n*) none_ok=true;;
3700 esac
3701 case "$fn" in
3702 *e*) exp_file=true;;
3703 esac
3704 case "$fn" in
3705 *p*) nopath_ok=true;;
3706 esac
3707
3708 case "$fn" in
3709 *f*) type='File';;
3710 *d*) type='Directory';;
3711 *l*) type='Locate';;
3712 esac
3713
3714 what="$type"
3715 case "$what" in
3716 Locate) what='File';;
3717 esac
3718
3719 case "$exp_file" in
3720 '')
3721         case "$d_portable" in
3722         "$define") ;;
3723         *) exp_file=true;;
3724         esac
3725         ;;
3726 esac
3727
3728 cd ..
3729 while test "$type"; do
3730         redo=''
3731         rp="$orig_rp"
3732         dflt="$orig_dflt"
3733         case "$tilde" in
3734         true) rp="$rp (~name ok)";;
3735         esac
3736         . UU/myread
3737         if test -f UU/getfile.ok && \
3738                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3739         then
3740                 value="$ans"
3741                 ansexp="$ans"
3742                 break
3743         fi
3744         case "$ans" in
3745         none)
3746                 value=''
3747                 ansexp=''
3748                 case "$none_ok" in
3749                 true) type='';;
3750                 esac
3751                 ;;
3752         *)
3753                 case "$tilde" in
3754                 '') value="$ans"
3755                         ansexp="$ans";;
3756                 *)
3757                         value=`UU/filexp $ans`
3758                         case $? in
3759                         0)
3760                                 if test "$ans" != "$value"; then
3761                                         echo "(That expands to $value on this system.)"
3762                                 fi
3763                                 ;;
3764                         *) value="$ans";;
3765                         esac
3766                         ansexp="$value"
3767                         case "$exp_file" in
3768                         '') value="$ans";;
3769                         esac
3770                         ;;
3771                 esac
3772                 case "$fullpath" in
3773                 true)
3774                         case "$ansexp" in
3775                         /*) value="$ansexp" ;;
3776                         [a-zA-Z]:/*) value="$ansexp" ;;
3777                         *)
3778                                 redo=true
3779                                 case "$already" in
3780                                 true)
3781                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3782                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3783                                         ;;
3784                                 *)
3785                                 echo "Please give a full path name, starting with slash." >&4
3786                                         case "$tilde" in
3787                                         true)
3788                                 echo "Note that using ~name is ok provided it expands well." >&4
3789                                                 already=true
3790                                                 ;;
3791                                         esac
3792                                 esac
3793                                 ;;
3794                         esac
3795                         ;;
3796                 esac
3797                 case "$redo" in
3798                 '')
3799                         case "$type" in
3800                         File)
3801                                 for fp in $gfpth; do
3802                                         if test "X$fp" = X.; then
3803                                             pf="$ansexp"
3804                                         else    
3805                                             pf="$fp/$ansexp"
3806                                         fi
3807                                         if test -f "$pf"; then
3808                                                 type=''
3809                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3810                                         then
3811                                                 echo "($value is not a plain file, but that's ok.)"
3812                                                 type=''
3813                                         fi
3814                                         if test X"$type" = X; then
3815                                             value="$pf"
3816                                             break
3817                                         fi
3818                                 done
3819                                 ;;
3820                         Directory)
3821                                 for fp in $gfpth; do
3822                                         if test "X$fp" = X.; then
3823                                             dir="$ans"
3824                                             direxp="$ansexp"
3825                                         else    
3826                                             dir="$fp/$ansexp"
3827                                             direxp="$fp/$ansexp"
3828                                         fi
3829                                         if test -d "$direxp"; then
3830                                                 type=''
3831                                                 value="$dir"
3832                                                 break
3833                                         fi
3834                                 done
3835                                 ;;
3836                         Locate)
3837                                 if test -d "$ansexp"; then
3838                                         echo "(Looking for $loc_file in directory $value.)"
3839                                         value="$value/$loc_file"
3840                                         ansexp="$ansexp/$loc_file"
3841                                 fi
3842                                 if test -f "$ansexp"; then
3843                                         type=''
3844                                 fi
3845                                 case "$nopath_ok" in
3846                                 true)   case "$value" in
3847                                         */*) ;;
3848                                         *)      echo "Assuming $value will be in people's path."
3849                                                 type=''
3850                                                 ;;
3851                                         esac
3852                                         ;;
3853                                 esac
3854                                 ;;
3855                         esac
3856
3857                         case "$skip" in
3858                         true) type='';
3859                         esac
3860
3861                         case "$type" in
3862                         '') ;;
3863                         *)
3864                                 if test "$fastread" = yes; then
3865                                         dflt=y
3866                                 else
3867                                         dflt=n
3868                                 fi
3869                                 rp="$what $value doesn't exist.  Use that name anyway?"
3870                                 . UU/myread
3871                                 dflt=''
3872                                 case "$ans" in
3873                                 y*) type='';;
3874                                 *) echo " ";;
3875                                 esac
3876                                 ;;
3877                         esac
3878                         ;;
3879                 esac
3880                 ;;
3881         esac
3882 done
3883 cd UU
3884 ans="$value"
3885 rp="$orig_rp"
3886 dflt="$orig_dflt"
3887 rm -f getfile.ok
3888 test "X$gfpthkeep" != Xy && gfpth=""
3889 EOSC
3890
3891 : determine root of directory hierarchy where package will be installed.
3892 case "$prefix" in
3893 '')
3894         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3895         ;;
3896 *?/)
3897         dflt=`echo "$prefix" | sed 's/.$//'`
3898         ;;
3899 *)
3900         dflt="$prefix"
3901         ;;
3902 esac
3903 $cat <<EOM
3904
3905 By default, $package will be installed in $dflt/bin, manual pages
3906 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3907 installation directories. Typically this is something like /usr/local.
3908 If you wish to have binaries under /usr/bin but other parts of the
3909 installation under /usr/local, that's ok: you will be prompted
3910 separately for each of the installation directories, the prefix being
3911 only used to set the defaults.
3912
3913 EOM
3914 fn=d~
3915 rp='Installation prefix to use?'
3916 . ./getfile
3917 oldprefix=''
3918 case "$prefix" in
3919 '') ;;
3920 *)
3921         case "$ans" in
3922         "$prefix") ;;
3923         *) oldprefix="$prefix";;
3924         esac
3925         ;;
3926 esac
3927 prefix="$ans"
3928 prefixexp="$ansexp"
3929
3930 : allow them to override the AFS root
3931 case "$afsroot" in
3932 '')     afsroot=/afs ;;
3933 *)      afsroot=$afsroot ;;
3934 esac
3935
3936 : is AFS running?
3937 echo " "
3938 case "$afs" in
3939 $define|true)   afs=true ;;
3940 $undef|false)   afs=false ;;
3941 *)      if $test -d $afsroot; then
3942                 afs=true
3943         else
3944                 afs=false
3945         fi
3946         ;;
3947 esac
3948 if $afs; then
3949         echo "AFS may be running... I'll be extra cautious then..." >&4
3950 else
3951         echo "AFS does not seem to be running..." >&4
3952 fi
3953
3954 : determine installation prefix for where package is to be installed.
3955 if $afs; then 
3956 $cat <<EOM
3957
3958 Since you are running AFS, I need to distinguish the directory in which
3959 files will reside from the directory in which they are installed (and from
3960 which they are presumably copied to the former directory by occult means).
3961
3962 EOM
3963         case "$installprefix" in
3964         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3965         *) dflt="$installprefix";;
3966         esac
3967 else
3968 $cat <<EOM
3969
3970 In some special cases, particularly when building $package for distribution,
3971 it is convenient to distinguish the directory in which files should be
3972 installed from the directory ($prefix) in which they will
3973 eventually reside.  For most users, these two directories are the same.
3974
3975 EOM
3976         case "$installprefix" in
3977         '') dflt=$prefix ;;
3978         *) dflt=$installprefix;;
3979         esac
3980 fi
3981 fn=d~
3982 rp='What installation prefix should I use for installing files?'
3983 . ./getfile
3984 installprefix="$ans"
3985 installprefixexp="$ansexp"
3986
3987 : Perform the prefixexp/installprefixexp correction if necessary
3988 cat <<EOS >installprefix
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>installprefix
3992 : Change installation prefix, if necessary.
3993 if $test X"$prefix" != X"$installprefix"; then
3994     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3995 else
3996     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3997 fi
3998 EOSC
3999 chmod +x installprefix
4000 $eunicefix installprefix
4001
4002 : Set variables such as privlib and privlibexp from the output of ./getfile
4003 : performing the prefixexp/installprefixexp correction if necessary.
4004 cat <<EOS >setprefixvar
4005 $startsh
4006 EOS
4007 cat <<'EOSC' >>setprefixvar
4008 eval "${prefixvar}=\"\$ans\""
4009 eval "${prefixvar}exp=\"\$ansexp\""
4010 . ./installprefix
4011 EOSC
4012 chmod +x setprefixvar
4013 $eunicefix setprefixvar
4014
4015 : set up the script used to warn in case of inconsistency
4016 cat <<EOS >whoa
4017 $startsh
4018 EOS
4019 cat <<'EOSC' >>whoa
4020 dflt=y
4021 case "$hint" in
4022     recommended)
4023         case "$hintfile" in
4024         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4025                 ;;
4026         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4027                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4028                 ;;
4029         esac
4030         ;;
4031     *)  echo " "
4032         echo "*** WHOA THERE!!! ***" >&4
4033         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4034         ;;
4035 esac
4036 rp="    Keep the $hint value?"
4037 . ./myread
4038 case "$ans" in
4039 y) td=$was; tu=$was;;
4040 esac
4041 EOSC
4042
4043 : function used to set '$1' to '$val'
4044 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4045 case "$val$was" in
4046 $define$undef) . ./whoa; eval "$var=\$td";;
4047 $undef$define) . ./whoa; eval "$var=\$tu";;
4048 *) eval "$var=$val";;
4049 esac'
4050
4051 : Check is we will use socks
4052 case "$usesocks" in
4053 $define|true|[yY]*)     dflt='y';;
4054 *) dflt='n';;
4055 esac
4056 cat <<EOM
4057
4058 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4059 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4060 to use the PerlIO abstraction layer, this will be implicitly selected.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Build Perl for SOCKS?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y)    val="$define" ;;
4068 *)      val="$undef" ;;
4069 esac
4070 set usesocks
4071 eval $setvar
4072
4073 case "$usesocks" in
4074 $define|true|[yY]*) useperlio="$define";;
4075 esac
4076
4077 : Check if we want perlio
4078 case "$useperlio" in
4079 $define|true|[yY]*|'')  dflt='y';;
4080 *) dflt='n';;
4081 esac
4082 cat <<EOM
4083
4084 Previous version of $package used the standard IO mechanisms as
4085 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4086 alternate IO mechanisms via the PerlIO abstraction layer, but the
4087 stdio mechanism is still available if needed.  The abstraction layer
4088 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4089 Using PerlIO with sfio may cause problems with some extension modules.
4090
4091 If this doesn't make any sense to you, just accept the default '$dflt'.
4092 EOM
4093 rp='Use the PerlIO abstraction layer?'
4094 . ./myread
4095 case "$ans" in
4096 y|Y)
4097         val="$define"
4098         ;;
4099 *)
4100         echo "Ok, doing things the stdio way."
4101         val="$undef"
4102         ;;
4103 esac
4104 set useperlio
4105 eval $setvar
4106
4107 case "$usesocks" in
4108 $define|true|[yY]*)
4109         case "$useperlio" in
4110         $define|true|[yY]*) ;;
4111         *)      cat >&4 <<EOM
4112
4113 You are using the SOCKS proxy protocol library which means that you
4114 should also use the PerlIO layer.  You may be headed for trouble.
4115
4116 EOM
4117                 ;;
4118         esac
4119         ;;
4120 esac
4121
4122 : get the patchlevel
4123 echo " "
4124 echo "Getting the current patchlevel..." >&4
4125 if $test -r $rsrc/patchlevel.h;then
4126         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4127         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4128         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4129         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4130         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4131         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4132         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4133 else
4134         revision=0
4135         patchlevel=0
4136         subversion=0
4137         api_revision=0
4138         api_version=0
4139         api_subversion=0
4140         perl_patchlevel=0
4141         $echo "(You do not have patchlevel.h.  Eek.)"
4142 fi
4143 if $test -r $rsrc/.patch ; then
4144         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4145                 perl_patchlevel=`cat $rsrc/.patch`
4146         fi
4147 fi
4148 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4149 version_patchlevel_string="version $patchlevel subversion $subversion"
4150 case "$perl_patchlevel" in
4151 0|'') ;;
4152 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4153     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4154     ;;
4155 esac
4156
4157 $echo "(You have $package $version_patchlevel_string.)"
4158
4159 case "$osname" in
4160 dos|vms)
4161         : XXX Should be a Configure test for double-dots in filenames.
4162         version=`echo $revision $patchlevel $subversion | \
4163                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4164         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4165                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4166         ;;
4167 *)
4168         version=`echo $revision $patchlevel $subversion | \
4169                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4170         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4171                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4172         ;;
4173 esac
4174 : Special case the 5.005_xx maintenance series, which used 5.005
4175 : without any subversion label as a subdirectory in $sitelib
4176 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4177         api_versionstring='5.005'
4178 fi
4179
4180 : Do we want threads support and if so, what type
4181 case "$usethreads" in
4182 $define|true|[yY]*)     dflt='y';;
4183 *)     # Catch case where user specified ithreads or 5005threads but
4184        # forgot -Dusethreads (A.D. 4/2002)
4185        case "$useithreads$use5005threads" in
4186        *$define*)
4187                 case "$useperlio" in
4188                 "$define")      dflt='y' ;;
4189                 *)              dflt='n' ;;
4190                 esac
4191                 ;;
4192        *)       dflt='n';;
4193        esac
4194        ;;
4195 esac
4196 cat <<EOM
4197
4198 Perl can be built to take advantage of threads on some systems.
4199 To do so, Configure can be run with -Dusethreads.
4200
4201 Note that Perl built with threading support runs slightly slower
4202 and uses more memory than plain Perl. The current implementation
4203 is believed to be stable, but it is fairly new, and so should be
4204 treated with caution.
4205
4206 If this doesn't make any sense to you, just accept the default '$dflt'.
4207 EOM
4208 rp='Build a threading Perl?'
4209 . ./myread
4210 case "$ans" in
4211 y|Y)    val="$define" ;;
4212 *)      val="$undef" ;;
4213 esac
4214 set usethreads
4215 eval $setvar
4216
4217 if $test $patchlevel -lt 9; then
4218     case "$usethreads" in
4219     $define)
4220         $cat <<EOM
4221
4222 Since release 5.6, Perl has had two different threading implementations,
4223 the newer interpreter-based version (ithreads) with one interpreter per
4224 thread, and the older 5.005 version (5005threads).
4225 The 5005threads version is effectively unmaintained and will probably be
4226 removed in Perl 5.10, so there should be no need to build a Perl using it
4227 unless needed for backwards compatibility with some existing 5.005threads
4228 code.
4229
4230 EOM
4231         : Default to ithreads unless overridden on command line or with
4232         : old config.sh
4233         dflt='y'
4234         case "$use5005threads" in
4235                 $define|true|[yY]*) dflt='n';;
4236         esac
4237         case "$useithreads" in
4238                 $undef|false|[nN]*) dflt='n';;
4239         esac
4240         rp='Use the newer interpreter-based ithreads?'
4241         . ./myread
4242         case "$ans" in
4243         y|Y)    val="$define" ;;
4244         *)      val="$undef" ;;
4245         esac
4246         set useithreads
4247         eval $setvar
4248         : Now set use5005threads to the opposite value.
4249         case "$useithreads" in
4250         $define) val="$undef" ;;
4251         *) val="$define" ;;
4252         esac
4253         set use5005threads
4254         eval $setvar
4255         ;;
4256     *)
4257         useithreads="$undef"
4258         use5005threads="$undef"
4259         ;;
4260     esac
4261
4262     case "$useithreads$use5005threads" in
4263     "$define$define")
4264         $cat >&4 <<EOM
4265
4266 You cannot have both the ithreads and the 5.005 threads enabled
4267 at the same time.  Disabling the 5.005 threads since they are
4268 much less stable than the ithreads.
4269
4270 EOM
4271         use5005threads="$undef"
4272         ;;
4273     esac
4274
4275 else
4276 : perl-5.9.x and later
4277
4278     if test X"$usethreads" = "X$define"; then
4279         case "$use5005threads" in
4280             $define|true|[yY]*)
4281                 $cat >&4 <<EOM
4282
4283 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4284
4285 EOM
4286             ;;
4287         esac
4288     fi
4289
4290     use5005threads="$undef"
4291     useithreads="$usethreads"
4292 fi
4293
4294 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4295         cat >&4 <<EOF
4296 ***
4297 *** To build with ithreads you must also use the PerlIO layer.
4298 *** Cannot continue, aborting.
4299 ***
4300 EOF
4301         exit 1
4302 fi
4303
4304 case "$d_oldpthreads" in
4305 '')     : Configure tests would be welcome here.  For now, assume undef.
4306         val="$undef" ;;
4307 *)      val="$d_oldpthreads" ;;
4308 esac
4309 set d_oldpthreads
4310 eval $setvar
4311
4312
4313 : Look for a hint-file generated 'call-back-unit'.  If the
4314 : user has specified that a threading perl is to be built,
4315 : we may need to set or change some other defaults.
4316 if $test -f usethreads.cbu; then
4317     echo "Your platform has some specific hints regarding threaded builds, using them..."
4318     . ./usethreads.cbu
4319 else
4320     case "$usethreads" in
4321         "$define"|true|[yY]*)
4322                 $cat <<EOM
4323 (Your platform does not have any specific hints for threaded builds.
4324  Assuming POSIX threads, then.)
4325 EOM
4326         ;;
4327     esac
4328 fi
4329
4330 : Check if multiplicity is required
4331 cat <<EOM
4332
4333 Perl can be built so that multiple Perl interpreters can coexist
4334 within the same Perl executable.
4335 EOM
4336
4337 case "$useithreads" in
4338 $define)
4339         cat <<EOM
4340 This multiple interpreter support is required for interpreter-based threads.
4341 EOM
4342         val="$define"
4343         ;;
4344 *)      case "$usemultiplicity" in
4345         $define|true|[yY]*)     dflt='y';;
4346         *) dflt='n';;
4347         esac
4348         echo " "
4349         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4350         rp='Build Perl for multiplicity?'
4351         . ./myread
4352         case "$ans" in
4353         y|Y)    val="$define" ;;
4354         *)      val="$undef" ;;
4355         esac
4356         ;;
4357 esac
4358 set usemultiplicity
4359 eval $setvar
4360
4361 : Check if morebits is requested
4362 case "$usemorebits" in
4363 "$define"|true|[yY]*)
4364         use64bitint="$define"
4365         uselongdouble="$define"
4366         usemorebits="$define"
4367         ;;
4368 *)      usemorebits="$undef"
4369         ;;
4370 esac
4371
4372 : Determine the C compiler to be used
4373 echo " "
4374 case "$cc" in
4375 '') dflt=cc;;
4376 *) dflt="$cc";;
4377 esac
4378 rp="Use which C compiler?"
4379 . ./myread
4380 cc="$ans"
4381
4382 : See whether they have no cc but they do have gcc
4383 . ./trygcc
4384 if $test -f cc.cbu; then
4385     . ./cc.cbu
4386 fi
4387 . ./checkcc
4388
4389 : make some quick guesses about what we are up against
4390 echo " "
4391 $echo $n "Hmm...  $c"
4392 echo exit 1 >bsd
4393 echo exit 1 >usg
4394 echo exit 1 >v7
4395 echo exit 1 >osf1
4396 echo exit 1 >eunice
4397 echo exit 1 >xenix
4398 echo exit 1 >venix
4399 echo exit 1 >os2
4400 d_bsd="$undef"
4401 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4402 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4403 then
4404         echo "Looks kind of like an OSF/1 system, but we'll see..."
4405         echo exit 0 >osf1
4406 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4407         xxx=`./loc addbib blurfl $pth`
4408         if $test -f $xxx; then
4409         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4410                 echo exit 0 >bsd
4411                 echo exit 0 >usg
4412         else
4413                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4414                         echo "Looks kind of like an extended USG system, but we'll see..."
4415                 else
4416                         echo "Looks kind of like a USG system, but we'll see..."
4417                 fi
4418                 echo exit 0 >usg
4419         fi
4420 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4421         echo "Looks kind of like a BSD system, but we'll see..."
4422         d_bsd="$define"
4423         echo exit 0 >bsd
4424 else
4425         echo "Looks kind of like a Version 7 system, but we'll see..."
4426         echo exit 0 >v7
4427 fi
4428 case "$eunicefix" in
4429 *unixtovms*)
4430         $cat <<'EOI'
4431 There is, however, a strange, musty smell in the air that reminds me of
4432 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4433 EOI
4434         echo exit 0 >eunice
4435         d_eunice="$define"
4436 : it so happens the Eunice I know will not run shell scripts in Unix format
4437         ;;
4438 *)
4439         echo " "
4440         echo "Congratulations.  You aren't running Eunice."
4441         d_eunice="$undef"
4442         ;;
4443 esac
4444 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4445 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4446 : semicolon as a patch separator
4447 case "$p_" in
4448 :) ;;
4449 *)
4450         $cat <<'EOI'
4451 I have the feeling something is not exactly right, however...don't tell me...
4452 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4453 (Or you may be running DOS with DJGPP.)
4454 EOI
4455         echo exit 0 >os2
4456         ;;
4457 esac
4458 if test -f /xenix; then
4459         echo "Actually, this looks more like a XENIX system..."
4460         echo exit 0 >xenix
4461         d_xenix="$define"
4462 else
4463         echo " "
4464         echo "It's not Xenix..."
4465         d_xenix="$undef"
4466 fi
4467 chmod +x xenix
4468 $eunicefix xenix
4469 if test -f /venix; then
4470         echo "Actually, this looks more like a VENIX system..."
4471         echo exit 0 >venix
4472 else
4473         echo " "
4474         if ./xenix; then
4475                 : null
4476         else
4477                 echo "Nor is it Venix..."
4478         fi
4479 fi
4480 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4481 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4482 $rm -f foo
4483
4484 : Check if we are using GNU gcc and what its version is
4485 echo " "
4486 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4487 $cat >try.c <<EOM
4488 #include <stdio.h>
4489 int main() {
4490 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4491 #ifdef __VERSION__
4492         printf("%s\n", __VERSION__);
4493 #else
4494         printf("%s\n", "1");
4495 #endif
4496 #endif
4497         return(0);
4498 }
4499 EOM
4500 if $cc -o try $ccflags $ldflags try.c; then
4501         gccversion=`$run ./try`
4502         case "$gccversion" in
4503         '') echo "You are not using GNU cc." ;;
4504         *)  echo "You are using GNU cc $gccversion."
4505             ccname=gcc
4506             ;;
4507         esac
4508 else
4509         echo " "
4510         echo "*** WHOA THERE!!! ***" >&4
4511         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4512         case "$knowitall" in
4513         '')
4514         echo "    You'd better start hunting for one and let me know about it." >&4
4515                 exit 1
4516                 ;;
4517         esac
4518 fi
4519 $rm -f try try.*
4520 case "$gccversion" in
4521 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4522 esac
4523 case "$gccversion" in
4524 '') gccosandvers='' ;;
4525 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4526    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4527    gccshortvers=''
4528    case "$gccosandvers" in
4529    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4530    $osname$osvers) ;; # looking good
4531    $osname*) cat <<EOM >&4
4532
4533 *** WHOA THERE!!! ***
4534
4535     Your gcc has not been compiled for the exact release of
4536     your operating system ($gccosandvers versus $osname$osvers).
4537
4538     In general it is a good idea to keep gcc synchronized with
4539     the operating system because otherwise serious problems
4540     may ensue when trying to compile software, like Perl.
4541
4542     I'm trying to be optimistic here, though, and will continue.
4543     If later during the configuration and build icky compilation
4544     problems appear (headerfile conflicts being the most common
4545     manifestation), I suggest reinstalling the gcc to match
4546     your operating system release.
4547
4548 EOM
4549       ;;
4550    *) gccosandvers='' ;; # failed to parse, better be silent
4551    esac
4552    ;;
4553 esac
4554 case "$ccname" in
4555 '') ccname="$cc" ;;
4556 esac
4557
4558 # gcc 3.* complain about adding -Idirectories that they already know about,
4559 # so we will take those off from locincpth.
4560 case "$gccversion" in
4561 3*)
4562     echo "main(){}">try.c
4563     for incdir in $locincpth; do
4564        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4565              grep '^c[cp]p*[01]: warning: changing search order '`
4566        if test "X$warn" != X; then
4567            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4568        fi
4569     done
4570     $rm -f try try.*
4571 esac
4572
4573 : What should the include directory be ?
4574 echo " "
4575 $echo $n "Hmm...  $c"
4576 dflt='/usr/include'
4577 incpath=''
4578 mips_type=''
4579 if $test -f /bin/mips && /bin/mips; then
4580         echo "Looks like a MIPS system..."
4581         $cat >usr.c <<'EOCP'
4582 #ifdef SYSTYPE_BSD43
4583 /bsd43
4584 #endif
4585 EOCP
4586         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4587                 dflt='/bsd43/usr/include'
4588                 incpath='/bsd43'
4589                 mips_type='BSD 4.3'
4590         else
4591                 mips_type='System V'
4592         fi
4593         $rm -f usr.c usr.out
4594         echo "and you're compiling with the $mips_type compiler and libraries."
4595         xxx_prompt=y
4596         echo "exit 0" >mips
4597 else
4598         echo "Doesn't look like a MIPS system."
4599         xxx_prompt=n
4600         echo "exit 1" >mips
4601 fi
4602 chmod +x mips
4603 $eunicefix mips
4604 case "$usrinc" in
4605 '') ;;
4606 *) dflt="$usrinc";;
4607 esac
4608 case "$xxx_prompt" in
4609 y)      fn=d/
4610         echo " "
4611         rp='Where are the include files you want to use?'
4612         . ./getfile
4613         usrinc="$ans"
4614         ;;
4615 *)      usrinc="$dflt"
4616         ;;
4617 esac
4618
4619 : see how we invoke the C preprocessor
4620 echo " "
4621 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4622 cat <<'EOT' >testcpp.c
4623 #define ABC abc
4624 #define XYZ xyz
4625 ABC.XYZ
4626 EOT
4627 cd ..
4628 if test ! -f cppstdin; then
4629         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4630                 # AIX cc -E doesn't show the absolute headerfile
4631                 # locations but we'll cheat by using the -M flag.
4632                 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
4633         else
4634                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4635         fi
4636 else
4637         echo "Keeping your $hint cppstdin wrapper."
4638 fi
4639 chmod 755 cppstdin
4640 wrapper=`pwd`/cppstdin
4641 ok='false'
4642 cd UU
4643
4644 if $test "X$cppstdin" != "X" && \
4645         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4647 then
4648         echo "You used to use $cppstdin $cppminus so we'll use that again."
4649         case "$cpprun" in
4650         '') echo "But let's see if we can live without a wrapper..." ;;
4651         *)
4652                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4653                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4654                 then
4655                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4656                         ok='true'
4657                 else
4658                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4659                 fi
4660                 ;;
4661         esac
4662 else
4663         case "$cppstdin" in
4664         '') ;;
4665         *)
4666                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4667                 ;;
4668         esac
4669 fi
4670
4671 if $ok; then
4672         : nothing
4673 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4674         $cc -E <testcpp.c >testcpp.out 2>&1; \
4675         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676         echo "Yup, it does."
4677         x_cpp="$cc -E"
4678         x_minus='';
4679 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4680         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4681         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4682         echo "Yup, it does."
4683         x_cpp="$cc -E"
4684         x_minus='-';
4685 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4686         $cc -P <testcpp.c >testcpp.out 2>&1; \
4687         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4688         echo "Yipee, that works!"
4689         x_cpp="$cc -P"
4690         x_minus='';
4691 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4692         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "At long last!"
4695         x_cpp="$cc -P"
4696         x_minus='-';
4697 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4698         $cpp <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "It works!"
4701         x_cpp="$cpp"
4702         x_minus='';
4703 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4704         $cpp - <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         echo "Hooray, it works!  I was beginning to wonder."
4707         x_cpp="$cpp"
4708         x_minus='-';
4709 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4710         $wrapper <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         x_cpp="$wrapper"
4713         x_minus=''
4714         echo "Eureka!"
4715 else
4716         dflt=''
4717         rp="No dice.  I can't find a C preprocessor.  Name one:"
4718         . ./myread
4719         x_cpp="$ans"
4720         x_minus=''
4721         $x_cpp <testcpp.c >testcpp.out 2>&1
4722         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4723                 echo "OK, that will do." >&4
4724         else
4725 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4726                 exit 1
4727         fi
4728 fi
4729
4730 case "$ok" in
4731 false)
4732         cppstdin="$x_cpp"
4733         cppminus="$x_minus"
4734         cpprun="$x_cpp"
4735         cpplast="$x_minus"
4736         set X $x_cpp
4737         shift
4738         case "$1" in
4739         "$cpp")
4740                 echo "Perhaps can we force $cc -E using a wrapper..."
4741                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4742                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4743                 then
4744                         echo "Yup, we can."
4745                         cppstdin="$wrapper"
4746                         cppminus='';
4747                 else
4748                         echo "Nope, we'll have to live without it..."
4749                 fi
4750                 ;;
4751         esac
4752         case "$cpprun" in
4753         "$wrapper")
4754                 cpprun=''
4755                 cpplast=''
4756                 ;;
4757         esac
4758         ;;
4759 esac
4760
4761 case "$cppstdin" in
4762 "$wrapper"|'cppstdin') ;;
4763 *) $rm -f $wrapper;;
4764 esac
4765 $rm -f testcpp.c testcpp.out
4766
4767 : Set private lib path
4768 case "$plibpth" in
4769 '') if ./mips; then
4770                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4771         fi;;
4772 esac
4773 case "$libpth" in
4774 ' ') dlist='';;
4775 '') dlist="$loclibpth $plibpth $glibpth";;
4776 *) dlist="$libpth";;
4777 esac
4778
4779 : Now check and see which directories actually exist, avoiding duplicates
4780 libpth=''
4781 for xxx in $dlist
4782 do
4783     if $test -d $xxx; then
4784                 case " $libpth " in
4785                 *" $xxx "*) ;;
4786                 *) libpth="$libpth $xxx";;
4787                 esac
4788     fi
4789 done
4790 $cat <<'EOM'
4791
4792 Some systems have incompatible or broken versions of libraries.  Among
4793 the directories listed in the question below, please remove any you
4794 know not to be holding relevant libraries, and add any that are needed.
4795 Say "none" for none.
4796
4797 EOM
4798 case "$libpth" in
4799 '') dflt='none';;
4800 *)
4801         set X $libpth
4802         shift
4803         dflt=${1+"$@"}
4804         ;;
4805 esac
4806 rp="Directories to use for library searches?"
4807 . ./myread
4808 case "$ans" in
4809 none) libpth=' ';;
4810 *) libpth="$ans";;
4811 esac
4812
4813 : compute shared library extension
4814 case "$so" in
4815 '')
4816         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4817                 dflt='sl'
4818         else
4819                 dflt='so'
4820         fi
4821         ;;
4822 *) dflt="$so";;
4823 esac
4824 $cat <<EOM
4825
4826 On some systems, shared libraries may be available.  Answer 'none' if
4827 you want to suppress searching of shared libraries for the remainder
4828 of this configuration.
4829
4830 EOM
4831 rp='What is the file extension used for shared libraries?'
4832 . ./myread
4833 so="$ans"
4834
4835 : Define several unixisms.
4836 : Hints files or command line option can be used to override them.
4837 : The convoluted testing is in case hints files set either the old
4838 : or the new name.
4839 case "$_exe" in
4840 '')     case "$exe_ext" in
4841         '')     ;;
4842         *)      _exe="$exe_ext" ;;
4843         esac
4844         ;;
4845 esac
4846 case "$_a" in
4847 '')     case "$lib_ext" in
4848     '') _a='.a';;
4849         *)      _a="$lib_ext" ;;
4850         esac
4851         ;;
4852 esac
4853 case "$_o" in
4854 '') case "$obj_ext" in
4855         '')     _o='.o';;
4856         *)      _o="$obj_ext";;
4857         esac
4858         ;;
4859 esac
4860 case "$p_" in
4861 '') case "$path_sep" in
4862         '')     p_=':';;
4863         *)      p_="$path_sep";;
4864         esac
4865         ;;
4866 esac
4867 exe_ext=$_exe
4868 lib_ext=$_a
4869 obj_ext=$_o
4870 path_sep=$p_
4871
4872 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4873
4874 : Which makefile gets called first.  This is used by make depend.
4875 case "$firstmakefile" in
4876 '') firstmakefile='makefile';;
4877 esac
4878
4879 : Check for uselongdouble support
4880 case "$ccflags" in
4881 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4882 esac
4883
4884 case "$uselongdouble" in
4885 $define|true|[yY]*)     dflt='y';;
4886 *) dflt='n';;
4887 esac
4888 cat <<EOM
4889
4890 Perl can be built to take advantage of long doubles which
4891 (if available) may give more accuracy and range for floating point numbers.
4892
4893 If this doesn't make any sense to you, just accept the default '$dflt'.
4894 EOM
4895 rp='Try to use long doubles if available?'
4896 . ./myread
4897 case "$ans" in
4898 y|Y)    val="$define"   ;;
4899 *)      val="$undef"    ;;
4900 esac
4901 set uselongdouble
4902 eval $setvar
4903
4904 case "$uselongdouble" in
4905 true|[yY]*) uselongdouble="$define" ;;
4906 esac
4907
4908 : Look for a hint-file generated 'call-back-unit'.  If the
4909 : user has specified that long doubles should be used,
4910 : we may need to set or change some other defaults.
4911 if $test -f uselongdouble.cbu; then
4912     echo "Your platform has some specific hints regarding long doubles, using them..."
4913     . ./uselongdouble.cbu
4914 else
4915     case "$uselongdouble" in
4916         $define)
4917                 $cat <<EOM
4918 (Your platform does not have any specific hints for long doubles.)
4919 EOM
4920         ;;
4921     esac
4922 fi
4923
4924 : Looking for optional libraries
4925 echo " "
4926 echo "Checking for optional libraries..." >&4
4927 case "$libs" in
4928 ' '|'') dflt='';;
4929 *) dflt="$libs";;
4930 esac
4931 case "$libswanted" in
4932 '') libswanted='c_s';;
4933 esac
4934 case "$usesocks" in
4935 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4936 esac
4937 libsfound=''
4938 libsfiles=''
4939 libsdirs=''
4940 libspath=''
4941 for thisdir in $libpth $xlibpth; do
4942   test -d $thisdir && libspath="$libspath $thisdir"
4943 done
4944 for thislib in $libswanted; do
4945         for thisdir in $libspath; do
4946             xxx=''
4947             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4948                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=shared
4951             fi
4952             if test ! -f "$xxx"; then
4953                 xxx=$thisdir/lib$thislib.$so
4954                 $test -f "$xxx" && eval $libscheck
4955                 $test -f "$xxx" && libstyle=shared
4956             fi
4957             if test ! -f "$xxx"; then
4958                 xxx=$thisdir/lib$thislib$_a
4959                 $test -f "$xxx" && eval $libscheck
4960                 $test -f "$xxx" && libstyle=static
4961             fi
4962             if test ! -f "$xxx"; then
4963                 xxx=$thisdir/$thislib$_a
4964                 $test -f "$xxx" && eval $libscheck
4965                 $test -f "$xxx" && libstyle=static
4966             fi
4967             if test ! -f "$xxx"; then
4968                 xxx=$thisdir/lib${thislib}_s$_a
4969                 $test -f "$xxx" && eval $libscheck
4970                 $test -f "$xxx" && libstyle=static
4971                 $test -f "$xxx" && thislib=${thislib}_s
4972             fi
4973             if test ! -f "$xxx"; then
4974                 xxx=$thisdir/Slib$thislib$_a
4975                 $test -f "$xxx" && eval $libscheck
4976                 $test -f "$xxx" && libstyle=static
4977             fi
4978             if $test -f "$xxx"; then
4979                 case "$libstyle" in
4980                 shared) echo "Found -l$thislib (shared)." ;;
4981                 static) echo "Found -l$thislib." ;;
4982                 *)      echo "Found -l$thislib ($libstyle)." ;;
4983                 esac
4984                 case " $dflt " in
4985                 *"-l$thislib "*);;
4986                 *) dflt="$dflt -l$thislib"
4987                    libsfound="$libsfound $xxx"
4988                    yyy=`basename $xxx`
4989                    libsfiles="$libsfiles $yyy"
4990                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4991                    case " $libsdirs " in
4992                    *" $yyy "*) ;;
4993                    *) libsdirs="$libsdirs $yyy" ;;
4994                    esac
4995                    ;;
4996                 esac
4997                 break
4998             fi
4999         done
5000         if $test ! -f "$xxx"; then
5001             echo "No -l$thislib."
5002         fi
5003 done
5004 set X $dflt
5005 shift
5006 dflt="$*"
5007 case "$libs" in
5008 '') dflt="$dflt";;
5009 *) dflt="$libs";;
5010 esac
5011 case "$dflt" in
5012 ' '|'') dflt='none';;
5013 esac
5014
5015 $cat <<EOM
5016
5017 In order to compile $package on your machine, a number of libraries
5018 are usually needed.  Include any other special libraries here as well.
5019 Say "none" for none.  The default list is almost always right.
5020 EOM
5021
5022 echo " "
5023 rp="What libraries to use?"
5024 . ./myread
5025 case "$ans" in
5026 none) libs=' ';;
5027 *) libs="$ans";;
5028 esac
5029
5030 : determine optimization, if desired, or use for debug flag also
5031 case "$optimize" in
5032 ' '|$undef) dflt='none';;
5033 '') dflt='-O';;
5034 *) dflt="$optimize";;
5035 esac
5036 $cat <<EOH
5037
5038 By default, $package compiles with the -O flag to use the optimizer.
5039 Alternately, you might want to use the symbolic debugger, which uses
5040 the -g flag (on traditional Unix systems).  Either flag can be
5041 specified here.  To use neither flag, specify the word "none".
5042
5043 EOH
5044 rp="What optimizer/debugger flag should be used?"
5045 . ./myread
5046 optimize="$ans"
5047 case "$optimize" in
5048 'none') optimize=" ";;
5049 esac
5050
5051 : Check what DEBUGGING is required from the command line
5052 : -DEBUGGING      or -DDEBUGGING or
5053 : -DEBUGGING=both                       = -g + -DDEBUGGING
5054 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5055 : -DEBUGGING=none or -UDEBUGGING        =
5056 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5057 case "$EBUGGING" in
5058 '')     ;;
5059 *)      DEBUGGING=$EBUGGING ;;
5060 esac
5061
5062 case "$DEBUGGING" in
5063 -g|both|$define)
5064     case "$optimize" in
5065         *-g*) ;;
5066         *)    optimize="$optimize -g" ;;
5067     esac ;;
5068 none|$undef)
5069     case "$optimize" in
5070         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5071                 shift
5072                 optimize="$*"
5073                 ;;
5074     esac ;;
5075 esac
5076
5077 dflt=''
5078 case "$DEBUGGING" in
5079 both|$define) dflt='-DDEBUGGING'
5080 esac
5081
5082 : argument order is deliberate, as the flag will start with - which set could
5083 : think is an option
5084 checkccflag='check=$1; flag=$2; callback=$3;
5085 echo " ";
5086 echo "Checking if your compiler accepts $flag" 2>&1;
5087 echo "int main(void) { return 0; }" > gcctest.c;
5088 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5089     echo "Yes, it does." 2>&1;
5090     if $test -s gcctest.out ; then
5091         echo "But your platform does not like it:";
5092         cat gcctest.out;
5093     else
5094         case "$ccflags" in
5095         *$check*)
5096             echo "Leaving current flags $ccflags alone." 2>&1
5097             ;;
5098         *) dflt="$dflt $flag";
5099             eval $callback
5100             ;;
5101         esac
5102     fi
5103 else
5104     echo "Nope, it does not, but that is ok." 2>&1;
5105 fi
5106 '
5107
5108 : We will not override a previous value, but we might want to
5109 : augment a hint file
5110 case "$hint" in
5111 default|recommended)
5112         case "$gccversion" in
5113         1*) dflt="$dflt -fpcc-struct-return" ;;
5114         esac
5115         case "$optimize:$DEBUGGING" in
5116         *-g*:old) dflt="$dflt -DDEBUGGING";;
5117         esac
5118         case "$gccversion" in
5119         2*) if $test -d /etc/conf/kconfig.d &&
5120                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5121                 then
5122                         # Interactive Systems (ISC) POSIX mode.
5123                         dflt="$dflt -posix"
5124                 fi
5125                 ;;
5126         esac
5127         case "$gccversion" in
5128         1*) ;;
5129         2.[0-8]*) ;;
5130         ?*)     set strict-aliasing -fno-strict-aliasing
5131                 eval $checkccflag
5132                 ;;
5133         esac
5134         # For gcc, adding -pipe speeds up compilations for some, but apparently
5135         # some assemblers can't read from stdin.  (It also slows down compilations
5136         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5137         case "$gccversion" in
5138         ?*)     set pipe -pipe
5139                 eval $checkccflag
5140                 ;;
5141         esac
5142
5143         # on x86_64 (at least) we require an extra library (libssp) in the
5144         # link command line. This library is not named, so I infer that it is
5145         # an implementation detail that may change. Hence the safest approach
5146         # is to add the flag to the flags passed to the compiler at link time,
5147         # as that way the compiler can do the right implementation dependant
5148         # thing. (NWC)
5149         case "$gccversion" in
5150         ?*)     set stack-protector -fstack-protector
5151                 eval $checkccflag
5152                 ;;
5153         esac
5154         ;;
5155 esac
5156
5157 case "$mips_type" in
5158 *BSD*|'') inclwanted="$locincpth $usrinc";;
5159 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5160 esac
5161 for thisincl in $inclwanted; do
5162         if $test -d $thisincl; then
5163                 if $test x$thisincl != x$usrinc; then
5164                         case "$dflt" in
5165                         *" -I$thisincl "*);;
5166                         *) dflt="$dflt -I$thisincl ";;
5167                         esac
5168                 fi
5169         fi
5170 done
5171
5172 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5173         xxx=true;
5174 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5175         xxx=true;
5176 else
5177         xxx=false;
5178 fi;
5179 if $xxx; then
5180         case "$dflt" in
5181         *$2*);;
5182         *) dflt="$dflt -D$2";;
5183         esac;
5184 fi'
5185
5186 set signal.h LANGUAGE_C; eval $inctest
5187
5188 case "$usesocks" in
5189 $define)
5190         ccflags="$ccflags -DSOCKS"
5191         ;;
5192 esac
5193
5194 case "$hint" in
5195 default|recommended) dflt="$ccflags $dflt" ;;
5196 *) dflt="$ccflags";;
5197 esac
5198
5199 case "$dflt" in
5200 ''|' ') dflt=none;;
5201 esac
5202
5203 $cat <<EOH
5204
5205 Your C compiler may want other flags.  For this question you should include
5206 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5207 but you should NOT include libraries or ld flags like -lwhatever.  If you
5208 want $package to honor its debug switch, you should include -DDEBUGGING here.
5209 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5210
5211 To use no flags, specify the word "none".
5212
5213 EOH
5214 set X $dflt
5215 shift
5216 dflt=${1+"$@"}
5217 rp="Any additional cc flags?"
5218 . ./myread
5219 case "$ans" in
5220 none) ccflags='';;
5221 *) ccflags="$ans";;
5222 esac
5223
5224 : the following weeds options from ccflags that are of no interest to cpp
5225 case "$cppflags" in
5226 '') cppflags="$ccflags" ;;
5227 *)  cppflags="$cppflags $ccflags" ;;
5228 esac
5229 case "$gccversion" in
5230 1*) cppflags="$cppflags -D__GNUC__"
5231 esac
5232 case "$mips_type" in
5233 '');;
5234 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5235 esac
5236 case "$cppflags" in
5237 '');;
5238 *)
5239         echo " "
5240         echo "Let me guess what the preprocessor flags are..." >&4
5241         set X $cppflags
5242         shift
5243         cppflags=''
5244         $cat >cpp.c <<'EOM'
5245 #define BLURFL foo
5246
5247 BLURFL xx LFRULB
5248 EOM
5249         previous=''
5250         for flag in $*
5251         do
5252                 case "$flag" in
5253                 -*) ftry="$flag";;
5254                 *) ftry="$previous $flag";;
5255                 esac
5256                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5257                         >cpp1.out 2>/dev/null && \
5258                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5259                         >cpp2.out 2>/dev/null && \
5260                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5261                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5262                 then
5263                         cppflags="$cppflags $ftry"
5264                         previous=''
5265                 else
5266                         previous="$flag"
5267                 fi
5268         done
5269         set X $cppflags
5270         shift
5271         cppflags=${1+"$@"}
5272         case "$cppflags" in
5273         *-*)  echo "They appear to be: $cppflags";;
5274         esac
5275         $rm -f cpp.c cpp?.out
5276         ;;
5277 esac
5278
5279 : flags used in final linking phase
5280 case "$ldflags" in
5281 '') if ./venix; then
5282                 dflt='-i -z'
5283         else
5284                 dflt=''
5285         fi
5286         case "$ccflags" in
5287         *-posix*) dflt="$dflt -posix" ;;
5288         esac
5289         ;;
5290 *) dflt="$ldflags";;
5291 esac
5292 # See note above about -fstack-protector
5293 case "$ccflags" in
5294 *-fstack-protector*) 
5295         case "$dflt" in
5296         *-fstack-protector*) ;; # Don't add it again
5297         *) dflt="$dflt -fstack-protector" ;; 
5298         esac
5299         ;;
5300 esac
5301
5302 : Try to guess additional flags to pick up local libraries.
5303 for thislibdir in $libpth; do
5304         case " $loclibpth " in
5305         *" $thislibdir "*)
5306                 case "$dflt " in
5307                 *"-L$thislibdir "*) ;;
5308                 *)  dflt="$dflt -L$thislibdir" ;;
5309                 esac
5310                 ;;
5311         esac
5312 done
5313
5314 case "$dflt" in
5315 '') dflt='none' ;;
5316 esac
5317
5318 $cat <<EOH
5319
5320 Your C linker may need flags.  For this question you should
5321 include -L/whatever and any other flags used by the C linker, but you
5322 should NOT include libraries like -lwhatever.
5323
5324 Make sure you include the appropriate -L/path flags if your C linker
5325 does not normally search all of the directories you specified above,
5326 namely
5327         $libpth
5328 To use no flags, specify the word "none".
5329
5330 EOH
5331
5332 rp="Any additional ld flags (NOT including libraries)?"
5333 . ./myread
5334 case "$ans" in
5335 none) ldflags='';;
5336 *) ldflags="$ans";;
5337 esac
5338 rmlist="$rmlist pdp11"
5339
5340 : coherency check
5341 echo " "
5342 echo "Checking your choice of C compiler and flags for coherency..." >&4
5343 $cat > try.c <<'EOF'
5344 #include <stdio.h>
5345 int main() { printf("Ok\n"); return(0); }
5346 EOF
5347 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5348 shift
5349 $cat >try.msg <<'EOM'
5350 I've tried to compile and run the following simple program:
5351
5352 EOM
5353 $cat try.c >> try.msg
5354
5355 $cat >> try.msg <<EOM
5356
5357 I used the command:
5358
5359         $*
5360         $run ./try
5361
5362 and I got the following output:
5363
5364 EOM
5365 dflt=y
5366 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5367         if $sh -c "$run ./try " >>try.msg 2>&1; then
5368                 xxx=`$run ./try`
5369                 case "$xxx" in
5370                 "Ok") dflt=n ;;
5371                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5372                         case " $libs " in
5373                         *" -lsfio "*)
5374                                 cat >> try.msg <<'EOQS'
5375 If $libs contains -lsfio, and sfio is mis-configured, then it
5376 sometimes (apparently) runs and exits with a 0 status, but with no
5377 output!  It may have to do with sfio's use of _exit vs. exit.
5378
5379 EOQS
5380                                 rp="You have a big problem.  Shall I abort Configure"
5381                                 dflt=y
5382                                 ;;
5383                         esac
5384                         ;;
5385                 esac
5386         else
5387                 echo "The program compiled OK, but exited with status $?." >>try.msg
5388                 rp="You have a problem.  Shall I abort Configure"
5389                 dflt=y
5390         fi
5391 else
5392         echo "I can't compile the test program." >>try.msg
5393         rp="You have a BIG problem.  Shall I abort Configure"
5394         dflt=y
5395 fi
5396 case "$dflt" in
5397 y)
5398         $cat try.msg >&4
5399         case "$knowitall" in
5400         '')
5401                 echo "(The supplied flags or libraries might be incorrect.)"
5402                 ;;
5403         *) dflt=n;;
5404         esac
5405         echo " "
5406         . ./myread
5407         case "$ans" in
5408         n*|N*) ;;
5409         *)      echo "Ok.  Stopping Configure." >&4
5410                 exit 1
5411                 ;;
5412         esac
5413         ;;
5414 n) echo "OK, that should do.";;
5415 esac
5416 $rm_try gcctest gcctest.out
5417
5418 : define a shorthand compile call
5419 compile='
5420 mc_file=$1;
5421 shift;
5422 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5423 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5424 exit 1;
5425 fi;
5426 esac;
5427 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5428 : define a shorthand compile call for compilations that should be ok.
5429 compile_ok='
5430 mc_file=$1;
5431 shift;
5432 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5433
5434 : determine filename position in cpp output
5435 echo " "
5436 echo "Computing filename position in cpp output for #include directives..." >&4
5437 case "$osname" in
5438 vos) testaccess=-e ;;
5439 *)   testaccess=-r ;;
5440 esac
5441 echo '#include <stdio.h>' > foo.c
5442 $cat >fieldn <<EOF
5443 $startsh
5444 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5445 $grep '^[       ]*#.*stdio\.h' | \
5446 while read cline; do
5447         pos=1
5448         set \$cline
5449         while $test \$# -gt 0; do
5450                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5451                         echo "\$pos"
5452                         exit 0
5453                 fi
5454                 shift
5455                 pos=\`expr \$pos + 1\`
5456         done
5457 done
5458 EOF
5459 chmod +x fieldn
5460 fieldn=`./fieldn`
5461 $rm -f foo.c fieldn
5462 case $fieldn in
5463 '') pos='???';;
5464 1) pos=first;;
5465 2) pos=second;;
5466 3) pos=third;;
5467 *) pos="${fieldn}th";;
5468 esac
5469 echo "Your cpp writes the filename in the $pos field of the line."
5470
5471 case "$osname" in
5472 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5473 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5474 *)   cppfilter='' ;;
5475 esac
5476 : locate header file
5477 $cat >findhdr <<EOF
5478 $startsh
5479 wanted=\$1
5480 name=''
5481 for usrincdir in $usrinc
5482 do
5483         if test -f \$usrincdir/\$wanted; then
5484                 echo "\$usrincdir/\$wanted"
5485                 exit 0
5486         fi
5487 done
5488 awkprg='{ print \$$fieldn }'
5489 echo "#include <\$wanted>" > foo\$\$.c
5490 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5491 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5492 while read cline; do
5493         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5494         case "\$name" in
5495         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5496         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5497         *) exit 2;;
5498         esac;
5499 done;
5500 #
5501 # status = 0: grep returned 0 lines, case statement not executed
5502 # status = 1: headerfile found
5503 # status = 2: while loop executed, no headerfile found
5504 #
5505 status=\$?
5506 $rm -f foo\$\$.c;
5507 if test \$status -eq 1; then
5508         exit 0;
5509 fi
5510 exit 1
5511 EOF
5512 chmod +x findhdr
5513
5514 : define an alternate in-header-list? function
5515 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5516 cont=true; xxf="echo \"<\$1> found.\" >&4";
5517 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5518 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5519 esac;
5520 case $# in 4) instead=instead;; *) instead="at last";; esac;
5521 while $test "$cont"; do
5522         xxx=`./findhdr $1`
5523         var=$2; eval "was=\$$2";
5524         if $test "$xxx" && $test -r "$xxx";
5525         then eval $xxf;
5526         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5527                 cont="";
5528         else eval $xxnf;
5529         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5530         set $yyy; shift; shift; yyy=$@;
5531         case $# in 0) cont="";;
5532         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5533                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5534         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5535                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5536         esac;
5537 done;
5538 while $test "$yyy";
5539 do set $yyy; var=$2; eval "was=\$$2";
5540         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5541         set $yyy; shift; shift; yyy=$@;
5542 done'
5543
5544 : see if stdlib is available
5545 set stdlib.h i_stdlib
5546 eval $inhdr
5547
5548 : check for lengths of integral types
5549 echo " "
5550 case "$intsize" in
5551 '')
5552         echo "Checking to see how big your integers are..." >&4
5553         $cat >try.c <<EOCP
5554 #include <stdio.h>
5555 #$i_stdlib I_STDLIB
5556 #ifdef I_STDLIB
5557 #include <stdlib.h>
5558 #endif
5559 int main()
5560 {
5561         printf("intsize=%d;\n", (int)sizeof(int));
5562         printf("longsize=%d;\n", (int)sizeof(long));
5563         printf("shortsize=%d;\n", (int)sizeof(short));
5564         exit(0);
5565 }
5566 EOCP
5567         set try
5568         if eval $compile_ok && $run ./try > /dev/null; then
5569                 eval `$run ./try`
5570                 echo "Your integers are $intsize bytes long."
5571                 echo "Your long integers are $longsize bytes long."
5572                 echo "Your short integers are $shortsize bytes long."
5573         else
5574                 $cat >&4 <<EOM
5575 !
5576 Help! I can't compile and run the intsize test program: please enlighten me!
5577 (This is probably a misconfiguration in your system or libraries, and
5578 you really ought to fix it.  Still, I'll try anyway.)
5579 !
5580 EOM
5581                 dflt=4
5582                 rp="What is the size of an integer (in bytes)?"
5583                 . ./myread
5584                 intsize="$ans"
5585                 dflt=$intsize
5586                 rp="What is the size of a long integer (in bytes)?"
5587                 . ./myread
5588                 longsize="$ans"
5589                 dflt=2
5590                 rp="What is the size of a short integer (in bytes)?"
5591                 . ./myread
5592                 shortsize="$ans"
5593         fi
5594         ;;
5595 esac
5596 $rm_try
5597
5598 : check for long long
5599 echo " "
5600 echo "Checking to see if you have long long..." >&4
5601 echo 'int main() { long long x = 7; return 0; }' > try.c
5602 set try
5603 if eval $compile; then
5604         val="$define"
5605         echo "You have long long."
5606 else
5607         val="$undef"
5608         echo "You do not have long long."
5609 fi
5610 $rm_try
5611 set d_longlong
5612 eval $setvar
5613
5614 : check for length of long long
5615 case "${d_longlong}${longlongsize}" in
5616 $define)
5617         echo " "
5618         echo "Checking to see how big your long longs are..." >&4
5619         $cat >try.c <<'EOCP'
5620 #include <stdio.h>
5621 int main()
5622 {
5623     printf("%d\n", (int)sizeof(long long));
5624     return(0);
5625 }
5626 EOCP
5627         set try
5628         if eval $compile_ok; then
5629                 longlongsize=`$run ./try`
5630                 echo "Your long longs are $longlongsize bytes long."
5631         else
5632                 dflt='8'
5633                 echo " "
5634                 echo "(I can't seem to compile the test program.  Guessing...)"
5635                 rp="What is the size of a long long (in bytes)?"
5636                 . ./myread
5637                 longlongsize="$ans"
5638         fi
5639         if $test "X$longsize" = "X$longlongsize"; then
5640                 echo "(That isn't any different from an ordinary long.)"
5641         fi
5642         ;;
5643 esac
5644 $rm_try
5645
5646 : see if inttypes.h is available
5647 : we want a real compile instead of Inhdr because some systems
5648 : have an inttypes.h which includes non-existent headers
5649 echo " "
5650 $cat >try.c <<EOCP
5651 #include <inttypes.h>
5652 int main() {
5653         static int32_t foo32 = 0x12345678;
5654 }
5655 EOCP
5656 set try
5657 if eval $compile; then
5658         echo "<inttypes.h> found." >&4
5659         val="$define"
5660 else
5661         echo "<inttypes.h> NOT found." >&4
5662         val="$undef"
5663 fi
5664 $rm_try
5665 set i_inttypes
5666 eval $setvar
5667
5668 : check for int64_t
5669 echo " "
5670 echo "Checking to see if you have int64_t..." >&4
5671 $cat >try.c <<EOCP
5672 #include <sys/types.h>
5673 #$i_inttypes I_INTTYPES
5674 #ifdef I_INTTYPES
5675 #include <inttypes.h>
5676 #endif
5677 int main() { int64_t x = 7; }
5678 EOCP
5679 set try
5680 if eval $compile; then
5681         val="$define"
5682         echo "You have int64_t."
5683 else
5684         val="$undef"
5685         echo "You do not have int64_t."
5686 fi
5687 $rm_try
5688 set d_int64_t
5689 eval $setvar
5690
5691 : Check if 64bit ints have a quad type
5692 echo " "
5693 echo "Checking which 64-bit integer type we could use..." >&4
5694
5695 case "$intsize" in
5696 8) val=int
5697    set quadtype
5698    eval $setvar
5699    val='"unsigned int"'
5700    set uquadtype
5701    eval $setvar
5702    quadkind=1
5703    ;;
5704 *) case "$longsize" in
5705    8) val=long
5706       set quadtype
5707       eval $setvar
5708       val='"unsigned long"'
5709       set uquadtype
5710       eval $setvar
5711       quadkind=2
5712       ;;
5713    *) case "$d_longlong:$longlongsize" in
5714       define:8)
5715         val='"long long"'
5716         set quadtype
5717         eval $setvar
5718         val='"unsigned long long"'
5719         set uquadtype
5720         eval $setvar
5721         quadkind=3
5722         ;;
5723       *) case "$d_int64_t" in
5724          define)
5725            val=int64_t
5726            set quadtype
5727            eval $setvar
5728            val=uint64_t
5729            set uquadtype
5730            eval $setvar
5731            quadkind=4
5732            ;;
5733          esac
5734          ;;
5735       esac
5736       ;;
5737    esac
5738    ;;
5739 esac
5740
5741 case "$quadtype" in
5742 '')     echo "Alas, no 64-bit integer types in sight." >&4
5743         d_quad="$undef"
5744         ;;
5745 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5746         d_quad="$define"
5747         ;;
5748 esac
5749
5750 : Do we want 64bit support
5751 case "$uselonglong" in
5752 "$define"|true|[yY]*)
5753         cat <<EOM >&4
5754
5755 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5756 EOM
5757         use64bitint="$define"
5758         ;;
5759 esac
5760 case "$use64bits" in
5761 "$define"|true|[yY]*)
5762         cat <<EOM >&4
5763
5764 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5765 EOM
5766         use64bitint="$define"
5767         ;;
5768 esac
5769 case "$use64bitints" in
5770 "$define"|true|[yY]*)
5771         cat <<EOM >&4
5772
5773 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5774 EOM
5775         use64bitint="$define"
5776         ;;
5777 esac
5778 case "$use64bitsint" in
5779 "$define"|true|[yY]*)
5780         cat <<EOM >&4
5781
5782 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5783 EOM
5784         use64bitint="$define"
5785         ;;
5786 esac
5787 case "$uselonglongs" in
5788 "$define"|true|[yY]*)
5789         cat <<EOM >&4
5790
5791 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5792 EOM
5793         use64bitint="$define"
5794         ;;
5795 esac
5796 case "$use64bitsall" in
5797 "$define"|true|[yY]*)
5798         cat <<EOM >&4
5799
5800 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5801 EOM
5802         use64bitall="$define"
5803         ;;
5804 esac
5805
5806 case "$ccflags" in
5807 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5808 esac
5809 case "$use64bitall" in
5810 "$define"|true|[yY]*) use64bitint="$define" ;;
5811 esac
5812
5813 case "$longsize" in
5814 8) cat <<EOM
5815
5816 You have natively 64-bit long integers.
5817 EOM
5818    val="$define"
5819    ;;
5820 *) case "$use64bitint" in
5821    "$define"|true|[yY]*) dflt='y';;
5822    *) dflt='n';;
5823    esac
5824    case "$d_quad" in
5825    "$define") ;;
5826    *) dflt='n' ;;
5827    esac
5828    cat <<EOM
5829
5830 Perl can be built to take advantage of 64-bit integer types
5831 on some systems.  To do so, Configure can be run with -Duse64bitint.
5832 Choosing this option will most probably introduce binary incompatibilities.
5833
5834 If this doesn't make any sense to you, just accept the default '$dflt'.
5835 (The default has been chosen based on your configuration.)
5836 EOM
5837    rp='Try to use 64-bit integers, if available?'
5838    . ./myread
5839    case "$ans" in
5840    [yY]*) val="$define" ;;
5841    *)     val="$undef"  ;;
5842    esac
5843    ;;
5844 esac
5845 set use64bitint
5846 eval $setvar
5847
5848 case "$use64bitall" in
5849 "$define"|true|[yY]*) dflt='y' ;;
5850 *) case "$longsize" in
5851    8) dflt='y' ;;
5852    *) dflt='n' ;;
5853    esac
5854    ;;
5855 esac
5856 cat <<EOM
5857
5858 You may also choose to try maximal 64-bitness.  It means using as much
5859 64-bitness as possible on the platform.  This in turn means even more
5860 binary incompatibilities.  On the other hand, your platform may not
5861 have any more 64-bitness available than what you already have chosen.
5862
5863 If this doesn't make any sense to you, just accept the default '$dflt'.
5864 (The default has been chosen based on your configuration.)
5865 EOM
5866 rp='Try to use maximal 64-bit support, if available?'
5867 . ./myread
5868 case "$ans" in
5869 [yY]*) val="$define" ;;
5870 *)     val="$undef"  ;;
5871 esac
5872 set use64bitall
5873 eval $setvar
5874 case "$use64bitall" in
5875 "$define")
5876         case "$use64bitint" in
5877         "$undef")
5878                 cat <<EOM
5879
5880 Since you have chosen a maximally 64-bit build, I'm also turning on
5881 the use of 64-bit integers.
5882 EOM
5883                 use64bitint="$define" ;;
5884         esac
5885         ;;
5886 esac
5887
5888 : Look for a hint-file generated 'call-back-unit'.  If the
5889 : user has specified that a 64-bit perl is to be built,
5890 : we may need to set or change some other defaults.
5891 if $test -f use64bitint.cbu; then
5892         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5893         . ./use64bitint.cbu
5894 fi
5895 case "$use64bitint" in
5896 "$define"|true|[yY]*)
5897         case "$longsize" in
5898         4) case "$archname64" in
5899            '') archname64=64int ;;
5900            esac
5901            ;;
5902         esac
5903         ;;
5904 esac
5905
5906 : Look for a hint-file generated 'call-back-unit'.  If the
5907 : user has specified that a maximally 64-bit perl is to be built,
5908 : we may need to set or change some other defaults.
5909 if $test -f use64bitall.cbu; then
5910         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5911         . ./use64bitall.cbu
5912 fi
5913 case "$use64bitall" in
5914 "$define"|true|[yY]*)
5915         case "$longsize" in
5916         4) case "$archname64" in
5917            ''|64int) archname64=64all ;;
5918            esac
5919            ;;
5920         esac
5921         ;;
5922 esac
5923
5924 case "$d_quad:$use64bitint" in
5925 $undef:$define)
5926         cat >&4 <<EOF
5927
5928 *** You have chosen to use 64-bit integers,
5929 *** but none can be found.
5930 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5931 *** Cannot continue, aborting.
5932
5933 EOF
5934         exit 1
5935         ;;
5936 esac
5937
5938 : check for length of double
5939 echo " "
5940 case "$doublesize" in
5941 '')
5942         echo "Checking to see how big your double precision numbers are..." >&4
5943         $cat >try.c <<EOCP
5944 #include <stdio.h>
5945 #$i_stdlib I_STDLIB
5946 #ifdef I_STDLIB
5947 #include <stdlib.h>
5948 #endif
5949 int main()
5950 {
5951     printf("%d\n", (int)sizeof(double));
5952     exit(0);
5953 }
5954 EOCP
5955         set try
5956         if eval $compile_ok; then
5957                 doublesize=`$run ./try`
5958                 echo "Your double is $doublesize bytes long."
5959         else
5960                 dflt='8'
5961                 echo "(I can't seem to compile the test program.  Guessing...)"
5962                 rp="What is the size of a double precision number (in bytes)?"
5963                 . ./myread
5964                 doublesize="$ans"
5965         fi
5966         ;;
5967 esac
5968 $rm_try
5969
5970 : check for long doubles
5971 echo " "
5972 echo "Checking to see if you have long double..." >&4
5973 echo 'int main() { long double x = 7.0; }' > try.c
5974 set try
5975 if eval $compile; then
5976         val="$define"
5977         echo "You have long double."
5978 else
5979         val="$undef"
5980         echo "You do not have long double."
5981 fi
5982 $rm_try
5983 set d_longdbl
5984 eval $setvar
5985
5986 : check for length of long double
5987 case "${d_longdbl}${longdblsize}" in
5988 $define)
5989         echo " "
5990         echo "Checking to see how big your long doubles are..." >&4
5991         $cat >try.c <<'EOCP'
5992 #include <stdio.h>
5993 int main()
5994 {
5995         printf("%d\n", sizeof(long double));
5996 }
5997 EOCP
5998         set try
5999         set try
6000         if eval $compile; then
6001                 longdblsize=`$run ./try`
6002                 echo "Your long doubles are $longdblsize bytes long."
6003         else
6004                 dflt='8'
6005                 echo " "
6006                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6007                 rp="What is the size of a long double (in bytes)?"
6008                 . ./myread
6009                 longdblsize="$ans"
6010         fi
6011         if $test "X$doublesize" = "X$longdblsize"; then
6012                 echo "That isn't any different from an ordinary double."
6013                 echo "I'll keep your setting anyway, but you may see some"
6014                 echo "harmless compilation warnings."
6015         fi
6016         ;;
6017 esac
6018 $rm_try
6019
6020 : determine the architecture name
6021 echo " "
6022 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6023         tarch=`arch`"-$osname"
6024 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6025         if uname -m > tmparch 2>&1 ; then
6026                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6027                         -e 's/$/'"-$osname/" tmparch`
6028         else
6029                 tarch="$osname"
6030         fi
6031         $rm -f tmparch
6032 else
6033         tarch="$osname"
6034 fi
6035 case "$myarchname" in
6036 ''|"$tarch") ;;
6037 *)
6038         echo "(Your architecture name used to be $myarchname.)"
6039         archname=''
6040         ;;
6041 esac
6042 case "$targetarch" in
6043 '') ;;
6044 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6045 esac
6046 myarchname="$tarch"
6047 case "$archname" in
6048 '') dflt="$tarch";;
6049 *) dflt="$archname";;
6050 esac
6051 rp='What is your architecture name'
6052 . ./myread
6053 archname="$ans"
6054 case "$usethreads" in
6055 $define)
6056         echo "Threads selected." >&4
6057         case "$archname" in
6058         *-thread*) echo "...and architecture name already has -thread." >&4
6059                 ;;
6060         *)      archname="$archname-thread"
6061                 echo "...setting architecture name to $archname." >&4
6062                 ;;
6063         esac
6064         ;;
6065 esac
6066 case "$usemultiplicity" in
6067 $define)
6068         echo "Multiplicity selected." >&4
6069         case "$archname" in
6070         *-multi*) echo "...and architecture name already has -multi." >&4
6071                 ;;
6072         *)      archname="$archname-multi"
6073                 echo "...setting architecture name to $archname." >&4
6074                 ;;
6075         esac
6076         ;;
6077 esac
6078 case "$use64bitint$use64bitall" in
6079 *"$define"*)
6080         case "$archname64" in
6081         '')
6082                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6083                 ;;
6084         *)
6085                 case "$use64bitint" in
6086                 "$define") echo "64 bit integers selected." >&4 ;;
6087                 esac
6088                 case "$use64bitall" in
6089                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6090                 esac
6091                 case "$archname" in
6092                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6093                         ;;
6094                 *)      archname="$archname-$archname64"
6095                         echo "...setting architecture name to $archname." >&4
6096                         ;;
6097                 esac
6098                 ;;
6099         esac
6100 esac
6101 case "$uselongdouble" in
6102 $define)
6103         echo "Long doubles selected." >&4
6104         case "$longdblsize" in
6105         $doublesize)
6106                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6107                 ;;
6108         *)
6109                 case "$archname" in
6110                 *-ld*) echo "...and architecture name already has -ld." >&4
6111                         ;;
6112                 *)      archname="$archname-ld"
6113                         echo "...setting architecture name to $archname." >&4
6114                         ;;
6115                 esac
6116                 ;;
6117         esac
6118         ;;
6119 esac
6120 case "$useperlio" in
6121 $define)
6122         echo "Perlio selected." >&4
6123         ;;
6124 *)
6125         echo "Perlio not selected, using stdio." >&4
6126         case "$archname" in
6127         *-stdio*) echo "...and architecture name already has -stdio." >&4
6128                 ;;
6129         *)      archname="$archname-stdio"
6130                 echo "...setting architecture name to $archname." >&4
6131                 ;;
6132         esac
6133         ;;
6134 esac
6135 if $test -f archname.cbu; then
6136         echo "Your platform has some specific hints for architecture name, using them..."
6137         . ./archname.cbu
6138 fi
6139
6140 : set the prefixit variable, to compute a suitable default value
6141 prefixit='case "$3" in
6142 ""|none)
6143         case "$oldprefix" in
6144         "") eval "$1=\"\$$2\"";;
6145         *)
6146                 case "$3" in
6147                 "") eval "$1=";;
6148                 none)
6149                         eval "tp=\"\$$2\"";
6150                         case "$tp" in
6151                         ""|" ") eval "$1=\"\$$2\"";;
6152                         *) eval "$1=";;
6153                         esac;;
6154                 esac;;
6155         esac;;
6156 *)
6157         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6158         case "$tp" in
6159         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6160         /*-$oldprefix/*|\~*-$oldprefix/*)
6161                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6162         *) eval "$1=\"\$$2\"";;
6163         esac;;
6164 esac'
6165
6166 : determine installation style
6167 : For now, try to deduce it from prefix unless it is already set.
6168 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6169 case "$installstyle" in
6170 '')     case "$prefix" in
6171                 *perl*) dflt='lib';;
6172                 *) dflt='lib/perl5' ;;
6173         esac
6174         ;;
6175 *)      dflt="$installstyle" ;;
6176 esac
6177 : Probably not worth prompting for this since we prompt for all
6178 : the directories individually, and the prompt would be too long and
6179 : confusing anyway.
6180 installstyle=$dflt
6181
6182 : determine where public executables go
6183 echo " "
6184 set dflt bin bin
6185 eval $prefixit
6186 fn=d~
6187 rp='Pathname where the public executables will reside?'
6188 . ./getfile
6189 if $test "X$ansexp" != "X$binexp"; then
6190         installbin=''
6191 fi
6192 prefixvar=bin
6193 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6194 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6195 :     this via initialinstalllocation
6196 . ./setprefixvar
6197
6198 case "$userelocatableinc" in
6199 $define|true|[yY]*)     dflt='y' ;;
6200 *)                      dflt='n' ;;
6201 esac
6202 cat <<EOM
6203
6204 Would you like to build Perl so that the installation is relocatable, so that
6205 library paths in @INC are determined relative to the path of the perl binary?
6206 This is not advised for system Perl installs, or if you need to run setid
6207 scripts or scripts under taint mode.
6208
6209 If this doesn't make any sense to you, just accept the default '$dflt'.
6210 EOM
6211 rp='Use relocatable @INC?'
6212 . ./myread
6213 case "$ans" in
6214 y|Y)    val="$define" ;;
6215 *)      val="$undef"  ;;
6216 esac
6217 set userelocatableinc
6218 eval $setvar
6219
6220 initialinstalllocation="$binexp"
6221 : Default prefix is now "up one level from where the binaries are"
6222 case "$userelocatableinc" in
6223 $define|true|[yY]*)
6224     bin=".../"
6225     binexp=".../"
6226     prefix=".../.."
6227     prefixexp=".../.."
6228     installprefixexp=".../.."
6229     ;;
6230 esac
6231
6232 : determine where private library files go
6233 : Usual default is /usr/local/lib/perl5/$version.
6234 : Also allow things like /opt/perl/lib/$version, since
6235 : /opt/perl/lib/perl5... would be redundant.
6236 : The default "style" setting is made in installstyle.U
6237 case "$installstyle" in
6238 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6239 *)       set dflt privlib lib/$version ;;
6240 esac
6241 eval $prefixit
6242 $cat <<EOM
6243
6244 There are some auxiliary files for $package that need to be put into a
6245 private library directory that is accessible by everyone.
6246
6247 EOM
6248 fn=$binexp
6249 fn=d~+
6250 rp='Pathname where the private library files will reside?'
6251 . ./getfile
6252 prefixvar=privlib
6253 . ./setprefixvar
6254
6255 : set the prefixup variable, to restore leading tilda escape
6256 prefixup='case "$prefixexp" in
6257 "$prefix") ;;
6258 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6259 esac'
6260
6261 : determine where public architecture dependent libraries go
6262 set archlib archlib
6263 eval $prefixit
6264 : privlib default is /usr/local/lib/$package/$version
6265 : archlib default is /usr/local/lib/$package/$version/$archname
6266 : privlib may have an optional trailing /share.
6267 tdflt=`echo $privlib | $sed 's,/share$,,'`
6268 tdflt=$tdflt/$archname
6269 case "$archlib" in
6270 '')     dflt=$tdflt
6271         ;;
6272 *)      dflt="$archlib"
6273     ;;
6274 esac
6275 $cat <<EOM
6276
6277 $spackage contains architecture-dependent library files.  If you are
6278 sharing libraries in a heterogeneous environment, you might store
6279 these files in a separate location.  Otherwise, you can just include
6280 them with the rest of the public library files.
6281
6282 EOM
6283 fn=$binexp
6284 fn=d+~
6285 rp='Where do you want to put the public architecture-dependent libraries?'
6286 . ./getfile
6287 prefixvar=archlib
6288 . ./setprefixvar
6289 if $test X"$archlib" = X"$privlib"; then
6290         d_archlib="$undef"
6291 else
6292         d_archlib="$define"
6293 fi
6294
6295 : see if setuid scripts can be secure
6296 $cat <<EOM
6297
6298 Some kernels have a bug that prevents setuid #! scripts from being
6299 secure.  Some sites have disabled setuid #! scripts because of this.
6300
6301 First let's decide if your kernel supports secure setuid #! scripts.
6302 (If setuid #! scripts would be secure but have been disabled anyway,
6303 don't say that they are secure if asked.)
6304
6305 EOM
6306
6307 val="$undef"
6308 if $test -d /dev/fd; then
6309         echo "#!$ls" >reflect
6310         chmod +x,u+s reflect
6311         ./reflect >flect 2>&1
6312         if $contains "/dev/fd" flect >/dev/null; then
6313                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6314                 val="$define"
6315         else
6316                 $cat <<EOM
6317 If you are not sure if they are secure, I can check but I'll need a
6318 username and password different from the one you are using right now.
6319 If you don't have such a username or don't want me to test, simply
6320 enter 'none'.
6321
6322 EOM
6323                 rp='Other username to test security of setuid scripts with?'
6324                 dflt='none'
6325                 . ./myread
6326                 case "$ans" in
6327                 n|none)
6328                         case "$d_suidsafe" in
6329                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6330                                 dflt=n;;
6331                         "$undef")
6332                                 echo "Well, the $hint value is *not* secure." >&4
6333                                 dflt=n;;
6334                         *)      echo "Well, the $hint value *is* secure." >&4
6335                                 dflt=y;;
6336                         esac
6337                         ;;
6338                 *)
6339                         $rm -f reflect flect
6340                         echo "#!$ls" >reflect
6341                         chmod +x,u+s reflect
6342                         echo >flect
6343                         chmod a+w flect
6344                         echo '"su" will (probably) prompt you for '"$ans's password."
6345                         su $ans -c './reflect >flect'
6346                         if $contains "/dev/fd" flect >/dev/null; then
6347                                 echo "Okay, it looks like setuid scripts are secure." >&4
6348                                 dflt=y
6349                         else
6350                                 echo "I don't think setuid scripts are secure." >&4
6351                                 dflt=n
6352                         fi
6353                         ;;
6354                 esac
6355                 rp='Does your kernel have *secure* setuid scripts?'
6356                 . ./myread
6357                 case "$ans" in
6358                 [yY]*)  val="$define";;
6359                 *)      val="$undef";;
6360                 esac
6361         fi
6362 else
6363         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6364         echo "(That's for file descriptors, not floppy disks.)"
6365         val="$undef"
6366 fi
6367 set d_suidsafe
6368 eval $setvar
6369
6370 $rm -f reflect flect
6371
6372 : now see if they want to do setuid emulation
6373 if $test $patchlevel -lt 11; then
6374 echo " "
6375 val="$undef"
6376 case "$d_suidsafe" in
6377 "$define")
6378         val="$undef"
6379         echo "No need to emulate SUID scripts since they are secure here." >&4
6380         ;;
6381 *)
6382         $cat <<EOM
6383 Some systems have disabled setuid scripts, especially systems where
6384 setuid scripts cannot be secure.  On systems where setuid scripts have
6385 been disabled, the setuid/setgid bits on scripts are currently
6386 useless.  It is possible for $package to detect those bits and emulate
6387 setuid/setgid in a secure fashion.  This emulation will only work if
6388 setuid scripts have been disabled in your kernel.
6389
6390 EOM
6391         case "$d_dosuid" in
6392         "$define") dflt=y ;;
6393         *) dflt=n ;;
6394         esac
6395         rp="Do you want to do setuid/setgid emulation?"
6396         . ./myread
6397         case "$ans" in
6398         [yY]*)  val="$define";;
6399         *)      val="$undef";;
6400         esac
6401         ;;
6402 esac
6403 set d_dosuid
6404 eval $setvar
6405 else
6406     case "$d_dosuid" in
6407         "$define")
6408         cat >&4 <<EOH
6409
6410 SUID emulation has been removed for 5.12
6411 Please re-run Configure without -Dd_dosuid
6412
6413 EOH
6414         exit 1;
6415         ;;
6416     esac
6417     d_dosuid=undef
6418 fi
6419
6420 : Find perl5.005 or later.
6421 echo "Looking for a previously installed perl5.005 or later... "
6422 case "$perl5" in
6423 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6424                 : Check if this perl is recent and can load a simple module
6425                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6426                         perl5=$tdir/perl
6427                         break;
6428                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6429                         perl5=$tdir/perl5
6430                         break;
6431                 fi
6432         done
6433         ;;
6434 *)      perl5="$perl5"
6435         ;;
6436 esac
6437 case "$perl5" in
6438 '')     echo "None found.  That's ok.";;
6439 *)      echo "Using $perl5." ;;
6440 esac
6441
6442 : Set the siteprefix variables
6443 $cat <<EOM
6444
6445 After $package is installed, you may wish to install various
6446 add-on modules and utilities.  Typically, these add-ons will
6447 be installed under $prefix with the rest
6448 of this package.  However, you may wish to install such add-ons
6449 elsewhere under a different prefix.
6450
6451 If you do not wish to put everything under a single prefix, that's
6452 ok.  You will be prompted for the individual locations; this siteprefix
6453 is only used to suggest the defaults.
6454
6455 The default should be fine for most people.
6456
6457 EOM
6458 fn=d~+
6459 rp='Installation prefix to use for add-on modules and utilities?'
6460 : XXX Here might be another good place for an installstyle setting.
6461 case "$siteprefix" in
6462 '') dflt=$prefix ;;
6463 *)  dflt=$siteprefix ;;
6464 esac
6465 . ./getfile
6466 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6467 oldsiteprefix=''
6468 case "$siteprefix" in
6469 '') ;;
6470 *)      case "$ans" in
6471         "$prefix") ;;
6472         *) oldsiteprefix="$prefix";;
6473         esac
6474         ;;
6475 esac
6476 siteprefix="$ans"
6477 siteprefixexp="$ansexp"
6478
6479 : determine where site specific libraries go.
6480 : Usual default is /usr/local/lib/perl5/site_perl/$version
6481 : The default "style" setting is made in installstyle.U
6482 : XXX No longer works with Prefixit stuff.
6483 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6484 case "$sitelib" in
6485 '') case "$installstyle" in
6486         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6487         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6488         esac
6489         ;;
6490 *)      dflt="$sitelib"
6491         ;;
6492 esac
6493 $cat <<EOM
6494
6495 The installation process will create a directory for
6496 site-specific extensions and modules.  Most users find it convenient
6497 to place all site-specific files in this directory rather than in the
6498 main distribution directory.
6499
6500 EOM
6501 fn=d~+
6502 rp='Pathname for the site-specific library files?'
6503 . ./getfile
6504 prefixvar=sitelib
6505 . ./setprefixvar
6506 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6507
6508 : Determine list of previous versions to include in @INC
6509 $cat > getverlist <<EOPL
6510 #!$perl5 -w
6511 use File::Basename;
6512 \$api_versionstring = "$api_versionstring";
6513 \$version = "$version";
6514 \$stem = "$sitelib_stem";
6515 \$archname = "$archname";
6516 EOPL
6517         $cat >> getverlist <<'EOPL'
6518 # The list found is store twice for each entry: the original name, and
6519 # the binary broken down version as pack "sss", so sorting is easy and
6520 # unambiguous. This will work for all versions that have a maximum of
6521 # three digit groups, separate by '.'s or '_'s. Names are extended with
6522 # ".0.0" to ensure at least three elements for the pack.
6523 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6524
6525 # Can't have leading @ because metaconfig interprets it as a command!
6526 ;@inc_version_list=();
6527 # XXX Redo to do opendir/readdir?
6528 if (-d $stem) {
6529     chdir($stem);
6530     ;@candidates = map {
6531         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6532 }
6533 else {
6534     ;@candidates = ();
6535 }
6536
6537 ($pversion, $aversion, $vsn5005) = map {
6538     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6539 foreach $d (@candidates) {
6540     if ($d->[1] lt $pversion) {
6541         if ($d->[1] ge $aversion) {
6542             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6543         }
6544         elsif ($d->[1] ge $vsn5005) {
6545             unshift(@inc_version_list, grep { -d } $d->[0]);
6546         }
6547     }
6548     else {
6549         # Skip newer version.  I.e. don't look in
6550         # 5.7.0 if we're installing 5.6.1.
6551     }
6552 }
6553
6554 if (@inc_version_list) {
6555     print join(' ', @inc_version_list);
6556 }
6557 else {
6558     # Blank space to preserve value for next Configure run.
6559     print " ";
6560 }
6561 EOPL
6562 chmod +x getverlist
6563 case "$inc_version_list" in
6564 '')     if test -x "$perl5$exe_ext"; then
6565                 dflt=`$perl5 getverlist`
6566         else
6567                 dflt='none'
6568         fi
6569         ;;
6570 $undef) dflt='none' ;;
6571 *)  eval dflt=\"$inc_version_list\" ;;
6572 esac
6573 case "$dflt" in
6574 ''|' ') dflt=none ;;
6575 esac
6576 case "$dflt" in
6577 5.005) dflt=none ;;
6578 esac
6579 $cat <<EOM
6580
6581 In order to ease the process of upgrading, this version of perl
6582 can be configured to use modules built and installed with earlier
6583 versions of perl that were installed under $prefix.  Specify here
6584 the list of earlier versions that this version of perl should check.
6585 If Configure detected no earlier versions of perl installed under
6586 $prefix, then the list will be empty.  Answer 'none' to tell perl
6587 to not search earlier versions.
6588
6589 The default should almost always be sensible, so if you're not sure,
6590 just accept the default.
6591 EOM
6592
6593 rp='List of earlier versions to include in @INC?'
6594 . ./myread
6595 case "$ans" in
6596 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6597 *) inc_version_list="$ans" ;;
6598 esac
6599 case "$inc_version_list" in
6600 ''|' ')
6601         inc_version_list_init='0'
6602         d_inc_version_list="$undef"
6603         ;;
6604 *)      inc_version_list_init=`echo $inc_version_list |
6605                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6606         d_inc_version_list="$define"
6607         ;;
6608 esac
6609 $rm -f getverlist
6610
6611 : see if malloc/malloc.h has to be included
6612 set malloc/malloc.h i_mallocmalloc
6613 eval $inhdr
6614
6615 : see if this is a malloc.h system
6616 : we want a real compile instead of Inhdr because some systems have a
6617 : malloc.h that just gives a compile error saying to use stdlib.h instead
6618 echo " "
6619 $cat >try.c <<EOCP
6620 #include <stdlib.h>
6621 #include <malloc.h>
6622 #$i_mallocmalloc I_MALLOCMALLOC
6623 #ifdef I_MALLOCMALLOC
6624 # include <malloc/malloc.h>
6625 #endif
6626
6627 int main () { return 0; }
6628 EOCP
6629 set try
6630 if eval $compile; then
6631     echo "<malloc.h> found." >&4
6632     val="$define"
6633 else
6634     echo "<malloc.h> NOT found." >&4
6635     val="$undef"
6636 fi
6637 $rm_try
6638 set i_malloc
6639 eval $setvar
6640
6641 : check for void type
6642 echo " "
6643 echo "Checking to see how well your C compiler groks the void type..." >&4
6644 case "$voidflags" in
6645 '')
6646         $cat >try.c <<EOCP
6647 #$i_stdlib I_STDLIB
6648 #ifdef I_STDLIB
6649 #include <stdlib.h>
6650 #endif
6651 #if TRY & 1
6652 void sub() {
6653 #else
6654 sub() {
6655 #endif
6656         extern void moo();      /* function returning void */
6657         void (*goo)();          /* ptr to func returning void */
6658 #if TRY & 8
6659         void *hue;              /* generic ptr */
6660 #endif
6661 #if TRY & 2
6662         void (*foo[10])();
6663 #endif
6664
6665 #if TRY & 4
6666         if(goo == moo) {
6667                 exit(0);
6668         }
6669 #endif
6670         exit(0);
6671 }
6672 int main() { sub(); }
6673 EOCP
6674         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6675                 voidflags=$defvoidused
6676         echo "Good.  It appears to support void to the level $package wants.">&4
6677                 if $contains warning .out >/dev/null 2>&1; then
6678                         echo "However, you might get some warnings that look like this:"
6679                         $cat .out
6680                 fi
6681         else
6682 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6683                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6684                         echo "It supports 1..."
6685                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6686                                 echo "It also supports 2..."
6687                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6688                                         voidflags=7
6689                                         echo "And it supports 4 but not 8 definitely."
6690                                 else
6691                                         echo "It doesn't support 4..."
6692                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6693                                                 voidflags=11
6694                                                 echo "But it supports 8."
6695                                         else
6696                                                 voidflags=3
6697                                                 echo "Neither does it support 8."
6698                                         fi
6699                                 fi
6700                         else
6701                                 echo "It does not support 2..."
6702                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6703                                         voidflags=13
6704                                         echo "But it supports 4 and 8."
6705                                 else
6706                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6707                                                 voidflags=5
6708                                                 echo "And it supports 4 but has not heard about 8."
6709                                         else
6710                                                 echo "However it supports 8 but not 4."
6711                                         fi
6712                                 fi
6713                         fi
6714                 else
6715                         echo "There is no support at all for void."
6716                         voidflags=0
6717                 fi
6718         fi
6719 esac
6720 case "$voidflags" in
6721 "$defvoidused") ;;
6722 *)      $cat >&4 <<'EOM'
6723   Support flag bits are:
6724     1: basic void declarations.
6725     2: arrays of pointers to functions returning void.
6726     4: operations between pointers to and addresses of void functions.
6727     8: generic void pointers.
6728 EOM
6729         dflt="$voidflags";
6730         rp="Your void support flags add up to what?"
6731         . ./myread
6732         voidflags="$ans"
6733         ;;
6734 esac
6735 $rm_try
6736
6737 : check for length of pointer
6738 echo " "
6739 case "$ptrsize" in
6740 '')
6741         echo "Checking to see how big your pointers are..." >&4
6742         if test "$voidflags" -gt 7; then
6743                 echo '#define VOID_PTR char *' > try.c
6744         else
6745                 echo '#define VOID_PTR void *' > try.c
6746         fi
6747         $cat >>try.c <<EOCP
6748 #include <stdio.h>
6749 #$i_stdlib I_STDLIB
6750 #ifdef I_STDLIB
6751 #include <stdlib.h>
6752 #endif
6753 int main()
6754 {
6755     printf("%d\n", (int)sizeof(VOID_PTR));
6756     exit(0);
6757 }
6758 EOCP
6759         set try
6760         if eval $compile_ok; then
6761                 ptrsize=`$run ./try`
6762                 echo "Your pointers are $ptrsize bytes long."
6763         else
6764                 dflt='4'
6765                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6766                 rp="What is the size of a pointer (in bytes)?"
6767                 . ./myread
6768                 ptrsize="$ans"
6769         fi
6770         ;;
6771 esac
6772 $rm_try
6773 case "$use64bitall" in
6774 "$define"|true|[yY]*)
6775         case "$ptrsize" in
6776         4)      cat <<EOM >&4
6777
6778 *** You have chosen a maximally 64-bit build,
6779 *** but your pointers are only 4 bytes wide.
6780 *** Please rerun Configure without -Duse64bitall.
6781 EOM
6782                 case "$d_quad" in
6783                 define)
6784                         cat <<EOM >&4
6785 *** Since you have quads, you could possibly try with -Duse64bitint.
6786 EOM
6787                         ;;
6788                 esac
6789                 cat <<EOM >&4
6790 *** Cannot continue, aborting.
6791
6792 EOM
6793
6794                 exit 1
6795                 ;;
6796         esac
6797         ;;
6798 esac
6799
6800
6801 : determine whether to use malloc wrapping
6802 echo " "
6803 case "$usemallocwrap" in
6804 [yY]*|true|$define)     dflt='y' ;;
6805 [nN]*|false|$undef)     dflt='n' ;;
6806 *)      case "$usedevel" in
6807         [yY]*|true|$define)     dflt='y' ;;
6808         *) dflt='n' ;;
6809         esac
6810         ;;
6811 esac
6812 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6813 . ./myread
6814 usemallocwrap="$ans"
6815 case "$ans" in
6816 y*|true)
6817         usemallocwrap="$define" ;;
6818 *)
6819         usemallocwrap="$undef" ;;
6820 esac
6821
6822 : determine which malloc to compile in
6823 echo " "
6824 case "$usemymalloc" in
6825 [yY]*|true|$define)     dflt='y' ;;
6826 [nN]*|false|$undef)     dflt='n' ;;
6827 *)      case "$ptrsize" in
6828         4) dflt='y' ;;
6829         *) dflt='n' ;;
6830         esac
6831         ;;
6832 esac
6833 rp="Do you wish to attempt to use the malloc that comes with $package?"
6834 . ./myread
6835 usemymalloc="$ans"
6836 case "$ans" in
6837 y*|true)
6838         usemymalloc='y'
6839         mallocsrc='malloc.c'
6840         mallocobj="malloc$_o"
6841         d_mymalloc="$define"
6842         case "$libs" in
6843         *-lmalloc*)
6844                 : Remove malloc from list of libraries to use
6845                 echo "Removing unneeded -lmalloc from library list" >&4
6846                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6847                 shift
6848                 libs="$*"
6849                 echo "libs = $libs" >&4
6850                 ;;
6851         esac
6852         ;;
6853 *)
6854         usemymalloc='n'
6855         mallocsrc=''
6856         mallocobj=''
6857         d_mymalloc="$undef"
6858         ;;
6859 esac
6860
6861 : compute the return types of malloc and free
6862 echo " "
6863 $cat >malloc.c <<END
6864 #$i_malloc I_MALLOC
6865 #$i_stdlib I_STDLIB
6866 #include <stdio.h>
6867 #include <sys/types.h>
6868 #ifdef I_MALLOC
6869 #include <malloc.h>
6870 #endif
6871 #ifdef I_STDLIB
6872 #include <stdlib.h>
6873 #endif
6874 #ifdef TRY_MALLOC
6875 void *malloc();
6876 #endif
6877 #ifdef TRY_FREE
6878 void free();
6879 #endif
6880 END
6881 case "$malloctype" in
6882 '')
6883         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6884                 malloctype='void *'
6885         else
6886                 malloctype='char *'
6887         fi
6888         ;;
6889 esac
6890 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6891
6892 case "$freetype" in
6893 '')
6894         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6895                 freetype='void'
6896         else
6897                 freetype='int'
6898         fi
6899         ;;
6900 esac
6901 echo "Your system uses $freetype free(), it would seem." >&4
6902 $rm -f malloc.[co]
6903 : determine where site specific architecture-dependent libraries go.
6904 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6905 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6906 : sitelib may have an optional trailing /share.
6907 case "$sitearch" in
6908 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6909         dflt="$dflt/$archname"
6910         ;;
6911 *)      dflt="$sitearch"
6912         ;;
6913 esac
6914 set sitearch sitearch none
6915 eval $prefixit
6916 $cat <<EOM
6917
6918 The installation process will also create a directory for
6919 architecture-dependent site-specific extensions and modules.
6920
6921 EOM
6922 fn=d~+
6923 rp='Pathname for the site-specific architecture-dependent library files?'
6924 . ./getfile
6925 prefixvar=sitearch
6926 . ./setprefixvar
6927 if $test X"$sitearch" = X"$sitelib"; then
6928         d_sitearch="$undef"
6929 else
6930         d_sitearch="$define"
6931 fi
6932
6933 : Set the vendorprefix variables
6934 $cat <<EOM
6935
6936 The installation process will also create a directory for
6937 vendor-supplied add-ons.  Vendors who supply perl with their system
6938 may find it convenient to place all vendor-supplied files in this
6939 directory rather than in the main distribution directory.  This will
6940 ease upgrades between binary-compatible maintenance versions of perl.
6941
6942 Of course you may also use these directories in whatever way you see
6943 fit.  For example, you might use them to access modules shared over a
6944 company-wide network.
6945
6946 The default answer should be fine for most people.
6947 This causes further questions about vendor add-ons to be skipped
6948 and no vendor-specific directories will be configured for perl.
6949
6950 EOM
6951 rp='Do you want to configure vendor-specific add-on directories?'
6952 case "$usevendorprefix" in
6953 define|true|[yY]*) dflt=y ;;
6954 *)      : User may have set vendorprefix directly on Configure command line.
6955         case "$vendorprefix" in
6956         ''|' ') dflt=n ;;
6957         *)      dflt=y ;;
6958         esac
6959         ;;
6960 esac
6961 . ./myread
6962 case "$ans" in
6963 [yY]*)  fn=d~+
6964         rp='Installation prefix to use for vendor-supplied add-ons?'
6965         case "$vendorprefix" in
6966         '') dflt='' ;;
6967         *)  dflt=$vendorprefix ;;
6968         esac
6969         . ./getfile
6970         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6971         oldvendorprefix=''
6972         case "$vendorprefix" in
6973         '') ;;
6974         *)      case "$ans" in
6975                 "$prefix") ;;
6976                 *) oldvendorprefix="$prefix";;
6977                 esac
6978                 ;;
6979         esac
6980         usevendorprefix="$define"
6981         vendorprefix="$ans"
6982         vendorprefixexp="$ansexp"
6983         ;;
6984 *)      usevendorprefix="$undef"
6985         vendorprefix=''
6986         vendorprefixexp=''
6987         ;;
6988 esac
6989
6990 : Set the vendorlib variables
6991 case "$vendorprefix" in
6992 '')     d_vendorlib="$undef"
6993         vendorlib=''
6994         vendorlibexp=''
6995         ;;
6996 *)      d_vendorlib="$define"
6997         : determine where vendor-supplied modules go.
6998         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6999         case "$vendorlib" in
7000         '')
7001                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7002                 case "$installstyle" in
7003                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7004                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7005                 esac
7006                 ;;
7007         *)      dflt="$vendorlib"
7008                 ;;
7009         esac
7010         fn=d~+
7011         rp='Pathname for the vendor-supplied library files?'
7012         . ./getfile
7013         vendorlib="$ans"
7014         vendorlibexp="$ansexp"
7015         ;;
7016 esac
7017 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7018 prefixvar=vendorlib
7019 . ./installprefix
7020
7021 : Set the vendorarch variables
7022 case "$vendorprefix" in
7023 '')     d_vendorarch="$undef"
7024         vendorarch=''
7025         vendorarchexp=''
7026         ;;
7027 *)      d_vendorarch="$define"
7028         : determine where vendor-supplied architecture-dependent libraries go.
7029         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7030         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7031         : vendorlib may have an optional trailing /share.
7032         case "$vendorarch" in
7033         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7034                 dflt="$dflt/$archname"
7035                 ;;
7036         *)      dflt="$vendorarch" ;;
7037         esac
7038         fn=d~+
7039         rp='Pathname for vendor-supplied architecture-dependent files?'
7040         . ./getfile
7041         vendorarch="$ans"
7042         vendorarchexp="$ansexp"
7043         ;;
7044 esac
7045 prefixvar=vendorarch
7046 . ./installprefix
7047 if $test X"$vendorarch" = X"$vendorlib"; then
7048         d_vendorarch="$undef"
7049 else
7050         d_vendorarch="$define"
7051 fi
7052
7053 : Final catch-all directories to search
7054 $cat <<EOM
7055
7056 Lastly, you can have perl look in other directories for extensions and
7057 modules in addition to those already specified.
7058 These directories will be searched after 
7059         $sitearch 
7060         $sitelib 
7061 EOM
7062 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7063 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7064 echo ' '
7065 case "$otherlibdirs" in
7066 ''|' ') dflt='none' ;;
7067 *)      dflt="$otherlibdirs" ;;
7068 esac
7069 $cat <<EOM
7070 Enter a colon-separated set of extra paths to include in perl's @INC
7071 search path, or enter 'none' for no extra paths.
7072
7073 EOM
7074
7075 rp='Colon-separated list of additional directories for perl to search?'
7076 . ./myread
7077 case "$ans" in
7078 ' '|''|none)    otherlibdirs=' ' ;;     
7079 *)      otherlibdirs="$ans" ;;
7080 esac
7081 case "$otherlibdirs" in
7082 ' ') val=$undef ;;
7083 *)      val=$define ;;
7084 esac
7085 set d_perl_otherlibdirs
7086 eval $setvar
7087
7088 : Cruising for prototypes
7089 echo " "
7090 echo "Checking out function prototypes..." >&4
7091 $cat >prototype.c <<EOCP
7092 #$i_stdlib I_STDLIB
7093 #ifdef I_STDLIB
7094 #include <stdlib.h>
7095 #endif
7096 int main(int argc, char *argv[]) {
7097         exit(0);}
7098 EOCP
7099 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7100         echo "Your C compiler appears to support function prototypes."
7101         val="$define"
7102 else
7103         echo "Your C compiler doesn't seem to understand function prototypes."
7104         val="$undef"
7105 fi
7106 set prototype
7107 eval $setvar
7108 $rm -f prototype*
7109
7110 : Check if ansi2knr is required
7111 case "$prototype" in
7112 "$define") ;;
7113 *)      ansi2knr='ansi2knr'
7114         echo " "
7115         cat <<EOM >&4
7116
7117 $me:  FATAL ERROR:
7118 This version of $package can only be compiled by a compiler that 
7119 understands function prototypes.  Unfortunately, your C compiler 
7120         $cc $ccflags
7121 doesn't seem to understand them.  Sorry about that.
7122
7123 If GNU cc is available for your system, perhaps you could try that instead.  
7124
7125 Eventually, we hope to support building Perl with pre-ANSI compilers.
7126 If you would like to help in that effort, please contact <perlbug@perl.org>.
7127
7128 Aborting Configure now.
7129 EOM
7130         exit 2
7131         ;;
7132 esac
7133
7134 : DTrace support
7135 dflt_dtrace='/usr/sbin/dtrace'
7136 cat <<EOM
7137
7138 Perl can be built to support DTrace on platforms that support it.
7139 DTrace is a diagnosis and performance analysis tool from Sun.
7140
7141 If this doesn't make any sense to you, just accept the default '$dflt'.
7142 EOM
7143
7144 while $test 1 ; do
7145         case "$usedtrace" in
7146         $define|true|[yY]*)
7147                 dflt='y'
7148                 ;;
7149         ?*)
7150                 dflt='y'
7151                 dflt_dtrace=$usedtrace
7152                 ;;
7153         *)
7154                 dflt='n'
7155                 ;;
7156         esac
7157
7158         rp='Support DTrace if available?'
7159         . ./myread
7160         case "$ans" in
7161         y|Y)    val="$define" ;;
7162         *)      val="$undef" ;;
7163         esac
7164         set usedtrace
7165         eval $setvar
7166
7167         test "X$usedtrace" != "X$define" && break
7168
7169         echo " "
7170         rp='Where is the dtrace executable?'
7171         dflt=$dflt_dtrace
7172         . ./getfile
7173         val="$ans"
7174         set dtrace
7175         eval $setvar
7176
7177         if $test -f $dtrace
7178         then
7179                 if $dtrace -h -s ../perldtrace.d \
7180                         -o perldtrace.tmp >/dev/null 2>&1 \
7181                         && rm -f perldtrace.tmp
7182                 then
7183                         echo " "
7184                         echo "Good: your $dtrace knows about the -h flag."
7185                 else
7186                         cat >&2 <<EOM
7187
7188 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7189 ***
7190 *** Your installed dtrace doesn't support the -h switch to compile a D
7191 *** program into a C header. Can't continue.
7192
7193 EOM
7194                         exit 1
7195                 fi
7196                 break;
7197         fi
7198
7199         case "$fastread" in
7200         yes)
7201                 cat >&2 <<EOM
7202
7203 *** $me:  Fatal Error:  $dtrace not found.
7204 *** Can't continue.
7205
7206 EOM
7207                 exit 1
7208                 ;;
7209         *)
7210                 echo "*** $dtrace was not found."
7211                 echo " "
7212                 ;;
7213         esac
7214 done
7215
7216 : See if we want extra modules installed
7217 echo " "
7218 case "$extras" in
7219 '') dflt='n';;
7220 *) dflt='y';;
7221 esac
7222 cat <<EOM
7223 Perl can be built with extra modules or bundles of modules which
7224 will be fetched from the CPAN and installed alongside Perl.
7225
7226 Notice that you will need access to the CPAN; either via the Internet,
7227 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7228 be asked later to configure the CPAN.pm module which will in turn do
7229 the installation of the rest of the extra modules or bundles.)
7230
7231 Notice also that if the modules require any external software such as
7232 libraries and headers (the libz library and the zlib.h header for the
7233 Compress::Zlib module, for example) you MUST have any such software
7234 already installed, this configuration process will NOT install such
7235 things for you.
7236
7237 If this doesn't make any sense to you, just accept the default '$dflt'.
7238 EOM
7239 rp='Install any extra modules (y or n)?'
7240 . ./myread
7241 case "$ans" in
7242 y|Y)
7243         cat <<EOM
7244
7245 Please list any extra modules or bundles to be installed from CPAN,
7246 with spaces between the names.  The names can be in any format the
7247 'install' command of CPAN.pm will understand.  (Answer 'none',
7248 without the quotes, to install no extra modules or bundles.)
7249 EOM
7250         rp='Extras?'
7251         dflt="$extras"
7252         . ./myread
7253         extras="$ans"
7254 esac
7255 case "$extras" in
7256 ''|'none')
7257         val=''
7258         $rm -f ../extras.lst
7259         ;;
7260 *)      echo "(Saving the list of extras for later...)"
7261         echo "$extras" > ../extras.lst
7262         val="'$extras'"
7263         ;;
7264 esac
7265 set extras
7266 eval $setvar
7267 echo " "
7268
7269 : determine where html pages for programs go
7270 set html1dir html1dir none
7271 eval $prefixit
7272 $cat <<EOM
7273
7274 If you wish to install html files for programs in $spackage, indicate
7275 the appropriate directory here.  To skip installing html files,
7276 answer "none".
7277 EOM
7278 case "$html1dir" in
7279 ''|none|$undef|' ') dflt=none ;;
7280 *) dflt=$html1dir ;;
7281 esac
7282 fn=dn+~
7283 rp="Directory for the main $spackage html pages?"
7284 . ./getfile
7285 prefixvar=html1dir
7286 . ./setprefixvar
7287 : Use ' ' for none so value is preserved next time through Configure
7288 $test X"$html1dir" = "X" && html1dir=' '
7289
7290 : determine where html pages for libraries and modules go
7291 set html3dir html3dir none
7292 eval $prefixit
7293 $cat <<EOM
7294
7295 If you wish to install html files for modules associated with $spackage,
7296 indicate the appropriate directory here.  To skip installing html files,
7297 answer "none".
7298 EOM
7299 : There is no obvious default.  If they have specified html1dir, then
7300 : try to key off that, possibly changing .../html1 into .../html3.
7301 case "$html3dir" in
7302 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7303 *) dflt=$html3dir ;;
7304 esac
7305 fn=dn+~
7306 rp="Directory for the $spackage module html pages?"
7307 . ./getfile
7308 prefixvar=html3dir
7309 . ./setprefixvar
7310 : Use ' ' for none so value is preserved next time through Configure
7311 $test X"$html3dir" = "X" && html3dir=' '
7312
7313 : determine whether to install perl also as /usr/bin/perl
7314
7315 echo " "
7316 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7317         $cat <<EOM
7318 Many scripts expect perl to be installed as /usr/bin/perl.
7319
7320 If you want to, I can install the perl you are about to compile
7321 as /usr/bin/perl (in addition to $bin/perl).
7322 EOM
7323         if test -f /usr/bin/perl; then
7324             $cat <<EOM
7325
7326 However, please note that because you already have a /usr/bin/perl,
7327 overwriting that with a new Perl would very probably cause problems.
7328 Therefore I'm assuming you don't want to do that (unless you insist).
7329
7330 EOM
7331             case "$installusrbinperl" in
7332             "$define"|[yY]*)    dflt='y';;
7333             *)                  dflt='n';;
7334             esac
7335         else
7336             $cat <<EOM
7337
7338 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7339
7340 EOM
7341             case "$installusrbinperl" in
7342             "$undef"|[nN]*)     dflt='n';;
7343             *)                  dflt='y';;
7344             esac
7345         fi
7346         rp="Do you want to install perl as /usr/bin/perl?"
7347         . ./myread
7348         case "$ans" in
7349         [yY]*)  val="$define";;
7350         *)      val="$undef" ;;
7351         esac
7352 else
7353         val="$undef"
7354 fi
7355 set installusrbinperl
7356 eval $setvar
7357
7358 : Check if we are using the GNU C library
7359 echo " "
7360 echo "Checking for GNU C Library..." >&4
7361 cat >try.c <<'EOCP'
7362 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7363    alone are insufficient to distinguish different versions, such as
7364    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7365    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7366 */
7367 #include <stdio.h>
7368 int main(void)
7369 {
7370 #ifdef __GLIBC__
7371 #   ifdef __GLIBC_MINOR__
7372 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7373 #           include <gnu/libc-version.h>
7374             printf("%s\n",  gnu_get_libc_version());
7375 #       else
7376             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7377 #       endif
7378 #   else
7379         printf("%d\n",  __GLIBC__);
7380 #   endif
7381     return 0;
7382 #else
7383     return 1;
7384 #endif
7385 }
7386 EOCP
7387 set try
7388 if eval $compile_ok && $run ./try > glibc.ver; then
7389         val="$define"
7390         gnulibc_version=`$cat glibc.ver`
7391         echo "You are using the GNU C Library version $gnulibc_version"
7392 else
7393         val="$undef"
7394         gnulibc_version=''
7395         echo "You are not using the GNU C Library"
7396 fi
7397 $rm_try glibc.ver
7398 set d_gnulibc
7399 eval $setvar
7400
7401 : see if nm is to be used to determine whether a symbol is defined or not
7402 case "$usenm" in
7403 '')
7404         dflt=''
7405         case "$d_gnulibc" in
7406         "$define")
7407                 echo " "
7408                 echo "nm probably won't work on the GNU C Library." >&4
7409                 dflt=n
7410                 ;;
7411         esac
7412         case "$dflt" in
7413         '') 
7414                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7415                         echo " "
7416                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7417                         echo "'nm' won't be sufficient on this sytem." >&4
7418                         dflt=n
7419                 fi
7420                 ;;
7421         esac
7422         case "$dflt" in
7423         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7424                 if $test $dflt -gt 20; then
7425                         dflt=y
7426                 else
7427                         dflt=n
7428                 fi
7429                 ;;
7430         esac
7431         ;;
7432 *)
7433         case "$usenm" in
7434         true|$define) dflt=y;;
7435         *) dflt=n;;
7436         esac
7437         ;;
7438 esac
7439 $cat <<EOM
7440
7441 I can use $nm to extract the symbols from your C libraries. This
7442 is a time consuming task which may generate huge output on the disk (up
7443 to 3 megabytes) but that should make the symbols extraction faster. The
7444 alternative is to skip the 'nm' extraction part and to compile a small
7445 test program instead to determine whether each symbol is present. If
7446 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7447 this may be the best solution.
7448
7449 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7450
7451 EOM
7452 rp="Shall I use $nm to extract C symbols from the libraries?"
7453 . ./myread
7454 case "$ans" in
7455 [Nn]*) usenm=false;;
7456 *) usenm=true;;
7457 esac
7458
7459 runnm=$usenm
7460 case "$reuseval" in
7461 true) runnm=false;;
7462 esac
7463
7464 : nm options which may be necessary
7465 case "$nm_opt" in
7466 '') if $test -f /mach_boot; then
7467                 nm_opt=''       # Mach
7468         elif $test -d /usr/ccs/lib; then
7469                 nm_opt='-p'     # Solaris (and SunOS?)
7470         elif $test -f /dgux; then
7471                 nm_opt='-p'     # DG-UX
7472         elif $test -f /lib64/rld; then
7473                 nm_opt='-p'     # 64-bit Irix
7474         else
7475                 nm_opt=''
7476         fi;;
7477 esac
7478
7479 : nm options which may be necessary for shared libraries but illegal
7480 : for archive libraries.  Thank you, Linux.
7481 case "$nm_so_opt" in
7482 '')     case "$myuname" in
7483         *linux*|gnu*)
7484                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7485                         nm_so_opt='--dynamic'
7486                 fi
7487                 ;;
7488         esac
7489         ;;
7490 esac
7491
7492 : Figure out where the libc is located
7493 case "$runnm" in
7494 true)
7495 : get list of predefined functions in a handy place
7496 echo " "
7497 case "$libc" in
7498 '') libc=unknown
7499         case "$libs" in
7500         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7501         esac
7502         ;;
7503 esac
7504 case "$libs" in
7505 '') ;;
7506 *)  for thislib in $libs; do
7507         case "$thislib" in
7508         -lc|-lc_s)
7509                 : Handle C library specially below.
7510                 ;;
7511         -l*)
7512                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7513                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7514                         :
7515                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7516                         :
7517                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7518                         :
7519                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7520                         :
7521                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7522                         :
7523                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7524                         :
7525                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7526                         :
7527                 else
7528                         try=''
7529                 fi
7530                 libnames="$libnames $try"
7531                 ;;
7532         *) libnames="$libnames $thislib" ;;
7533         esac
7534         done
7535         ;;
7536 esac
7537 xxx=normal
7538 case "$libc" in
7539 unknown)
7540         set /lib/libc.$so
7541         for xxx in $libpth; do
7542                 $test -r $1 || set $xxx/libc.$so
7543                 : The messy sed command sorts on library version numbers.
7544                 $test -r $1 || \
7545                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7546                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7547                                 h
7548                                 s/[0-9][0-9]*/0000&/g
7549                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7550                                 G
7551                                 s/\n/ /' | \
7552                          $sort | $sed -e 's/^.* //'`
7553                 eval set \$$#
7554         done
7555         $test -r $1 || set /usr/ccs/lib/libc.$so
7556         $test -r $1 || set /lib/libsys_s$_a
7557         ;;
7558 *)
7559         set blurfl
7560         ;;
7561 esac
7562 if $test -r "$1"; then
7563         echo "Your (shared) C library seems to be in $1."
7564         libc="$1"
7565 elif $test -r /lib/libc && $test -r /lib/clib; then
7566         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7567         xxx=apollo
7568         libc='/lib/clib /lib/libc'
7569         if $test -r /lib/syslib; then
7570                 echo "(Your math library is in /lib/syslib.)"
7571                 libc="$libc /lib/syslib"
7572         fi
7573 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7574         echo "Your C library seems to be in $libc, as you said before."
7575 elif $test -r $incpath/usr/lib/libc$_a; then
7576         libc=$incpath/usr/lib/libc$_a;
7577         echo "Your C library seems to be in $libc.  That's fine."
7578 elif $test -r /lib/libc$_a; then
7579         libc=/lib/libc$_a;
7580         echo "Your C library seems to be in $libc.  You're normal."
7581 else
7582         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7583                 :
7584         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7585                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7586         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7587                 :
7588         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7589                 :
7590         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7591                 :
7592         else
7593                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7594         fi
7595         if $test -r "$tans"; then
7596                 echo "Your C library seems to be in $tans, of all places."
7597                 libc=$tans
7598         else
7599                 libc='blurfl'
7600         fi
7601 fi
7602 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7603         dflt="$libc"
7604         cat <<EOM
7605
7606 If the guess above is wrong (which it might be if you're using a strange
7607 compiler, or your machine supports multiple models), you can override it here.
7608
7609 EOM
7610 else
7611         dflt=''
7612         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7613         cat >&4 <<EOM
7614 I can't seem to find your C library.  I've looked in the following places:
7615
7616 EOM
7617         $sed 's/^/      /' libpath
7618         cat <<EOM
7619
7620 None of these seems to contain your C library. I need to get its name...
7621
7622 EOM
7623 fi
7624 fn=f
7625 rp='Where is your C library?'
7626 . ./getfile
7627 libc="$ans"
7628
7629 echo " "
7630 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7631 set X `cat libnames`
7632 shift
7633 xxx=files
7634 case $# in 1) xxx=file; esac
7635 echo "Extracting names from the following $xxx for later perusal:" >&4
7636 echo " "
7637 $sed 's/^/      /' libnames >&4
7638 echo " "
7639 $echo $n "This may take a while...$c" >&4
7640
7641 for file in $*; do
7642         case $file in
7643         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7644         *) $nm $nm_opt $file 2>/dev/null;;
7645         esac
7646 done >libc.tmp
7647
7648 $echo $n ".$c"
7649 $grep fprintf libc.tmp > libc.ptf
7650 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7651 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7652 xxx='[ADTSIW]'
7653 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7678                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7703         eval $xscan;\
7704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705                 eval $xrun
7706 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7707         eval $xscan;\
7708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709                 eval $xrun
7710 else
7711         $nm -p $* 2>/dev/null >libc.tmp
7712         $grep fprintf libc.tmp > libc.ptf
7713         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7714                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7715         then
7716                 nm_opt='-p'
7717                 eval $xrun
7718         else
7719                 echo " "
7720                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7721                 com=''
7722                 if $ar t $libc > libc.tmp && \
7723                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7724                 then
7725                         for thisname in $libnames $libc; do
7726                                 $ar t $thisname >>libc.tmp
7727                         done
7728                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7729                         echo "Ok." >&4
7730                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7731                         for thisname in $libnames $libc; do
7732                                 $ar tv $thisname >>libc.tmp
7733                                 emximp -o tmp.imp $thisname \
7734                                     2>/dev/null && \
7735                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7736                                     < tmp.imp >>libc.tmp
7737                                 $rm -f tmp.imp
7738                         done
7739                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7740                         echo "Ok." >&4
7741                 else
7742                         echo "$ar didn't seem to work right." >&4
7743                         echo "Maybe this is a Cray...trying bld instead..." >&4
7744                         if  bld t $libc | \
7745                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7746                                 $test -s libc.list
7747                         then
7748                                 for thisname in $libnames; do
7749                                         bld t $libnames | \
7750                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7751                                         $ar t $thisname >>libc.tmp
7752                                 done
7753                                 echo "Ok." >&4
7754                         else
7755                                 echo "That didn't work either.  Giving up." >&4
7756                                 exit 1
7757                         fi
7758                 fi
7759         fi
7760 fi
7761 nm_extract="$com"
7762 case "$PASE" in
7763 define)
7764     echo " "
7765     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7766     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7767     ;;
7768 *)  if $test -f /lib/syscalls.exp; then
7769         echo " "
7770         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7771         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7772                 /lib/syscalls.exp >>libc.list
7773     fi
7774     ;;
7775 esac
7776 ;;
7777 esac
7778 $rm -f libnames libpath
7779
7780 : see if dld is available
7781 set dld.h i_dld
7782 eval $inhdr
7783
7784 : Check if we are using C++
7785 echo " "
7786 echo "Checking for C++..." >&4
7787 $cat >try.c <<'EOCP'
7788 #include <stdio.h>
7789 int main(void)
7790 {
7791 #ifdef __cplusplus
7792     return 0;
7793 #else
7794     return 1;
7795 #endif
7796 }
7797 EOCP
7798 set try
7799 if eval $compile_ok && $run ./try; then
7800         val="$define"
7801         echo "You are using a C++ compiler."
7802 else
7803         val="$undef"
7804         echo "You are not using a C++ compiler."
7805 fi
7806 $rm_try cplusplus$$
7807 set d_cplusplus
7808 eval $setvar
7809
7810 : is a C symbol defined?
7811 csym='tlook=$1;
7812 case "$3" in
7813 -v) tf=libc.tmp; tdc="";;
7814 -a) tf=libc.tmp; tdc="[]";;
7815 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7816 esac;
7817 case "$d_cplusplus" in
7818     $define)    extern_C="extern \"C\"" ;;
7819     *)          extern_C="extern"       ;;
7820 esac;
7821 tx=yes;
7822 case "$reuseval-$4" in
7823 true-) ;;
7824 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7825 esac;
7826 case "$tx" in
7827 yes)
7828         tval=false;
7829         if $test "$runnm" = true; then
7830                 if $contains $tlook $tf >/dev/null 2>&1; then
7831                         tval=true;
7832                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7833                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7834                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7835                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7836                         $rm_try;
7837                 fi;
7838         else
7839                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7840                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7841                 $rm_try;
7842         fi;
7843         ;;
7844 *)
7845         case "$tval" in
7846         $define) tval=true;;
7847         *) tval=false;;
7848         esac;
7849         ;;
7850 esac;
7851 eval "$2=$tval"'
7852
7853 : define an is-in-libc? function
7854 inlibc='echo " "; td=$define; tu=$undef;
7855 sym=$1; var=$2; eval "was=\$$2";
7856 tx=yes;
7857 case "$reuseval$was" in
7858 true) ;;
7859 true*) tx=no;;
7860 esac;
7861 case "$tx" in
7862 yes)
7863         set $sym tres -f;
7864         eval $csym;
7865         case "$tres" in
7866         true)
7867                 echo "$sym() found." >&4;
7868                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7869         *)
7870                 echo "$sym() NOT found." >&4;
7871                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7872         esac;;
7873 *)
7874         case "$was" in
7875         $define) echo "$sym() found." >&4;;
7876         *) echo "$sym() NOT found." >&4;;
7877         esac;;
7878 esac'
7879
7880 : see if dlopen exists
7881 xxx_runnm="$runnm"
7882 xxx_ccflags="$ccflags"
7883 runnm=false
7884 : with g++ one needs -shared to get is-in-libc to work for dlopen
7885 case "$gccversion" in
7886 '')     ;;
7887 *)      case "$d_cplusplus" in
7888         "$define") ccflags="$ccflags -shared" ;;
7889         esac
7890         ;;
7891 esac
7892 set dlopen d_dlopen
7893 eval $inlibc
7894 runnm="$xxx_runnm"
7895 ccflags="$xxx_ccflags"
7896
7897 : see if this is a unistd.h system
7898 set unistd.h i_unistd
7899 eval $inhdr
7900
7901 : determine which dynamic loading, if any, to compile in
7902 echo " "
7903 dldir="ext/DynaLoader"
7904 case "$usedl" in
7905 $define|y|true)
7906         dflt='y'
7907         usedl="$define"
7908         ;;
7909 $undef|n|false)
7910         dflt='n'
7911         usedl="$undef"
7912         ;;
7913 *)
7914         dflt='n'
7915         case "$d_dlopen" in
7916             $define) dflt='y' ;;
7917         esac
7918         case "$i_dld" in
7919             $define) dflt='y' ;;
7920         esac
7921         : Does a dl_xxx.xs file exist for this operating system
7922         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7923         ;;
7924 esac
7925 rp="Do you wish to use dynamic loading?"
7926 . ./myread
7927 usedl="$ans"
7928 case "$ans" in
7929 y*) usedl="$define"
7930         case "$dlsrc" in
7931         '')
7932                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7933                         dflt="$dldir/dl_${osname}.xs"
7934                 elif $test "$d_dlopen" = "$define" ; then
7935                         dflt="$dldir/dl_dlopen.xs"
7936                 elif $test "$i_dld" = "$define" ; then
7937                         dflt="$dldir/dl_dld.xs"
7938                 else
7939                         dflt=''
7940                 fi
7941                 ;;
7942         *)      dflt="$dldir/$dlsrc"
7943                 ;;
7944         esac
7945     echo "The following dynamic loading files are available:"
7946         : Can not go over to $dldir because getfile has path hard-coded in.
7947         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7948         rp="Source file to use for dynamic loading"
7949         fn="fne"
7950         gfpth="$src"
7951         . ./getfile
7952         usedl="$define"
7953         : emulate basename
7954         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7955
7956         $cat << EOM
7957
7958 Some systems may require passing special flags to $cc -c to
7959 compile modules that will be used to create a shared library.
7960 To use no flags, say "none".
7961
7962 EOM
7963     case "$cccdlflags" in
7964     '') case "$gccversion" in
7965                 '') case "$osname" in
7966                         hpux)   dflt='+z' ;;
7967                         next)   dflt='none' ;;
7968                         irix*)  dflt='-KPIC' ;;
7969                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7970                         sunos)  dflt='-pic' ;;
7971                         *)      dflt='none' ;;
7972                     esac
7973                         ;;
7974                 *)  case "$osname" in
7975                         darwin) dflt='none' ;;
7976                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7977                         *)      dflt='-fpic' ;;
7978                     esac ;;
7979             esac ;;
7980         ' ') dflt='none' ;;
7981     *)  dflt="$cccdlflags" ;;
7982     esac
7983     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7984     . ./myread
7985     case "$ans" in
7986     none) cccdlflags=' ' ;;
7987     *) cccdlflags="$ans" ;;
7988     esac
7989
7990     cat << EOM
7991
7992 Some systems use ld to create libraries that can be dynamically loaded,
7993 while other systems (such as those using ELF) use $cc.
7994
7995 EOM
7996         case "$ld" in
7997         '')     $cat >try.c <<EOM
7998 /* Test for whether ELF binaries are produced */
7999 #include <fcntl.h>
8000 #$i_stdlib I_STDLIB
8001 #ifdef I_STDLIB
8002 #include <stdlib.h>
8003 #endif
8004 #$i_unistd I_UNISTD
8005 #ifdef I_UNISTD
8006 #include <unistd.h>
8007 #endif
8008 int main() {
8009         char b[4];
8010         int i = open("a.out",O_RDONLY);
8011         if(i == -1)
8012                 exit(1); /* fail */
8013         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8014                 exit(0); /* succeed (yes, it's ELF) */
8015         else
8016                 exit(1); /* fail */
8017 }
8018 EOM
8019                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8020                         cat <<EOM
8021 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8022 EOM
8023                         dflt="$cc"
8024                 else
8025                         echo "I'll use ld to build dynamic libraries."
8026                         dflt='ld'
8027                 fi
8028                 $rm_try
8029                 ;;
8030         *)      dflt="$ld"
8031                 ;;
8032         esac
8033
8034     rp="What command should be used to create dynamic libraries?"
8035     . ./myread
8036         ld="$ans"
8037
8038     cat << EOM
8039
8040 Some systems may require passing special flags to $ld to create a
8041 library that can be dynamically loaded.  If your ld flags include
8042 -L/other/path options to locate libraries outside your loader's normal
8043 search path, you may need to specify those -L options here as well.  To
8044 use no flags, say "none".
8045
8046 EOM
8047     case "$lddlflags" in
8048     '') case "$osname" in
8049                         beos) dflt='-nostart' ;;
8050                         haiku) dflt='-shared' ;;
8051                         hpux) dflt='-b';
8052                               case "$gccversion" in
8053                               '') dflt="$dflt +vnocompatwarnings" ;;
8054                               esac
8055                               ;;
8056                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8057                         next)  dflt='none' ;;
8058                         solaris) dflt='-G' ;;
8059                         sunos) dflt='-assert nodefinitions' ;;
8060                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8061                 *)     dflt='none' ;;
8062                         esac
8063                         ;;
8064     *) dflt="$lddlflags" ;;
8065     esac
8066
8067         : Try to guess additional flags to pick up local libraries.
8068         : Be careful not to append to a plain 'none'
8069         case "$dflt" in
8070         none) dflt='' ;;
8071         esac
8072         for thisflag in $ldflags; do
8073                 case "$thisflag" in
8074                 -L*|-R*|-Wl,-R*)
8075                         case " $dflt " in
8076                         *" $thisflag "*) ;;
8077                         *) dflt="$dflt $thisflag" ;;
8078                         esac
8079                         ;;
8080                 esac
8081         done
8082
8083         case "$dflt" in
8084         ''|' ') dflt='none' ;;
8085         esac
8086
8087         case "$ldflags" in
8088         *-fstack-protector*)
8089             case "$dflt" in
8090                         *-fstack-protector*) ;; # Don't add it again
8091                         *) dflt="$dflt -fstack-protector" ;; 
8092                 esac
8093                 ;;
8094         esac
8095
8096
8097     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8098     . ./myread
8099     case "$ans" in
8100     none) lddlflags=' ' ;;
8101     *) lddlflags="$ans" ;;
8102     esac
8103
8104         cat <<EOM
8105
8106 Some systems may require passing special flags to $cc to indicate that
8107 the resulting executable will use dynamic linking.  To use no flags,
8108 say "none".
8109
8110 EOM
8111     case "$ccdlflags" in
8112     '') case "$osname" in
8113             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8114             next|sunos) dflt='none' ;;
8115             *)          dflt='none' ;;
8116             esac ;;
8117     ' ')  dflt='none' ;;
8118     *)  dflt="$ccdlflags" ;;
8119     esac
8120     rp="Any special flags to pass to $cc to use dynamic linking?"
8121     . ./myread
8122     case "$ans" in
8123     none) ccdlflags=' ' ;;
8124     *) ccdlflags="$ans" ;;
8125     esac
8126     ;;
8127 *)  usedl="$undef"
8128         ld='ld'
8129     dlsrc='dl_none.xs'
8130     lddlflags=''
8131     ccdlflags=''
8132     ;;
8133 esac
8134
8135 : Do we want a shared libperl?
8136 also=''
8137 case "$usedl" in
8138 $undef)
8139         # No dynamic loading being used, so don't bother even to prompt.
8140         useshrplib='false'
8141         ;;
8142 *)      case "$useshrplib" in
8143         '')     case "$osname" in
8144                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8145                         dflt=y
8146                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8147                         ;;
8148                 next*)
8149                         case "$osvers" in
8150                         4*)     dflt=y
8151                                 also='Building a shared libperl is needed for MAB support.'
8152                                 ;;
8153                         *)      dflt=n
8154                                 ;;
8155                         esac
8156                         ;;
8157                 *)      dflt=n
8158                         ;;
8159                 esac
8160                 ;;
8161         $define|true|[Yy]*)
8162                 dflt=y
8163                 ;;
8164         *)      dflt=n
8165                 ;;
8166         esac
8167         $cat << EOM
8168
8169 The perl executable is normally obtained by linking perlmain.c with
8170 libperl${_a}, any static extensions (usually just DynaLoader), and
8171 any other libraries needed on this system (such as -lm, etc.).  Since
8172 your system supports dynamic loading, it is probably possible to build
8173 a shared libperl.$so.  If you will have more than one executable linked
8174 to libperl.$so, this will significantly reduce the size of each
8175 executable, but it may have a noticeable effect on performance.  The
8176 default is probably sensible for your system.
8177 $also
8178
8179 EOM
8180         rp="Build a shared libperl.$so (y/n)"
8181         . ./myread
8182         case "$ans" in
8183         true|$define|[Yy]*)
8184                 useshrplib='true'  ;;
8185         *)      useshrplib='false' ;;
8186         esac
8187         ;;
8188 esac
8189
8190 case "$useshrplib" in
8191 true)
8192         case "$userelocatableinc" in
8193         true|define)
8194                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8195                 echo "See INSTALL for an explanation why that won't work." >&4
8196                 exit 4
8197                 ;;
8198         esac
8199         case "$libperl" in
8200         '')
8201                 # Figure out a good name for libperl.so.  Since it gets stored in
8202                 # a version-specific architecture-dependent library, the version
8203                 # number isn't really that important, except for making cc/ld happy.
8204                 #
8205                 # A name such as libperl.so.10.1
8206                 majmin="libperl.$so.$patchlevel.$subversion"
8207                 # A name such as libperl.so.100
8208                 majonly=`echo $patchlevel $subversion |
8209                         $awk '{printf "%d%02d", $1, $2}'`
8210                 majonly=libperl.$so.$majonly
8211                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8212                 # rely on figuring it out from the naming of libc.
8213                 case "${osname}${osvers}" in
8214                 next4*)
8215                         dflt=libperl.5.$so
8216                         # XXX How handle the --version stuff for MAB?
8217                         ;;
8218                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8219                         dflt=libperl.$so
8220                         ;;
8221                 cygwin*) # ld links now against the dll directly
8222                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8223                         majonly=`echo $patchlevel $subversion |
8224                                 $awk '{printf "%03d%03d", $1, $2}'`
8225                         majonly=cygperl5.$majonly.$so
8226                         dflt=$majmin
8227                         ;;
8228                 *)      # Try to guess based on whether libc has major.minor.
8229                         case "$libc" in
8230                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8231                         *libc.$so.[0-9]*) dflt=$majonly ;;
8232                         *)      dflt=libperl.$so ;;
8233                         esac
8234                         ;;
8235                 esac
8236                 ;;
8237         *)      dflt=$libperl
8238                 ;;
8239         esac
8240         cat << EOM
8241
8242 I need to select a good name for the shared libperl.  If your system uses
8243 library names with major and minor numbers, then you might want something
8244 like $majmin.  Alternatively, if your system uses a single version
8245 number for shared libraries, then you might want to use $majonly.
8246 Or, your system might be quite happy with a simple libperl.$so.
8247
8248 Since the shared libperl will get installed into a version-specific
8249 architecture-dependent directory, the version number of the shared perl
8250 library probably isn't important, so the default should be o.k.
8251
8252 EOM
8253         rp='What name do you want to give to the shared libperl?'
8254         . ./myread
8255         libperl=$ans
8256         echo "Ok, I'll use $libperl"
8257         ;;
8258 *)
8259         libperl="libperl${_a}"
8260         ;;
8261 esac
8262
8263 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8264 case "$shrpdir" in
8265 '') ;;
8266 *)      $cat >&4 <<EOM
8267 WARNING:  Use of the shrpdir variable for the installation location of
8268 the shared $libperl is not supported.  It was never documented and
8269 will not work in this version.  Let me (perlbug@perl.org)
8270 know of any problems this may cause.
8271
8272 EOM
8273         case "$shrpdir" in
8274         "$archlibexp/CORE")
8275                 $cat >&4 <<EOM
8276 But your current setting of $shrpdir is
8277 the default anyway, so it's harmless.
8278 EOM
8279                 ;;
8280         *)
8281                 $cat >&4 <<EOM
8282 Further, your current attempted setting of $shrpdir
8283 conflicts with the value of $archlibexp/CORE
8284 that installperl will use.
8285 EOM
8286                 ;;
8287         esac
8288         ;;
8289 esac
8290
8291 # How will the perl executable find the installed shared $libperl?
8292 # Add $xxx to ccdlflags.
8293 # If we can't figure out a command-line option, use $shrpenv to
8294 # set env LD_RUN_PATH.  The main perl makefile uses this.
8295 shrpdir=$archlibexp/CORE
8296 xxx=''
8297 tmp_shrpenv=''
8298 if "$useshrplib"; then
8299     case "$osname" in
8300         aix)
8301                 # We'll set it in Makefile.SH...
8302                 ;;
8303         solaris)
8304                 xxx="-R $shrpdir"
8305                 ;;
8306         freebsd|netbsd|openbsd|interix|dragonfly)
8307                 xxx="-Wl,-R$shrpdir"
8308                 ;;
8309         bsdos|linux|irix*|dec_osf|gnu*)
8310                 xxx="-Wl,-rpath,$shrpdir"
8311                 ;;
8312         next)
8313                 # next doesn't like the default...
8314                 ;;
8315         beos)
8316                 # beos doesn't like the default, either.
8317                 ;;
8318         haiku)
8319                 # Haiku doesn't like the default, either.
8320                 ;;
8321         hpux*)
8322                 # hpux doesn't like the default, either.
8323                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8324                 ;;
8325         cygwin)
8326                 # cygwin needs only ldlibpth
8327                 ;;
8328         *)
8329                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8330                 ;;
8331         esac
8332         case "$xxx" in
8333         '') ;;
8334         *)
8335                 # Only add $xxx if it isn't already in ccdlflags.
8336                 case " $ccdlflags " in
8337                 *" $xxx "*)     ;;
8338                 *)      ccdlflags="$ccdlflags $xxx"
8339                         cat <<EOM >&4
8340
8341 Adding $xxx to the flags
8342 passed to $ld so that the perl executable will find the
8343 installed shared $libperl.
8344
8345 EOM
8346                         ;;
8347                 esac
8348                 ;;
8349         esac
8350 fi
8351 # Fix ccdlflags in AIX for building external extensions.
8352 # (For building Perl itself bare -bE:perl.exp is needed,
8353 #  Makefile.SH takes care of this.)
8354 case "$osname" in
8355 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8356 esac
8357 # Respect a hint or command-line value.
8358 case "$shrpenv" in
8359 '') shrpenv="$tmp_shrpenv" ;;
8360 esac
8361 case "$ldlibpthname" in
8362 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8363 none)   ldlibpthname='' ;;
8364 esac
8365
8366 : determine where manual pages are on this system
8367 echo " "
8368 case "$sysman" in
8369 '') 
8370         syspath='/usr/share/man/man1 /usr/man/man1'
8371         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8372         syspath="$syspath /usr/man/u_man/man1"
8373         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8374         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8375         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8376         sysman=`./loc . /usr/man/man1 $syspath`
8377         ;;
8378 esac
8379 if $test -d "$sysman"; then
8380         echo "System manual is in $sysman." >&4
8381 else
8382         echo "Could not find manual pages in source form." >&4
8383 fi
8384
8385 : determine where manual pages go
8386 set man1dir man1dir none
8387 eval $prefixit
8388 $cat <<EOM
8389
8390 $spackage has manual pages available in source form.
8391 EOM
8392 case "$nroff" in
8393 nroff)
8394         echo "However, you don't have nroff, so they're probably useless to you."
8395         case "$man1dir" in
8396         '') man1dir="none";;
8397         esac;;
8398 esac
8399 echo "If you don't want the manual sources installed, answer 'none'."
8400 case "$man1dir" in
8401 ' ') dflt=none
8402         ;;
8403 '')
8404         lookpath="$prefixexp/share/man/man1"
8405         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8406         lookpath="$lookpath $prefixexp/man/p_man/man1"
8407         lookpath="$lookpath $prefixexp/man/u_man/man1"
8408         lookpath="$lookpath $prefixexp/man/man.1"
8409         case "$sysman" in
8410         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8411         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8412         esac
8413         set dflt
8414         eval $prefixup
8415         ;;
8416 *)  dflt="$man1dir"
8417         ;;
8418 esac
8419 echo " "
8420 fn=dn+~
8421 rp="Where do the main $spackage manual pages (source) go?"
8422 . ./getfile
8423 if $test "X$man1direxp" != "X$ansexp"; then
8424         installman1dir=''
8425 fi
8426 prefixvar=man1dir
8427 . ./setprefixvar
8428
8429 case "$man1dir" in
8430 '')     man1dir=' '
8431         installman1dir='';;
8432 esac
8433
8434 : What suffix to use on installed man pages
8435
8436 case "$man1dir" in
8437 ' ')
8438         man1ext='0'
8439         ;;
8440 *)
8441         rp="What suffix should be used for the main $spackage man pages?"
8442         case "$man1ext" in
8443         '')     case "$man1dir" in
8444                 *1)  dflt=1 ;;
8445                 *1p) dflt=1p ;;
8446                 *1pm) dflt=1pm ;;
8447                 *l) dflt=l;;
8448                 *n) dflt=n;;
8449                 *o) dflt=o;;
8450                 *p) dflt=p;;
8451                 *C) dflt=C;;
8452                 *L) dflt=L;;
8453                 *L1) dflt=L1;;
8454                 *) dflt=1;;
8455                 esac
8456                 ;;
8457         *)      dflt="$man1ext";;
8458         esac
8459         . ./myread
8460         man1ext="$ans"
8461         ;;
8462 esac
8463
8464 : see if we can have long filenames
8465 echo " "
8466 first=123456789abcdef
8467 $rm -f $first
8468 if (echo hi >$first) 2>/dev/null; then
8469         if $test -f 123456789abcde; then
8470                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8471                 val="$undef"
8472         else
8473                 echo 'You can have filenames longer than 14 characters.'>&4
8474                 val="$define"
8475         fi
8476 else
8477         $cat <<'EOM'
8478 You can't have filenames longer than 14 chars.
8479 You can't even think about them!
8480 EOM
8481         val="$undef"
8482 fi
8483 set d_flexfnam
8484 eval $setvar
8485 $rm -rf 123456789abcde*
8486
8487 : determine where library module manual pages go
8488 set man3dir man3dir none
8489 eval $prefixit
8490 $cat <<EOM
8491
8492 $spackage has manual pages for many of the library modules.
8493 EOM
8494
8495 case "$nroff" in
8496 nroff)
8497         $cat <<'EOM'
8498 However, you don't have nroff, so they're probably useless to you.
8499 EOM
8500         case "$man3dir" in
8501         '') man3dir="none";;
8502         esac;;
8503 esac
8504
8505 case "$d_flexfnam" in
8506 undef)
8507         $cat <<'EOM'
8508 However, your system can't handle the long file names like File::Basename.3.
8509 EOM
8510         case "$man3dir" in
8511         '') man3dir="none";;
8512         esac;;
8513 esac
8514
8515 echo "If you don't want the manual sources installed, answer 'none'."
8516 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8517 case "$man3dir" in
8518 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8519         if $test -d "$privlib/man/man3"; then
8520                 cat <<EOM >&4
8521
8522 WARNING:  Previous versions of perl installed man3 pages into
8523 $privlib/man/man3.  This version will suggest a
8524 new default of $dflt.
8525 EOM
8526                 tdflt=$dflt
8527                 dflt='n'
8528                 rp='Do you wish to preserve the old behavior?(y/n)'
8529                 . ./myread
8530                 case "$ans" in
8531                 y*) dflt="$privlib/man/man3" ;;
8532                 *)  dflt=$tdflt ;;
8533                 esac
8534     fi
8535         ;;
8536 *)      dflt="$man3dir" ;;
8537 esac
8538 case "$dflt" in
8539 ' ') dflt=none ;;
8540 esac
8541 echo " "
8542 fn=dn+~
8543 rp="Where do the $package library man pages (source) go?"
8544 . ./getfile
8545 prefixvar=man3dir
8546 . ./setprefixvar
8547
8548 case "$man3dir" in
8549 '')     man3dir=' '
8550         installman3dir='';;
8551 esac
8552
8553 : What suffix to use on installed man pages
8554 case "$man3dir" in
8555 ' ')
8556         man3ext='0'
8557         ;;
8558 *)
8559         rp="What suffix should be used for the $package library man pages?"
8560         case "$man3ext" in
8561         '')     case "$man3dir" in
8562                 *3)  dflt=3 ;;
8563                 *3p) dflt=3p ;;
8564                 *3pm) dflt=3pm ;;
8565                 *l) dflt=l;;
8566                 *n) dflt=n;;
8567                 *o) dflt=o;;
8568                 *p) dflt=p;;
8569                 *C) dflt=C;;
8570                 *L) dflt=L;;
8571                 *L3) dflt=L3;;
8572                 *) dflt=3;;
8573                 esac
8574                 ;;
8575         *)      dflt="$man3ext";;
8576         esac
8577         . ./myread
8578         man3ext="$ans"
8579         ;;
8580 esac
8581
8582 : see if we have to deal with yellow pages, now NIS.
8583 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8584         if $test -f /usr/etc/nibindd; then
8585                 echo " "
8586                 echo "I'm fairly confident you're on a NeXT."
8587                 echo " "
8588                 rp='Do you get the hosts file via NetInfo?'
8589                 dflt=y
8590                 case "$hostcat" in
8591                 nidump*) ;;
8592                 '') ;;
8593                 *) dflt=n;;
8594                 esac
8595                 . ./myread
8596                 case "$ans" in
8597                 y*) hostcat='nidump hosts .';;
8598                 *)      case "$hostcat" in
8599                         nidump*) hostcat='';;
8600                         esac
8601                         ;;
8602                 esac
8603         fi
8604         case "$hostcat" in
8605         nidump*) ;;
8606         *)
8607                 case "$hostcat" in
8608                 *ypcat*) dflt=y;;
8609                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8610                                 dflt=y
8611                         else
8612                                 dflt=n
8613                         fi;;
8614                 *) dflt=n;;
8615                 esac
8616                 echo " "
8617                 rp='Are you getting the hosts file via yellow pages?'
8618                 . ./myread
8619                 case "$ans" in
8620                 y*) hostcat='ypcat hosts';;
8621                 *) hostcat='cat /etc/hosts';;
8622                 esac
8623                 ;;
8624         esac
8625 fi
8626 case "$hostcat" in
8627 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8628 esac
8629 case "$groupcat" in
8630 '') test -f /etc/group && groupcat='cat /etc/group';;
8631 esac
8632 case "$passcat" in
8633 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8634 esac
8635
8636 : now get the host name
8637 echo " "
8638 echo "Figuring out host name..." >&4
8639 case "$myhostname" in
8640 '') cont=true
8641         echo 'Maybe "hostname" will work...'
8642         if tans=`sh -c hostname 2>&1` ; then
8643                 myhostname=$tans
8644                 phostname=hostname
8645                 cont=''
8646         fi
8647         ;;
8648 *) cont='';;
8649 esac
8650 if $test "$cont"; then
8651         if ./xenix; then
8652                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8653                 if tans=`cat /etc/systemid 2>&1` ; then
8654                         myhostname=$tans
8655                         phostname='cat /etc/systemid'
8656                         echo "Whadyaknow.  Xenix always was a bit strange..."
8657                         cont=''
8658                 fi
8659         elif $test -r /etc/systemid; then
8660                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8661         fi
8662 fi
8663 if $test "$cont"; then
8664         echo 'No, maybe "uuname -l" will work...'
8665         if tans=`sh -c 'uuname -l' 2>&1` ; then
8666                 myhostname=$tans
8667                 phostname='uuname -l'
8668         else
8669                 echo 'Strange.  Maybe "uname -n" will work...'
8670                 if tans=`sh -c 'uname -n' 2>&1` ; then
8671                         myhostname=$tans
8672                         phostname='uname -n'
8673                 else
8674                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8675                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8676                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8677                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8678                         else
8679                                 case "$myhostname" in
8680                                 '') echo "Does this machine have an identity crisis or something?"
8681                                         phostname='';;
8682                                 *)
8683                                         echo "Well, you said $myhostname before..."
8684                                         phostname='echo $myhostname';;
8685                                 esac
8686                         fi
8687                 fi
8688         fi
8689 fi
8690 case "$myhostname" in
8691 '') myhostname=noname ;;
8692 esac
8693 : you do not want to know about this
8694 set $myhostname
8695 myhostname=$1
8696
8697 : verify guess
8698 if $test "$myhostname" ; then
8699         dflt=y
8700         rp='Your host name appears to be "'$myhostname'".'" Right?"
8701         . ./myread
8702         case "$ans" in
8703         y*) ;;
8704         *) myhostname='';;
8705         esac
8706 fi
8707
8708 : bad guess or no guess
8709 while $test "X$myhostname" = X ; do
8710         dflt=''
8711         rp="Please type the (one word) name of your host:"
8712         . ./myread
8713         myhostname="$ans"
8714 done
8715
8716 : translate upper to lower if necessary
8717 case "$myhostname" in
8718 *[A-Z]*)
8719         echo "(Normalizing case in your host name)"
8720         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8721         ;;
8722 esac
8723
8724 case "$myhostname" in
8725 *.*)
8726         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8727         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8728         echo "(Trimming domain name from host name--host name is now $myhostname)"
8729         ;;
8730 *) case "$mydomain" in
8731         '')
8732                 {
8733                         test "X$hostcat" = "Xypcat hosts" &&
8734                         ypmatch "$myhostname" hosts 2>/dev/null |\
8735                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8736                         $test -s hosts
8737                 } || {
8738                         test "X$hostcat" != "X" &&
8739                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8740                                         /[       ]$myhostname[  . ]/p" > hosts
8741                 }
8742                 tmp_re="[       . ]"
8743                 if $test -f hosts; then
8744                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8745                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8746                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8747                                 hosts | $sort | $uniq | \
8748                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8749                         case `$echo X$dflt` in
8750                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8751                                 dflt=.
8752                                 ;;
8753                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8754                                 ;;
8755                         esac
8756                 else
8757                         echo "(I cannot locate a hosts database anywhere)"
8758                         dflt=.
8759                 fi
8760                 case "$dflt" in
8761                 .)
8762                         tans=`./loc resolv.conf X /etc /usr/etc`
8763                         if $test -f "$tans"; then
8764                                 echo "(Attempting domain name extraction from $tans)"
8765                                 dflt=.`$sed -n -e 's/   / /g' \
8766                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8767                                   -e 1q 2>/dev/null`
8768                                 case "$dflt" in
8769                                 .) dflt=.`$sed -n -e 's/        / /g' \
8770                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8771                                      -e 1q 2>/dev/null`
8772                                         ;;
8773                                 esac
8774                         fi
8775                         ;;
8776                 esac
8777                 case "$dflt" in
8778                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8779                         dflt=.`sh -c domainname 2>/dev/null`
8780                         case "$dflt" in
8781                         '') dflt='.';;
8782                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8783                         esac
8784                         ;;
8785                 esac
8786                 case "$dflt$osname" in
8787                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8788                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8789                         ;;
8790                 esac
8791                 case "$dflt" in
8792                 .) echo "(Lost all hope -- silly guess then)"
8793                         dflt='.nonet'
8794                         ;;
8795                 esac
8796                 $rm -f hosts
8797                 ;;
8798         *) dflt="$mydomain";;
8799         esac;;
8800 esac
8801 echo " "
8802 rp="What is your domain name?"
8803 . ./myread
8804 tans="$ans"
8805 case "$ans" in
8806 '') ;;
8807 .*) ;;
8808 *) tans=".$tans";;
8809 esac
8810 mydomain="$tans"
8811
8812 : translate upper to lower if necessary
8813 case "$mydomain" in
8814 *[A-Z]*)
8815         echo "(Normalizing case in your domain name)"
8816         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8817         ;;
8818 esac
8819
8820 : a little sanity check here
8821 case "$phostname" in
8822 '') ;;
8823 *)
8824         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8825         $myhostname$mydomain|$myhostname) ;;
8826         *)
8827                 case "$phostname" in
8828                 sed*)
8829                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8830                         ;;
8831                 *)
8832                         echo "(That doesn't agree with your $phostname command, by the way.)"
8833                         ;;
8834                 esac
8835         ;;
8836         esac
8837         ;;
8838 esac
8839
8840 : determine the e-mail address of the user who is running us
8841 $cat <<EOM
8842
8843 I need to get your e-mail address in Internet format if possible, i.e.
8844 something like user@host.domain. Please answer accurately since I have
8845 no easy means to double check it. The default value provided below
8846 is most probably close to reality but may not be valid from outside
8847 your organization...
8848
8849 EOM
8850 cont=x
8851 while test "$cont"; do
8852         case "$cf_email" in
8853         '') dflt="$cf_by@$myhostname$mydomain";;
8854         *) dflt="$cf_email";;
8855         esac
8856         rp='What is your e-mail address?'
8857         . ./myread
8858         cf_email="$ans"
8859         case "$cf_email" in
8860         *@*.*) cont='' ;;
8861         *)
8862                 rp='Address does not look like an Internet one.  Use it anyway?'
8863                 case "$fastread" in
8864                 yes) dflt=y ;;
8865                 *) dflt=n ;;
8866                 esac
8867                 . ./myread
8868                 case "$ans" in
8869                 y*) cont='' ;;
8870                 *) echo " " ;;
8871                 esac
8872                 ;;
8873         esac
8874 done
8875
8876 : Ask e-mail of administrator
8877 $cat <<EOM
8878
8879 If you or somebody else will be maintaining perl at your site, please
8880 fill in the correct e-mail address here so that they may be contacted
8881 if necessary. Currently, the "perlbug" program included with perl
8882 will send mail to this address in addition to perlbug@perl.org. You may
8883 enter "none" for no administrator.
8884
8885 EOM
8886 case "$perladmin" in
8887 '') dflt="$cf_email";;
8888 *) dflt="$perladmin";;
8889 esac
8890 rp='Perl administrator e-mail address'
8891 . ./myread
8892 perladmin="$ans"
8893
8894 : determine whether to only install version-specific parts.
8895 echo " "
8896 $cat <<EOM
8897 Do you want to install only the version-specific parts of the perl
8898 distribution?  Usually you do *not* want to do this.
8899 EOM
8900 case "$versiononly" in
8901 "$define"|[Yy]*|true) dflt='y' ;;
8902 *) dflt='n';
8903 esac
8904 rp="Do you want to install only the version-specific parts of perl?"
8905 . ./myread
8906 case "$ans" in
8907 [yY]*)  val="$define";;
8908 *)      val="$undef" ;;
8909 esac
8910 set versiononly
8911 eval $setvar
8912
8913 case "$versiononly" in
8914 "$define") inc_version_list=''
8915            inc_version_list_init=0
8916            ;;
8917 esac
8918
8919 : figure out how to guarantee perl startup
8920 : XXX Note that this currently takes advantage of the bug that binexp ignores
8921 :     the Configure -Dinstallprefix setting, which in turn means that under
8922 :     relocatable @INC, initialinstalllocation is what binexp started as.
8923 case "$startperl" in
8924 '')
8925         case "$sharpbang" in
8926         *!)
8927                 $cat <<EOH
8928
8929 I can use the #! construct to start perl on your system. This will
8930 make startup of perl scripts faster, but may cause problems if you
8931 want to share those scripts and perl is not in a standard place
8932 ($initialinstalllocation/perl) on all your platforms. The alternative
8933 is to force a shell by starting the script with a single ':' character.
8934
8935 EOH
8936                 case "$versiononly" in
8937                 "$define")      dflt="$initialinstalllocation/perl$version";;
8938                 *)              dflt="$initialinstalllocation/perl";;
8939                 esac
8940                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8941                 . ./myread
8942                 case "$ans" in
8943                 none)   startperl=": # use perl";;
8944                 *)      startperl="#!$ans"
8945                         if $test 30 -lt `echo "$ans" | wc -c`; then
8946                                 $cat >&4 <<EOM
8947
8948 WARNING:  Some systems limit the #! command to 32 characters.
8949 If you experience difficulty running Perl scripts with #!, try
8950 installing Perl in a directory with a shorter pathname.
8951
8952 EOM
8953                         fi ;;
8954                 esac
8955                 ;;
8956         *) startperl=": # use perl"
8957                 ;;
8958         esac
8959         ;;
8960 esac
8961 echo "I'll use $startperl to start perl scripts."
8962
8963 : figure best path for perl in scripts
8964 case "$perlpath" in
8965 '')
8966         case "$versiononly" in
8967         "$define")      perlpath="$initialinstalllocation/perl$version";;
8968         *)              perlpath="$initialinstalllocation/perl";;
8969         esac
8970         case "$startperl" in
8971         *!*) ;;
8972         *)
8973                 $cat <<EOH
8974
8975 I will use the "eval 'exec'" idiom to start Perl on your system.
8976 I can use the full path of your Perl binary for this purpose, but
8977 doing so may cause problems if you want to share those scripts and
8978 Perl is not always in a standard place ($initialinstalllocation/perl).
8979
8980 EOH
8981                 dflt="$initialinstalllocation/perl"
8982                 rp="What path shall I use in \"eval 'exec'\"?"
8983                 . ./myread
8984                 perlpath="$ans"
8985                 ;;
8986         esac
8987         ;;
8988 esac
8989 case "$startperl" in
8990 *!*)    ;;
8991 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8992 esac
8993
8994 : determine where public executable scripts go
8995 set scriptdir scriptdir
8996 eval $prefixit
8997 case "$scriptdir" in
8998 '')
8999         dflt="$bin"
9000         : guess some guesses
9001         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9002         $test -d /usr/share/bin     && dflt=/usr/share/bin
9003         $test -d /usr/local/script  && dflt=/usr/local/script
9004         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9005         $test -d $prefixexp/script  && dflt=$prefixexp/script
9006         set dflt
9007         eval $prefixup
9008         ;;
9009 *)  dflt="$scriptdir"
9010         ;;
9011 esac
9012 $cat <<EOM
9013
9014 Some installations have a separate directory just for executable scripts so
9015 that they can mount it across multiple architectures but keep the scripts in
9016 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9017 Or you might just lump your scripts in with all your other executables.
9018
9019 EOM
9020 fn=d~
9021 rp='Where do you keep publicly executable scripts?'
9022 . ./getfile
9023 if $test "X$ansexp" != "X$scriptdirexp"; then
9024         installscript=''
9025 fi
9026 installscriptdir=''
9027 prefixvar=scriptdir
9028 . ./setprefixvar
9029 : A little fix up for an irregularly named variable.
9030 installscript="$installscriptdir"
9031
9032 : determine where add-on public executables go
9033 case "$sitebin" in
9034 '')     dflt=$siteprefix/bin ;;
9035 *)      dflt=$sitebin ;;
9036 esac
9037 fn=d~
9038 rp='Pathname where the add-on public executables should be installed?'
9039 . ./getfile
9040 prefixvar=sitebin
9041 . ./setprefixvar
9042
9043 : determine where add-on html pages go
9044 : There is no standard location, so try to copy the previously-selected
9045 : directory structure for the core html pages.
9046 case "$sitehtml1dir" in
9047 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9048 *)     dflt=$sitehtml1dir ;;
9049 esac
9050 case "$dflt" in
9051 ''|' ') dflt=none ;;
9052 esac
9053 fn=dn+~
9054 rp='Pathname where the site-specific html pages should be installed?'
9055 . ./getfile
9056 prefixvar=sitehtml1dir
9057 . ./setprefixvar
9058
9059 : determine where add-on library html pages go
9060 : There is no standard location, so try to copy the previously-selected
9061 : directory structure for the core html pages.
9062 case "$sitehtml3dir" in
9063 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9064 *)     dflt=$sitehtml3dir ;;
9065 esac
9066 case "$dflt" in
9067 ''|' ') dflt=none ;;
9068 esac
9069 fn=dn+~
9070 rp='Pathname where the site-specific library html pages should be installed?'
9071 . ./getfile
9072 prefixvar=sitehtml3dir
9073 . ./setprefixvar
9074
9075 : determine where add-on manual pages go
9076 case "$siteman1dir" in
9077 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9078 *)      dflt=$siteman1dir ;;
9079 esac
9080 case "$dflt" in
9081 ''|' ') dflt=none ;;
9082 esac
9083 fn=dn+~
9084 rp='Pathname where the site-specific manual pages should be installed?'
9085 . ./getfile
9086 prefixvar=siteman1dir
9087 . ./setprefixvar
9088
9089 : determine where add-on library man pages go
9090 case "$siteman3dir" in
9091 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9092 *)      dflt=$siteman3dir ;;
9093 esac
9094 case "$dflt" in
9095 ''|' ') dflt=none ;;
9096 esac
9097 fn=dn+~
9098 rp='Pathname where the site-specific library manual pages should be installed?'
9099 . ./getfile
9100 prefixvar=siteman3dir
9101 . ./setprefixvar
9102
9103 : determine where add-on public executable scripts go
9104 case "$sitescript" in
9105 '')     dflt=$siteprefix/script
9106         $test -d $dflt || dflt=$sitebin ;;
9107 *)  dflt="$sitescript" ;;
9108 esac
9109 fn=d~+
9110 rp='Pathname where add-on public executable scripts should be installed?'
9111 . ./getfile
9112 prefixvar=sitescript
9113 . ./setprefixvar
9114
9115 : Check if faststdio is requested and available
9116 case "$usefaststdio" in
9117 $define|true|[yY]*|'')
9118         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9119         case "$xversion" in
9120         [68])   dflt='y' ;;
9121         *)      dflt='n' ;;
9122         esac
9123         ;;
9124 *) dflt='n';;
9125 esac
9126 cat <<EOM
9127
9128 Perl can be built to use 'fast stdio', which means using the stdio
9129 library but also directly manipulating the stdio buffers to enable
9130 faster I/O.  Using stdio is better for backward compatibility (especially
9131 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9132 interface has been preferred instead of stdio.
9133
9134 If this doesn't make any sense to you, just accept the default '$dflt'.
9135 EOM
9136 rp='Use the "fast stdio" if available?'
9137 . ./myread
9138 case "$ans" in
9139 y|Y)    val="$define" ;;
9140 *)      val="$undef" ;;
9141 esac
9142 set usefaststdio
9143 eval $setvar
9144
9145
9146 : define an is-a-typedef? function
9147 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9148 case "$inclist" in
9149 "") inclist="sys/types.h";;
9150 esac;
9151 eval "varval=\$$var";
9152 case "$varval" in
9153 "")
9154         $rm -f temp.c;
9155         for inc in $inclist; do
9156                 echo "#include <$inc>" >>temp.c;
9157         done;
9158         echo "#ifdef $type" >> temp.c;
9159         echo "printf(\"We have $type\");" >> temp.c;
9160         echo "#endif" >> temp.c;
9161         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9162         if $contains $type temp.E >/dev/null 2>&1; then
9163                 eval "$var=\$type";
9164         else
9165                 eval "$var=\$def";
9166         fi;
9167         $rm -f temp.?;;
9168 *) eval "$var=\$varval";;
9169 esac'
9170
9171 : define an is-a-typedef? function that prompts if the type is not available.
9172 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9173 case "$inclist" in
9174 "") inclist="sys/types.h";;
9175 esac;
9176 eval "varval=\$$var";
9177 case "$varval" in
9178 "")
9179         $rm -f temp.c;
9180         for inc in $inclist; do
9181                 echo "#include <$inc>" >>temp.c;
9182         done;
9183         echo "#ifdef $type" >> temp.c;
9184         echo "printf(\"We have $type\");" >> temp.c;
9185         echo "#endif" >> temp.c;
9186         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9187         echo " " ;
9188         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9189         if $contains $type temp.E >/dev/null 2>&1; then
9190                 echo "$type found." >&4;
9191                 eval "$var=\$type";
9192         else
9193                 echo "$type NOT found." >&4;
9194                 dflt="$def";
9195                 . ./myread ;
9196                 eval "$var=\$ans";
9197         fi;
9198         $rm -f temp.?;;
9199 *) eval "$var=\$varval";;
9200 esac'
9201
9202 : see what type lseek is declared as in the kernel
9203 rp="What is the type used for lseek's offset on this system?"
9204 set off_t lseektype long stdio.h sys/types.h
9205 eval $typedef_ask
9206
9207 echo " "
9208 echo "Checking to see how big your file offsets are..." >&4
9209 $cat >try.c <<EOCP
9210 #include <sys/types.h>
9211 #include <stdio.h>
9212 int main()
9213 {
9214     printf("%d\n", (int)sizeof($lseektype));
9215     return(0);
9216 }
9217 EOCP
9218 set try
9219 if eval $compile_ok; then
9220         lseeksize=`$run ./try`
9221         echo "Your file offsets are $lseeksize bytes long."
9222 else
9223         dflt=$longsize
9224         echo " "
9225         echo "(I can't seem to compile the test program.  Guessing...)"
9226         rp="What is the size of your file offsets (in bytes)?"
9227         . ./myread
9228         lseeksize="$ans"
9229 fi
9230 $rm_try
9231
9232 : see what type file positions are declared as in the library
9233 rp="What is the type for file position used by fsetpos()?"
9234 set fpos_t fpostype long stdio.h sys/types.h
9235 eval $typedef_ask
9236
9237 : Check size for Fpos_t
9238 echo " "
9239 case "$fpostype" in
9240 *_t) zzz="$fpostype"    ;;
9241 *)   zzz="fpos_t"       ;;
9242 esac
9243 echo "Checking the size of $zzz..." >&4
9244 cat > try.c <<EOCP
9245 #include <sys/types.h>
9246 #include <stdio.h>
9247 #$i_stdlib I_STDLIB
9248 #ifdef I_STDLIB
9249 #include <stdlib.h>
9250 #endif
9251 int main() {
9252     printf("%d\n", (int)sizeof($fpostype));
9253     exit(0);
9254 }
9255 EOCP
9256 set try
9257 if eval $compile_ok; then
9258         yyy=`$run ./try`
9259         case "$yyy" in
9260         '')     fpossize=4
9261                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9262                 ;;
9263         *)      fpossize=$yyy
9264                 echo "Your $zzz is $fpossize bytes long."
9265                 ;;
9266         esac
9267 else
9268         dflt="$longsize"
9269         echo " " >&4
9270         echo "(I can't compile the test program.  Guessing...)" >&4
9271         rp="What is the size of your file positions (in bytes)?"
9272         . ./myread
9273         fpossize="$ans"
9274 fi
9275
9276 : Check for large file support
9277 # Backward compatibility (uselfs is deprecated).
9278 case "$uselfs" in
9279 "$define"|true|[yY]*)
9280         cat <<EOM >&4
9281
9282 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9283 EOM
9284         uselargefiles="$define"
9285         ;;
9286 esac
9287
9288 case "$lseeksize:$fpossize" in
9289 8:8) cat <<EOM
9290
9291 You can have files larger than 2 gigabytes.
9292 EOM
9293    val="$define" ;;
9294 *)    case "$uselargefiles" in
9295    "$undef"|false|[nN]*) dflt='n' ;;
9296    *)   dflt='y' ;;
9297    esac
9298    cat <<EOM
9299
9300 Perl can be built to understand large files (files larger than 2 gigabytes)
9301 on some systems.  To do so, Configure can be run with -Duselargefiles.
9302
9303 If this doesn't make any sense to you, just accept the default '$dflt'.
9304 EOM
9305    rp='Try to understand large files, if available?'
9306    . ./myread
9307    case "$ans" in
9308    y|Y)         val="$define" ;;
9309    *)           val="$undef"  ;;
9310    esac
9311    ;;
9312 esac
9313 set uselargefiles
9314 eval $setvar
9315 : Look for a hint-file generated 'call-back-unit'.  If the
9316 : user has specified that a large files perl is to be built,
9317 : we may need to set or change some other defaults.
9318 if $test -f uselargefiles.cbu; then
9319         echo "Your platform has some specific hints regarding large file builds, using them..."
9320         . ./uselargefiles.cbu
9321 fi
9322 case "$uselargefiles" in
9323 "$define")
9324         if $test -f uselargefiles.cbu; then
9325                 echo " "
9326                 echo "Rechecking to see how big your file offsets are..." >&4
9327                 $cat >try.c <<EOCP
9328 #include <sys/types.h>
9329 #include <stdio.h>
9330 int main()
9331 {
9332     printf("%d\n", (int)sizeof($lseektype));
9333     return(0);
9334 }
9335 EOCP
9336                 set try
9337                 if eval $compile_ok; then
9338                         lseeksize=`$run ./try`
9339                         $echo "Your file offsets are now $lseeksize bytes long."
9340                 else
9341                         dflt="$lseeksize"
9342                         echo " "
9343                         echo "(I can't seem to compile the test program.  Guessing...)"
9344                         rp="What is the size of your file offsets (in bytes)?"
9345                         . ./myread
9346                         lseeksize="$ans"
9347                 fi
9348                 case "$fpostype" in
9349                 *_t) zzz="$fpostype"    ;;
9350                 *)   zzz="fpos_t"       ;;
9351                 esac
9352                 $echo $n "Rechecking the size of $zzz...$c" >&4
9353                 $cat > try.c <<EOCP
9354 #include <sys/types.h>
9355 #include <stdio.h>
9356 #$i_stdlib I_STDLIB
9357 #ifdef I_STDLIB
9358 #include <stdlib.h>
9359 #endif
9360 int main() {
9361     printf("%d\n", (int)sizeof($fpostype));
9362     return(0);
9363 }
9364 EOCP
9365                 set try
9366                 if eval $compile_ok; then
9367                         yyy=`$run ./try`
9368                         dflt="$lseeksize"
9369                         case "$yyy" in
9370                         '')     echo " "
9371                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9372                                 ;;
9373                         *)      fpossize=$yyy
9374                                 echo " $fpossize bytes." >&4
9375                                 ;;
9376                         esac
9377                 else
9378                         dflt="$fpossize"
9379                         echo " "
9380                         echo "(I can't compile the test program.  Guessing...)" >&4
9381                         rp="What is the size of your file positions (in bytes)?"
9382                         . ./myread
9383                         fpossize="$ans"
9384                 fi
9385                 $rm_try
9386         fi
9387         ;;
9388 esac
9389
9390 : Set the vendorbin variables
9391 case "$vendorprefix" in
9392 '')     d_vendorbin="$undef"
9393         vendorbin=''
9394         vendorbinexp=''
9395         ;;
9396 *)      d_vendorbin="$define"
9397         : determine where vendor-supplied executables go.
9398         case "$vendorbin" in
9399         '') dflt=$vendorprefix/bin ;;
9400         *)      dflt="$vendorbin" ;;
9401         esac
9402         fn=d~+
9403         rp='Pathname for the vendor-supplied executables directory?'
9404         . ./getfile
9405         vendorbin="$ans"
9406         vendorbinexp="$ansexp"
9407         ;;
9408 esac
9409 prefixvar=vendorbin
9410 . ./installprefix
9411
9412 : Set the vendorhtml1dir variables
9413 case "$vendorprefix" in
9414 '')     vendorhtml1dir=''
9415         vendorhtml1direxp=''
9416         ;;
9417 *)      : determine where vendor-supplied html pages go.
9418         : There is no standard location, so try to copy the previously-selected
9419         : directory structure for the core html pages.
9420         : XXX Better default suggestions would be welcome.
9421         case "$vendorhtml1dir" in
9422         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9423         *)      dflt=$vendorhtml1dir ;;
9424         esac
9425         case "$dflt" in
9426         ''|' ') dflt=none ;;
9427         esac
9428         fn=dn+~
9429         rp='Pathname for the vendor-supplied html pages?'
9430         . ./getfile
9431         vendorhtml1dir="$ans"
9432         vendorhtml1direxp="$ansexp"
9433         ;;
9434 esac
9435 : Use ' ' for none so value is preserved next time through Configure
9436 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9437 prefixvar=vendorhtml1dir
9438 . ./installprefix
9439
9440 : Set the vendorhtml3dir variables
9441 case "$vendorprefix" in
9442 '')     vendorhtml3dir=''
9443         vendorhtml3direxp=''
9444         ;;
9445 *)      : determine where vendor-supplied module html pages go.
9446         : There is no standard location, so try to copy the previously-selected
9447         : directory structure for the core html pages.
9448         : XXX Better default suggestions would be welcome.
9449         case "$vendorhtml3dir" in
9450         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9451         *)      dflt=$vendorhtml3dir ;;
9452         esac
9453         case "$dflt" in
9454         ''|' ') dflt=none ;;
9455         esac
9456         fn=dn+~
9457         rp='Pathname for the vendor-supplied html pages?'
9458         . ./getfile
9459         vendorhtml3dir="$ans"
9460         vendorhtml3direxp="$ansexp"
9461         ;;
9462 esac
9463 : Use ' ' for none so value is preserved next time through Configure
9464 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9465 prefixvar=vendorhtml3dir
9466 . ./installprefix
9467
9468 : Set the vendorman1dir variables
9469 case "$vendorprefix" in
9470 '')     vendorman1dir=''
9471         vendorman1direxp=''
9472         ;;
9473 *)      : determine where vendor-supplied manual pages go.
9474         case "$vendorman1dir" in
9475         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9476         *)      dflt=$vendorman1dir ;;
9477         esac
9478         case "$dflt" in
9479         ''|' ') dflt=none ;;
9480         esac
9481         fn=nd~+
9482         rp='Pathname for the vendor-supplied manual section 1 pages?'
9483         . ./getfile
9484         vendorman1dir="$ans"
9485         vendorman1direxp="$ansexp"
9486         ;;
9487 esac
9488 : Use ' ' for none so value is preserved next time through Configure
9489 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9490 prefixvar=vendorman1dir
9491 . ./installprefix
9492
9493 : Set the vendorman3dir variables
9494 case "$vendorprefix" in
9495 '')     vendorman3dir=''
9496         vendorman3direxp=''
9497         ;;
9498 *)      : determine where vendor-supplied module manual pages go.
9499         case "$vendorman3dir" in
9500         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9501         *)      dflt=$vendorman3dir ;;
9502         esac
9503         case "$dflt" in
9504         ''|' ') dflt=none ;;
9505         esac
9506         fn=nd~+
9507         rp='Pathname for the vendor-supplied manual section 3 pages?'
9508         . ./getfile
9509         vendorman3dir="$ans"
9510         vendorman3direxp="$ansexp"
9511         ;;
9512 esac
9513 : Use ' ' for none so value is preserved next time through Configure
9514 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9515 prefixvar=vendorman3dir
9516 . ./installprefix
9517
9518 : Set the vendorscript variables
9519 case "$vendorprefix" in
9520 '')     d_vendorscript="$undef"
9521         vendorscript=''
9522         vendorscriptexp=''
9523         ;;
9524 *)      d_vendorscript="$define"
9525         : determine where vendor-supplied scripts go.
9526         case "$vendorscript" in
9527         '')     dflt=$vendorprefix/script
9528                 $test -d $dflt || dflt=$vendorbin ;;
9529         *)  dflt="$vendorscript" ;;
9530         esac
9531         $cat <<EOM
9532
9533 The installation process will create a directory for
9534 vendor-supplied scripts.
9535
9536 EOM
9537         fn=d~+
9538         rp='Pathname for the vendor-supplied scripts directory?'
9539         . ./getfile
9540         vendorscript="$ans"
9541         vendorscriptexp="$ansexp"
9542         ;;
9543 esac
9544 prefixvar=vendorscript
9545 . ./installprefix
9546
9547 : script used to emit important warnings
9548 cat >warn <<EOS
9549 $startsh
9550 if test \$# -gt 0; then
9551         echo "\$@" >msg
9552 else
9553         cat >msg
9554 fi
9555 echo "*** WARNING:" >&4
9556 sed -e 's/^/*** /' <msg >&4
9557 echo "*** " >&4
9558 cat msg >>config.msg
9559 echo " " >>config.msg
9560 rm -f msg
9561 EOS
9562 chmod +x warn
9563 $eunicefix warn
9564
9565 : see which of string.h or strings.h is needed
9566 echo " "
9567 strings=`./findhdr string.h`
9568 if $test "$strings" && $test -r "$strings"; then
9569         echo "Using <string.h> instead of <strings.h>." >&4
9570         val="$define"
9571 else
9572         val="$undef"
9573         strings=`./findhdr strings.h`
9574         if $test "$strings" && $test -r "$strings"; then
9575                 echo "Using <strings.h> instead of <string.h>." >&4
9576         else
9577                 ./warn "No string header found -- You'll surely have problems."
9578         fi
9579 fi
9580 set i_string
9581 eval $setvar
9582 case "$i_string" in
9583 "$undef") strings=`./findhdr strings.h`;;
9584 *)        strings=`./findhdr string.h`;;
9585 esac
9586
9587 : see if qgcvt exists
9588 set qgcvt d_qgcvt
9589 eval $inlibc
9590
9591 : Check print/scan long double stuff
9592 echo " "
9593
9594 if $test X"$d_longdbl" = X"$define"; then
9595
9596 echo "Checking how to print long doubles..." >&4
9597
9598 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9599         $cat >try.c <<'EOCP'
9600 #include <sys/types.h>
9601 #include <stdio.h>
9602 int main() {
9603   double d = 123.456;
9604   printf("%.3f\n", d);
9605 }
9606 EOCP
9607         set try
9608         if eval $compile; then
9609                 yyy=`$run ./try`
9610                 case "$yyy" in
9611                 123.456)
9612                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9613                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9614                         echo "We will use %f."
9615                         ;;
9616                 esac
9617         fi
9618 fi
9619
9620 if $test X"$sPRIfldbl" = X; then
9621         $cat >try.c <<'EOCP'
9622 #include <sys/types.h>
9623 #include <stdio.h>
9624 int main() {
9625   long double d = 123.456;
9626   printf("%.3Lf\n", d);
9627 }
9628 EOCP
9629         set try
9630         if eval $compile; then
9631                 yyy=`$run ./try`
9632                 case "$yyy" in
9633                 123.456)
9634                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9635                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9636                         echo "We will use %Lf."
9637                         ;;
9638                 esac
9639         fi
9640 fi
9641
9642 if $test X"$sPRIfldbl" = X; then
9643         $cat >try.c <<'EOCP'
9644 #include <sys/types.h>
9645 #include <stdio.h>
9646 int main() {
9647   long double d = 123.456;
9648   printf("%.3llf\n", d);
9649 }
9650 EOCP
9651         set try
9652         if eval $compile; then
9653                 yyy=`$run ./try`
9654                 case "$yyy" in
9655                 123.456)
9656                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9657                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9658                         echo "We will use %llf."
9659                         ;;
9660                 esac
9661         fi
9662 fi
9663
9664 if $test X"$sPRIfldbl" = X; then
9665         $cat >try.c <<'EOCP'
9666 #include <sys/types.h>
9667 #include <stdio.h>
9668 int main() {
9669   long double d = 123.456;
9670   printf("%.3lf\n", d);
9671 }
9672 EOCP
9673         set try
9674         if eval $compile; then
9675                 yyy=`$run ./try`
9676                 case "$yyy" in
9677                 123.456)
9678                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9679                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9680                         echo "We will use %lf."
9681                         ;;
9682                 esac
9683         fi
9684 fi
9685
9686 if $test X"$sPRIfldbl" = X; then
9687         echo "Cannot figure out how to print long doubles." >&4
9688 else
9689         sSCNfldbl=$sPRIfldbl    # expect consistency
9690 fi
9691
9692 $rm_try
9693
9694 fi # d_longdbl
9695
9696 case "$sPRIfldbl" in
9697 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9698         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9699         d_SCNfldbl="$undef";
9700         ;;
9701 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9702         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9703         d_SCNfldbl="$define";
9704         ;;
9705 esac
9706
9707 : Check how to convert floats to strings.
9708
9709 if test "X$d_Gconvert" = X; then
9710
9711 echo " "
9712 echo "Checking for an efficient way to convert floats to strings."
9713 echo " " > try.c
9714 case "$uselongdouble" in
9715 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9716 esac
9717 case "$d_longdbl" in
9718 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9719 esac
9720 case "$d_PRIgldbl" in
9721 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9722 esac
9723 $cat >>try.c <<EOP
9724 #ifdef TRY_gconvert
9725 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9726 char *myname = "gconvert";
9727 #endif
9728 #ifdef TRY_gcvt
9729 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9730 char *myname = "gcvt";
9731 #endif
9732 #ifdef TRY_qgcvt
9733 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9734 char *myname = "qgcvt";
9735 #define DOUBLETYPE long double
9736 #endif
9737 #ifdef TRY_sprintf
9738 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9739 #ifdef HAS_PRIgldbl
9740 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9741 #else
9742 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9743 #endif
9744 #else
9745 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9746 #endif
9747 char *myname = "sprintf";
9748 #endif
9749
9750 #ifndef DOUBLETYPE
9751 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9752 #define DOUBLETYPE long double
9753 #else
9754 #define DOUBLETYPE double
9755 #endif
9756 #endif
9757
9758 #include <stdio.h>
9759
9760 #$i_stdlib I_STDLIB
9761 #ifdef I_STDLIB
9762 #include <stdlib.h>
9763 #endif
9764 #$i_string I_STRING
9765 #ifdef I_STRING
9766 #  include <string.h>
9767 #else
9768 #  include <strings.h>
9769 #endif
9770
9771 int checkit(char *expect, char *got)
9772 {
9773     if (strcmp(expect, got)) {
9774                 printf("%s oddity:  Expected %s, got %s\n",
9775                         myname, expect, got);
9776                 exit(1);
9777         }
9778 }
9779
9780 int main()
9781 {
9782         char buf[64];
9783         buf[63] = '\0';
9784
9785         /* This must be 1st test on (which?) platform */
9786         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9787         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9788         checkit("0.1", buf);
9789
9790         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9791         checkit("0.01", buf);
9792
9793         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9794         checkit("0.001", buf);
9795
9796         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9797         checkit("0.0001", buf);
9798
9799         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9800         if (strlen(buf) > 5)
9801             checkit("9e-005", buf); /* for Microsoft ?? */
9802         else
9803             checkit("9e-05", buf);
9804
9805         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9806         checkit("1", buf);
9807
9808         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9809         checkit("1.1", buf);
9810
9811         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9812         checkit("1.01", buf);
9813
9814         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9815         checkit("1.001", buf);
9816
9817         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9818         checkit("1.0001", buf);
9819
9820         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9821         checkit("1.00001", buf);
9822
9823         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9824         checkit("1.000001", buf);
9825
9826         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9827         checkit("0", buf);
9828
9829         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9830         checkit("-1", buf);
9831
9832         /* Some Linux gcvt's give 1.e+5 here. */
9833         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9834         checkit("100000", buf);
9835
9836         /* Some Linux gcvt's give -1.e+5 here. */
9837         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9838         checkit("-100000", buf);
9839
9840         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9841         checkit("123.456", buf);
9842
9843         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9844         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9845         /* 34 should be enough to scare even long double
9846          * places into using the e notation. */
9847         if (strlen(buf) > 5)
9848             checkit("1e+034", buf); /* for Microsoft */
9849         else
9850             checkit("1e+34", buf);
9851
9852         /* For Perl, if you add additional tests here, also add them to
9853          * t/base/num.t for benefit of platforms not using Configure or
9854          * overriding d_Gconvert */
9855
9856         exit(0);
9857 }
9858 EOP
9859 : first add preferred functions to our list
9860 xxx_list=""
9861 for xxx_convert in $gconvert_preference; do
9862     case $xxx_convert in
9863     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9864     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9865     esac
9866 done
9867 : then add any others
9868 for xxx_convert in gconvert gcvt sprintf; do
9869     case "$xxx_list" in
9870     *$xxx_convert*) ;;
9871     *) xxx_list="$xxx_list $xxx_convert" ;;
9872     esac
9873 done
9874
9875 case "$d_longdbl$uselongdouble" in
9876 "$define$define")
9877     : again, add prefered functions to our list first
9878     xxx_ld_list=""
9879     for xxx_convert in $gconvert_ld_preference; do
9880         case $xxx_convert in
9881         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9882         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9883         esac
9884     done
9885     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9886     for xxx_convert in qgcvt sprintf $xxx_list; do
9887         case "$xxx_ld_list" in
9888         $xxx_convert*|*" $xxx_convert"*) ;;
9889         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9890         esac
9891     done
9892     : if sprintf cannot do long doubles, move it to the end
9893     if test "$d_PRIgldbl" != "$define"; then
9894         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9895     fi
9896     : if no qgcvt, remove it
9897     if test "$d_qgcvt" != "$define"; then
9898         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9899     fi
9900     : use the ld_list
9901     xxx_list="$xxx_ld_list"
9902     ;;
9903 esac
9904
9905 for xxx_convert in $xxx_list; do
9906         echo "Trying $xxx_convert..."
9907         $rm -f try try$_o core
9908         set try -DTRY_$xxx_convert
9909         if eval $compile; then
9910                 echo "$xxx_convert() found." >&4
9911                 if $run ./try; then
9912                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9913                         break;
9914                 else
9915                         echo "...But $xxx_convert didn't work as I expected."
9916                         xxx_convert=''
9917                 fi
9918         else
9919                 echo "$xxx_convert NOT found." >&4
9920         fi
9921 done
9922
9923 if test X$xxx_convert = X; then
9924     echo "*** WHOA THERE!!! ***" >&4
9925     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9926     xxx_convert=sprintf
9927 fi
9928
9929 case "$xxx_convert" in
9930 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9931 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9932 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9933 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9934    "$define$define$define")
9935       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9936    "$define$define$undef")
9937       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9938    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9939    esac
9940    ;;
9941 esac
9942
9943 fi
9944 $rm_try
9945
9946 : see if _fwalk exists
9947 set fwalk d__fwalk
9948 eval $inlibc
9949
9950 : Initialize h_fcntl
9951 h_fcntl=false
9952
9953 : Initialize h_sysfile
9954 h_sysfile=false
9955
9956 : access call always available on UNIX
9957 set access d_access
9958 eval $inlibc
9959
9960 : locate the flags for 'access()'
9961 case "$d_access" in
9962 "$define")
9963         echo " "
9964         $cat >access.c <<EOCP
9965 #include <sys/types.h>
9966 #ifdef I_FCNTL
9967 #include <fcntl.h>
9968 #endif
9969 #ifdef I_SYS_FILE
9970 #include <sys/file.h>
9971 #endif
9972 #ifdef I_UNISTD
9973 #include <unistd.h>
9974 #endif
9975 #$i_stdlib I_STDLIB
9976 #ifdef I_STDLIB
9977 #include <stdlib.h>
9978 #endif
9979 int main() {
9980         exit(R_OK);
9981 }
9982 EOCP
9983         : check sys/file.h first, no particular reason here
9984         if $test `./findhdr sys/file.h` && \
9985                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9986                 h_sysfile=true;
9987                 echo "<sys/file.h> defines the *_OK access constants." >&4
9988         elif $test `./findhdr fcntl.h` && \
9989                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9990                 h_fcntl=true;
9991                 echo "<fcntl.h> defines the *_OK access constants." >&4
9992         elif $test `./findhdr unistd.h` && \
9993                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9994                 echo "<unistd.h> defines the *_OK access constants." >&4
9995         else
9996                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9997         fi
9998         ;;
9999 esac
10000 $rm -f access*
10001
10002 : see if accessx exists
10003 set accessx d_accessx
10004 eval $inlibc
10005
10006 : see if aintl exists
10007 set aintl d_aintl
10008 eval $inlibc
10009
10010 : see if alarm exists
10011 set alarm d_alarm
10012 eval $inlibc
10013
10014 : see if 64bit time functions exists
10015
10016 set ctime64 d_ctime64
10017 eval $inlibc
10018
10019 set localtime64 d_localtime64
10020 eval $inlibc
10021
10022 set gmtime64 d_gmtime64
10023 eval $inlibc
10024
10025 set mktime64 d_mktime64
10026 eval $inlibc
10027
10028 set difftime64 d_difftime64
10029 eval $inlibc
10030
10031 set asctime64 d_asctime64
10032 eval $inlibc
10033
10034 : see if POSIX threads are available
10035 set pthread.h i_pthread
10036 eval $inhdr
10037
10038 : define a fucntion to check prototypes
10039 $cat > protochk <<EOSH
10040 $startsh
10041 cc="$cc"
10042 optimize="$optimize"
10043 ccflags="$ccflags"
10044 prototype="$prototype"
10045 define="$define"
10046 rm_try="$rm_try"
10047 usethreads=$usethreads
10048 i_pthread=$i_pthread
10049 pthread_h_first=$pthread_h_first
10050 EOSH
10051
10052 $cat >> protochk <<'EOSH'
10053
10054 $rm_try
10055 foo="$1"
10056 shift
10057 while test $# -ge 2; do
10058         case "$1" in
10059                 $define) echo "#include <$2>" >> try.c ;;
10060                 literal) echo "$2" >> try.c ;;
10061         esac
10062     # Extra magic for the benefit of systems that need pthread.h
10063     # to be included early to correctly detect threadsafe functions.
10064     # Such functions must guarantee themselves, though, that the usethreads
10065     # and i_pthread have been defined, before calling protochk.
10066     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10067         echo "#include <pthread.h>" >> try.c
10068         pthread_h_done=yes
10069     fi
10070     shift 2
10071 done
10072 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10073 cat >> try.c <<'EOCP'
10074 #ifdef CAN_PROTOTYPE
10075 #define _(args) args
10076 #else
10077 #define _(args) ()
10078 #endif
10079 EOCP
10080 echo "$foo" >> try.c
10081 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10082 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10083 status=$?
10084 $rm_try
10085 exit $status
10086 EOSH
10087 chmod +x protochk
10088 $eunicefix protochk
10089
10090 : Define hasproto macro for Configure internal use
10091 hasproto='varname=$1; func=$2; shift; shift;
10092 while $test $# -ge 2; do
10093         case "$1" in
10094         $define) echo "#include <$2>";;
10095         esac ;
10096     shift 2;
10097 done > try.c;
10098 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10099 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10100         echo "$func() prototype found.";
10101         val="$define";
10102 else
10103         echo "$func() prototype NOT found.";
10104         val="$undef";
10105 fi;
10106 set $varname;
10107 eval $setvar;
10108 $rm_try tryout.c'
10109
10110 : see if sys/types.h has to be included
10111 set sys/types.h i_systypes
10112 eval $inhdr
10113
10114 : see if sys/select.h has to be included
10115 set sys/select.h i_sysselct
10116 eval $inhdr
10117
10118 : Define hasfield macro for Configure internal use
10119 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10120 while $test $# -ge 2; do
10121         case "$1" in
10122         $define) echo "#include <$2>";;
10123         esac ;
10124     shift 2;
10125 done > try.c;
10126 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10127 set try;
10128 if eval $compile; then
10129         val="$define";
10130 else
10131         val="$undef";
10132 fi;
10133 set $varname;
10134 eval $setvar;
10135 $rm_try'
10136
10137 : see if we should include time.h, sys/time.h, or both
10138 echo " "
10139 if test "X$timeincl" = X; then
10140         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10141         $echo $n "I'm now running the test program...$c"
10142         $cat >try.c <<EOCP
10143 #include <sys/types.h>
10144 #ifdef I_TIME
10145 #include <time.h>
10146 #endif
10147 #ifdef I_SYSTIME
10148 #ifdef SYSTIMEKERNEL
10149 #define KERNEL
10150 #endif
10151 #include <sys/time.h>
10152 #endif
10153 #ifdef I_SYSSELECT
10154 #include <sys/select.h>
10155 #endif
10156 #$i_stdlib I_STDLIB
10157 #ifdef I_STDLIB
10158 #include <stdlib.h>
10159 #endif
10160 int main()
10161 {
10162         struct tm foo;
10163 #ifdef S_TIMEVAL
10164         struct timeval bar;
10165 #endif
10166 #ifdef S_TIMEZONE
10167         struct timezone tzp;
10168 #endif
10169         if (foo.tm_sec == foo.tm_sec)
10170                 exit(0);
10171 #ifdef S_TIMEVAL
10172         if (bar.tv_sec == bar.tv_sec)
10173                 exit(0);
10174 #endif
10175         exit(1);
10176 }
10177 EOCP
10178         flags=''
10179         for s_timezone in '-DS_TIMEZONE' ''; do
10180         sysselect=''
10181         for s_timeval in '-DS_TIMEVAL' ''; do
10182         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10183         for i_time in '' '-DI_TIME'; do
10184         for i_systime in '-DI_SYSTIME' ''; do
10185                 case "$flags" in
10186                 '') $echo $n ".$c"
10187                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10188                         if eval $compile; then
10189                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10190                                 shift
10191                                 flags="$*"
10192                                 echo " "
10193                                 $echo $n "Succeeded with $flags$c"
10194                         fi
10195                         ;;
10196                 esac
10197         done
10198         done
10199         done
10200         done
10201         done
10202         timeincl=''
10203         echo " "
10204         case "$flags" in
10205         *SYSTIMEKERNEL*) i_systimek="$define"
10206                 timeincl=`./findhdr sys/time.h`
10207                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10208         *) i_systimek="$undef";;
10209         esac
10210         case "$flags" in
10211         *I_TIME*) i_time="$define"
10212                 timeincl=`./findhdr time.h`" $timeincl"
10213                 echo "We'll include <time.h>." >&4;;
10214         *) i_time="$undef";;
10215         esac
10216         case "$flags" in
10217         *I_SYSTIME*) i_systime="$define"
10218                 timeincl=`./findhdr sys/time.h`" $timeincl"
10219                 echo "We'll include <sys/time.h>." >&4;;
10220         *) i_systime="$undef";;
10221         esac
10222         $rm_try
10223 fi
10224 : see if struct tm knows about tm_zone
10225 case "$i_systime$i_time" in
10226 *$define*)
10227         echo " "
10228         echo "Checking to see if your struct tm has tm_zone field..." >&4
10229         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10230         eval $hasfield
10231         ;;
10232 *)      val="$undef"
10233         set d_tm_tm_zone
10234         eval $setvar
10235         ;;
10236 esac
10237 case "$d_tm_tm_zone" in
10238 "$define")      echo "Yes, it does."   ;;
10239 *)              echo "No, it doesn't." ;;
10240 esac
10241 : see if struct tm knows about tm_gmtoff
10242 case "$i_systime$i_time" in
10243 *$define*)
10244         echo " "
10245         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10246         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10247         eval $hasfield
10248         ;;
10249 *)      val="$undef"
10250         set d_tm_tm_gmtoff
10251         eval $setvar
10252         ;;
10253 esac
10254 case "$d_tm_tm_gmtoff" in
10255 "$define")      echo "Yes, it does."   ;;
10256 *)              echo "No, it doesn't." ;;
10257 esac
10258
10259 : see if asctime_r exists
10260 set asctime_r d_asctime_r
10261 eval $inlibc
10262 case "$d_asctime_r" in
10263 "$define")
10264         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10265         case "$d_asctime_r_proto:$usethreads" in
10266         ":define")      d_asctime_r_proto=define
10267                 set d_asctime_r_proto asctime_r $hdrs
10268                 eval $hasproto ;;
10269         *)      ;;
10270         esac
10271         case "$d_asctime_r_proto" in
10272         define)
10273         case "$asctime_r_proto" in
10274         ''|0) try='char* asctime_r(const struct tm*, char*);'
10275         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10276         esac
10277         case "$asctime_r_proto" in
10278         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10279         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10280         esac
10281         case "$asctime_r_proto" in
10282         ''|0) try='int asctime_r(const struct tm*, char*);'
10283         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10284         esac
10285         case "$asctime_r_proto" in
10286         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10287         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10288         esac
10289         case "$asctime_r_proto" in
10290         ''|0)   d_asctime_r=undef
10291                 asctime_r_proto=0
10292                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10293         * )     case "$asctime_r_proto" in
10294                 REENTRANT_PROTO*) ;;
10295                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10296                 esac
10297                 echo "Prototype: $try" ;;
10298         esac
10299         ;;
10300         *)      case "$usethreads" in
10301                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10302                 esac
10303                 d_asctime_r=undef
10304                 asctime_r_proto=0
10305                 ;;
10306         esac
10307         ;;
10308 *)      asctime_r_proto=0
10309         ;;
10310 esac
10311
10312 : see if atolf exists
10313 set atolf d_atolf
10314 eval $inlibc
10315
10316 : see if atoll exists
10317 set atoll d_atoll
10318 eval $inlibc
10319
10320 : Look for GCC-style attribute format
10321 case "$d_attribute_format" in
10322 '')
10323 echo " "
10324 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10325 $cat >attrib.c <<'EOCP'
10326 #include <stdio.h>
10327 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10328 EOCP
10329 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10330         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10331                 echo "Your C compiler doesn't support __attribute__((format))."
10332                 val="$undef"
10333         else
10334                 echo "Your C compiler supports __attribute__((format))."
10335                 val="$define"
10336         fi
10337 else
10338         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10339         val="$undef"
10340 fi
10341 ;;
10342 *) val="$d_attribute_format" ;;
10343 esac
10344 set d_attribute_format
10345 eval $setvar
10346 $rm -f attrib*
10347
10348 : Look for GCC-style attribute format with null format allowed
10349 case "$d_printf_format_null" in
10350 '') case "$d_attribute_format" in
10351     $define)
10352         echo " "
10353         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10354 $cat >attrib.c <<EOCP
10355 #include <stdio.h>
10356 #$i_stdlib I_STDLIB
10357 #ifdef I_STDLIB
10358 #include <stdlib.h>
10359 #endif
10360 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10361 int null_printf (char* pat,...) { return (int)pat; }
10362 int main () { exit(null_printf(NULL)); }
10363 EOCP
10364         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10365             : run the executable in case it produces a run-time warning
10366             if $run ./attrib >>attrib.out 2>&1; then
10367                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10368                     echo "Your C compiler doesn't allow __printf__ format to be null."
10369                     val="$undef"
10370                 else
10371                     echo "Your C compiler allows __printf__ format to be null."
10372                     val="$define"
10373                 fi
10374             else
10375             echo "Your C compiler executable failed with __printf__ format null."
10376             val="$undef"
10377         fi
10378     else
10379         echo "Your C compiler fails with __printf__ format null."
10380         val="$undef"
10381     fi
10382     ;;
10383     *)  val="$undef" ;;
10384     esac
10385 ;;
10386 *)  val="$d_printf_format_null" ;;
10387 esac
10388 set d_printf_format_null
10389 eval $setvar
10390 $rm -f attrib*
10391
10392 : Look for GCC-style attribute malloc
10393 case "$d_attribute_malloc" in
10394 '')
10395 echo " "
10396 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10397 $cat >attrib.c <<'EOCP'
10398 #include <stdio.h>
10399 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10400 EOCP
10401 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10402         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10403                 echo "Your C compiler doesn't support __attribute__((malloc))."
10404                 val="$undef"
10405         else
10406                 echo "Your C compiler supports __attribute__((malloc))."
10407                 val="$define"
10408         fi
10409 else
10410         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10411         val="$undef"
10412 fi
10413 ;;
10414 *) val="$d_attribute_malloc" ;;
10415 esac
10416 set d_attribute_malloc
10417 eval $setvar
10418 $rm -f attrib*
10419
10420 : Look for GCC-style attribute nonnull
10421 case "$d_attribute_nonnull" in
10422 '')
10423 echo " "
10424 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10425 $cat >attrib.c <<'EOCP'
10426 #include <stdio.h>
10427 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10428 EOCP
10429 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10430         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10431                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10432                 val="$undef"
10433         else
10434                 echo "Your C compiler supports __attribute__((nonnull))."
10435                 val="$define"
10436         fi
10437 else
10438         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10439         val="$undef"
10440 fi
10441 ;;
10442 *) val="$d_attribute_nonnull" ;;
10443 esac
10444 set d_attribute_nonnull
10445 eval $setvar
10446 $rm -f attrib*
10447
10448 : Look for GCC-style attribute noreturn
10449 case "$d_attribute_noreturn" in
10450 '')
10451 echo " "
10452 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10453 $cat >attrib.c <<'EOCP'
10454 #include <stdio.h>
10455 void fall_over_dead( void ) __attribute__((noreturn));
10456 EOCP
10457 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10458         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10459                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10460                 val="$undef"
10461         else
10462                 echo "Your C compiler supports __attribute__((noreturn))."
10463                 val="$define"
10464         fi
10465 else
10466         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10467         val="$undef"
10468 fi
10469 ;;
10470 *) val="$d_attribute_noreturn" ;;
10471 esac
10472 set d_attribute_noreturn
10473 eval $setvar
10474 $rm -f attrib*
10475
10476 : Look for GCC-style attribute pure
10477 case "$d_attribute_pure" in
10478 '')
10479 echo " "
10480 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10481 $cat >attrib.c <<'EOCP'
10482 #include <stdio.h>
10483 int square( int n ) __attribute__((pure));
10484 EOCP
10485 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10486         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10487                 echo "Your C compiler doesn't support __attribute__((pure))."
10488                 val="$undef"
10489         else
10490                 echo "Your C compiler supports __attribute__((pure))."
10491                 val="$define"
10492         fi
10493 else
10494         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10495         val="$undef"
10496 fi
10497 ;;
10498 *) val="$d_attribute_pure" ;;
10499 esac
10500 set d_attribute_pure
10501 eval $setvar
10502 $rm -f attrib*
10503
10504 : Look for GCC-style attribute unused
10505 case "$d_attribute_unused" in
10506 '')
10507 echo " "
10508 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10509 $cat >attrib.c <<'EOCP'
10510 #include <stdio.h>
10511 int do_something( int dummy __attribute__((unused)), int n );
10512 EOCP
10513 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10514         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10515                 echo "Your C compiler doesn't support __attribute__((unused))."
10516                 val="$undef"
10517         else
10518                 echo "Your C compiler supports __attribute__((unused))."
10519                 val="$define"
10520         fi
10521 else
10522         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10523         val="$undef"
10524 fi
10525 ;;
10526 *) val="$d_attribute_unused" ;;
10527 esac
10528 set d_attribute_unused
10529 eval $setvar
10530 $rm -f attrib*
10531
10532 : Look for GCC-style attribute deprecated
10533 case "$d_attribute_deprecated" in
10534 '')
10535 echo " "
10536 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10537 $cat >attrib.c <<'EOCP'
10538 #include <stdio.h>
10539 int I_am_deprecated(void) __attribute__((deprecated));
10540 EOCP
10541 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10542         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10543                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10544                 val="$undef"
10545         else
10546                 echo "Your C compiler supports __attribute__((deprecated))."
10547                 val="$define"
10548         fi
10549 else
10550         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10551         val="$undef"
10552 fi
10553 ;;
10554 *) val="$d_attribute_deprecated" ;;
10555 esac
10556 set d_attribute_deprecated
10557 eval $setvar
10558 $rm -f attrib*
10559
10560 : Look for GCC-style attribute warn_unused_result
10561 case "$d_attribute_warn_unused_result" in
10562 '')
10563 echo " "
10564 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10565 $cat >attrib.c <<'EOCP'
10566 #include <stdio.h>
10567 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10568 EOCP
10569 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10570         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10571                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10572                 val="$undef"
10573         else
10574                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10575                 val="$define"
10576         fi
10577 else
10578         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10579         val="$undef"
10580 fi
10581 ;;
10582 *) val="$d_attribute_warn_unused_result" ;;
10583 esac
10584 set d_attribute_warn_unused_result
10585 eval $setvar
10586 $rm -f attrib*
10587
10588 : see if bcmp exists
10589 set bcmp d_bcmp
10590 eval $inlibc
10591
10592 : see if bcopy exists
10593 set bcopy d_bcopy
10594 eval $inlibc
10595
10596 : see if getpgrp exists
10597 set getpgrp d_getpgrp
10598 eval $inlibc
10599
10600 case "$d_getpgrp" in
10601 "$define")
10602         echo " "
10603         echo "Checking to see which flavor of getpgrp is in use..."
10604         $cat >try.c <<EOP
10605 #$i_unistd I_UNISTD
10606 #include <sys/types.h>
10607 #ifdef I_UNISTD
10608 #  include <unistd.h>
10609 #endif
10610 #$i_stdlib I_STDLIB
10611 #ifdef I_STDLIB
10612 #include <stdlib.h>
10613 #endif
10614 int main()
10615 {
10616         if (getuid() == 0) {
10617                 printf("(I see you are running Configure as super-user...)\n");
10618                 setuid(1);
10619         }
10620 #ifdef TRY_BSD_PGRP
10621         if (getpgrp(1) == 0)
10622                 exit(0);
10623 #else
10624         if (getpgrp() > 0)
10625                 exit(0);
10626 #endif
10627         exit(1);
10628 }
10629 EOP
10630         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10631                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10632                 val="$define"
10633         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10634                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10635                 val="$undef"
10636         else
10637                 echo "I can't seem to compile and run the test program."
10638                 if ./usg; then
10639                         xxx="a USG one, i.e. you use getpgrp()."
10640                 else
10641                         # SVR4 systems can appear rather BSD-ish.
10642                         case "$i_unistd" in
10643                         $undef)
10644                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10645                                 val="$define"
10646                                 ;;
10647                         $define)
10648                                 xxx="probably a USG one, i.e. you use getpgrp()."
10649                                 val="$undef"
10650                                 ;;
10651                         esac
10652                 fi
10653                 echo "Assuming your getpgrp is $xxx" >&4
10654         fi
10655         ;;
10656 *) val="$undef";;
10657 esac
10658 set d_bsdgetpgrp
10659 eval $setvar
10660 $rm_try
10661
10662 : see if setpgrp exists
10663 set setpgrp d_setpgrp
10664 eval $inlibc
10665
10666 case "$d_setpgrp" in
10667 "$define")
10668         echo " "
10669         echo "Checking to see which flavor of setpgrp is in use..."
10670         $cat >try.c <<EOP
10671 #$i_unistd I_UNISTD
10672 #include <sys/types.h>
10673 #ifdef I_UNISTD
10674 #  include <unistd.h>
10675 #endif
10676 #$i_stdlib I_STDLIB
10677 #ifdef I_STDLIB
10678 #include <stdlib.h>
10679 #endif
10680 int main()
10681 {
10682         if (getuid() == 0) {
10683                 printf("(I see you are running Configure as super-user...)\n");
10684                 setuid(1);
10685         }
10686 #ifdef TRY_BSD_PGRP
10687         if (-1 == setpgrp(1, 1))
10688                 exit(0);
10689 #else
10690         if (setpgrp() != -1)
10691                 exit(0);
10692 #endif
10693         exit(1);
10694 }
10695 EOP
10696         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10697                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10698                 val="$define"
10699         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10700                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10701                 val="$undef"
10702         else
10703                 echo "(I can't seem to compile and run the test program.)"
10704                 if ./usg; then
10705                         xxx="a USG one, i.e. you use setpgrp()."
10706                 else
10707                         # SVR4 systems can appear rather BSD-ish.
10708                         case "$i_unistd" in
10709                         $undef)
10710                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10711                                 val="$define"
10712                                 ;;
10713                         $define)
10714                                 xxx="probably a USG one, i.e. you use setpgrp()."
10715                                 val="$undef"
10716                                 ;;
10717                         esac
10718                 fi
10719                 echo "Assuming your setpgrp is $xxx" >&4
10720         fi
10721         ;;
10722 *) val="$undef";;
10723 esac
10724 set d_bsdsetpgrp
10725 eval $setvar
10726 $rm_try
10727
10728 : Look for GCC-style __builtin_choose_expr
10729 case "$d_builtin_choose_expr" in
10730 '')
10731     echo " "
10732     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10733     $cat >try.c <<'EOCP'
10734 #include <assert.h>
10735 #include <stdlib.h>
10736 #include <stdio.h>
10737
10738 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10739
10740 int main(void) {
10741     assert( SYRINX(1) == 2112 );
10742     assert( SYRINX(1) != 5150 );
10743     assert( SYRINX(0) == 5150 );
10744     assert( SYRINX(0) != 2112 );
10745     puts( "All good!" );
10746     exit(0);
10747 }
10748
10749 EOCP
10750     set try
10751     if eval $compile && $run ./try; then
10752         echo "Your C compiler supports __builtin_choose_expr."
10753         val="$define"
10754     else
10755         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10756         val="$undef"
10757     fi
10758 ;;
10759 *) val="$d_builtin_choose_expr" ;;
10760 esac
10761
10762 set d_builtin_choose_expr
10763 eval $setvar
10764 $rm_try
10765
10766 : Look for GCC-style __builtin_expect
10767 case "$d_builtin_expect" in
10768 '')
10769     echo " "
10770     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10771     $cat >try.c <<'EOCP'
10772 int main(void) {
10773     int n = 50;
10774     if ( __builtin_expect(n, 0) ) n = 1;
10775     /* Remember shell exit code truth is 0, C truth is non-zero */
10776     return !(n == 1);
10777 }
10778 EOCP
10779     set try
10780     if eval $compile && $run ./try; then
10781         echo "Your C compiler supports __builtin_expect."
10782         val="$define"
10783     else
10784         echo "Your C compiler doesn't seem to understand __builtin_expect."
10785         val="$undef"
10786     fi
10787     ;;
10788 *) val="$d_builtin_expect" ;;
10789 esac
10790
10791 set d_builtin_expect
10792 eval $setvar
10793 $rm_try
10794
10795 : see if bzero exists
10796 set bzero d_bzero
10797 eval $inlibc
10798
10799 : see if stdarg is available
10800 echo " "
10801 if $test `./findhdr stdarg.h`; then
10802         echo "<stdarg.h> found." >&4
10803         valstd="$define"
10804 else
10805         echo "<stdarg.h> NOT found." >&4
10806         valstd="$undef"
10807 fi
10808
10809 : see if varags is available
10810 echo " "
10811 if $test `./findhdr varargs.h`; then
10812         echo "<varargs.h> found." >&4
10813 else
10814         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10815 fi
10816
10817 : set up the varargs testing programs
10818 $cat > varargs.c <<EOP
10819 #ifdef I_STDARG
10820 #include <stdarg.h>
10821 #endif
10822 #ifdef I_VARARGS
10823 #include <varargs.h>
10824 #endif
10825
10826 #ifdef I_STDARG
10827 int f(char *p, ...)
10828 #else
10829 int f(va_alist)
10830 va_dcl
10831 #endif
10832 {
10833         va_list ap;
10834 #ifndef I_STDARG
10835         char *p;
10836 #endif
10837 #ifdef I_STDARG
10838         va_start(ap,p);
10839 #else
10840         va_start(ap);
10841         p = va_arg(ap, char *);
10842 #endif
10843         va_end(ap);
10844         return 0;
10845 }
10846 EOP
10847 $cat > varargs <<EOP
10848 $startsh
10849 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10850         echo "true"
10851 else
10852         echo "false"
10853 fi
10854 $rm -f varargs$_o
10855 EOP
10856 chmod +x varargs
10857
10858 : now check which varargs header should be included
10859 echo " "
10860 i_varhdr=''
10861 case "$valstd" in
10862 "$define")
10863         if `./varargs I_STDARG`; then
10864                 val='stdarg.h'
10865         elif `./varargs I_VARARGS`; then
10866                 val='varargs.h'
10867         fi
10868         ;;
10869 *)
10870         if `./varargs I_VARARGS`; then
10871                 val='varargs.h'
10872         fi
10873         ;;
10874 esac
10875 case "$val" in
10876 '')
10877 echo "I could not find the definition for va_dcl... You have problems..." >&4
10878         val="$undef"; set i_stdarg; eval $setvar
10879         val="$undef"; set i_varargs; eval $setvar
10880         ;;
10881 *)
10882         set i_varhdr
10883         eval $setvar
10884         case "$i_varhdr" in
10885         stdarg.h)
10886                 val="$define"; set i_stdarg; eval $setvar
10887                 val="$undef"; set i_varargs; eval $setvar
10888                 ;;
10889         varargs.h)
10890                 val="$undef"; set i_stdarg; eval $setvar
10891                 val="$define"; set i_varargs; eval $setvar
10892                 ;;
10893         esac
10894         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10895 esac
10896 $rm -f varargs*
10897
10898 : see if the Compiler supports C99 variadic macros
10899 case "$i_stdarg$i_stdlib" in
10900     "$define$define")
10901     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10902     $cat >try.c <<EOCP
10903 #include <stdio.h>
10904 #include <stdarg.h>
10905
10906 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10907
10908 int main() {
10909   char buf[20];
10910   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10911   puts(buf);
10912   return 0;
10913 }
10914 EOCP
10915     set try
10916     if eval $compile && $run ./try 2>&1 >/dev/null; then
10917         case "`$run ./try`" in
10918             "123 456 789")
10919             echo "You have C99 variadic macros." >&4
10920             d_c99_variadic_macros="$define"
10921             ;;
10922             *)
10923             echo "You don't have functional C99 variadic macros." >&4
10924             d_c99_variadic_macros="$undef"
10925             ;;
10926         esac
10927     else
10928         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10929         d_c99_variadic_macros="$undef"
10930     fi
10931     $rm_try
10932     ;;
10933     *)
10934     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10935     d_c99_variadic_macros="$undef"
10936     ;;
10937 esac
10938
10939 : see if signal is declared as pointer to function returning int or void
10940 echo " "
10941 xxx=`./findhdr signal.h`
10942 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10943 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10944         echo "You have int (*signal())() instead of void." >&4
10945         val="$undef"
10946 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10947         echo "You have void (*signal())()." >&4
10948         val="$define"
10949 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10950         echo "You have int (*signal())() instead of void." >&4
10951         val="$undef"
10952 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10953         echo "You have void (*signal())()." >&4
10954         val="$define"
10955 else
10956         case "$d_voidsig" in
10957         '')
10958         echo "I can't determine whether signal handler returns void or int..." >&4
10959                 dflt=void
10960                 rp="What type does your signal handler return?"
10961                 . ./myread
10962                 case "$ans" in
10963                 v*) val="$define";;
10964                 *) val="$undef";;
10965                 esac;;
10966         "$define")
10967                 echo "As you already told me, signal handler returns void." >&4
10968                 val="$define"
10969                 ;;
10970         *)      echo "As you already told me, signal handler returns int." >&4
10971                 val="$undef"
10972                 ;;
10973         esac
10974 fi
10975 set d_voidsig
10976 eval $setvar
10977 case "$d_voidsig" in
10978 "$define") signal_t="void";;
10979 *) signal_t="int";;
10980 esac
10981 $rm -f $$.tmp
10982
10983 : check for ability to cast large floats to 32-bit ints.
10984 echo " "
10985 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10986 if $test "$intsize" -ge 4; then
10987         xxx=int
10988 else
10989         xxx=long
10990 fi
10991 $cat >try.c <<EOCP
10992 #include <stdio.h>
10993 #$i_stdlib I_STDLIB
10994 #ifdef I_STDLIB
10995 #include <stdlib.h>
10996 #endif
10997 #include <sys/types.h>
10998 #include <signal.h>
10999 $signal_t blech(int s) { exit(3); }
11000 int main()
11001 {
11002         $xxx i32;
11003         double f, g;
11004         int result = 0;
11005         char str[16];
11006         signal(SIGFPE, blech);
11007
11008         /* Don't let compiler optimize the test away.  Store the number
11009            in a writable string for gcc to pass to sscanf under HP/UX.
11010         */
11011         sprintf(str, "2147483647");
11012         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11013         g = 10 * f;
11014         i32  = ($xxx) g;
11015
11016         /* x86 processors will probably give 0x8000 0000, which is a
11017            sign change.  We don't want that.  We want to mimic SPARC
11018            behavior here, which is to preserve the sign and give
11019            back 0x7fff ffff.
11020         */
11021         if (i32 != ($xxx) f)
11022                 result |= 1;
11023         exit(result);
11024 }
11025 EOCP
11026 set try
11027 if eval $compile_ok; then
11028         $run ./try
11029         yyy=$?
11030 else
11031         echo "(I can't seem to compile the test program--assuming it can't)"
11032         yyy=1
11033 fi
11034 case "$yyy" in
11035 0)      val="$define"
11036         echo "Yup, it can."
11037         ;;
11038 *)      val="$undef"
11039         echo "Nope, it can't."
11040         ;;
11041 esac
11042 set d_casti32
11043 eval $setvar
11044 $rm_try
11045
11046 : check for ability to cast negative floats to unsigned
11047 echo " "
11048 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11049 $cat >try.c <<EOCP
11050 #include <stdio.h>
11051 #$i_stdlib I_STDLIB
11052 #ifdef I_STDLIB
11053 #include <stdlib.h>
11054 #endif
11055 #include <sys/types.h>
11056 #include <signal.h>
11057 $signal_t blech(int s) { exit(7); }
11058 $signal_t blech_in_list(int s) { exit(4); }
11059 unsigned long dummy_long(unsigned long p) { return p; }
11060 unsigned int dummy_int(unsigned int p) { return p; }
11061 unsigned short dummy_short(unsigned short p) { return p; }
11062 int main()
11063 {
11064         double f;
11065         unsigned long along;
11066         unsigned int aint;
11067         unsigned short ashort;
11068         int result = 0;
11069         char str[16];
11070
11071         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11072            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11073            optimized the whole file away
11074         */
11075         /* Store the number in a writable string for gcc to pass to
11076            sscanf under HP/UX.
11077         */
11078         sprintf(str, "-123");
11079         sscanf(str, "%lf", &f);  /* f = -123.; */
11080
11081         signal(SIGFPE, blech);
11082         along = (unsigned long)f;
11083         aint = (unsigned int)f;
11084         ashort = (unsigned short)f;
11085         if (along != (unsigned long)-123)
11086                 result |= 1;
11087         if (aint != (unsigned int)-123)
11088                 result |= 1;
11089         if (ashort != (unsigned short)-123)
11090                 result |= 1;
11091         sprintf(str, "1073741824.");
11092         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11093         f = f + f;
11094         along = 0;
11095         along = (unsigned long)f;
11096         if (along != 0x80000000)
11097                 result |= 2;
11098         f -= 1.;
11099         along = 0;
11100         along = (unsigned long)f;
11101         if (along != 0x7fffffff)
11102                 result |= 1;
11103         f += 2.;
11104         along = 0;
11105         along = (unsigned long)f;
11106         if (along != 0x80000001)
11107                 result |= 2;
11108         if (result)
11109                 exit(result);
11110         signal(SIGFPE, blech_in_list);
11111         sprintf(str, "123.");
11112         sscanf(str, "%lf", &f);  /* f = 123.; */
11113         along = dummy_long((unsigned long)f);
11114         aint = dummy_int((unsigned int)f);
11115         ashort = dummy_short((unsigned short)f);
11116         if (along != (unsigned long)123)
11117                 result |= 4;
11118         if (aint != (unsigned int)123)
11119                 result |= 4;
11120         if (ashort != (unsigned short)123)
11121                 result |= 4;
11122         exit(result);
11123
11124 }
11125 EOCP
11126 set try
11127 if eval $compile_ok; then
11128         $run ./try
11129         castflags=$?
11130 else
11131         echo "(I can't seem to compile the test program--assuming it can't)"
11132         castflags=7
11133 fi
11134 case "$castflags" in
11135 0)      val="$define"
11136         echo "Yup, it can."
11137         ;;
11138 *)      val="$undef"
11139         echo "Nope, it can't."
11140         ;;
11141 esac
11142 set d_castneg
11143 eval $setvar
11144 $rm_try
11145
11146 : see if vprintf exists
11147 echo " "
11148 if set vprintf val -f d_vprintf; eval $csym; $val; then
11149         echo 'vprintf() found.' >&4
11150         val="$define"
11151         $cat >try.c <<EOF
11152 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11153 #$i_varargs I_VARARGS
11154
11155 #$i_stdlib I_STDLIB
11156 #$i_unistd I_UNISTD
11157
11158 #ifdef I_STDARG
11159 #  include <stdarg.h>
11160 #else /* I_VARARGS */
11161 #  include <varargs.h>
11162 #endif
11163
11164 #ifdef I_UNISTD
11165 #  include <unistd.h>
11166 #endif
11167
11168 #ifdef I_STDLIB
11169 #  include <stdlib.h>
11170 #endif
11171
11172 #include <stdio.h> /* vsprintf prototype */
11173
11174 #ifdef I_STDARG
11175 void xxx(int n, ...)
11176 {
11177     va_list args;
11178     char buf[10];
11179     va_start(args, n);
11180     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11181 }
11182 int main() { xxx(1, "foo"); }
11183
11184 #else /* I_VARARGS */
11185
11186 xxx(va_alist)
11187 va_dcl
11188 {
11189     va_list args;
11190     char buf[10];
11191     va_start(args);
11192     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11193 }
11194 int main() { xxx("foo"); }
11195
11196 #endif
11197
11198 EOF
11199         set try
11200         if eval $compile_ok; then
11201                 if $run ./try; then
11202                         echo "Your vsprintf() returns (int)." >&4
11203                         val2="$undef"
11204                 else
11205                         echo "Your vsprintf() returns (char*)." >&4
11206                         val2="$define"
11207                 fi
11208         else
11209                 echo 'I am unable to compile the vsprintf() test program.' >&4
11210                 # We shouldn't get here.  If we do, assume the standard signature,
11211                 # not the old BSD one.
11212                 echo 'Guessing that vsprintf() returns (int).' >&4
11213                 val2="$undef"
11214         fi
11215 else
11216         echo 'vprintf() NOT found.' >&4
11217         val="$undef"
11218         val2="$undef"
11219 fi
11220 $rm_try
11221 set d_vprintf
11222 eval $setvar
11223 val=$val2
11224 set d_charvspr
11225 eval $setvar
11226
11227 : see if chown exists
11228 set chown d_chown
11229 eval $inlibc
11230
11231 : see if chroot exists
11232 set chroot d_chroot
11233 eval $inlibc
11234
11235 : see if chsize exists
11236 set chsize d_chsize
11237 eval $inlibc
11238
11239 : see if class exists
11240 set class d_class
11241 eval $inlibc
11242
11243 : see if clearenv exists
11244 set clearenv d_clearenv
11245 eval $inlibc
11246
11247 : Define hasstruct macro for Configure internal use
11248 hasstruct='varname=$1; struct=$2; shift; shift;
11249 while $test $# -ge 2; do
11250         case "$1" in
11251         $define) echo "#include <$2>";;
11252         esac ;
11253     shift 2;
11254 done > try.c;
11255 echo "int main () { struct $struct foo; }" >> try.c;
11256 set try;
11257 if eval $compile; then
11258         val="$define";
11259 else
11260         val="$undef";
11261 fi;
11262 set $varname;
11263 eval $setvar;
11264 $rm_try'
11265
11266 : see whether socket exists
11267 socketlib=''
11268 sockethdr=''
11269 echo " "
11270 $echo $n "Hmm... $c" >&4
11271 if set socket val -f d_socket; eval $csym; $val; then
11272         echo "Looks like you have Berkeley networking support." >&4
11273         d_socket="$define"
11274         if set setsockopt val -f; eval $csym; $val; then
11275                 d_oldsock="$undef"
11276         else
11277                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11278                 d_oldsock="$define"
11279         fi
11280 else
11281         if $contains socklib libc.list >/dev/null 2>&1; then
11282                 echo "Looks like you have Berkeley networking support." >&4
11283                 d_socket="$define"
11284                 : we will have to assume that it supports the 4.2 BSD interface
11285                 d_oldsock="$undef"
11286         else
11287                 echo "You don't have Berkeley networking in libc$_a..." >&4
11288                 if test "X$d_socket" = "X$define"; then
11289                    echo "...but you seem to believe that you have sockets." >&4
11290                 else
11291                         for net in net socket
11292                         do
11293                                 if test -f /usr/lib/lib$net$_a; then
11294                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11295                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11296                                         if $contains socket libc.list >/dev/null 2>&1; then
11297                                                 d_socket="$define"
11298                                                 socketlib="-l$net"
11299                                                 case "$net" in
11300                                                 net)
11301                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11302                                                         sockethdr="-I/usr/netinclude"
11303                                                         ;;
11304                                                 esac
11305                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11306                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11307                                                         d_oldsock="$undef"
11308                                                 else
11309                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11310                                                         d_oldsock="$define"
11311                                                 fi
11312                                                 break
11313                                         fi
11314                                 fi
11315                         done
11316                         if test "X$d_socket" != "X$define"; then
11317                            echo "or anywhere else I see." >&4
11318                            d_socket="$undef"
11319                            d_oldsock="$undef"
11320                         fi
11321                 fi
11322         fi
11323 fi
11324
11325 : see if socketpair exists
11326 set socketpair d_sockpair
11327 eval $inlibc
11328
11329
11330 echo " "
11331 echo "Checking the availability of certain socket constants..." >&4
11332 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11333         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11334         $cat >try.c <<EOF
11335 #include <sys/types.h>
11336 #include <sys/socket.h>
11337 int main() {
11338     int i = $ENUM;
11339 }
11340 EOF
11341         val="$undef"
11342         set try; if eval $compile; then
11343                 val="$define"
11344         fi
11345         set d_${enum}; eval $setvar
11346         $rm_try
11347 done
11348
11349 : see if this is a sys/uio.h system
11350 set sys/uio.h i_sysuio
11351 eval $inhdr
11352
11353 : Check for cmsghdr support
11354 echo " "
11355 echo "Checking to see if your system supports struct cmsghdr..." >&4
11356 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11357 eval $hasstruct
11358 case "$d_cmsghdr_s" in
11359 "$define")      echo "Yes, it does."   ;;
11360 *)              echo "No, it doesn't." ;;
11361 esac
11362
11363
11364 : check for const keyword
11365 echo " "
11366 echo 'Checking to see if your C compiler knows about "const"...' >&4
11367 $cat >const.c <<'EOCP'
11368 typedef struct spug { int drokk; } spug;
11369 int main()
11370 {
11371         const char *foo;
11372         const spug y = { 0 };
11373 }
11374 EOCP
11375 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11376         val="$define"
11377         echo "Yup, it does."
11378 else
11379         val="$undef"
11380         echo "Nope, it doesn't."
11381 fi
11382 set d_const
11383 eval $setvar
11384
11385 : see if copysignl exists
11386 set copysignl d_copysignl
11387 eval $inlibc
11388
11389 : see if crypt exists
11390 echo " "
11391 set crypt d_crypt
11392 eval $inlibc
11393 case "$d_crypt" in
11394 $define) cryptlib='' ;;
11395 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11396                 echo 'crypt() found.' >&4
11397                 val="$define"
11398                 cryptlib=''
11399         else
11400                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11401                 if $test -z "$cryptlib"; then
11402                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11403                 else
11404                         cryptlib=-lcrypt
11405                 fi
11406                 if $test -z "$cryptlib"; then
11407                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11408                 else
11409                         cryptlib=-lcrypt
11410                 fi
11411                 if $test -z "$cryptlib"; then
11412                         cryptlib=`./loc libcrypt$_a "" $libpth`
11413                 else
11414                         cryptlib=-lcrypt
11415                 fi
11416                 if $test -z "$cryptlib"; then
11417                         echo 'crypt() NOT found.' >&4
11418                         val="$undef"
11419                 else
11420                         val="$define"
11421                 fi
11422         fi
11423         set d_crypt
11424         eval $setvar
11425         ;;
11426 esac
11427
11428 : see if this is a crypt.h system
11429 set crypt.h i_crypt
11430 eval $inhdr
11431
11432 : see if crypt_r exists
11433 set crypt_r d_crypt_r
11434 eval $inlibc
11435 case "$d_crypt_r" in
11436 "$define")
11437         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11438         case "$d_crypt_r_proto:$usethreads" in
11439         ":define")      d_crypt_r_proto=define
11440                 set d_crypt_r_proto crypt_r $hdrs
11441                 eval $hasproto ;;
11442         *)      ;;
11443         esac
11444         case "$d_crypt_r_proto" in
11445         define)
11446         case "$crypt_r_proto" in
11447         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11448         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11449         esac
11450         case "$crypt_r_proto" in
11451         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11452         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11453         esac
11454         case "$crypt_r_proto" in
11455         ''|0)   d_crypt_r=undef
11456                 crypt_r_proto=0
11457                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11458         * )     case "$crypt_r_proto" in
11459                 REENTRANT_PROTO*) ;;
11460                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11461                 esac
11462                 echo "Prototype: $try" ;;
11463         esac
11464         ;;
11465         *)      case "$usethreads" in
11466                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11467                 esac
11468                 d_crypt_r=undef
11469                 crypt_r_proto=0
11470                 ;;
11471         esac
11472         ;;
11473 *)      crypt_r_proto=0
11474         ;;
11475 esac
11476
11477 : get csh whereabouts
11478 case "$csh" in
11479 'csh') val="$undef" ;;
11480 *) val="$define" ;;
11481 esac
11482 set d_csh
11483 eval $setvar
11484 : Respect a hint or command line value for full_csh.
11485 case "$full_csh" in
11486 '') full_csh=$csh ;;
11487 esac
11488
11489 : see if ctermid exists
11490 set ctermid d_ctermid
11491 eval $inlibc
11492
11493 : see if ctermid_r exists
11494 set ctermid_r d_ctermid_r
11495 eval $inlibc
11496 case "$d_ctermid_r" in
11497 "$define")
11498         hdrs="$i_systypes sys/types.h define stdio.h "
11499         case "$d_ctermid_r_proto:$usethreads" in
11500         ":define")      d_ctermid_r_proto=define
11501                 set d_ctermid_r_proto ctermid_r $hdrs
11502                 eval $hasproto ;;
11503         *)      ;;
11504         esac
11505         case "$d_ctermid_r_proto" in
11506         define)
11507         case "$ctermid_r_proto" in
11508         ''|0) try='char* ctermid_r(char*);'
11509         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11510         esac
11511         case "$ctermid_r_proto" in
11512         ''|0)   d_ctermid_r=undef
11513                 ctermid_r_proto=0
11514                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11515         * )     case "$ctermid_r_proto" in
11516                 REENTRANT_PROTO*) ;;
11517                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11518                 esac
11519                 echo "Prototype: $try" ;;
11520         esac
11521         ;;
11522         *)      case "$usethreads" in
11523                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11524                 esac
11525                 d_ctermid_r=undef
11526                 ctermid_r_proto=0
11527                 ;;
11528         esac
11529         ;;
11530 *)      ctermid_r_proto=0
11531         ;;
11532 esac
11533
11534 : see if ctime_r exists
11535 set ctime_r d_ctime_r
11536 eval $inlibc
11537 case "$d_ctime_r" in
11538 "$define")
11539         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11540         case "$d_ctime_r_proto:$usethreads" in
11541         ":define")      d_ctime_r_proto=define
11542                 set d_ctime_r_proto ctime_r $hdrs
11543                 eval $hasproto ;;
11544         *)      ;;
11545         esac
11546         case "$d_ctime_r_proto" in
11547         define)
11548         case "$ctime_r_proto" in
11549         ''|0) try='char* ctime_r(const time_t*, char*);'
11550         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11551         esac
11552         case "$ctime_r_proto" in
11553         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11554         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11555         esac
11556         case "$ctime_r_proto" in
11557         ''|0) try='int ctime_r(const time_t*, char*);'
11558         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11559         esac
11560         case "$ctime_r_proto" in
11561         ''|0) try='int ctime_r(const time_t*, char*, int);'
11562         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11563         esac
11564         case "$ctime_r_proto" in
11565         ''|0)   d_ctime_r=undef
11566                 ctime_r_proto=0
11567                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11568         * )     case "$ctime_r_proto" in
11569                 REENTRANT_PROTO*) ;;
11570                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11571                 esac
11572                 echo "Prototype: $try" ;;
11573         esac
11574         ;;
11575         *)      case "$usethreads" in
11576                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11577                 esac
11578                 d_ctime_r=undef
11579                 ctime_r_proto=0
11580                 ;;
11581         esac
11582         ;;
11583 *)      ctime_r_proto=0
11584         ;;
11585 esac
11586
11587 : see if cuserid exists
11588 set cuserid d_cuserid
11589 eval $inlibc
11590
11591 : see if this is a limits.h system
11592 set limits.h i_limits
11593 eval $inhdr
11594
11595 : see if this is a float.h system
11596 set float.h i_float
11597 eval $inhdr
11598
11599 : See if number of significant digits in a double precision number is known
11600 echo " "
11601 $cat >dbl_dig.c <<EOM
11602 #$i_limits I_LIMITS
11603 #$i_float I_FLOAT
11604 #ifdef I_LIMITS
11605 #include <limits.h>
11606 #endif
11607 #ifdef I_FLOAT
11608 #include <float.h>
11609 #endif
11610 #ifdef DBL_DIG
11611 printf("Contains DBL_DIG");
11612 #endif
11613 EOM
11614 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11615 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11616         echo "DBL_DIG found." >&4
11617         val="$define"
11618 else
11619         echo "DBL_DIG NOT found." >&4
11620         val="$undef"
11621 fi
11622 $rm -f dbl_dig.?
11623 set d_dbl_dig
11624 eval $setvar
11625
11626 : see if dbm.h is available
11627 : see if dbmclose exists
11628 set dbmclose d_dbmclose
11629 eval $inlibc
11630
11631 case "$d_dbmclose" in
11632 $define)
11633         set dbm.h i_dbm
11634         eval $inhdr
11635         case "$i_dbm" in
11636         $define)
11637                 val="$undef"
11638                 set i_rpcsvcdbm
11639                 eval $setvar
11640                 ;;
11641         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11642                 eval $inhdr
11643                 ;;
11644         esac
11645         ;;
11646 *)      echo "We won't be including <dbm.h>"
11647         val="$undef"
11648         set i_dbm
11649         eval $setvar
11650         val="$undef"
11651         set i_rpcsvcdbm
11652         eval $setvar
11653         ;;
11654 esac
11655
11656 : see if prototype for dbminit is available
11657 echo " "
11658 set d_dbminitproto dbminit $i_dbm dbm.h
11659 eval $hasproto
11660
11661 : see if difftime exists
11662 set difftime d_difftime
11663 eval $inlibc
11664
11665 : see if this is a dirent system
11666 echo " "
11667 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11668         val="$define"
11669         echo "<dirent.h> found." >&4
11670 else
11671         val="$undef"
11672         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11673                 echo "<sys/dir.h> found." >&4
11674                 echo " "
11675         else
11676                 xinc=`./findhdr sys/ndir.h`
11677         fi
11678         echo "<dirent.h> NOT found." >&4
11679 fi
11680 set i_dirent
11681 eval $setvar
11682
11683 : Look for type of directory structure.
11684 echo " "
11685 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11686
11687 case "$direntrytype" in
11688 ''|' ')
11689         case "$i_dirent" in
11690         $define) guess1='struct dirent' ;;
11691         *) guess1='struct direct'  ;;
11692         esac
11693         ;;
11694 *)      guess1="$direntrytype"
11695         ;;
11696 esac
11697
11698 case "$guess1" in
11699 'struct dirent') guess2='struct direct' ;;
11700 *) guess2='struct dirent' ;;
11701 esac
11702
11703 if $contains "$guess1" try.c >/dev/null 2>&1; then
11704         direntrytype="$guess1"
11705         echo "Your directory entries are $direntrytype." >&4
11706 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11707         direntrytype="$guess2"
11708         echo "Your directory entries seem to be $direntrytype." >&4
11709 else
11710         echo "I don't recognize your system's directory entries." >&4
11711         rp="What type is used for directory entries on this system?"
11712         dflt="$guess1"
11713         . ./myread
11714         direntrytype="$ans"
11715 fi
11716 $rm_try
11717
11718 : see if the directory entry stores field length
11719 echo " "
11720 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11721 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11722         echo "Good, your directory entry keeps length information in d_namlen." >&4
11723         val="$define"
11724 else
11725         echo "Your directory entry does not know about the d_namlen field." >&4
11726         val="$undef"
11727 fi
11728 set d_dirnamlen
11729 eval $setvar
11730 $rm_try
11731
11732 : Look for DIR.dd_fd
11733 case "$i_dirent" in
11734 "$define")
11735     echo "Checking to see if DIR has a dd_fd member variable" >&4
11736     $cat >try.c <<EOCP
11737 #$i_stdlib I_STDLIB
11738 #ifdef I_STDLIB
11739 #include <stdlib.h>
11740 #endif
11741 #include <dirent.h>
11742
11743 int main() {
11744     DIR dir;
11745     dir.dd_fd = 1;
11746     return 0;
11747 }
11748 EOCP
11749     val=$undef
11750     set try
11751     if eval $compile; then
11752         echo "Yes, it does."
11753         val="$define"
11754     else
11755         echo "No, it does not."
11756         val="$undef"
11757     fi
11758     ;;
11759 *)
11760     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11761     val="$undef"
11762     ;;
11763 esac
11764 set d_dir_dd_fd
11765 eval $setvar
11766 $rm_try
11767
11768 : see if this is an sysdir system
11769 set sys/dir.h i_sysdir
11770 eval $inhdr
11771
11772 : see if this is an sysndir system
11773 set sys/ndir.h i_sysndir
11774 eval $inhdr
11775
11776 : Look for dirfd
11777 echo " "
11778 $cat >dirfd.c <<EOM
11779 #include <stdio.h>
11780 #$i_stdlib I_STDLIB
11781 #ifdef I_STDLIB
11782 #include <stdlib.h>
11783 #endif
11784 #$i_dirent I_DIRENT             /**/
11785 #$i_sysdir I_SYS_DIR            /**/
11786 #$i_sysndir I_SYS_NDIR          /**/
11787 #$i_systypes I_SYS_TYPES        /**/
11788 #if defined(I_SYS_TYPES)
11789 #include <sys/types.h>
11790 #endif
11791 #if defined(I_DIRENT)
11792 #include <dirent.h>
11793 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11794 #include <sys/dir.h>
11795 #endif
11796 #else
11797 #ifdef I_SYS_NDIR
11798 #include <sys/ndir.h>
11799 #else
11800 #ifdef I_SYS_DIR
11801 #ifdef hp9000s500
11802 #include <ndir.h>       /* may be wrong in the future */
11803 #else
11804 #include <sys/dir.h>
11805 #endif
11806 #endif
11807 #endif
11808 #endif 
11809 int main() {
11810         DIR *dirp = opendir(".");
11811         if (dirfd(dirp) >= 0)
11812                 exit(0);
11813         else
11814                 exit(1);
11815 }
11816 EOM
11817 val=$undef
11818 set dirfd
11819 if eval $compile; then
11820         val="$define"
11821 fi
11822 case "$val" in
11823 $define)        echo "dirfd() found." >&4       ;;
11824 *)              echo "dirfd() NOT found." >&4   ;;
11825 esac
11826 set d_dirfd
11827 eval $setvar
11828 $rm -f dirfd*
11829
11830 : see if dlerror exists
11831 xxx_runnm="$runnm"
11832 runnm=false
11833 set dlerror d_dlerror
11834 eval $inlibc
11835 runnm="$xxx_runnm"
11836
11837 : see if dlfcn is available
11838 set dlfcn.h i_dlfcn
11839 eval $inhdr
11840
11841 : Check what extension to use for shared libs
11842 case "$usedl" in
11843 $define|y|true)
11844         $cat << EOM
11845
11846 On a few systems, the dynamically loaded modules that perl generates and uses
11847 will need a different extension than shared libs. The default will probably
11848 be appropriate.
11849
11850 EOM
11851         case "$dlext" in
11852         '')     dflt="$so" ;;
11853         *)      dflt="$dlext" ;;
11854         esac
11855         rp='What is the extension of dynamically loaded modules'
11856         . ./myread
11857         dlext="$ans"
11858         ;;
11859 *)
11860         dlext="none"
11861         ;;
11862 esac
11863
11864 : Check if dlsym need a leading underscore
11865 echo " "
11866 val="$undef"
11867
11868 case "$dlsrc" in
11869 dl_dlopen.xs)
11870         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11871         $cat >dyna.c <<'EOM'
11872 fred () { }
11873 EOM
11874
11875 $cat >fred.c<<EOM
11876
11877 #include <stdio.h>
11878 #$i_stdlib I_STDLIB
11879 #ifdef I_STDLIB
11880 #include <stdlib.h>
11881 #endif
11882 #$i_dlfcn I_DLFCN
11883 #ifdef I_DLFCN
11884 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11885 #else
11886 #include <sys/types.h>
11887 #include <nlist.h>
11888 #include <link.h>
11889 #endif
11890
11891 extern int fred() ;
11892
11893 int main()
11894 {
11895     void * handle ;
11896     void * symbol ;
11897 #ifndef RTLD_LAZY
11898     int mode = 1 ;
11899 #else
11900     int mode = RTLD_LAZY ;
11901 #endif
11902     handle = dlopen("./dyna.$dlext", mode) ;
11903     if (handle == NULL) {
11904         printf ("1\n") ;
11905         fflush (stdout) ;
11906         exit(0);
11907     }
11908     symbol = dlsym(handle, "fred") ;
11909     if (symbol == NULL) {
11910         /* try putting a leading underscore */
11911         symbol = dlsym(handle, "_fred") ;
11912         if (symbol == NULL) {
11913             printf ("2\n") ;
11914             fflush (stdout) ;
11915             exit(0);
11916         }
11917         printf ("3\n") ;
11918     }
11919     else
11920         printf ("4\n") ;
11921     fflush (stdout) ;
11922     exit(0);
11923 }
11924 EOM
11925         : Call the object file tmp-dyna.o in case dlext=o.
11926         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11927                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11928                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11929                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11930                 xxx=`$run ./fred`
11931                 case $xxx in
11932                 1)      echo "Test program failed using dlopen." >&4
11933                         echo "Perhaps you should not use dynamic loading." >&4;;
11934                 2)      echo "Test program failed using dlsym." >&4
11935                         echo "Perhaps you should not use dynamic loading." >&4;;
11936                 3)      echo "dlsym needs a leading underscore" >&4
11937                         val="$define" ;;
11938                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11939                 esac
11940         else
11941                 echo "I can't compile and run the test program." >&4
11942                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11943         fi
11944         ;;
11945 esac
11946
11947 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11948
11949 set d_dlsymun
11950 eval $setvar
11951
11952 : see if drand48_r exists
11953 set drand48_r d_drand48_r
11954 eval $inlibc
11955 case "$d_drand48_r" in
11956 "$define")
11957         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11958         case "$d_drand48_r_proto:$usethreads" in
11959         ":define")      d_drand48_r_proto=define
11960                 set d_drand48_r_proto drand48_r $hdrs
11961                 eval $hasproto ;;
11962         *)      ;;
11963         esac
11964         case "$d_drand48_r_proto" in
11965         define)
11966         case "$drand48_r_proto" in
11967         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11968         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11969         esac
11970         case "$drand48_r_proto" in
11971         ''|0)   d_drand48_r=undef
11972                 drand48_r_proto=0
11973                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11974         * )     case "$drand48_r_proto" in
11975                 REENTRANT_PROTO*) ;;
11976                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11977                 esac
11978                 echo "Prototype: $try" ;;
11979         esac
11980         ;;
11981         *)      case "$usethreads" in
11982                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11983                 esac
11984                 d_drand48_r=undef
11985                 drand48_r_proto=0
11986                 ;;
11987         esac
11988         ;;
11989 *)      drand48_r_proto=0
11990         ;;
11991 esac
11992
11993 : see if prototype for drand48 is available
11994 echo " "
11995 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11996 eval $hasproto
11997
11998 : see if dup2 exists
11999 set dup2 d_dup2
12000 eval $inlibc
12001
12002 : see if eaccess exists
12003 set eaccess d_eaccess
12004 eval $inlibc
12005
12006 : see if endgrent exists
12007 set endgrent d_endgrent
12008 eval $inlibc
12009
12010 : see if this is an grp system
12011 set grp.h i_grp
12012 eval $inhdr
12013
12014 case "$i_grp" in
12015 $define)
12016         xxx=`./findhdr grp.h`
12017         $cppstdin $cppflags $cppminus < $xxx >$$.h
12018
12019         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12020                 val="$define"
12021         else
12022                 val="$undef"
12023         fi
12024         set d_grpasswd
12025         eval $setvar
12026
12027         $rm -f $$.h
12028         ;;
12029 *)
12030         val="$undef";
12031         set d_grpasswd; eval $setvar
12032         ;;
12033 esac
12034
12035 : see if endgrent_r exists
12036 set endgrent_r d_endgrent_r
12037 eval $inlibc
12038 case "$d_endgrent_r" in
12039 "$define")
12040         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12041         case "$d_endgrent_r_proto:$usethreads" in
12042         ":define")      d_endgrent_r_proto=define
12043                 set d_endgrent_r_proto endgrent_r $hdrs
12044                 eval $hasproto ;;
12045         *)      ;;
12046         esac
12047         case "$d_endgrent_r_proto" in
12048         define)
12049         case "$endgrent_r_proto" in
12050         ''|0) try='int endgrent_r(FILE**);'
12051         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12052         esac
12053         case "$endgrent_r_proto" in
12054         ''|0) try='void endgrent_r(FILE**);'
12055         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12056         esac
12057         case "$endgrent_r_proto" in
12058         ''|0)   d_endgrent_r=undef
12059                 endgrent_r_proto=0
12060                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12061         * )     case "$endgrent_r_proto" in
12062                 REENTRANT_PROTO*) ;;
12063                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12064                 esac
12065                 echo "Prototype: $try" ;;
12066         esac
12067         ;;
12068         *)      case "$usethreads" in
12069                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12070                 esac
12071                 d_endgrent_r=undef
12072                 endgrent_r_proto=0
12073                 ;;
12074         esac
12075         ;;
12076 *)      endgrent_r_proto=0
12077         ;;
12078 esac
12079
12080 : see if endhostent exists
12081 set endhostent d_endhent
12082 eval $inlibc
12083
12084 : see if this is a netdb.h system
12085 set netdb.h i_netdb
12086 eval $inhdr
12087
12088 : see if endhostent_r exists
12089 set endhostent_r d_endhostent_r
12090 eval $inlibc
12091 case "$d_endhostent_r" in
12092 "$define")
12093         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12094         case "$d_endhostent_r_proto:$usethreads" in
12095         ":define")      d_endhostent_r_proto=define
12096                 set d_endhostent_r_proto endhostent_r $hdrs
12097                 eval $hasproto ;;
12098         *)      ;;
12099         esac
12100         case "$d_endhostent_r_proto" in
12101         define)
12102         case "$endhostent_r_proto" in
12103         ''|0) try='int endhostent_r(struct hostent_data*);'
12104         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12105         esac
12106         case "$endhostent_r_proto" in
12107         ''|0) try='void endhostent_r(struct hostent_data*);'
12108         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12109         esac
12110         case "$endhostent_r_proto" in
12111         ''|0)   d_endhostent_r=undef
12112                 endhostent_r_proto=0
12113                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12114         * )     case "$endhostent_r_proto" in
12115                 REENTRANT_PROTO*) ;;
12116                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12117                 esac
12118                 echo "Prototype: $try" ;;
12119         esac
12120         ;;
12121         *)      case "$usethreads" in
12122                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12123                 esac
12124                 d_endhostent_r=undef
12125                 endhostent_r_proto=0
12126                 ;;
12127         esac
12128         ;;
12129 *)      endhostent_r_proto=0
12130         ;;
12131 esac
12132
12133 : see if endnetent exists
12134 set endnetent d_endnent
12135 eval $inlibc
12136
12137 : see if endnetent_r exists
12138 set endnetent_r d_endnetent_r
12139 eval $inlibc
12140 case "$d_endnetent_r" in
12141 "$define")
12142         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12143         case "$d_endnetent_r_proto:$usethreads" in
12144         ":define")      d_endnetent_r_proto=define
12145                 set d_endnetent_r_proto endnetent_r $hdrs
12146                 eval $hasproto ;;
12147         *)      ;;
12148         esac
12149         case "$d_endnetent_r_proto" in
12150         define)
12151         case "$endnetent_r_proto" in
12152         ''|0) try='int endnetent_r(struct netent_data*);'
12153         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12154         esac
12155         case "$endnetent_r_proto" in
12156         ''|0) try='void endnetent_r(struct netent_data*);'
12157         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12158         esac
12159         case "$endnetent_r_proto" in
12160         ''|0)   d_endnetent_r=undef
12161                 endnetent_r_proto=0
12162                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12163         * )     case "$endnetent_r_proto" in
12164                 REENTRANT_PROTO*) ;;
12165                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12166                 esac
12167                 echo "Prototype: $try" ;;
12168         esac
12169         ;;
12170         *)      case "$usethreads" in
12171                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12172                 esac
12173                 d_endnetent_r=undef
12174                 endnetent_r_proto=0
12175                 ;;
12176         esac
12177         ;;
12178 *)      endnetent_r_proto=0
12179         ;;
12180 esac
12181
12182 : see if endprotoent exists
12183 set endprotoent d_endpent
12184 eval $inlibc
12185
12186 : see if endprotoent_r exists
12187 set endprotoent_r d_endprotoent_r
12188 eval $inlibc
12189 case "$d_endprotoent_r" in
12190 "$define")
12191         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12192         case "$d_endprotoent_r_proto:$usethreads" in
12193         ":define")      d_endprotoent_r_proto=define
12194                 set d_endprotoent_r_proto endprotoent_r $hdrs
12195                 eval $hasproto ;;
12196         *)      ;;
12197         esac
12198         case "$d_endprotoent_r_proto" in
12199         define)
12200         case "$endprotoent_r_proto" in
12201         ''|0) try='int endprotoent_r(struct protoent_data*);'
12202         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12203         esac
12204         case "$endprotoent_r_proto" in
12205         ''|0) try='void endprotoent_r(struct protoent_data*);'
12206         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12207         esac
12208         case "$endprotoent_r_proto" in
12209         ''|0)   d_endprotoent_r=undef
12210                 endprotoent_r_proto=0
12211                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12212         * )     case "$endprotoent_r_proto" in
12213                 REENTRANT_PROTO*) ;;
12214                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12215                 esac
12216                 echo "Prototype: $try" ;;
12217         esac
12218         ;;
12219         *)      case "$usethreads" in
12220                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12221                 esac
12222                 d_endprotoent_r=undef
12223                 endprotoent_r_proto=0
12224                 ;;
12225         esac
12226         ;;
12227 *)      endprotoent_r_proto=0
12228         ;;
12229 esac
12230
12231 : see if endpwent exists
12232 set endpwent d_endpwent
12233 eval $inlibc
12234
12235 : see if this is a pwd.h system
12236 set pwd.h i_pwd
12237 eval $inhdr
12238
12239 case "$i_pwd" in
12240 $define)
12241         xxx=`./findhdr pwd.h`
12242         $cppstdin $cppflags $cppminus < $xxx >$$.h
12243
12244         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12245                 val="$define"
12246         else
12247                 val="$undef"
12248         fi
12249         set d_pwquota
12250         eval $setvar
12251
12252         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12253                 val="$define"
12254         else
12255                 val="$undef"
12256         fi
12257         set d_pwage
12258         eval $setvar
12259
12260         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12261                 val="$define"
12262         else
12263                 val="$undef"
12264         fi
12265         set d_pwchange
12266         eval $setvar
12267
12268         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12269                 val="$define"
12270         else
12271                 val="$undef"
12272         fi
12273         set d_pwclass
12274         eval $setvar
12275
12276         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12277                 val="$define"
12278         else
12279                 val="$undef"
12280         fi
12281         set d_pwexpire
12282         eval $setvar
12283
12284         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12285                 val="$define"
12286         else
12287                 val="$undef"
12288         fi
12289         set d_pwcomment
12290         eval $setvar
12291
12292         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12293                 val="$define"
12294         else
12295                 val="$undef"
12296         fi
12297         set d_pwgecos
12298         eval $setvar
12299
12300         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12301                 val="$define"
12302         else
12303                 val="$undef"
12304         fi
12305         set d_pwpasswd
12306         eval $setvar
12307
12308         $rm -f $$.h
12309         ;;
12310 *)
12311         val="$undef"; 
12312         set d_pwquota; eval $setvar
12313         set d_pwage; eval $setvar
12314         set d_pwchange; eval $setvar
12315         set d_pwclass; eval $setvar
12316         set d_pwexpire; eval $setvar
12317         set d_pwcomment; eval $setvar
12318         set d_pwgecos; eval $setvar
12319         set d_pwpasswd; eval $setvar
12320         ;;
12321 esac
12322
12323 : see if endpwent_r exists
12324 set endpwent_r d_endpwent_r
12325 eval $inlibc
12326 case "$d_endpwent_r" in
12327 "$define")
12328         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12329         case "$d_endpwent_r_proto:$usethreads" in
12330         ":define")      d_endpwent_r_proto=define
12331                 set d_endpwent_r_proto endpwent_r $hdrs
12332                 eval $hasproto ;;
12333         *)      ;;
12334         esac
12335         case "$d_endpwent_r_proto" in
12336         define)
12337         case "$endpwent_r_proto" in
12338         ''|0) try='int endpwent_r(FILE**);'
12339         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12340         esac
12341         case "$endpwent_r_proto" in
12342         ''|0) try='void endpwent_r(FILE**);'
12343         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12344         esac
12345         case "$endpwent_r_proto" in
12346         ''|0)   d_endpwent_r=undef
12347                 endpwent_r_proto=0
12348                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12349         * )     case "$endpwent_r_proto" in
12350                 REENTRANT_PROTO*) ;;
12351                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12352                 esac
12353                 echo "Prototype: $try" ;;
12354         esac
12355         ;;
12356         *)      case "$usethreads" in
12357                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12358                 esac
12359                 d_endpwent_r=undef
12360                 endpwent_r_proto=0
12361                 ;;
12362         esac
12363         ;;
12364 *)      endpwent_r_proto=0
12365         ;;
12366 esac
12367
12368 : see if endservent exists
12369 set endservent d_endsent
12370 eval $inlibc
12371
12372 : see if endservent_r exists
12373 set endservent_r d_endservent_r
12374 eval $inlibc
12375 case "$d_endservent_r" in
12376 "$define")
12377         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12378         case "$d_endservent_r_proto:$usethreads" in
12379         ":define")      d_endservent_r_proto=define
12380                 set d_endservent_r_proto endservent_r $hdrs
12381                 eval $hasproto ;;
12382         *)      ;;
12383         esac
12384         case "$d_endservent_r_proto" in
12385         define)
12386         case "$endservent_r_proto" in
12387         ''|0) try='int endservent_r(struct servent_data*);'
12388         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12389         esac
12390         case "$endservent_r_proto" in
12391         ''|0) try='void endservent_r(struct servent_data*);'
12392         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12393         esac
12394         case "$endservent_r_proto" in
12395         ''|0)   d_endservent_r=undef
12396                 endservent_r_proto=0
12397                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12398         * )     case "$endservent_r_proto" in
12399                 REENTRANT_PROTO*) ;;
12400                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12401                 esac
12402                 echo "Prototype: $try" ;;
12403         esac
12404         ;;
12405         *)      case "$usethreads" in
12406                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12407                 esac
12408                 d_endservent_r=undef
12409                 endservent_r_proto=0
12410                 ;;
12411         esac
12412         ;;
12413 *)      endservent_r_proto=0
12414         ;;
12415 esac
12416
12417 : Locate the flags for 'open()'
12418 echo " "
12419 $cat >try.c <<EOCP
12420 #include <sys/types.h>
12421 #ifdef I_FCNTL
12422 #include <fcntl.h>
12423 #endif
12424 #ifdef I_SYS_FILE
12425 #include <sys/file.h>
12426 #endif
12427 #$i_stdlib I_STDLIB
12428 #ifdef I_STDLIB
12429 #include <stdlib.h>
12430 #endif
12431 int main() {
12432         if(O_RDONLY);
12433 #ifdef O_TRUNC
12434         exit(0);
12435 #else
12436         exit(1);
12437 #endif
12438 }
12439 EOCP
12440 : check sys/file.h first to get FREAD on Sun
12441 if $test `./findhdr sys/file.h` && \
12442                 set try -DI_SYS_FILE && eval $compile; then
12443         h_sysfile=true;
12444         echo "<sys/file.h> defines the O_* constants..." >&4
12445         if $run ./try; then
12446                 echo "and you have the 3 argument form of open()." >&4
12447                 val="$define"
12448         else
12449                 echo "but not the 3 argument form of open().  Oh, well." >&4
12450                 val="$undef"
12451         fi
12452 elif $test `./findhdr fcntl.h` && \
12453                 set try -DI_FCNTL && eval $compile; then
12454         h_fcntl=true;
12455         echo "<fcntl.h> defines the O_* constants..." >&4
12456         if $run ./try; then
12457                 echo "and you have the 3 argument form of open()." >&4
12458                 val="$define"
12459         else
12460                 echo "but not the 3 argument form of open().  Oh, well." >&4
12461                 val="$undef"
12462         fi
12463 else
12464         val="$undef"
12465         echo "I can't find the O_* constant definitions!  You got problems." >&4
12466 fi
12467 set d_open3
12468 eval $setvar
12469 $rm_try
12470
12471 : see if this is a sys/file.h system
12472 val=''
12473 set sys/file.h val
12474 eval $inhdr
12475
12476 : do we need to include sys/file.h ?
12477 case "$val" in
12478 "$define")
12479         echo " "
12480         if $h_sysfile; then
12481                 val="$define"
12482                 echo "We'll be including <sys/file.h>." >&4
12483         else
12484                 val="$undef"
12485                 echo "We won't be including <sys/file.h>." >&4
12486         fi
12487         ;;
12488 *)
12489         h_sysfile=false
12490         ;;
12491 esac
12492 set i_sysfile
12493 eval $setvar
12494
12495 : see if fcntl.h is there
12496 val=''
12497 set fcntl.h val
12498 eval $inhdr
12499
12500 : see if we can include fcntl.h
12501 case "$val" in
12502 "$define")
12503         echo " "
12504         if $h_fcntl; then
12505                 val="$define"
12506                 echo "We'll be including <fcntl.h>." >&4
12507         else
12508                 val="$undef"
12509                 if $h_sysfile; then
12510         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12511                 else
12512                         echo "We won't be including <fcntl.h>." >&4
12513                 fi
12514         fi
12515         ;;
12516 *)
12517         h_fcntl=false
12518         val="$undef"
12519         ;;
12520 esac
12521 set i_fcntl
12522 eval $setvar
12523
12524 : see if fork exists
12525 set fork d_fork
12526 eval $inlibc
12527
12528 : see if pipe exists
12529 set pipe d_pipe
12530 eval $inlibc
12531
12532 : check for non-blocking I/O stuff
12533 case "$h_sysfile" in
12534 true) echo "#include <sys/file.h>" > head.c;;
12535 *)
12536        case "$h_fcntl" in
12537        true) echo "#include <fcntl.h>" > head.c;;
12538        *) echo "#include <sys/fcntl.h>" > head.c;;
12539        esac
12540        ;;
12541 esac
12542 echo " "
12543 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12544 case "$o_nonblock" in
12545 '')
12546         $cat head.c > try.c
12547         $cat >>try.c <<EOCP
12548 #include <stdio.h>
12549 #$i_stdlib I_STDLIB
12550 #ifdef I_STDLIB
12551 #include <stdlib.h>
12552 #endif
12553 #$i_fcntl I_FCNTL
12554 #ifdef I_FCNTL
12555 #include <fcntl.h>
12556 #endif
12557 int main() {
12558 #ifdef O_NONBLOCK
12559         printf("O_NONBLOCK\n");
12560         exit(0);
12561 #endif
12562 #ifdef O_NDELAY
12563         printf("O_NDELAY\n");
12564         exit(0);
12565 #endif
12566 #ifdef FNDELAY
12567         printf("FNDELAY\n");
12568         exit(0);
12569 #endif
12570         exit(0);
12571 }
12572 EOCP
12573         set try
12574         if eval $compile_ok; then
12575                 o_nonblock=`$run ./try`
12576                 case "$o_nonblock" in
12577                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12578                 *) echo "Seems like we can use $o_nonblock.";;
12579                 esac
12580         else
12581                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12582         fi
12583         ;;
12584 *) echo "Using $hint value $o_nonblock.";;
12585 esac
12586 $rm_try
12587
12588 echo " "
12589 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12590 case "$eagain" in
12591 '')
12592         case "$d_fork:$d_pipe" in
12593         define:define)
12594         $cat head.c > try.c
12595         $cat >>try.c <<EOCP
12596 #include <errno.h>
12597 #include <sys/types.h>
12598 #include <signal.h>
12599 #include <stdio.h>
12600 #$i_stdlib I_STDLIB
12601 #ifdef I_STDLIB
12602 #include <stdlib.h>
12603 #endif
12604 #$i_fcntl I_FCNTL
12605 #ifdef I_FCNTL
12606 #include <fcntl.h>
12607 #endif
12608 #define MY_O_NONBLOCK $o_nonblock
12609 #ifndef errno  /* XXX need better Configure test */
12610 extern int errno;
12611 #endif
12612 #$i_unistd I_UNISTD
12613 #ifdef I_UNISTD
12614 #include <unistd.h>
12615 #endif
12616 #$i_string I_STRING
12617 #ifdef I_STRING
12618 #include <string.h>
12619 #else
12620 #include <strings.h>
12621 #endif
12622 $signal_t blech(int x) { exit(3); }
12623 EOCP
12624         $cat >> try.c <<'EOCP'
12625 int main()
12626 {
12627         int pd[2];
12628         int pu[2];
12629         char buf[1];
12630         char string[100];
12631
12632         pipe(pd);       /* Down: child -> parent */
12633         pipe(pu);       /* Up: parent -> child */
12634         if (0 != fork()) {
12635                 int ret;
12636                 close(pd[1]);   /* Parent reads from pd[0] */
12637                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12638 #ifdef F_SETFL
12639                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12640                         exit(1);
12641 #else
12642                 exit(4);
12643 #endif
12644                 signal(SIGALRM, blech);
12645                 alarm(5);
12646                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12647                         exit(2);
12648                 sprintf(string, "%d\n", ret);
12649                 write(2, string, strlen(string));
12650                 alarm(0);
12651 #ifdef EAGAIN
12652                 if (errno == EAGAIN) {
12653                         printf("EAGAIN\n");
12654                         goto ok;
12655                 }
12656 #endif
12657 #ifdef EWOULDBLOCK
12658                 if (errno == EWOULDBLOCK)
12659                         printf("EWOULDBLOCK\n");
12660 #endif
12661         ok:
12662                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12663                 sleep(2);                               /* Give it time to close our pipe */
12664                 alarm(5);
12665                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12666                 alarm(0);
12667                 sprintf(string, "%d\n", ret);
12668                 write(4, string, strlen(string));
12669                 exit(0);
12670         }
12671
12672         close(pd[0]);                   /* We write to pd[1] */
12673         close(pu[1]);                   /* We read from pu[0] */
12674         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12675         close(pd[1]);                   /* Pipe pd is now fully closed! */
12676         exit(0);                                /* Bye bye, thank you for playing! */
12677 }
12678 EOCP
12679         set try
12680         if eval $compile_ok; then
12681                 echo "$startsh" >mtry
12682                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12683                 chmod +x mtry
12684                 ./mtry >/dev/null 2>&1
12685                 case $? in
12686                 0) eagain=`$cat try.out`;;
12687                 1) echo "Could not perform non-blocking setting!";;
12688                 2) echo "I did a successful read() for something that was not there!";;
12689                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12690                 4) echo "Could not find F_SETFL!";;
12691                 *) echo "Something terribly wrong happened during testing.";;
12692                 esac
12693                 rd_nodata=`$cat try.ret`
12694                 echo "A read() system call with no data present returns $rd_nodata."
12695                 case "$rd_nodata" in
12696                 0|-1) ;;
12697                 *)
12698                         echo "(That's peculiar, fixing that to be -1.)"
12699                         rd_nodata=-1
12700                         ;;
12701                 esac
12702                 case "$eagain" in
12703                 '')
12704                         echo "Forcing errno EAGAIN on read() with no data available."
12705                         eagain=EAGAIN
12706                         ;;
12707                 *)
12708                         echo "Your read() sets errno to $eagain when no data is available."
12709                         ;;
12710                 esac
12711                 status=`$cat try.err`
12712                 case "$status" in
12713                 0) echo "And it correctly returns 0 to signal EOF.";;
12714                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12715                 *) echo "However, your read() returns '$status' on EOF??";;
12716                 esac
12717                 val="$define"
12718                 if test "$status" = "$rd_nodata"; then
12719                         echo "WARNING: you can't distinguish between EOF and no data!"
12720                         val="$undef"
12721                 fi
12722         else
12723                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12724                 eagain=EAGAIN
12725         fi
12726         ;;
12727         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12728                 eagain=EAGAIN
12729                 val="$define"
12730                 ;;
12731         esac
12732         set d_eofnblk
12733         eval $setvar
12734         ;;
12735 *)
12736         echo "Using $hint value $eagain."
12737         echo "Your read() returns $rd_nodata when no data is present."
12738         case "$d_eofnblk" in
12739         "$define") echo "And you can see EOF because read() returns 0.";;
12740         "$undef") echo "But you can't see EOF status from read() returned value.";;
12741         *)
12742                 echo "(Assuming you can't see EOF status from read anyway.)"
12743                 d_eofnblk=$undef
12744                 ;;
12745         esac
12746         ;;
12747 esac
12748 $rm_try head.c mtry
12749
12750 : see if _ptr and _cnt from stdio act std
12751 echo " "
12752
12753 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12754         echo "(Looks like you have stdio.h from BSD.)"
12755         case "$stdio_ptr" in
12756         '') stdio_ptr='((fp)->_p)'
12757                 ptr_lval=$define
12758                 ;;
12759         *)      ptr_lval=$d_stdio_ptr_lval;;
12760         esac
12761         case "$stdio_cnt" in
12762         '') stdio_cnt='((fp)->_r)'
12763                 cnt_lval=$define
12764                 ;;
12765         *)      cnt_lval=$d_stdio_cnt_lval;;
12766         esac
12767         case "$stdio_base" in
12768         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12769         esac
12770         case "$stdio_bufsiz" in
12771         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12772         esac
12773 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12774         echo "(Looks like you have stdio.h from Linux.)"
12775         case "$stdio_ptr" in
12776         '') stdio_ptr='((fp)->_IO_read_ptr)'
12777                 ptr_lval=$define
12778                 ;;
12779         *)      ptr_lval=$d_stdio_ptr_lval;;
12780         esac
12781         case "$stdio_cnt" in
12782         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12783                 cnt_lval=$undef
12784                 ;;
12785         *)      cnt_lval=$d_stdio_cnt_lval;;
12786         esac
12787         case "$stdio_base" in
12788         '') stdio_base='((fp)->_IO_read_base)';;
12789         esac
12790         case "$stdio_bufsiz" in
12791         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12792         esac
12793 else
12794         case "$stdio_ptr" in
12795         '') stdio_ptr='((fp)->_ptr)'
12796                 ptr_lval=$define
12797                 ;;
12798         *)      ptr_lval=$d_stdio_ptr_lval;;
12799         esac
12800         case "$stdio_cnt" in
12801         '') stdio_cnt='((fp)->_cnt)'
12802                 cnt_lval=$define
12803                 ;;
12804         *)      cnt_lval=$d_stdio_cnt_lval;;
12805         esac
12806         case "$stdio_base" in
12807         '') stdio_base='((fp)->_base)';;
12808         esac
12809         case "$stdio_bufsiz" in
12810         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12811         esac
12812 fi
12813
12814 : test whether _ptr and _cnt really work
12815 echo "Checking how std your stdio is..." >&4
12816 $cat >try.c <<EOP
12817 #include <stdio.h>
12818 #$i_stdlib I_STDLIB
12819 #ifdef I_STDLIB
12820 #include <stdlib.h>
12821 #endif
12822 #define FILE_ptr(fp)    $stdio_ptr
12823 #define FILE_cnt(fp)    $stdio_cnt
12824 int main() {
12825         FILE *fp = fopen("try.c", "r");
12826         char c = getc(fp);
12827         if (
12828                 18 <= FILE_cnt(fp) &&
12829                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12830         )
12831                 exit(0);
12832         exit(1);
12833 }
12834 EOP
12835 val="$undef"
12836 set try
12837 if eval $compile && $to try.c; then
12838         if $run ./try; then
12839                 echo "Your stdio acts pretty std."
12840                 val="$define"
12841         else
12842                 echo "Your stdio isn't very std."
12843         fi
12844 else
12845         echo "Your stdio doesn't appear very std."
12846 fi
12847 $rm_try
12848
12849 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12850 # direct buffer manipulation no longer works.  The Configure tests
12851 # should be changed to correctly detect this, but until then,
12852 # the following check should at least let perl compile and run.
12853 # (This quick fix should be updated before 5.8.1.)
12854 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12855 # A. Dougherty, June 3, 2002.
12856 case "$d_gnulibc" in
12857 $define)
12858         case "$gnulibc_version" in
12859         2.[01]*)  ;;
12860         2.2) ;;
12861         2.2.[0-9]) ;;
12862         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12863                 val="$undef"
12864                 ;;
12865         esac
12866         ;;
12867 esac
12868 set d_stdstdio
12869 eval $setvar
12870
12871 : Can _ptr be used as an lvalue?
12872 case "$d_stdstdio$ptr_lval" in
12873 $define$define) val=$define ;;
12874 *) val=$undef ;;
12875 esac
12876 set d_stdio_ptr_lval
12877 eval $setvar
12878
12879 : Can _cnt be used as an lvalue?
12880 case "$d_stdstdio$cnt_lval" in
12881 $define$define) val=$define ;;
12882 *) val=$undef ;;
12883 esac
12884 set d_stdio_cnt_lval
12885 eval $setvar
12886
12887
12888 : test whether setting _ptr sets _cnt as a side effect
12889 d_stdio_ptr_lval_sets_cnt="$undef"
12890 d_stdio_ptr_lval_nochange_cnt="$undef"
12891 case "$d_stdio_ptr_lval$d_stdstdio" in
12892 $define$define)
12893         echo "Checking to see what happens if we set the stdio ptr..." >&4
12894 $cat >try.c <<EOP
12895 #include <stdio.h>
12896 /* Can we scream? */
12897 /* Eat dust sed :-) */
12898 /* In the buffer space, no one can hear you scream. */
12899 #$i_stdlib I_STDLIB
12900 #ifdef I_STDLIB
12901 #include <stdlib.h>
12902 #endif
12903 #define FILE_ptr(fp)    $stdio_ptr
12904 #define FILE_cnt(fp)    $stdio_cnt
12905 #include <sys/types.h>
12906 int main() {
12907         FILE *fp = fopen("try.c", "r");
12908         int c;
12909         char *ptr;
12910         size_t cnt;
12911         if (!fp) {
12912             puts("Fail even to read");
12913             exit(1);
12914         }
12915         c = getc(fp); /* Read away the first # */
12916         if (c == EOF) {
12917             puts("Fail even to read");
12918             exit(1);
12919         }
12920         if (!(
12921                 18 <= FILE_cnt(fp) &&
12922                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12923         )) {
12924                 puts("Fail even to read");
12925                 exit (1);
12926         }
12927         ptr = (char*) FILE_ptr(fp);
12928         cnt = (size_t)FILE_cnt(fp);
12929
12930         FILE_ptr(fp) += 42;
12931
12932         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12933                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12934                 exit (1);
12935         }
12936         if (FILE_cnt(fp) <= 20) {
12937                 printf ("Fail (<20 chars to test)");
12938                 exit (1);
12939         }
12940         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12941                 puts("Fail compare");
12942                 exit (1);
12943         }
12944         if (cnt == FILE_cnt(fp)) {
12945                 puts("Pass_unchanged");
12946                 exit (0);
12947         }
12948         if (FILE_cnt(fp) == (cnt - 42)) {
12949                 puts("Pass_changed");
12950                 exit (0);
12951         }
12952         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12953         return 1;
12954
12955 }
12956 EOP
12957         set try
12958         if eval $compile && $to try.c; then
12959                 case `$run ./try` in
12960                 Pass_changed)
12961                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12962                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12963                 Pass_unchanged)
12964                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12965                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12966                 Fail*)
12967                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12968                 *)
12969                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12970         esac
12971         else
12972                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12973         fi
12974         $rm_try
12975         ;;
12976 esac
12977
12978 : see if _base is also standard
12979 val="$undef"
12980 case "$d_stdstdio" in
12981 $define)
12982         $cat >try.c <<EOP
12983 #include <stdio.h>
12984 #$i_stdlib I_STDLIB
12985 #ifdef I_STDLIB
12986 #include <stdlib.h>
12987 #endif
12988 #define FILE_base(fp)   $stdio_base
12989 #define FILE_bufsiz(fp) $stdio_bufsiz
12990 int main() {
12991         FILE *fp = fopen("try.c", "r");
12992         char c = getc(fp);
12993         if (
12994                 19 <= FILE_bufsiz(fp) &&
12995                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12996         )
12997                 exit(0);
12998         exit(1);
12999 }
13000 EOP
13001         set try
13002         if eval $compile && $to try.c; then
13003                 if $run ./try; then
13004                         echo "And its _base field acts std."
13005                         val="$define"
13006                 else
13007                         echo "But its _base field isn't std."
13008                 fi
13009         else
13010                 echo "However, it seems to be lacking the _base field."
13011         fi
13012         $rm_try
13013         ;;
13014 esac
13015 set d_stdiobase
13016 eval $setvar
13017
13018 : see if fast_stdio exists
13019 val="$undef"
13020 case "$d_stdstdio:$d_stdio_ptr_lval" in
13021 "$define:$define")
13022         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13023         *$define*)
13024                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13025                 val="$define"
13026                 ;;
13027         esac
13028         ;;
13029 esac
13030 set d_faststdio
13031 eval $setvar
13032
13033
13034
13035 : see if fchdir exists
13036 set fchdir d_fchdir
13037 eval $inlibc
13038
13039 : see if fchmod exists
13040 set fchmod d_fchmod
13041 eval $inlibc
13042
13043 : see if fchown exists
13044 set fchown d_fchown
13045 eval $inlibc
13046
13047 : see if this is an fcntl system
13048 set fcntl d_fcntl
13049 eval $inlibc
13050
13051 : See if fcntl-based locking works.
13052 echo " "
13053 $cat >try.c <<EOCP
13054 #$i_stdlib I_STDLIB
13055 #ifdef I_STDLIB
13056 #include <stdlib.h>
13057 #endif
13058 #include <unistd.h>
13059 #include <fcntl.h>
13060 #include <signal.h>
13061 $signal_t blech(int x) { exit(3); }
13062 int main() {
13063 #if defined(F_SETLK) && defined(F_SETLKW)
13064      struct flock flock;
13065      int retval, fd;
13066      fd = open("try.c", O_RDONLY);
13067      flock.l_type = F_RDLCK;
13068      flock.l_whence = SEEK_SET;
13069      flock.l_start = flock.l_len = 0;
13070      signal(SIGALRM, blech);
13071      alarm(10);
13072      retval = fcntl(fd, F_SETLK, &flock);
13073      close(fd);
13074      (retval < 0 ? exit(2) : exit(0));
13075 #else
13076      exit(2);
13077 #endif
13078 }
13079 EOCP
13080 echo "Checking if fcntl-based file locking works... "
13081 case "$d_fcntl" in
13082 "$define")
13083         set try
13084         if eval $compile_ok; then
13085                 if $run ./try; then
13086                         echo "Yes, it seems to work."
13087                         val="$define"
13088                 else
13089                         echo "Nope, it didn't work."
13090                         val="$undef"
13091                         case "$?" in
13092                         3) $cat >&4 <<EOM
13093 ***
13094 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13095 *** This is (almost) impossible.
13096 *** If your NFS lock daemons are not feeling well, something like
13097 *** this may happen, please investigate.  Cannot continue, aborting.
13098 ***
13099 EOM
13100                                 exit 1
13101                                 ;;
13102                         esac
13103                 fi
13104         else
13105                 echo "I'm unable to compile the test program, so I'll assume not."
13106                 val="$undef"
13107         fi
13108         ;;
13109 *) val="$undef";
13110         echo "Nope, since you don't even have fcntl()."
13111         ;;
13112 esac
13113 set d_fcntl_can_lock
13114 eval $setvar
13115 $rm_try
13116
13117 : check for fd_set items
13118 $cat <<EOM
13119
13120 Checking to see how well your C compiler handles fd_set and friends ...
13121 EOM
13122 $cat >try.c <<EOCP
13123 #$i_stdlib I_STDLIB
13124 #ifdef I_STDLIB
13125 #include <stdlib.h>
13126 #endif
13127 #$i_systime I_SYS_TIME
13128 #$i_sysselct I_SYS_SELECT
13129 #$d_socket HAS_SOCKET
13130 #include <sys/types.h>
13131 #ifdef HAS_SOCKET
13132 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13133 #endif
13134 #ifdef I_SYS_TIME
13135 #include <sys/time.h>
13136 #endif
13137 #ifdef I_SYS_SELECT
13138 #include <sys/select.h>
13139 #endif
13140 int main() {
13141         fd_set fds;
13142
13143 #ifdef TRYBITS
13144         if(fds.fds_bits);
13145 #endif
13146
13147 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13148         exit(0);
13149 #else
13150         exit(1);
13151 #endif
13152 }
13153 EOCP
13154 set try -DTRYBITS
13155 if eval $compile; then
13156         d_fds_bits="$define"
13157         d_fd_set="$define"
13158         echo "Well, your system knows about the normal fd_set typedef..." >&4
13159         if $run ./try; then
13160                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13161                 d_fd_macros="$define"
13162         else
13163                 $cat >&4 <<'EOM'
13164 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13165 EOM
13166                 d_fd_macros="$undef"
13167         fi
13168 else
13169         $cat <<'EOM'
13170 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13171 EOM
13172         set try
13173         if eval $compile; then
13174                 d_fds_bits="$undef"
13175                 d_fd_set="$define"
13176                 echo "Well, your system has some sort of fd_set available..." >&4
13177                 if $run ./try; then
13178                         echo "and you have the normal fd_set macros." >&4
13179                         d_fd_macros="$define"
13180                 else
13181                         $cat <<'EOM'
13182 but not the normal fd_set macros!  Gross!  More work for me...
13183 EOM
13184                         d_fd_macros="$undef"
13185                 fi
13186         else
13187         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13188                 d_fd_set="$undef"
13189                 d_fds_bits="$undef"
13190                 d_fd_macros="$undef"
13191         fi
13192 fi
13193 $rm_try
13194
13195 : see if fgetpos exists
13196 set fgetpos d_fgetpos
13197 eval $inlibc
13198
13199 : see if finite exists
13200 set finite d_finite
13201 eval $inlibc
13202
13203 : see if finitel exists
13204 set finitel d_finitel
13205 eval $inlibc
13206
13207 : see if flock exists
13208 set flock d_flock
13209 eval $inlibc
13210
13211 : see if prototype for flock is available
13212 echo " "
13213 set d_flockproto flock $i_sysfile sys/file.h
13214 eval $hasproto
13215
13216 : see if fp_class exists
13217 set fp_class d_fp_class
13218 eval $inlibc
13219
13220 : see if pathconf exists
13221 set pathconf d_pathconf
13222 eval $inlibc
13223
13224 : see if fpathconf exists
13225 set fpathconf d_fpathconf
13226 eval $inlibc
13227
13228 : see if fpclass exists
13229 set fpclass d_fpclass
13230 eval $inlibc
13231
13232 : see if fpclassify exists
13233 set fpclassify d_fpclassify
13234 eval $inlibc
13235
13236 : see if fpclassl exists
13237 set fpclassl d_fpclassl
13238 eval $inlibc
13239
13240 : check for fpos64_t
13241 echo " "
13242 echo "Checking to see if you have fpos64_t..." >&4
13243 $cat >try.c <<EOCP
13244 #include <stdio.h>
13245 int main() { fpos64_t x = 7; }
13246 EOCP
13247 set try
13248 if eval $compile; then
13249         val="$define"
13250         echo "You have fpos64_t."
13251 else
13252         val="$undef"
13253         echo "You do not have fpos64_t."
13254         case "$fpossize" in
13255         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13256         esac
13257 fi
13258 $rm_try
13259 set d_fpos64_t
13260 eval $setvar
13261
13262 : see if frexpl exists
13263 set frexpl d_frexpl
13264 eval $inlibc
13265
13266 : see if this is a sys/param system
13267 set sys/param.h i_sysparam
13268 eval $inhdr
13269
13270 : see if this is a sys/mount.h system
13271 set sys/mount.h i_sysmount
13272 eval $inhdr
13273
13274 : Check for fs_data_s
13275 echo " "
13276 echo "Checking to see if your system supports struct fs_data..." >&4
13277 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13278 eval $hasstruct
13279 case "$d_fs_data_s" in
13280 "$define")      echo "Yes, it does."   ;;
13281 *)              echo "No, it doesn't." ;;
13282 esac
13283
13284 : see if fseeko exists
13285 set fseeko d_fseeko
13286 eval $inlibc
13287 case "$longsize" in
13288 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13289 esac
13290
13291 : see if fsetpos exists
13292 set fsetpos d_fsetpos
13293 eval $inlibc
13294
13295 : see if fstatfs exists
13296 set fstatfs d_fstatfs
13297 eval $inlibc
13298
13299 : see if statvfs exists
13300 set statvfs d_statvfs
13301 eval $inlibc
13302
13303 : see if fstatvfs exists
13304 set fstatvfs d_fstatvfs
13305 eval $inlibc
13306
13307
13308 : see if fsync exists
13309 set fsync d_fsync
13310 eval $inlibc
13311
13312 : see if ftello exists
13313 set ftello d_ftello
13314 eval $inlibc
13315 case "$longsize" in
13316 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13317 esac
13318
13319 : check for a working futimes
13320 d_futimes="$undef"
13321 echo " "
13322 echo "Checking if you have a working futimes()" >&4
13323 $cat >try.c <<EOCP
13324 #include <stdio.h>
13325 #include <sys/time.h>
13326 #include <errno.h>
13327 #include <fcntl.h>
13328
13329 int main ()
13330 {
13331     int fd, rv;
13332     fd = open ("try.c", O_RDWR);
13333     if (-1 == fd) exit (1);
13334     rv = futimes (fd, NULL);
13335     exit (rv == -1 ? errno : 0);
13336 }
13337 EOCP
13338 set try
13339 if eval $compile; then
13340     `$run ./try`
13341     rc=$?
13342     case "$rc" in
13343         0)  echo "Yes, you have" >&4
13344             d_futimes="$define"
13345             ;;
13346         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13347             ;;
13348     esac
13349 else
13350     echo "No, it does not (probably harmless)" >&4
13351 fi
13352 $rm_try
13353
13354 : see if ndbm.h is available
13355 set ndbm.h i_ndbm
13356 eval $inhdr
13357 : Compatibility location for RedHat 7.1
13358 set gdbm/ndbm.h i_gdbmndbm
13359 eval $inhdr
13360 : Compatibility location for Debian 4.0
13361 set gdbm-ndbm.h i_gdbm_ndbm
13362 eval $inhdr
13363
13364 val="$undef"
13365 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13366         : see if dbm_open exists
13367         set dbm_open d_dbm_open
13368         eval $inlibc
13369         case "$d_dbm_open" in
13370         $undef)
13371                 i_ndbm="$undef"
13372                 i_gdbmndbm="$undef"
13373                 i_gdbm_ndbm="$undef"
13374                 echo "We won't be including <ndbm.h>"
13375                 val="$undef"
13376                 ;;
13377         *) val="$define"
13378            ;;
13379         esac
13380 fi
13381 set d_ndbm
13382 eval $setvar
13383
13384 ndbm_hdr_protochk='name=$1; hdr=$2;
13385 eval "ihdr=\$""i_$name";
13386 val="$undef";
13387 if $test "$ihdr" = "$define"; then
13388         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13389         case "$d_cplusplus" in
13390         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13391         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13392         esac;
13393         case "$val" in
13394         $define) $echo "Your <$hdr> seems to have prototypes";;
13395         *) $echo "Your <$hdr> does not seem to have prototypes";;
13396         esac;
13397 fi;
13398 set "d_${name}_h_uses_prototypes";
13399 eval $setvar'
13400
13401 set ndbm ndbm.h
13402 eval $ndbm_hdr_protochk
13403 set gdbmndbm gdbm/ndbm.h
13404 eval $ndbm_hdr_protochk
13405 set gdbm_ndbm gdbm-ndbm.h
13406 eval $ndbm_hdr_protochk
13407
13408 : see if getaddrinfo exists
13409 set getaddrinfo d_getaddrinfo
13410 eval $inlibc
13411
13412 : see if getcwd exists
13413 set getcwd d_getcwd
13414 eval $inlibc
13415
13416 : see if getespwnam exists
13417 set getespwnam d_getespwnam
13418 eval $inlibc
13419
13420 : see if getfsstat exists
13421 set getfsstat d_getfsstat
13422 eval $inlibc
13423
13424 : see if getgrent exists
13425 set getgrent d_getgrent
13426 eval $inlibc
13427
13428 : see if getgrent_r exists
13429 set getgrent_r d_getgrent_r
13430 eval $inlibc
13431 case "$d_getgrent_r" in
13432 "$define")
13433         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13434         case "$d_getgrent_r_proto:$usethreads" in
13435         ":define")      d_getgrent_r_proto=define
13436                 set d_getgrent_r_proto getgrent_r $hdrs
13437                 eval $hasproto ;;
13438         *)      ;;
13439         esac
13440         case "$d_getgrent_r_proto" in
13441         define)
13442         case "$getgrent_r_proto" in
13443         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13444         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13445         esac
13446         case "$getgrent_r_proto" in
13447         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13448         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13449         esac
13450         case "$getgrent_r_proto" in
13451         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13452         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13453         esac
13454         case "$getgrent_r_proto" in
13455         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13456         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13457         esac
13458         case "$getgrent_r_proto" in
13459         ''|0) try='int getgrent_r(struct group*, char*, int);'
13460         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13461         esac
13462         case "$getgrent_r_proto" in
13463         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13464         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13465         esac
13466         case "$getgrent_r_proto" in
13467         ''|0)   d_getgrent_r=undef
13468                 getgrent_r_proto=0
13469                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13470         * )     case "$getgrent_r_proto" in
13471                 REENTRANT_PROTO*) ;;
13472                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13473                 esac
13474                 echo "Prototype: $try" ;;
13475         esac
13476         ;;
13477         *)      case "$usethreads" in
13478                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13479                 esac
13480                 d_getgrent_r=undef
13481                 getgrent_r_proto=0
13482                 ;;
13483         esac
13484         ;;
13485 *)      getgrent_r_proto=0
13486         ;;
13487 esac
13488
13489 : see if getgrgid_r exists
13490 set getgrgid_r d_getgrgid_r
13491 eval $inlibc
13492 case "$d_getgrgid_r" in
13493 "$define")
13494         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13495         case "$d_getgrgid_r_proto:$usethreads" in
13496         ":define")      d_getgrgid_r_proto=define
13497                 set d_getgrgid_r_proto getgrgid_r $hdrs
13498                 eval $hasproto ;;
13499         *)      ;;
13500         esac
13501         case "$d_getgrgid_r_proto" in
13502         define)
13503         case "$getgrgid_r_proto" in
13504         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13505         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13506         esac
13507         case "$getgrgid_r_proto" in
13508         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13509         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13510         esac
13511         case "$getgrgid_r_proto" in
13512         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13513         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13514         esac
13515         case "$getgrgid_r_proto" in
13516         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13517         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13518         esac
13519         case "$getgrgid_r_proto" in
13520         ''|0)   d_getgrgid_r=undef
13521                 getgrgid_r_proto=0
13522                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13523         * )     case "$getgrgid_r_proto" in
13524                 REENTRANT_PROTO*) ;;
13525                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13526                 esac
13527                 echo "Prototype: $try" ;;
13528         esac
13529         ;;
13530         *)      case "$usethreads" in
13531                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13532                 esac
13533                 d_getgrgid_r=undef
13534                 getgrgid_r_proto=0
13535                 ;;
13536         esac
13537         ;;
13538 *)      getgrgid_r_proto=0
13539         ;;
13540 esac
13541
13542 : see if getgrnam_r exists
13543 set getgrnam_r d_getgrnam_r
13544 eval $inlibc
13545 case "$d_getgrnam_r" in
13546 "$define")
13547         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13548         case "$d_getgrnam_r_proto:$usethreads" in
13549         ":define")      d_getgrnam_r_proto=define
13550                 set d_getgrnam_r_proto getgrnam_r $hdrs
13551                 eval $hasproto ;;
13552         *)      ;;
13553         esac
13554         case "$d_getgrnam_r_proto" in
13555         define)
13556         case "$getgrnam_r_proto" in
13557         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13558         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13559         esac
13560         case "$getgrnam_r_proto" in
13561         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13562         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13563         esac
13564         case "$getgrnam_r_proto" in
13565         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13566         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13567         esac
13568         case "$getgrnam_r_proto" in
13569         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13570         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13571         esac
13572         case "$getgrnam_r_proto" in
13573         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13575         esac
13576         case "$getgrnam_r_proto" in
13577         ''|0)   d_getgrnam_r=undef
13578                 getgrnam_r_proto=0
13579                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13580         * )     case "$getgrnam_r_proto" in
13581                 REENTRANT_PROTO*) ;;
13582                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13583                 esac
13584                 echo "Prototype: $try" ;;
13585         esac
13586         ;;
13587         *)      case "$usethreads" in
13588                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13589                 esac
13590                 d_getgrnam_r=undef
13591                 getgrnam_r_proto=0
13592                 ;;
13593         esac
13594         ;;
13595 *)      getgrnam_r_proto=0
13596         ;;
13597 esac
13598
13599 : see if gethostbyaddr exists
13600 set gethostbyaddr d_gethbyaddr
13601 eval $inlibc
13602
13603 : see if gethostbyname exists
13604 set gethostbyname d_gethbyname
13605 eval $inlibc
13606
13607 : see if gethostent exists
13608 set gethostent d_gethent
13609 eval $inlibc
13610
13611 : see how we will look up host name
13612 echo " "
13613 call=''
13614 if set gethostname val -f d_gethname; eval $csym; $val; then
13615         echo 'gethostname() found.' >&4
13616         d_gethname="$define"
13617         call=gethostname
13618 fi
13619 if set uname val -f d_uname; eval $csym; $val; then
13620         if ./xenix; then
13621                 $cat <<'EOM'
13622 uname() was found, but you're running xenix, and older versions of xenix
13623 have a broken uname(). If you don't really know whether your xenix is old
13624 enough to have a broken system call, use the default answer.
13625
13626 EOM
13627                 dflt=y
13628                 case "$d_uname" in
13629                 "$define") dflt=n;;
13630                 esac
13631                 rp='Is your uname() broken?'
13632                 . ./myread
13633                 case "$ans" in
13634                 n*) d_uname="$define"; call=uname;;
13635                 esac
13636         else
13637                 echo 'uname() found.' >&4
13638                 d_uname="$define"
13639                 case "$call" in
13640                 '') call=uname ;;
13641                 esac
13642         fi
13643 fi
13644 case "$d_gethname" in
13645 '') d_gethname="$undef";;
13646 esac
13647 case "$d_uname" in
13648 '') d_uname="$undef";;
13649 esac
13650 case "$d_uname$d_gethname" in
13651 *define*)
13652         dflt=n
13653         cat <<EOM
13654
13655 Every now and then someone has a $call() that lies about the hostname
13656 but can't be fixed for political or economic reasons.  If you wish, I can
13657 pretend $call() isn't there and maybe compute hostname at run-time
13658 thanks to the '$phostname' command.
13659
13660 EOM
13661         rp="Shall I ignore $call() from now on?"
13662         . ./myread
13663         case "$ans" in
13664         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13665         esac;;
13666 esac
13667 case "$phostname" in
13668 '') aphostname='';;
13669 *) case "$aphostname" in
13670         /*) ;;
13671         *) set X $phostname
13672                 shift
13673                 file=$1
13674                 shift
13675                 file=`./loc $file $file $pth`
13676                 aphostname=`echo $file $*`
13677                 ;;
13678         esac
13679         ;;
13680 esac
13681 case "$d_uname$d_gethname" in
13682 *define*) ;;
13683 *)
13684         case "$phostname" in
13685         '')
13686                 echo "There will be no way for $package to get your hostname." >&4;;
13687         *)
13688         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13689                 ;;
13690         esac;;
13691 esac
13692 case "$d_phostname" in
13693 '') d_phostname="$undef";;
13694 esac
13695
13696 : see if gethostbyaddr_r exists
13697 set gethostbyaddr_r d_gethostbyaddr_r
13698 eval $inlibc
13699 case "$d_gethostbyaddr_r" in
13700 "$define")
13701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13702         case "$d_gethostbyaddr_r_proto:$usethreads" in
13703         ":define")      d_gethostbyaddr_r_proto=define
13704                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13705                 eval $hasproto ;;
13706         *)      ;;
13707         esac
13708         case "$d_gethostbyaddr_r_proto" in
13709         define)
13710         case "$gethostbyaddr_r_proto" in
13711         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13712         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13713         esac
13714         case "$gethostbyaddr_r_proto" in
13715         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13717         esac
13718         case "$gethostbyaddr_r_proto" in
13719         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13721         esac
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13725         esac
13726         case "$gethostbyaddr_r_proto" in
13727         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13729         esac
13730         case "$gethostbyaddr_r_proto" in
13731         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13733         esac
13734         case "$gethostbyaddr_r_proto" in
13735         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13737         esac
13738         case "$gethostbyaddr_r_proto" in
13739         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13740         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13741         esac
13742         case "$gethostbyaddr_r_proto" in
13743         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13744         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13745         esac
13746         case "$gethostbyaddr_r_proto" in
13747         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13748         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13749         esac
13750         case "$gethostbyaddr_r_proto" in
13751         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13752         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13753         esac
13754         case "$gethostbyaddr_r_proto" in
13755         ''|0)   d_gethostbyaddr_r=undef
13756                 gethostbyaddr_r_proto=0
13757                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13758         * )     case "$gethostbyaddr_r_proto" in
13759                 REENTRANT_PROTO*) ;;
13760                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13761                 esac
13762                 echo "Prototype: $try" ;;
13763         esac
13764         ;;
13765         *)      case "$usethreads" in
13766                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13767                 esac
13768                 d_gethostbyaddr_r=undef
13769                 gethostbyaddr_r_proto=0
13770                 ;;
13771         esac
13772         ;;
13773 *)      gethostbyaddr_r_proto=0
13774         ;;
13775 esac
13776
13777 : see if gethostbyname_r exists
13778 set gethostbyname_r d_gethostbyname_r
13779 eval $inlibc
13780 case "$d_gethostbyname_r" in
13781 "$define")
13782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13783         case "$d_gethostbyname_r_proto:$usethreads" in
13784         ":define")      d_gethostbyname_r_proto=define
13785                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13786                 eval $hasproto ;;
13787         *)      ;;
13788         esac
13789         case "$d_gethostbyname_r_proto" in
13790         define)
13791         case "$gethostbyname_r_proto" in
13792         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13793         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13794         esac
13795         case "$gethostbyname_r_proto" in
13796         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13797         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13798         esac
13799         case "$gethostbyname_r_proto" in
13800         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13801         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13802         esac
13803         case "$gethostbyname_r_proto" in
13804         ''|0)   d_gethostbyname_r=undef
13805                 gethostbyname_r_proto=0
13806                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13807         * )     case "$gethostbyname_r_proto" in
13808                 REENTRANT_PROTO*) ;;
13809                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13810                 esac
13811                 echo "Prototype: $try" ;;
13812         esac
13813         ;;
13814         *)      case "$usethreads" in
13815                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13816                 esac
13817                 d_gethostbyname_r=undef
13818                 gethostbyname_r_proto=0
13819                 ;;
13820         esac
13821         ;;
13822 *)      gethostbyname_r_proto=0
13823         ;;
13824 esac
13825
13826 : see if gethostent_r exists
13827 set gethostent_r d_gethostent_r
13828 eval $inlibc
13829 case "$d_gethostent_r" in
13830 "$define")
13831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13832         case "$d_gethostent_r_proto:$usethreads" in
13833         ":define")      d_gethostent_r_proto=define
13834                 set d_gethostent_r_proto gethostent_r $hdrs
13835                 eval $hasproto ;;
13836         *)      ;;
13837         esac
13838         case "$d_gethostent_r_proto" in
13839         define)
13840         case "$gethostent_r_proto" in
13841         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13842         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13843         esac
13844         case "$gethostent_r_proto" in
13845         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13847         esac
13848         case "$gethostent_r_proto" in
13849         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13851         esac
13852         case "$gethostent_r_proto" in
13853         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13854         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13855         esac
13856         case "$gethostent_r_proto" in
13857         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13858         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13859         esac
13860         case "$gethostent_r_proto" in
13861         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13862         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13863         esac
13864         case "$gethostent_r_proto" in
13865         ''|0)   d_gethostent_r=undef
13866                 gethostent_r_proto=0
13867                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13868         * )     case "$gethostent_r_proto" in
13869                 REENTRANT_PROTO*) ;;
13870                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13871                 esac
13872                 echo "Prototype: $try" ;;
13873         esac
13874         ;;
13875         *)      case "$usethreads" in
13876                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13877                 esac
13878                 d_gethostent_r=undef
13879                 gethostent_r_proto=0
13880                 ;;
13881         esac
13882         ;;
13883 *)      gethostent_r_proto=0
13884         ;;
13885 esac
13886
13887 : see if prototypes for various gethostxxx netdb.h functions are available
13888 echo " "
13889 set d_gethostprotos gethostent $i_netdb netdb.h
13890 eval $hasproto
13891
13892 : see if getitimer exists
13893 set getitimer d_getitimer
13894 eval $inlibc
13895
13896 : see if getlogin exists
13897 set getlogin d_getlogin
13898 eval $inlibc
13899
13900 : see if getlogin_r exists
13901 set getlogin_r d_getlogin_r
13902 eval $inlibc
13903 case "$d_getlogin_r" in
13904 "$define")
13905         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13906         case "$d_getlogin_r_proto:$usethreads" in
13907         ":define")      d_getlogin_r_proto=define
13908                 set d_getlogin_r_proto getlogin_r $hdrs
13909                 eval $hasproto ;;
13910         *)      ;;
13911         esac
13912         case "$d_getlogin_r_proto" in
13913         define)
13914         case "$getlogin_r_proto" in
13915         ''|0) try='int getlogin_r(char*, size_t);'
13916         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13917         esac
13918         case "$getlogin_r_proto" in
13919         ''|0) try='int getlogin_r(char*, int);'
13920         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13921         esac
13922         case "$getlogin_r_proto" in
13923         ''|0) try='char* getlogin_r(char*, size_t);'
13924         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13925         esac
13926         case "$getlogin_r_proto" in
13927         ''|0) try='char* getlogin_r(char*, int);'
13928         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13929         esac
13930         case "$getlogin_r_proto" in
13931         ''|0)   d_getlogin_r=undef
13932                 getlogin_r_proto=0
13933                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13934         * )     case "$getlogin_r_proto" in
13935                 REENTRANT_PROTO*) ;;
13936                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13937                 esac
13938                 echo "Prototype: $try" ;;
13939         esac
13940         ;;
13941         *)      case "$usethreads" in
13942                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13943                 esac
13944                 d_getlogin_r=undef
13945                 getlogin_r_proto=0
13946                 ;;
13947         esac
13948         ;;
13949 *)      getlogin_r_proto=0
13950         ;;
13951 esac
13952
13953 : see if getmnt exists
13954 set getmnt d_getmnt
13955 eval $inlibc
13956
13957 : see if getmntent exists
13958 set getmntent d_getmntent
13959 eval $inlibc
13960
13961 : see if getnameinfo exists
13962 set getnameinfo d_getnameinfo
13963 eval $inlibc
13964
13965 : see if getnetbyaddr exists
13966 set getnetbyaddr d_getnbyaddr
13967 eval $inlibc
13968
13969 : see if getnetbyname exists
13970 set getnetbyname d_getnbyname
13971 eval $inlibc
13972
13973 : see if getnetent exists
13974 set getnetent d_getnent
13975 eval $inlibc
13976
13977 : see if getnetbyaddr_r exists
13978 set getnetbyaddr_r d_getnetbyaddr_r
13979 eval $inlibc
13980 case "$d_getnetbyaddr_r" in
13981 "$define")
13982         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13983         case "$d_getnetbyaddr_r_proto:$usethreads" in
13984         ":define")      d_getnetbyaddr_r_proto=define
13985                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13986                 eval $hasproto ;;
13987         *)      ;;
13988         esac
13989         case "$d_getnetbyaddr_r_proto" in
13990         define)
13991         case "$getnetbyaddr_r_proto" in
13992         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13993         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13994         esac
13995         case "$getnetbyaddr_r_proto" in
13996         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13998         esac
13999         case "$getnetbyaddr_r_proto" in
14000         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14002         esac
14003         case "$getnetbyaddr_r_proto" in
14004         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14006         esac
14007         case "$getnetbyaddr_r_proto" in
14008         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14009         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14010         esac
14011         case "$getnetbyaddr_r_proto" in
14012         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14013         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14014         esac
14015         case "$getnetbyaddr_r_proto" in
14016         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14017         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14018         esac
14019         case "$getnetbyaddr_r_proto" in
14020         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14021         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14022         esac
14023         case "$getnetbyaddr_r_proto" in
14024         ''|0)   d_getnetbyaddr_r=undef
14025                 getnetbyaddr_r_proto=0
14026                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14027         * )     case "$getnetbyaddr_r_proto" in
14028                 REENTRANT_PROTO*) ;;
14029                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14030                 esac
14031                 echo "Prototype: $try" ;;
14032         esac
14033         ;;
14034         *)      case "$usethreads" in
14035                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14036                 esac
14037                 d_getnetbyaddr_r=undef
14038                 getnetbyaddr_r_proto=0
14039                 ;;
14040         esac
14041         ;;
14042 *)      getnetbyaddr_r_proto=0
14043         ;;
14044 esac
14045
14046 : see if getnetbyname_r exists
14047 set getnetbyname_r d_getnetbyname_r
14048 eval $inlibc
14049 case "$d_getnetbyname_r" in
14050 "$define")
14051         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14052         case "$d_getnetbyname_r_proto:$usethreads" in
14053         ":define")      d_getnetbyname_r_proto=define
14054                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14055                 eval $hasproto ;;
14056         *)      ;;
14057         esac
14058         case "$d_getnetbyname_r_proto" in
14059         define)
14060         case "$getnetbyname_r_proto" in
14061         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14062         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14063         esac
14064         case "$getnetbyname_r_proto" in
14065         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14066         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14067         esac
14068         case "$getnetbyname_r_proto" in
14069         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14070         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14071         esac
14072         case "$getnetbyname_r_proto" in
14073         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14074         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14075         esac
14076         case "$getnetbyname_r_proto" in
14077         ''|0)   d_getnetbyname_r=undef
14078                 getnetbyname_r_proto=0
14079                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14080         * )     case "$getnetbyname_r_proto" in
14081                 REENTRANT_PROTO*) ;;
14082                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14083                 esac
14084                 echo "Prototype: $try" ;;
14085         esac
14086         ;;
14087         *)      case "$usethreads" in
14088                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14089                 esac
14090                 d_getnetbyname_r=undef
14091                 getnetbyname_r_proto=0
14092                 ;;
14093         esac
14094         ;;
14095 *)      getnetbyname_r_proto=0
14096         ;;
14097 esac
14098
14099 : see if getnetent_r exists
14100 set getnetent_r d_getnetent_r
14101 eval $inlibc
14102 case "$d_getnetent_r" in
14103 "$define")
14104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14105         case "$d_getnetent_r_proto:$usethreads" in
14106         ":define")      d_getnetent_r_proto=define
14107                 set d_getnetent_r_proto getnetent_r $hdrs
14108                 eval $hasproto ;;
14109         *)      ;;
14110         esac
14111         case "$d_getnetent_r_proto" in
14112         define)
14113         case "$getnetent_r_proto" in
14114         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14115         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14116         esac
14117         case "$getnetent_r_proto" in
14118         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14119         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14120         esac
14121         case "$getnetent_r_proto" in
14122         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14123         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14124         esac
14125         case "$getnetent_r_proto" in
14126         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14127         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14128         esac
14129         case "$getnetent_r_proto" in
14130         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14131         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14132         esac
14133         case "$getnetent_r_proto" in
14134         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14136         esac
14137         case "$getnetent_r_proto" in
14138         ''|0)   d_getnetent_r=undef
14139                 getnetent_r_proto=0
14140                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14141         * )     case "$getnetent_r_proto" in
14142                 REENTRANT_PROTO*) ;;
14143                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14144                 esac
14145                 echo "Prototype: $try" ;;
14146         esac
14147         ;;
14148         *)      case "$usethreads" in
14149                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14150                 esac
14151                 d_getnetent_r=undef
14152                 getnetent_r_proto=0
14153                 ;;
14154         esac
14155         ;;
14156 *)      getnetent_r_proto=0
14157         ;;
14158 esac
14159
14160 : see if prototypes for various getnetxxx netdb.h functions are available
14161 echo " "
14162 set d_getnetprotos getnetent $i_netdb netdb.h
14163 eval $hasproto
14164
14165 : see if getpagesize exists
14166 set getpagesize d_getpagsz
14167 eval $inlibc
14168
14169 : Optional checks for getprotobyname and getprotobynumber
14170
14171 : see if getprotobyname exists
14172 set getprotobyname d_getpbyname
14173 eval $inlibc
14174
14175 : see if getprotobynumber exists
14176 set getprotobynumber d_getpbynumber
14177 eval $inlibc
14178
14179 : see if getprotoent exists
14180 set getprotoent d_getpent
14181 eval $inlibc
14182
14183 : see if getpgid exists
14184 set getpgid d_getpgid
14185 eval $inlibc
14186
14187 : see if getpgrp2 exists
14188 set getpgrp2 d_getpgrp2
14189 eval $inlibc
14190
14191 : see if getppid exists
14192 set getppid d_getppid
14193 eval $inlibc
14194
14195 : see if getpriority exists
14196 set getpriority d_getprior
14197 eval $inlibc
14198
14199 : see if getprotobyname_r exists
14200 set getprotobyname_r d_getprotobyname_r
14201 eval $inlibc
14202 case "$d_getprotobyname_r" in
14203 "$define")
14204         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14205         case "$d_getprotobyname_r_proto:$usethreads" in
14206         ":define")      d_getprotobyname_r_proto=define
14207                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14208                 eval $hasproto ;;
14209         *)      ;;
14210         esac
14211         case "$d_getprotobyname_r_proto" in
14212         define)
14213         case "$getprotobyname_r_proto" in
14214         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14215         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14216         esac
14217         case "$getprotobyname_r_proto" in
14218         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14219         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14220         esac
14221         case "$getprotobyname_r_proto" in
14222         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14223         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14224         esac
14225         case "$getprotobyname_r_proto" in
14226         ''|0)   d_getprotobyname_r=undef
14227                 getprotobyname_r_proto=0
14228                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14229         * )     case "$getprotobyname_r_proto" in
14230                 REENTRANT_PROTO*) ;;
14231                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14232                 esac
14233                 echo "Prototype: $try" ;;
14234         esac
14235         ;;
14236         *)      case "$usethreads" in
14237                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14238                 esac
14239                 d_getprotobyname_r=undef
14240                 getprotobyname_r_proto=0
14241                 ;;
14242         esac
14243         ;;
14244 *)      getprotobyname_r_proto=0
14245         ;;
14246 esac
14247
14248 : see if getprotobynumber_r exists
14249 set getprotobynumber_r d_getprotobynumber_r
14250 eval $inlibc
14251 case "$d_getprotobynumber_r" in
14252 "$define")
14253         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14254         case "$d_getprotobynumber_r_proto:$usethreads" in
14255         ":define")      d_getprotobynumber_r_proto=define
14256                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14257                 eval $hasproto ;;
14258         *)      ;;
14259         esac
14260         case "$d_getprotobynumber_r_proto" in
14261         define)
14262         case "$getprotobynumber_r_proto" in
14263         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14264         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14265         esac
14266         case "$getprotobynumber_r_proto" in
14267         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14268         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14269         esac
14270         case "$getprotobynumber_r_proto" in
14271         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14272         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14273         esac
14274         case "$getprotobynumber_r_proto" in
14275         ''|0)   d_getprotobynumber_r=undef
14276                 getprotobynumber_r_proto=0
14277                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14278         * )     case "$getprotobynumber_r_proto" in
14279                 REENTRANT_PROTO*) ;;
14280                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14281                 esac
14282                 echo "Prototype: $try" ;;
14283         esac
14284         ;;
14285         *)      case "$usethreads" in
14286                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14287                 esac
14288                 d_getprotobynumber_r=undef
14289                 getprotobynumber_r_proto=0
14290                 ;;
14291         esac
14292         ;;
14293 *)      getprotobynumber_r_proto=0
14294         ;;
14295 esac
14296
14297 : see if getprotoent_r exists
14298 set getprotoent_r d_getprotoent_r
14299 eval $inlibc
14300 case "$d_getprotoent_r" in
14301 "$define")
14302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14303         case "$d_getprotoent_r_proto:$usethreads" in
14304         ":define")      d_getprotoent_r_proto=define
14305                 set d_getprotoent_r_proto getprotoent_r $hdrs
14306                 eval $hasproto ;;
14307         *)      ;;
14308         esac
14309         case "$d_getprotoent_r_proto" in
14310         define)
14311         case "$getprotoent_r_proto" in
14312         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14313         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14314         esac
14315         case "$getprotoent_r_proto" in
14316         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14317         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14318         esac
14319         case "$getprotoent_r_proto" in
14320         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14321         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14322         esac
14323         case "$getprotoent_r_proto" in
14324         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14325         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14326         esac
14327         case "$getprotoent_r_proto" in
14328         ''|0)   d_getprotoent_r=undef
14329                 getprotoent_r_proto=0
14330                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14331         * )     case "$getprotoent_r_proto" in
14332                 REENTRANT_PROTO*) ;;
14333                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14334                 esac
14335                 echo "Prototype: $try" ;;
14336         esac
14337         ;;
14338         *)      case "$usethreads" in
14339                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14340                 esac
14341                 d_getprotoent_r=undef
14342                 getprotoent_r_proto=0
14343                 ;;
14344         esac
14345         ;;
14346 *)      getprotoent_r_proto=0
14347         ;;
14348 esac
14349
14350 : see if prototypes for various getprotoxxx netdb.h functions are available
14351 echo " "
14352 set d_getprotoprotos getprotoent $i_netdb netdb.h
14353 eval $hasproto
14354
14355 : see if getprpwnam exists
14356 set getprpwnam d_getprpwnam
14357 eval $inlibc
14358
14359 : see if getpwent exists
14360 set getpwent d_getpwent
14361 eval $inlibc
14362
14363 : see if getpwent_r exists
14364 set getpwent_r d_getpwent_r
14365 eval $inlibc
14366 case "$d_getpwent_r" in
14367 "$define")
14368         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14369         case "$d_getpwent_r_proto:$usethreads" in
14370         ":define")      d_getpwent_r_proto=define
14371                 set d_getpwent_r_proto getpwent_r $hdrs
14372                 eval $hasproto ;;
14373         *)      ;;
14374         esac
14375         case "$d_getpwent_r_proto" in
14376         define)
14377         case "$getpwent_r_proto" in
14378         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14379         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14380         esac
14381         case "$getpwent_r_proto" in
14382         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14383         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14384         esac
14385         case "$getpwent_r_proto" in
14386         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14387         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14388         esac
14389         case "$getpwent_r_proto" in
14390         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14391         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14392         esac
14393         case "$getpwent_r_proto" in
14394         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14395         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14396         esac
14397         case "$getpwent_r_proto" in
14398         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14399         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14400         esac
14401         case "$getpwent_r_proto" in
14402         ''|0)   d_getpwent_r=undef
14403                 getpwent_r_proto=0
14404                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14405         * )     case "$getpwent_r_proto" in
14406                 REENTRANT_PROTO*) ;;
14407                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14408                 esac
14409                 echo "Prototype: $try" ;;
14410         esac
14411         ;;
14412         *)      case "$usethreads" in
14413                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14414                 esac
14415                 d_getpwent_r=undef
14416                 getpwent_r_proto=0
14417                 ;;
14418         esac
14419         ;;
14420 *)      getpwent_r_proto=0
14421         ;;
14422 esac
14423
14424 : see if getpwnam_r exists
14425 set getpwnam_r d_getpwnam_r
14426 eval $inlibc
14427 case "$d_getpwnam_r" in
14428 "$define")
14429         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14430         case "$d_getpwnam_r_proto:$usethreads" in
14431         ":define")      d_getpwnam_r_proto=define
14432                 set d_getpwnam_r_proto getpwnam_r $hdrs
14433                 eval $hasproto ;;
14434         *)      ;;
14435         esac
14436         case "$d_getpwnam_r_proto" in
14437         define)
14438         case "$getpwnam_r_proto" in
14439         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14440         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14441         esac
14442         case "$getpwnam_r_proto" in
14443         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14444         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14445         esac
14446         case "$getpwnam_r_proto" in
14447         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14448         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14449         esac
14450         case "$getpwnam_r_proto" in
14451         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14452         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14453         esac
14454         case "$getpwnam_r_proto" in
14455         ''|0)   d_getpwnam_r=undef
14456                 getpwnam_r_proto=0
14457                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14458         * )     case "$getpwnam_r_proto" in
14459                 REENTRANT_PROTO*) ;;
14460                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14461                 esac
14462                 echo "Prototype: $try" ;;
14463         esac
14464         ;;
14465         *)      case "$usethreads" in
14466                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14467                 esac
14468                 d_getpwnam_r=undef
14469                 getpwnam_r_proto=0
14470                 ;;
14471         esac
14472         ;;
14473 *)      getpwnam_r_proto=0
14474         ;;
14475 esac
14476
14477 : see if getpwuid_r exists
14478 set getpwuid_r d_getpwuid_r
14479 eval $inlibc
14480 case "$d_getpwuid_r" in
14481 "$define")
14482         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14483         case "$d_getpwuid_r_proto:$usethreads" in
14484         ":define")      d_getpwuid_r_proto=define
14485                 set d_getpwuid_r_proto getpwuid_r $hdrs
14486                 eval $hasproto ;;
14487         *)      ;;
14488         esac
14489         case "$d_getpwuid_r_proto" in
14490         define)
14491         case "$getpwuid_r_proto" in
14492         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14493         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14494         esac
14495         case "$getpwuid_r_proto" in
14496         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14497         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14498         esac
14499         case "$getpwuid_r_proto" in
14500         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14501         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14502         esac
14503         case "$getpwuid_r_proto" in
14504         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14505         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14506         esac
14507         case "$getpwuid_r_proto" in
14508         ''|0)   d_getpwuid_r=undef
14509                 getpwuid_r_proto=0
14510                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14511         * )     case "$getpwuid_r_proto" in
14512                 REENTRANT_PROTO*) ;;
14513                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14514                 esac
14515                 echo "Prototype: $try" ;;
14516         esac
14517         ;;
14518         *)      case "$usethreads" in
14519                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14520                 esac
14521                 d_getpwuid_r=undef
14522                 getpwuid_r_proto=0
14523                 ;;
14524         esac
14525         ;;
14526 *)      getpwuid_r_proto=0
14527         ;;
14528 esac
14529
14530 : Optional checks for getsbyname and getsbyport
14531
14532 : see if getservbyname exists
14533 set getservbyname d_getsbyname
14534 eval $inlibc
14535
14536 : see if getservbyport exists
14537 set getservbyport d_getsbyport
14538 eval $inlibc
14539
14540 : see if getservent exists
14541 set getservent d_getsent
14542 eval $inlibc
14543
14544 : see if getservbyname_r exists
14545 set getservbyname_r d_getservbyname_r
14546 eval $inlibc
14547 case "$d_getservbyname_r" in
14548 "$define")
14549         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14550         case "$d_getservbyname_r_proto:$usethreads" in
14551         ":define")      d_getservbyname_r_proto=define
14552                 set d_getservbyname_r_proto getservbyname_r $hdrs
14553                 eval $hasproto ;;
14554         *)      ;;
14555         esac
14556         case "$d_getservbyname_r_proto" in
14557         define)
14558         case "$getservbyname_r_proto" in
14559         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14560         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14561         esac
14562         case "$getservbyname_r_proto" in
14563         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14564         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14565         esac
14566         case "$getservbyname_r_proto" in
14567         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14568         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14569         esac
14570         case "$getservbyname_r_proto" in
14571         ''|0)   d_getservbyname_r=undef
14572                 getservbyname_r_proto=0
14573                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14574         * )     case "$getservbyname_r_proto" in
14575                 REENTRANT_PROTO*) ;;
14576                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14577                 esac
14578                 echo "Prototype: $try" ;;
14579         esac
14580         ;;
14581         *)      case "$usethreads" in
14582                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14583                 esac
14584                 d_getservbyname_r=undef
14585                 getservbyname_r_proto=0
14586                 ;;
14587         esac
14588         ;;
14589 *)      getservbyname_r_proto=0
14590         ;;
14591 esac
14592
14593 : see if getservbyport_r exists
14594 set getservbyport_r d_getservbyport_r
14595 eval $inlibc
14596 case "$d_getservbyport_r" in
14597 "$define")
14598         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14599         case "$d_getservbyport_r_proto:$usethreads" in
14600         ":define")      d_getservbyport_r_proto=define
14601                 set d_getservbyport_r_proto getservbyport_r $hdrs
14602                 eval $hasproto ;;
14603         *)      ;;
14604         esac
14605         case "$d_getservbyport_r_proto" in
14606         define)
14607         case "$getservbyport_r_proto" in
14608         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14609         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14610         esac
14611         case "$getservbyport_r_proto" in
14612         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14613         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14614         esac
14615         case "$getservbyport_r_proto" in
14616         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14617         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14618         esac
14619         case "$getservbyport_r_proto" in
14620         ''|0)   d_getservbyport_r=undef
14621                 getservbyport_r_proto=0
14622                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14623         * )     case "$getservbyport_r_proto" in
14624                 REENTRANT_PROTO*) ;;
14625                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14626                 esac
14627                 echo "Prototype: $try" ;;
14628         esac
14629         ;;
14630         *)      case "$usethreads" in
14631                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14632                 esac
14633                 d_getservbyport_r=undef
14634                 getservbyport_r_proto=0
14635                 ;;
14636         esac
14637         ;;
14638 *)      getservbyport_r_proto=0
14639         ;;
14640 esac
14641
14642 : see if getservent_r exists
14643 set getservent_r d_getservent_r
14644 eval $inlibc
14645 case "$d_getservent_r" in
14646 "$define")
14647         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14648         case "$d_getservent_r_proto:$usethreads" in
14649         ":define")      d_getservent_r_proto=define
14650                 set d_getservent_r_proto getservent_r $hdrs
14651                 eval $hasproto ;;
14652         *)      ;;
14653         esac
14654         case "$d_getservent_r_proto" in
14655         define)
14656         case "$getservent_r_proto" in
14657         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14658         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14659         esac
14660         case "$getservent_r_proto" in
14661         ''|0) try='int getservent_r(struct servent*, char*, int);'
14662         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14663         esac
14664         case "$getservent_r_proto" in
14665         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14666         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14667         esac
14668         case "$getservent_r_proto" in
14669         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14670         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14671         esac
14672         case "$getservent_r_proto" in
14673         ''|0)   d_getservent_r=undef
14674                 getservent_r_proto=0
14675                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14676         * )     case "$getservent_r_proto" in
14677                 REENTRANT_PROTO*) ;;
14678                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14679                 esac
14680                 echo "Prototype: $try" ;;
14681         esac
14682         ;;
14683         *)      case "$usethreads" in
14684                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14685                 esac
14686                 d_getservent_r=undef
14687                 getservent_r_proto=0
14688                 ;;
14689         esac
14690         ;;
14691 *)      getservent_r_proto=0
14692         ;;
14693 esac
14694
14695 : see if prototypes for various getservxxx netdb.h functions are available
14696 echo " "
14697 set d_getservprotos getservent $i_netdb netdb.h
14698 eval $hasproto
14699
14700 : see if getspnam exists
14701 set getspnam d_getspnam
14702 eval $inlibc
14703
14704 : see if this is a shadow.h system
14705 set shadow.h i_shadow
14706 eval $inhdr
14707
14708 : see if getspnam_r exists
14709 set getspnam_r d_getspnam_r
14710 eval $inlibc
14711 case "$d_getspnam_r" in
14712 "$define")
14713         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14714         case "$d_getspnam_r_proto:$usethreads" in
14715         ":define")      d_getspnam_r_proto=define
14716                 set d_getspnam_r_proto getspnam_r $hdrs
14717                 eval $hasproto ;;
14718         *)      ;;
14719         esac
14720         case "$d_getspnam_r_proto" in
14721         define)
14722         case "$getspnam_r_proto" in
14723         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14724         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14725         esac
14726         case "$getspnam_r_proto" in
14727         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14728         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14729         esac
14730         case "$getspnam_r_proto" in
14731         ''|0)   d_getspnam_r=undef
14732                 getspnam_r_proto=0
14733                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14734         * )     case "$getspnam_r_proto" in
14735                 REENTRANT_PROTO*) ;;
14736                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14737                 esac
14738                 echo "Prototype: $try" ;;
14739         esac
14740         ;;
14741         *)      case "$usethreads" in
14742                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14743                 esac
14744                 d_getspnam_r=undef
14745                 getspnam_r_proto=0
14746                 ;;
14747         esac
14748         ;;
14749 *)      getspnam_r_proto=0
14750         ;;
14751 esac
14752
14753 : see if gettimeofday or ftime exists
14754 set gettimeofday d_gettimeod
14755 eval $inlibc
14756 case "$d_gettimeod" in
14757 "$undef")
14758         set ftime d_ftime 
14759         eval $inlibc
14760         ;;
14761 *)
14762         val="$undef"; set d_ftime; eval $setvar
14763         ;;
14764 esac
14765 case "$d_gettimeod$d_ftime" in
14766 "$undef$undef")
14767         echo " "
14768         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14769         ;;
14770 esac
14771
14772 : see if gmtime_r exists
14773 set gmtime_r d_gmtime_r
14774 eval $inlibc
14775 case "$d_gmtime_r" in
14776 "$define")
14777         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14778         case "$d_gmtime_r_proto:$usethreads" in
14779         ":define")      d_gmtime_r_proto=define
14780                 set d_gmtime_r_proto gmtime_r $hdrs
14781                 eval $hasproto ;;
14782         *)      ;;
14783         esac
14784         case "$d_gmtime_r_proto" in
14785         define)
14786         case "$gmtime_r_proto" in
14787         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14788         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14789         esac
14790         case "$gmtime_r_proto" in
14791         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14792         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14793         esac
14794         case "$gmtime_r_proto" in
14795         ''|0)   d_gmtime_r=undef
14796                 gmtime_r_proto=0
14797                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14798         * )     case "$gmtime_r_proto" in
14799                 REENTRANT_PROTO*) ;;
14800                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14801                 esac
14802                 echo "Prototype: $try" ;;
14803         esac
14804         ;;
14805         *)      case "$usethreads" in
14806                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14807                 esac
14808                 d_gmtime_r=undef
14809                 gmtime_r_proto=0
14810                 ;;
14811         esac
14812         ;;
14813 *)      gmtime_r_proto=0
14814         ;;
14815 esac
14816
14817 : see if hasmntopt exists
14818 set hasmntopt d_hasmntopt
14819 eval $inlibc
14820
14821 : see if this is a netinet/in.h or sys/in.h system
14822 set netinet/in.h i_niin sys/in.h i_sysin
14823 eval $inhdr
14824
14825 : see if arpa/inet.h has to be included
14826 set arpa/inet.h i_arpainet
14827 eval $inhdr
14828
14829 : see if htonl --and friends-- exists
14830 val=''
14831 set htonl val
14832 eval $inlibc
14833
14834 : Maybe they are macros.
14835 case "$val" in
14836 $undef)
14837         $cat >htonl.c <<EOM
14838 #include <stdio.h>
14839 #include <sys/types.h>
14840 #$i_niin I_NETINET_IN
14841 #$i_sysin I_SYS_IN
14842 #$i_arpainet I_ARPA_INET
14843 #ifdef I_NETINET_IN
14844 #include <netinet/in.h>
14845 #endif
14846 #ifdef I_SYS_IN
14847 #include <sys/in.h>
14848 #endif
14849 #ifdef I_ARPA_INET
14850 #include <arpa/inet.h>
14851 #endif
14852 #ifdef htonl
14853 printf("Defined as a macro.");
14854 #endif
14855 EOM
14856         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14857         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14858                 val="$define"
14859                 echo "But it seems to be defined as a macro." >&4
14860         fi
14861         $rm -f htonl.?
14862         ;;
14863 esac
14864 set d_htonl
14865 eval $setvar
14866
14867 : see if ilogbl exists
14868 set ilogbl d_ilogbl
14869 eval $inlibc
14870
14871 : index or strchr
14872 echo " "
14873 if set index val -f; eval $csym; $val; then
14874         if set strchr val -f d_strchr; eval $csym; $val; then
14875                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14876                         val="$define"
14877                         vali="$undef"
14878                         echo "strchr() found." >&4
14879                 else
14880                         val="$undef"
14881                         vali="$define"
14882                         echo "index() found." >&4
14883                 fi
14884         else
14885                 val="$undef"
14886                 vali="$define"
14887                 echo "index() found." >&4
14888         fi
14889 else
14890         if set strchr val -f d_strchr; eval $csym; $val; then
14891                 val="$define"
14892                 vali="$undef"
14893                 echo "strchr() found." >&4
14894         else
14895                 echo "No index() or strchr() found!" >&4
14896                 val="$undef"
14897                 vali="$undef"
14898         fi
14899 fi
14900 set d_strchr; eval $setvar
14901 val="$vali"
14902 set d_index; eval $setvar
14903
14904 : check whether inet_aton exists
14905 set inet_aton d_inetaton
14906 eval $inlibc
14907
14908 : see if inet_ntop exists
14909 set inet_ntop d_inetntop
14910 eval $inlibc
14911
14912 : see if inet_pton exists
14913 set inet_pton d_inetpton
14914 eval $inlibc
14915
14916 : Look for isascii
14917 echo " "
14918 $cat >isascii.c <<EOCP
14919 #include <stdio.h>
14920 #include <ctype.h>
14921 #$i_stdlib I_STDLIB
14922 #ifdef I_STDLIB
14923 #include <stdlib.h>
14924 #endif
14925 int main() {
14926         int c = 'A';
14927         if (isascii(c))
14928                 exit(0);
14929         else
14930                 exit(1);
14931 }
14932 EOCP
14933 set isascii
14934 if eval $compile; then
14935         echo "isascii() found." >&4
14936         val="$define"
14937 else
14938         echo "isascii() NOT found." >&4
14939         val="$undef"
14940 fi
14941 set d_isascii
14942 eval $setvar
14943 $rm -f isascii*
14944
14945 : see if isfinite exists
14946 set isfinite d_isfinite
14947 eval $inlibc
14948
14949 : see if isinf exists
14950 set isinf d_isinf
14951 eval $inlibc
14952
14953 : see if isnan exists
14954 set isnan d_isnan
14955 eval $inlibc
14956
14957 : see if isnanl exists
14958 set isnanl d_isnanl
14959 eval $inlibc
14960
14961 : see if killpg exists
14962 set killpg d_killpg
14963 eval $inlibc
14964
14965 : see if lchown exists
14966 echo " "
14967 $cat > try.c <<'EOCP'
14968 /* System header to define __stub macros and hopefully few prototypes,
14969     which can conflict with char lchown(); below.  */
14970 #include <assert.h>
14971 /* Override any gcc2 internal prototype to avoid an error.  */
14972 /* We use char because int might match the return type of a gcc2
14973    builtin and then its argument prototype would still apply.  */
14974 char lchown();
14975 int main() {
14976     /*  The GNU C library defines this for functions which it implements
14977         to always fail with ENOSYS.  Some functions are actually named
14978         something starting with __ and the normal name is an alias.  */
14979 #if defined (__stub_lchown) || defined (__stub___lchown)
14980 choke me
14981 #else
14982 lchown();
14983 #endif
14984 ; return 0; }
14985 EOCP
14986 set try
14987 if eval $compile; then
14988     $echo "lchown() found." >&4
14989     val="$define"
14990 else
14991     $echo "lchown() NOT found." >&4
14992     val="$undef"
14993 fi
14994 set d_lchown
14995 eval $setvar
14996
14997 : See if number of significant digits in a double precision number is known
14998 echo " "
14999 $cat >ldbl_dig.c <<EOM
15000 #$i_limits I_LIMITS
15001 #$i_float I_FLOAT
15002 #ifdef I_LIMITS
15003 #include <limits.h>
15004 #endif
15005 #ifdef I_FLOAT
15006 #include <float.h>
15007 #endif
15008 #ifdef LDBL_DIG
15009 printf("Contains LDBL_DIG");
15010 #endif
15011 EOM
15012 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15013 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15014         echo "LDBL_DIG found." >&4
15015         val="$define"
15016 else
15017         echo "LDBL_DIG NOT found." >&4
15018         val="$undef"
15019 fi
15020 $rm -f ldbl_dig.?
15021 set d_ldbl_dig
15022 eval $setvar
15023
15024 : see if this is a math.h system
15025 set math.h i_math
15026 eval $inhdr
15027
15028 : check to see if math.h defines _LIB_VERSION
15029 d_libm_lib_version="$undef"
15030 case $i_math in
15031     $define)
15032         echo " "
15033         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15034         $cat >try.c <<EOCP
15035 #include <unistd.h>
15036 #include <math.h>
15037 int main (int argc, char *argv[])
15038 {
15039     printf ("%d\n", _LIB_VERSION);
15040     return (0);
15041     } /* main */
15042 EOCP
15043         set try
15044         if eval $compile; then
15045             foo=`$run ./try`
15046             echo "Yes, it does ($foo)" >&4
15047             d_libm_lib_version="$define"
15048         else
15049             echo "No, it does not (probably harmless)" >&4
15050             fi
15051         $rm_try
15052         ;;
15053
15054     esac
15055
15056 : see if link exists
15057 set link d_link
15058 eval $inlibc
15059
15060 : see if localtime_r exists
15061 set localtime_r d_localtime_r
15062 eval $inlibc
15063 case "$d_localtime_r" in
15064 "$define")
15065         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15066         case "$d_localtime_r_proto:$usethreads" in
15067         ":define")      d_localtime_r_proto=define
15068                 set d_localtime_r_proto localtime_r $hdrs
15069                 eval $hasproto ;;
15070         *)      ;;
15071         esac
15072         case "$d_localtime_r_proto" in
15073         define)
15074         case "$localtime_r_proto" in
15075         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15076         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15077         esac
15078         case "$localtime_r_proto" in
15079         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15080         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15081         esac
15082         case "$localtime_r_proto" in
15083         ''|0)   d_localtime_r=undef
15084                 localtime_r_proto=0
15085                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15086         * )     case "$localtime_r_proto" in
15087                 REENTRANT_PROTO*) ;;
15088                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15089                 esac
15090                 echo "Prototype: $try" ;;
15091         esac
15092         ;;
15093         *)      case "$usethreads" in
15094                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15095                 esac
15096                 d_localtime_r=undef
15097                 localtime_r_proto=0
15098                 ;;
15099         esac
15100         ;;
15101 *)      localtime_r_proto=0
15102         ;;
15103 esac
15104
15105 : see if localtime_r calls tzset
15106 case "$localtime_r_proto" in
15107 REENTRANT_PROTO*)
15108         $cat >try.c <<EOCP
15109 /*  Does our libc's localtime_r call tzset ?
15110  *  return 0 if so, 1 otherwise.
15111  */
15112 #$i_systypes    I_SYS_TYPES
15113 #$i_unistd      I_UNISTD
15114 #$i_time        I_TIME
15115 #$i_stdlib      I_STDLIB
15116 #$i_string      I_STRING
15117 #$i_malloc      I_MALLOC
15118 #ifdef I_SYS_TYPES
15119 #  include <sys/types.h>
15120 #endif
15121 #ifdef I_UNISTD
15122 #  include <unistd.h>
15123 #endif
15124 #ifdef I_TIME
15125 #  include <time.h>
15126 #endif
15127 #ifdef I_STDLIB
15128 #include <stdlib.h>
15129 #endif
15130 #ifdef I_STRING
15131 #  include <string.h>
15132 #else
15133 #  include <strings.h>
15134 #endif
15135 #ifdef I_MALLOC
15136 #  include <malloc.h>
15137 #endif
15138 int main()
15139 {
15140     time_t t = time(0L);
15141     char w_tz[]="TZ" "=GMT+5",
15142          e_tz[]="TZ" "=GMT-5",
15143         *tz_e = (char*)malloc(16),
15144         *tz_w = (char*)malloc(16);
15145     struct tm tm_e, tm_w;
15146     memset(&tm_e,'\0',sizeof(struct tm));
15147     memset(&tm_w,'\0',sizeof(struct tm));
15148     strcpy(tz_e,e_tz);
15149     strcpy(tz_w,w_tz);
15150
15151     putenv(tz_e);
15152     localtime_r(&t, &tm_e);
15153
15154     putenv(tz_w);
15155     localtime_r(&t, &tm_w);
15156
15157     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15158         return 1;
15159     return 0;
15160 }
15161 EOCP
15162         set try
15163         if eval $compile; then
15164             if $run ./try; then
15165                 d_localtime_r_needs_tzset=undef;
15166             else
15167                 d_localtime_r_needs_tzset=define;
15168             fi;
15169         else
15170             d_localtime_r_needs_tzset=undef;
15171         fi;
15172      ;;
15173   *)
15174      d_localtime_r_needs_tzset=undef;
15175      ;;
15176 esac
15177 $rm_try
15178
15179 : see if localeconv exists
15180 set localeconv d_locconv
15181 eval $inlibc
15182
15183 : see if lockf exists
15184 set lockf d_lockf
15185 eval $inlibc
15186
15187 : see if prototype for lseek is available
15188 echo " "
15189 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15190 eval $hasproto
15191
15192 : see if lstat exists
15193 set lstat d_lstat
15194 eval $inlibc
15195
15196 : see if madvise exists
15197 set madvise d_madvise
15198 eval $inlibc
15199
15200 : see if malloc_size exists
15201 set malloc_size d_malloc_size
15202 eval $inlibc
15203
15204 : see if malloc_size_good exists
15205 set malloc_good_size d_malloc_good_size
15206 eval $inlibc
15207
15208 : see if mblen exists
15209 set mblen d_mblen
15210 eval $inlibc
15211
15212 : see if mbstowcs exists
15213 set mbstowcs d_mbstowcs
15214 eval $inlibc
15215
15216 : see if mbtowc exists
15217 set mbtowc d_mbtowc
15218 eval $inlibc
15219
15220 : see if memchr exists
15221 set memchr d_memchr
15222 eval $inlibc
15223
15224 : see if memcmp exists
15225 set memcmp d_memcmp
15226 eval $inlibc
15227
15228 : see if memcpy exists
15229 set memcpy d_memcpy
15230 eval $inlibc
15231
15232 : see if memmove exists
15233 set memmove d_memmove
15234 eval $inlibc
15235
15236 : see if memset exists
15237 set memset d_memset
15238 eval $inlibc
15239
15240 : see if mkdir exists
15241 set mkdir d_mkdir
15242 eval $inlibc
15243
15244 : see if mkdtemp exists
15245 set mkdtemp d_mkdtemp
15246 eval $inlibc
15247
15248 : see if mkfifo exists
15249 set mkfifo d_mkfifo
15250 eval $inlibc
15251
15252 : see if mkstemp exists
15253 set mkstemp d_mkstemp
15254 eval $inlibc
15255
15256 : see if mkstemps exists
15257 set mkstemps d_mkstemps
15258 eval $inlibc
15259
15260 : see if mktime exists
15261 set mktime d_mktime
15262 eval $inlibc
15263
15264 : see if this is a sys/mman.h system
15265 set sys/mman.h i_sysmman
15266 eval $inhdr
15267
15268 : see if mmap exists
15269 set mmap d_mmap
15270 eval $inlibc
15271 : see what shmat returns
15272 : default to something harmless
15273 mmaptype='void *'
15274 case "$i_sysmman$d_mmap" in
15275 "$define$define")
15276         $cat >mmap.c <<'END'
15277 #include <sys/mman.h>
15278 void *mmap();
15279 END
15280         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15281                 mmaptype='void *'
15282         else
15283                 mmaptype='caddr_t'
15284         fi
15285         echo "and it returns ($mmaptype)." >&4
15286         ;;
15287 esac
15288
15289
15290
15291 : see if sqrtl exists
15292 set sqrtl d_sqrtl
15293 eval $inlibc
15294
15295 : see if scalbnl exists
15296 set scalbnl d_scalbnl
15297 eval $inlibc
15298
15299 : see if modfl exists
15300 set modfl d_modfl
15301 eval $inlibc
15302
15303 : see if prototype for modfl is available
15304 echo " "
15305 set d_modflproto modfl $i_math math.h
15306 eval $hasproto
15307
15308 d_modfl_pow32_bug="$undef"
15309
15310 case "$d_longdbl$d_modfl" in
15311 $define$define)
15312         $cat <<EOM
15313 Checking to see whether your modfl() is okay for large values...
15314 EOM
15315 $cat >try.c <<EOCP
15316 #include <math.h>
15317 #include <stdio.h>
15318 EOCP
15319 if $test "X$d_modflproto" != "X$define"; then
15320         $cat >>try.c <<EOCP
15321 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15322 long double modfl (long double, long double *);
15323 EOCP
15324 fi
15325 $cat >>try.c <<EOCP
15326 int main() {
15327     long double nv = 4294967303.15;
15328     long double v, w;
15329     v = modfl(nv, &w);
15330 #ifdef __GLIBC__
15331     printf("glibc");
15332 #endif
15333     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15334     return 0;
15335 }
15336 EOCP
15337         case "$osname:$gccversion" in
15338         aix:)   saveccflags="$ccflags"
15339                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15340         esac
15341         set try
15342         if eval $compile; then
15343                 foo=`$run ./try`
15344                 case "$foo" in
15345                 *" 4294967303.150000 1.150000 4294967302.000000")
15346                         echo >&4 "Your modfl() is broken for large values."
15347                         d_modfl_pow32_bug="$define"
15348                         case "$foo" in
15349                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15350                         ;;
15351                         esac
15352                         ;;
15353                 *" 4294967303.150000 0.150000 4294967303.000000")
15354                         echo >&4 "Your modfl() seems okay for large values."
15355                         ;;
15356                 *)      echo >&4 "I don't understand your modfl() at all."
15357                         d_modfl="$undef"
15358                         ;;
15359                 esac
15360                 $rm_try
15361         else
15362                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15363                 d_modfl="$undef"
15364         fi
15365         case "$osname:$gccversion" in
15366         aix:)   ccflags="$saveccflags" ;; # restore
15367         esac
15368         ;;
15369 esac
15370
15371 if $test "$uselongdouble" = "$define"; then
15372     message=""
15373     if $test "$d_sqrtl" != "$define"; then
15374         message="$message sqrtl"
15375     fi
15376     if $test "$d_modfl" != "$define"; then
15377         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15378             echo "You have both aintl and copysignl, so I can emulate modfl."
15379         else
15380             message="$message modfl"
15381         fi
15382     fi
15383     if $test "$d_frexpl" != "$define"; then
15384         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15385             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15386         else
15387             message="$message frexpl"
15388         fi
15389     fi
15390
15391     if $test "$message" != ""; then
15392         $cat <<EOM >&4
15393
15394 *** You requested the use of long doubles but you do not seem to have
15395 *** the following mathematical functions needed for long double support:
15396 ***    $message
15397 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15398 *** Cannot continue, aborting.
15399
15400 EOM
15401
15402         exit 1
15403     fi
15404 fi
15405
15406 : see if mprotect exists
15407 set mprotect d_mprotect
15408 eval $inlibc
15409
15410 : see if msgctl exists
15411 set msgctl d_msgctl
15412 eval $inlibc
15413
15414 : see if msgget exists
15415 set msgget d_msgget
15416 eval $inlibc
15417
15418 : see if msgsnd exists
15419 set msgsnd d_msgsnd
15420 eval $inlibc
15421
15422 : see if msgrcv exists
15423 set msgrcv d_msgrcv
15424 eval $inlibc
15425
15426 : see how much of the 'msg*(2)' library is present.
15427 h_msg=true
15428 echo " "
15429 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15430 *"$undef"*) h_msg=false;;
15431 esac
15432 case "$osname" in
15433 freebsd)
15434     case "`ipcs 2>&1`" in
15435     "SVID messages"*"not configured"*)
15436         echo "Your $osname does not have the msg*(2) configured." >&4
15437         h_msg=false
15438         val="$undef"
15439         set msgctl d_msgctl
15440         eval $setvar
15441         set msgget d_msgget
15442         eval $setvar
15443         set msgsnd d_msgsnd
15444         eval $setvar
15445         set msgrcv d_msgrcv
15446         eval $setvar
15447         ;;
15448     esac
15449     ;;
15450 esac
15451 : we could also check for sys/ipc.h ...
15452 if $h_msg && $test `./findhdr sys/msg.h`; then
15453         echo "You have the full msg*(2) library." >&4
15454         val="$define"
15455 else
15456         echo "You don't have the full msg*(2) library." >&4
15457         val="$undef"
15458 fi
15459 set d_msg
15460 eval $setvar
15461
15462 : Check for msghdr_s
15463 echo " "
15464 echo "Checking to see if your system supports struct msghdr..." >&4
15465 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15466 eval $hasstruct
15467 case "$d_msghdr_s" in
15468 "$define")      echo "Yes, it does."   ;;
15469 *)              echo "No, it doesn't." ;;
15470 esac
15471
15472
15473 : see if msync exists
15474 set msync d_msync
15475 eval $inlibc
15476
15477 : see if munmap exists
15478 set munmap d_munmap
15479 eval $inlibc
15480
15481 : see if nice exists
15482 set nice d_nice
15483 eval $inlibc
15484
15485 : see if this is a langinfo.h system
15486 set langinfo.h i_langinfo
15487 eval $inhdr
15488
15489 : see if nl_langinfo exists
15490 set nl_langinfo d_nl_langinfo
15491 eval $inlibc
15492
15493 : check for volatile keyword
15494 echo " "
15495 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15496 $cat >try.c <<'EOCP'
15497 int main()
15498 {
15499         typedef struct _goo_struct goo_struct;
15500         goo_struct * volatile goo = ((goo_struct *)0);
15501         struct _goo_struct {
15502                 long long_int;
15503                 int reg_int;
15504                 char char_var;
15505         };
15506         typedef unsigned short foo_t;
15507         char *volatile foo;
15508         volatile int bar;
15509         volatile foo_t blech;
15510         foo = foo;
15511 }
15512 EOCP
15513 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15514         val="$define"
15515         echo "Yup, it does."
15516 else
15517         val="$undef"
15518         echo "Nope, it doesn't."
15519 fi
15520 set d_volatile
15521 eval $setvar
15522 $rm_try
15523
15524 : Check basic sizes
15525 echo " "
15526 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15527
15528 case "$use64bitint:$d_quad:$quadtype" in
15529 define:define:?*)
15530         ivtype="$quadtype"
15531         uvtype="$uquadtype"
15532         ivsize=8
15533         uvsize=8
15534         ;;
15535 *)      ivtype="long"
15536         uvtype="unsigned long"
15537         ivsize=$longsize
15538         uvsize=$longsize
15539         ;;
15540 esac
15541
15542 case "$uselongdouble:$d_longdbl" in
15543 define:define)
15544         nvtype="long double"
15545         nvsize=$longdblsize
15546         ;;
15547 *)      nvtype=double
15548         nvsize=$doublesize
15549         ;;
15550 esac
15551
15552 $echo "(IV will be "$ivtype", $ivsize bytes)"
15553 $echo "(UV will be "$uvtype", $uvsize bytes)"
15554 $echo "(NV will be "$nvtype", $nvsize bytes)"
15555
15556 $cat >try.c <<EOCP
15557 #$i_inttypes I_INTTYPES
15558 #ifdef I_INTTYPES
15559 #include <inttypes.h>
15560 #endif
15561 #include <stdio.h>
15562 int main() {
15563 #ifdef INT8
15564    int8_t i =  INT8_MAX;
15565   uint8_t u = UINT8_MAX;
15566   printf("int8_t\n");
15567 #endif
15568 #ifdef INT16
15569    int16_t i =  INT16_MAX;
15570   uint16_t i = UINT16_MAX;
15571   printf("int16_t\n");
15572 #endif
15573 #ifdef INT32
15574    int32_t i =  INT32_MAX;
15575   uint32_t u = UINT32_MAX;
15576   printf("int32_t\n");
15577 #endif
15578 }
15579 EOCP
15580
15581 i8type="signed char"
15582 u8type="unsigned char"
15583 i8size=1
15584 u8size=1
15585
15586 case "$i16type" in
15587 '')     case "$shortsize" in
15588         2)      i16type=short
15589                 u16type="unsigned short"
15590                 i16size=$shortsize
15591                 u16size=$shortsize
15592                 ;;
15593         esac
15594         ;;
15595 esac
15596 case "$i16type" in
15597 '')     set try -DINT16
15598         if eval $compile; then
15599                 case "`$run ./try`" in
15600                 int16_t)
15601                         i16type=int16_t
15602                         u16type=uint16_t
15603                         i16size=2
15604                         u16size=2
15605                         ;;
15606                 esac
15607         fi
15608         ;;
15609 esac
15610 case "$i16type" in
15611 '')     if $test $shortsize -ge 2; then
15612                 i16type=short
15613                 u16type="unsigned short"
15614                 i16size=$shortsize
15615                 u16size=$shortsize
15616         fi
15617         ;;
15618 esac
15619
15620 case "$i32type" in
15621 '')     case "$longsize" in
15622         4)      i32type=long
15623                 u32type="unsigned long"
15624                 i32size=$longsize
15625                 u32size=$longsize
15626                 ;;
15627         *)      case "$intsize" in
15628                 4)      i32type=int
15629                         u32type="unsigned int"
15630                         i32size=$intsize
15631                         u32size=$intsize
15632                         ;;
15633                 esac
15634                 ;;
15635         esac
15636         ;;
15637 esac
15638 case "$i32type" in
15639 '')     set try -DINT32
15640         if eval $compile; then
15641                 case "`$run ./try`" in
15642                 int32_t)
15643                         i32type=int32_t
15644                         u32type=uint32_t
15645                         i32size=4
15646                         u32size=4
15647                         ;;
15648                 esac
15649         fi
15650         ;;
15651 esac
15652 case "$i32type" in
15653 '')     if $test $intsize -ge 4; then
15654                 i32type=int
15655                 u32type="unsigned int"
15656                 i32size=$intsize
15657                 u32size=$intsize
15658         fi
15659         ;;
15660 esac
15661
15662 case "$i64type" in
15663 '')     case "$d_quad:$quadtype" in
15664         define:?*)
15665                 i64type="$quadtype"
15666                 u64type="$uquadtype"
15667                 i64size=8
15668                 u64size=8
15669                 ;;
15670         esac
15671         ;;
15672 esac
15673
15674 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15675 : volatile so that the compiler has to store it out to memory.
15676 if test X"$d_volatile" = X"$define"; then
15677         volatile=volatile
15678 fi
15679 $cat <<EOP >try.c
15680 #include <stdio.h>
15681 #$i_stdlib I_STDLIB
15682 #ifdef I_STDLIB
15683 #include <stdlib.h>
15684 #endif
15685 #include <sys/types.h>
15686 #include <signal.h>
15687 #ifdef SIGFPE
15688 $volatile int bletched = 0;
15689 $signal_t blech(int s) { bletched = 1; }
15690 #endif
15691 int main() {
15692     $uvtype u = 0;
15693     $nvtype d;
15694     int     n = 8 * $uvsize;
15695     int     i;
15696 #ifdef SIGFPE
15697     signal(SIGFPE, blech);
15698 #endif
15699
15700     for (i = 0; i < n; i++) {
15701       u = u << 1 | ($uvtype)1;
15702       d = ($nvtype)u;
15703       if (($uvtype)d != u)
15704         break;
15705       if (d <= 0)
15706         break;
15707       d = ($nvtype)(u - 1);
15708       if (($uvtype)d != (u - 1))
15709         break;
15710 #ifdef SIGFPE
15711       if (bletched)
15712         break;
15713 #endif
15714     }
15715     printf("%d\n", ((i == n) ? -n : i));
15716     exit(0);
15717 }
15718 EOP
15719 set try
15720
15721 d_nv_preserves_uv="$undef"
15722 if eval $compile; then
15723         nv_preserves_uv_bits="`$run ./try`"
15724 fi
15725 case "$nv_preserves_uv_bits" in
15726 \-[1-9]*)
15727         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15728         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15729         d_nv_preserves_uv="$define"
15730         ;;
15731 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15732         d_nv_preserves_uv="$undef" ;;
15733 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15734         nv_preserves_uv_bits="0" ;;
15735 esac
15736 $rm_try
15737
15738 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15739 : volatile so that the compiler has to store it out to memory.
15740 if test X"$d_volatile" = X"$define"; then
15741         volatile=volatile
15742 fi
15743 $cat <<EOP >try.c
15744 #include <stdio.h>
15745
15746 typedef $nvtype NV;
15747
15748 int
15749 main() {
15750   NV value = 2;
15751   int count = 1;
15752
15753   while(count < 256) {
15754     $volatile NV up = value + 1.0;
15755     $volatile NV negated = -value;
15756     $volatile NV down = negated - 1.0;
15757     $volatile NV got_up = up - value;
15758     int up_good = got_up == 1.0;
15759     int got_down = down - negated;
15760     int down_good = got_down == -1.0;
15761
15762     if (down_good != up_good) {
15763       fprintf(stderr,
15764               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15765               up_good, (double) got_up, down_good, (double) got_down,
15766               count, (double) value);
15767       return 1;
15768     }
15769     if (!up_good) {
15770       while (1) {
15771         if (count > 8) {
15772           count -= 8;
15773           fputs("256.0", stdout);
15774         } else {
15775           count--;
15776           fputs("2.0", stdout);
15777         }
15778         if (!count) {
15779           puts("");
15780           return 0;
15781         }
15782         fputs("*", stdout);
15783       }
15784     }
15785     value *= 2;
15786     ++count;
15787   }
15788   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15789           count, (double) value);
15790   return 1;
15791 }
15792 EOP
15793 set try
15794
15795 nv_overflows_integers_at='0'
15796 if eval $compile; then
15797     xxx="`$run ./try`"
15798     case "$?" in
15799         0)
15800             case "$xxx" in
15801                 2*)  cat >&4 <<EOM
15802 The largest integer your NVs can preserve is equal to $xxx
15803 EOM
15804                     nv_overflows_integers_at="$xxx"
15805                     ;;
15806                 *)  cat >&4 <<EOM
15807 Cannot determine the largest integer value your NVs can hold, unexpected output
15808 '$xxx'
15809 EOM
15810                     ;;
15811             esac
15812             ;;
15813         *)  cat >&4 <<EOM
15814 Cannot determine the largest integer value your NVs can hold
15815 EOM
15816             ;;
15817     esac
15818 fi
15819 $rm_try
15820
15821 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15822 : volatile so that the compiler has to store it out to memory.
15823 if test X"$d_volatile" = X"$define"; then
15824         volatile=volatile
15825 fi
15826 $cat <<EOP >try.c
15827 #include <stdio.h>
15828 #$i_stdlib I_STDLIB
15829 #ifdef I_STDLIB
15830 #include <stdlib.h>
15831 #endif
15832 #$i_string I_STRING
15833 #ifdef I_STRING
15834 #  include <string.h>
15835 #else
15836 #  include <strings.h>
15837 #endif
15838 #include <sys/types.h>
15839 #include <signal.h>
15840 #ifdef SIGFPE
15841 $volatile int bletched = 0;
15842 $signal_t blech(int s) { bletched = 1; }
15843 #endif
15844
15845 int checkit($nvtype d, char *where) {
15846     unsigned char *p = (char *)&d;
15847     unsigned char *end = p + sizeof(d);
15848     int fail = 0;
15849
15850     while (p < end)
15851         fail += *p++;
15852
15853     if (!fail)
15854         return 0;
15855
15856     p = (char *)&d;
15857     printf("No - %s: 0x", where);
15858     while (p < end)
15859         printf ("%02X", *p++);
15860     printf("\n");
15861     return 1;
15862 }
15863
15864 int main(int argc, char **argv) {
15865     $nvtype d = 0.0;
15866     int fail = 0;
15867     fail += checkit(d, "0.0");
15868
15869     /* The compiler shouldn't be assuming that bletched is 0  */
15870     d = bletched;
15871
15872     fail += checkit(d, "bleched");
15873
15874 #ifdef SIGFPE
15875     signal(SIGFPE, blech);
15876 #endif
15877
15878     /* Paranoia - the compiler should have no way of knowing that ANSI says
15879        that argv[argc] will always be NULL.  Actually, if it did assume this it
15880        would be buggy, as this is C and main() can be called from elsewhere in
15881        the program.  */
15882     d = argv[argc] ? 1 : 0;
15883
15884     if (d) {
15885         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15886     }
15887
15888     fail += checkit(d, "ternary");
15889
15890     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15891
15892     if (d != 0.0) {
15893         printf("No - memset doesn't give 0.0\n");
15894         /* This might just blow up:  */
15895         printf("(gives %g)\n", d);
15896         return 1;
15897     }
15898
15899 #ifdef SIGFPE
15900     if (bletched) {
15901         printf("No - something bleched\n");
15902         return 1;
15903     }
15904 #endif
15905     if (fail) {
15906       printf("No - %d fail(s)\n", fail);
15907       return 1;
15908     }
15909     printf("Yes\n");
15910     return 0;
15911 }
15912 EOP
15913 set try
15914
15915 d_nv_zero_is_allbits_zero="$undef"
15916 if eval $compile; then
15917     xxx="`$run ./try`"
15918     case "$?" in
15919         0)
15920             case "$xxx" in
15921                 Yes)  cat >&4 <<EOM
15922 0.0 is represented as all bits zero in memory
15923 EOM
15924                     d_nv_zero_is_allbits_zero="$define"
15925                     ;;
15926                 *)  cat >&4 <<EOM
15927 0.0 is not represented as all bits zero in memory
15928 EOM
15929                     d_nv_zero_is_allbits_zero="$undef"
15930                     ;;
15931             esac
15932             ;;
15933         *)  cat >&4 <<EOM
15934 0.0 is not represented as all bits zero in memory
15935 EOM
15936             d_nv_zero_is_allbits_zero="$undef"
15937             ;;
15938     esac
15939 fi
15940 $rm_try
15941
15942 : check for off64_t
15943 echo " "
15944 echo "Checking to see if you have off64_t..." >&4
15945 $cat >try.c <<EOCP
15946 #include <sys/types.h>
15947 #include <unistd.h>
15948 int main() { off64_t x = 7; }
15949 EOCP
15950 set try
15951 if eval $compile; then
15952         val="$define"
15953         echo "You have off64_t."
15954 else
15955         val="$undef"
15956         echo "You do not have off64_t."
15957         case "$lseeksize" in
15958         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15959         esac
15960 fi
15961 $rm_try
15962 set d_off64_t
15963 eval $setvar
15964
15965 : how to create joinable pthreads
15966 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15967         echo " "
15968         echo "Checking what constant to use for creating joinable pthreads..." >&4
15969         $cat >try.c <<'EOCP'
15970 #include <pthread.h>
15971 int main() {
15972     int detachstate = JOINABLE;
15973 }
15974 EOCP
15975         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15976         if eval $compile; then
15977                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15978                 val="$undef" # Yes, undef.
15979                 set d_old_pthread_create_joinable
15980                 eval $setvar
15981                 val=""
15982                 set old_pthread_create_joinable
15983                 eval $setvar
15984         else
15985                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15986                 if eval $compile; then
15987                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15988                         val="$define"
15989                         set d_old_pthread_create_joinable
15990                         eval $setvar
15991                         val=PTHREAD_CREATE_UNDETACHED
15992                         set old_pthread_create_joinable
15993                         eval $setvar
15994                 else
15995                         set try -DJOINABLE=__UNDETACHED
15996                         if eval $compile; then
15997                                 echo "You seem to use __UNDETACHED." >&4
15998                                 val="$define"
15999                                 set d_old_pthread_create_joinable
16000                                 eval $setvar
16001                                 val=__UNDETACHED
16002                                 set old_pthread_create_joinable
16003                                 eval $setvar
16004                         else
16005                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16006                                 val="$define"
16007                                 set d_old_pthread_create_joinable
16008                                 eval $setvar
16009                                 val=0
16010                                 set old_pthread_create_joinable
16011                                 eval $setvar
16012                         fi
16013                 fi
16014         fi
16015         $rm_try
16016 else
16017     d_old_pthread_create_joinable="$undef"
16018     old_pthread_create_joinable=""
16019 fi
16020
16021 : see if pause exists
16022 set pause d_pause
16023 eval $inlibc
16024
16025 : see if poll exists
16026 set poll d_poll
16027 eval $inlibc
16028
16029 : see if readlink exists
16030 set readlink d_readlink
16031 eval $inlibc
16032
16033 : Check if exe is symlink to abs path of executing program
16034 echo " "
16035 procselfexe=''
16036 val="$undef"
16037 case "$d_readlink" in
16038 "$define")
16039         if $issymlink /proc/self/exe ; then
16040                 $ls -l /proc/self/exe > reflect
16041                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16042                         echo "You have Linux-like /proc/self/exe."
16043                         procselfexe='"/proc/self/exe"'
16044                         val="$define"
16045                 fi
16046         fi
16047         if $issymlink /proc/curproc/file ; then
16048                 $ls -l /proc/curproc/file > reflect
16049                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16050                         echo "You have BSD-like /proc/curproc/file."
16051                         procselfexe='"/proc/curproc/file"'
16052                         val="$define"
16053                 fi
16054         fi
16055         ;;
16056 esac
16057 $rm -f reflect
16058 set d_procselfexe
16059 eval $setvar
16060
16061 : backward compatibility for d_hvfork
16062 if test X$d_hvfork != X; then
16063         d_vfork="$d_hvfork"
16064         d_hvfork=''
16065 fi
16066 : see if there is a vfork
16067 val=''
16068 set vfork val
16069 eval $inlibc
16070
16071 d_pseudofork=$undef
16072
16073 : Ok, but do we want to use it. vfork is reportedly unreliable in
16074 : perl on Solaris 2.x, and probably elsewhere.
16075 case "$val" in
16076 $define)
16077         echo " "
16078         case "$usevfork" in
16079         false) dflt='n';;
16080         *) dflt='y';;
16081         esac
16082         cat <<'EOM'
16083
16084 Perl can only use a vfork() that doesn't suffer from strict
16085 restrictions on calling functions or modifying global data in
16086 the child.  For example, glibc-2.1 contains such a vfork()
16087 that is unsuitable.  If your system provides a proper fork()
16088 call, chances are that you do NOT want perl to use vfork().
16089
16090 EOM
16091         rp="Do you still want to use vfork()?"
16092         . ./myread
16093         case "$ans" in
16094         y|Y) ;;
16095         *)
16096                 echo "Ok, we won't use vfork()."
16097                 val="$undef"
16098                 ;;
16099         esac
16100         ;;
16101 esac
16102 set d_vfork
16103 eval $setvar
16104 case "$d_vfork" in
16105 $define) usevfork='true';;
16106 *) usevfork='false';;
16107 esac
16108
16109 : see whether the pthread_atfork exists
16110 $cat >try.c <<EOP
16111 #include <pthread.h>
16112 #include <stdio.h>
16113 int main() {
16114 #ifdef  PTHREAD_ATFORK
16115         pthread_atfork(NULL,NULL,NULL);
16116 #endif
16117 }
16118 EOP
16119
16120 : see if pthread_atfork exists
16121 set try -DPTHREAD_ATFORK
16122 if eval $compile; then
16123     val="$define"
16124 else
16125     val="$undef"
16126 fi
16127 case "$usethreads" in
16128 $define)
16129         case "$val" in
16130         $define) echo 'pthread_atfork found.' >&4        ;;
16131         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16132         esac
16133 esac
16134 set d_pthread_atfork
16135 eval $setvar
16136
16137 : see if pthread_attr_setscope exists
16138 set pthread_attr_setscope d_pthread_attr_setscope
16139 eval $inlibc
16140
16141 : see whether the various POSIXish _yields exist
16142 $cat >try.c <<EOP
16143 #include <pthread.h>
16144 #include <stdio.h>
16145 int main() {
16146 #ifdef SCHED_YIELD
16147         sched_yield();
16148 #else
16149 #ifdef PTHREAD_YIELD
16150         pthread_yield();
16151 #else
16152 #ifdef PTHREAD_YIELD_NULL
16153         pthread_yield(NULL);
16154 #endif
16155 #endif
16156 #endif
16157 }
16158 EOP
16159 : see if sched_yield exists
16160 set try -DSCHED_YIELD
16161 if eval $compile; then
16162     val="$define"
16163     sched_yield='sched_yield()'
16164 else
16165     val="$undef"
16166 fi
16167 case "$usethreads" in
16168 $define)
16169         case "$val" in
16170         $define) echo 'sched_yield() found.' >&4        ;;
16171         *)       echo 'sched_yield() NOT found.' >&4    ;;
16172         esac
16173 esac
16174 set d_sched_yield
16175 eval $setvar
16176
16177 : see if pthread_yield exists
16178 set try -DPTHREAD_YIELD
16179 if eval $compile; then
16180     val="$define"
16181     case "$sched_yield" in
16182     '') sched_yield='pthread_yield()' ;;
16183     esac
16184 else
16185     set try -DPTHREAD_YIELD_NULL
16186     if eval $compile; then
16187         val="$define"
16188         case "$sched_yield" in
16189         '') sched_yield='pthread_yield(NULL)' ;;
16190         esac
16191     else
16192         val="$undef"
16193     fi
16194 fi
16195 case "$usethreads" in
16196 $define)
16197         case "$val" in
16198         $define) echo 'pthread_yield() found.' >&4      ;;
16199         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16200         esac
16201         ;;
16202 esac
16203 set d_pthread_yield
16204 eval $setvar
16205 case "$sched_yield" in
16206 '') sched_yield=undef ;;
16207 esac
16208 $rm_try
16209
16210 : see if random_r exists
16211 set random_r d_random_r
16212 eval $inlibc
16213 case "$d_random_r" in
16214 "$define")
16215         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16216         case "$d_random_r_proto:$usethreads" in
16217         ":define")      d_random_r_proto=define
16218                 set d_random_r_proto random_r $hdrs
16219                 eval $hasproto ;;
16220         *)      ;;
16221         esac
16222         case "$d_random_r_proto" in
16223         define)
16224         case "$random_r_proto" in
16225         ''|0) try='int random_r(int*, struct random_data*);'
16226         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16227         esac
16228         case "$random_r_proto" in
16229         ''|0) try='int random_r(long*, struct random_data*);'
16230         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16231         esac
16232         case "$random_r_proto" in
16233         ''|0) try='int random_r(struct random_data*, int32_t*);'
16234         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16235         esac
16236         case "$random_r_proto" in
16237         ''|0)   d_random_r=undef
16238                 random_r_proto=0
16239                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16240         * )     case "$random_r_proto" in
16241                 REENTRANT_PROTO*) ;;
16242                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16243                 esac
16244                 echo "Prototype: $try" ;;
16245         esac
16246         ;;
16247         *)      case "$usethreads" in
16248                 define) echo "random_r has no prototype, not using it." >&4 ;;
16249                 esac
16250                 d_random_r=undef
16251                 random_r_proto=0
16252                 ;;
16253         esac
16254         ;;
16255 *)      random_r_proto=0
16256         ;;
16257 esac
16258
16259 : see if readdir and friends exist
16260 set readdir d_readdir
16261 eval $inlibc
16262 set seekdir d_seekdir
16263 eval $inlibc
16264 set telldir d_telldir
16265 eval $inlibc
16266 set rewinddir d_rewinddir
16267 eval $inlibc
16268
16269 : see if readdir64_r exists
16270 set readdir64_r d_readdir64_r
16271 eval $inlibc
16272 case "$d_readdir64_r" in
16273 "$define")
16274         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16275         case "$d_readdir64_r_proto:$usethreads" in
16276         ":define")      d_readdir64_r_proto=define
16277                 set d_readdir64_r_proto readdir64_r $hdrs
16278                 eval $hasproto ;;
16279         *)      ;;
16280         esac
16281         case "$d_readdir64_r_proto" in
16282         define)
16283         case "$readdir64_r_proto" in
16284         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16285         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16286         esac
16287         case "$readdir64_r_proto" in
16288         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16289         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16290         esac
16291         case "$readdir64_r_proto" in
16292         ''|0)   d_readdir64_r=undef
16293                 readdir64_r_proto=0
16294                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16295         * )     case "$readdir64_r_proto" in
16296                 REENTRANT_PROTO*) ;;
16297                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16298                 esac
16299                 echo "Prototype: $try" ;;
16300         esac
16301         ;;
16302         *)      case "$usethreads" in
16303                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16304                 esac
16305                 d_readdir64_r=undef
16306                 readdir64_r_proto=0
16307                 ;;
16308         esac
16309         ;;
16310 *)      readdir64_r_proto=0
16311         ;;
16312 esac
16313
16314 : see if readdir_r exists
16315 set readdir_r d_readdir_r
16316 eval $inlibc
16317 case "$d_readdir_r" in
16318 "$define")
16319         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16320         case "$d_readdir_r_proto:$usethreads" in
16321         ":define")      d_readdir_r_proto=define
16322                 set d_readdir_r_proto readdir_r $hdrs
16323                 eval $hasproto ;;
16324         *)      ;;
16325         esac
16326         case "$d_readdir_r_proto" in
16327         define)
16328         case "$readdir_r_proto" in
16329         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16330         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16331         esac
16332         case "$readdir_r_proto" in
16333         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16334         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16335         esac
16336         case "$readdir_r_proto" in
16337         ''|0)   d_readdir_r=undef
16338                 readdir_r_proto=0
16339                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16340         * )     case "$readdir_r_proto" in
16341                 REENTRANT_PROTO*) ;;
16342                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16343                 esac
16344                 echo "Prototype: $try" ;;
16345         esac
16346         ;;
16347         *)      case "$usethreads" in
16348                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16349                 esac
16350                 d_readdir_r=undef
16351                 readdir_r_proto=0
16352                 ;;
16353         esac
16354         ;;
16355 *)      readdir_r_proto=0
16356         ;;
16357 esac
16358
16359 : see if readv exists
16360 set readv d_readv
16361 eval $inlibc
16362
16363 : see if recvmsg exists
16364 set recvmsg d_recvmsg
16365 eval $inlibc
16366
16367 : see if rename exists
16368 set rename d_rename
16369 eval $inlibc
16370
16371 : see if rmdir exists
16372 set rmdir d_rmdir
16373 eval $inlibc
16374
16375 : see if memory.h is available.
16376 val=''
16377 set memory.h val
16378 eval $inhdr
16379
16380 : See if it conflicts with string.h
16381 case "$val" in
16382 $define)
16383         case "$strings" in
16384         '') ;;
16385         *)
16386                 $cppstdin $cppflags $cppminus < $strings > mem.h
16387                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16388                         echo " "
16389                         echo "We won't be including <memory.h>."
16390                         val="$undef"
16391                 fi
16392                 $rm -f mem.h
16393                 ;;
16394         esac
16395 esac
16396 set i_memory
16397 eval $setvar
16398
16399 : can bcopy handle overlapping blocks?
16400 echo " "
16401 val="$undef"
16402 case "$d_memmove" in
16403 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16404 *)      case "$d_bcopy" in
16405         "$define")
16406                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16407                 $cat >try.c <<EOCP
16408 #$i_memory I_MEMORY
16409 #$i_stdlib I_STDLIB
16410 #$i_string I_STRING
16411 #$i_unistd I_UNISTD
16412 EOCP
16413         $cat >>try.c <<'EOCP'
16414 #include <stdio.h>
16415 #ifdef I_MEMORY
16416 #  include <memory.h>
16417 #endif
16418 #ifdef I_STDLIB
16419 #  include <stdlib.h>
16420 #endif
16421 #ifdef I_STRING
16422 #  include <string.h>
16423 #else
16424 #  include <strings.h>
16425 #endif
16426 #ifdef I_UNISTD
16427 #  include <unistd.h>  /* Needed for NetBSD */
16428 #endif
16429 int main()
16430 {
16431 char buf[128], abc[128];
16432 char *b;
16433 int len;
16434 int off;
16435 int align;
16436
16437 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16438    try to store the string in read-only memory. */
16439 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16440
16441 for (align = 7; align >= 0; align--) {
16442         for (len = 36; len; len--) {
16443                 b = buf+align;
16444                 bcopy(abc, b, len);
16445                 for (off = 1; off <= len; off++) {
16446                         bcopy(b, b+off, len);
16447                         bcopy(b+off, b, len);
16448                         if (bcmp(b, abc, len))
16449                                 exit(1);
16450                 }
16451         }
16452 }
16453 exit(0);
16454 }
16455 EOCP
16456                 set try
16457                 if eval $compile_ok; then
16458                         if $run ./try 2>/dev/null; then
16459                                 echo "Yes, it can."
16460                                 val="$define"
16461                         else
16462                                 echo "It can't, sorry."
16463                         fi
16464                 else
16465                         echo "(I can't compile the test program, so we'll assume not...)"
16466                 fi
16467                 ;;
16468         esac
16469         $rm_try
16470         ;;
16471 esac
16472 set d_safebcpy
16473 eval $setvar
16474
16475 : can memcpy handle overlapping blocks?
16476 echo " "
16477 val="$undef"
16478 case "$d_memmove" in
16479 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16480 *)      case "$d_memcpy" in
16481         "$define")
16482                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16483                 $cat >try.c <<EOCP
16484 #$i_memory I_MEMORY
16485 #$i_stdlib I_STDLIB
16486 #$i_string I_STRING
16487 #$i_unistd I_UNISTD
16488 EOCP
16489         $cat >>try.c <<'EOCP'
16490 #include <stdio.h>
16491 #ifdef I_MEMORY
16492 #  include <memory.h>
16493 #endif
16494 #ifdef I_STDLIB
16495 #  include <stdlib.h>
16496 #endif
16497 #ifdef I_STRING
16498 #  include <string.h>
16499 #else
16500 #  include <strings.h>
16501 #endif
16502 #ifdef I_UNISTD
16503 #  include <unistd.h>  /* Needed for NetBSD */
16504 #endif
16505 int main()
16506 {
16507 char buf[128], abc[128];
16508 char *b;
16509 int len;
16510 int off;
16511 int align;
16512
16513 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16514    try to store the string in read-only memory. */
16515 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16516
16517 for (align = 7; align >= 0; align--) {
16518         for (len = 36; len; len--) {
16519                 b = buf+align;
16520                 memcpy(b, abc, len);
16521                 for (off = 1; off <= len; off++) {
16522                         memcpy(b+off, b, len);
16523                         memcpy(b, b+off, len);
16524                         if (memcmp(b, abc, len))
16525                                 exit(1);
16526                 }
16527         }
16528 }
16529 exit(0);
16530 }
16531 EOCP
16532                 set try
16533                 if eval $compile_ok; then
16534                         if $run ./try 2>/dev/null; then
16535                                 echo "Yes, it can."
16536                                 val="$define"
16537                         else
16538                                 echo "It can't, sorry."
16539                         fi
16540                 else
16541                         echo "(I can't compile the test program, so we'll assume not...)"
16542                 fi
16543                 ;;
16544         esac
16545         $rm_try
16546         ;;
16547 esac
16548 set d_safemcpy
16549 eval $setvar
16550
16551 : can memcmp be trusted to compare relative magnitude?
16552 val="$undef"
16553 case "$d_memcmp" in
16554 "$define")
16555         echo " "
16556         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16557         $cat >try.c <<EOCP
16558 #$i_memory I_MEMORY
16559 #$i_stdlib I_STDLIB
16560 #$i_string I_STRING
16561 #$i_unistd I_UNISTD
16562 EOCP
16563         $cat >>try.c <<'EOCP'
16564 #include <stdio.h>
16565 #ifdef I_MEMORY
16566 #  include <memory.h>
16567 #endif
16568 #ifdef I_STDLIB
16569 #  include <stdlib.h>
16570 #endif
16571 #ifdef I_STRING
16572 #  include <string.h>
16573 #else
16574 #  include <strings.h>
16575 #endif
16576 #ifdef I_UNISTD
16577 #  include <unistd.h>  /* Needed for NetBSD */
16578 #endif
16579 int main()
16580 {
16581 char a = -1;
16582 char b = 0;
16583 if ((a < b) && memcmp(&a, &b, 1) < 0)
16584         exit(1);
16585 exit(0);
16586 }
16587 EOCP
16588         set try
16589         if eval $compile_ok; then
16590                 if $run ./try 2>/dev/null; then
16591                         echo "Yes, it can."
16592                         val="$define"
16593                 else
16594                         echo "No, it can't (it uses signed chars)."
16595                 fi
16596         else
16597                 echo "(I can't compile the test program, so we'll assume not...)"
16598         fi
16599         ;;
16600 esac
16601 $rm_try
16602 set d_sanemcmp
16603 eval $setvar
16604
16605 : see if prototype for sbrk is available
16606 echo " "
16607 set d_sbrkproto sbrk $i_unistd unistd.h
16608 eval $hasproto
16609
16610 : see if select exists
16611 set select d_select
16612 eval $inlibc
16613
16614 : see if semctl exists
16615 set semctl d_semctl
16616 eval $inlibc
16617
16618 : see if semget exists
16619 set semget d_semget
16620 eval $inlibc
16621
16622 : see if semop exists
16623 set semop d_semop
16624 eval $inlibc
16625
16626 : see how much of the 'sem*(2)' library is present.
16627 h_sem=true
16628 echo " "
16629 case "$d_semctl$d_semget$d_semop" in
16630 *"$undef"*) h_sem=false;;
16631 esac
16632 case "$osname" in
16633 freebsd)
16634     case "`ipcs 2>&1`" in
16635     "SVID messages"*"not configured"*)
16636         echo "Your $osname does not have the sem*(2) configured." >&4
16637         h_sem=false
16638         val="$undef"
16639         set semctl d_semctl
16640         eval $setvar
16641         set semget d_semget
16642         eval $setvar
16643         set semop d_semop
16644         eval $setvar
16645         ;;
16646     esac
16647     ;;
16648 esac
16649 : we could also check for sys/ipc.h ...
16650 if $h_sem && $test `./findhdr sys/sem.h`; then
16651         echo "You have the full sem*(2) library." >&4
16652         val="$define"
16653 else
16654         echo "You don't have the full sem*(2) library." >&4
16655         val="$undef"
16656 fi
16657 set d_sem
16658 eval $setvar
16659
16660 : see whether sys/sem.h defines union semun
16661 echo " "
16662 $cat > try.c <<'END'
16663 #include <sys/types.h>
16664 #include <sys/ipc.h>
16665 #include <sys/sem.h>
16666 int main () { union semun semun; semun.buf = 0; }
16667 END
16668 set try
16669 if eval $compile; then
16670     echo "You have union semun in <sys/sem.h>." >&4
16671     val="$define"
16672 else
16673     echo "You do not have union semun in <sys/sem.h>." >&4
16674     val="$undef"
16675 fi
16676 $rm_try
16677 set d_union_semun
16678 eval $setvar
16679
16680 : see how to do semctl IPC_STAT
16681 case "$d_sem" in
16682 $define)
16683     echo " "
16684     $cat > tryh.h <<END
16685 #ifndef S_IRUSR
16686 #   ifdef S_IREAD
16687 #       define S_IRUSR S_IREAD
16688 #       define S_IWUSR S_IWRITE
16689 #       define S_IXUSR S_IEXEC
16690 #   else
16691 #       define S_IRUSR 0400
16692 #       define S_IWUSR 0200
16693 #       define S_IXUSR 0100
16694 #   endif
16695 #   define S_IRGRP (S_IRUSR>>3)
16696 #   define S_IWGRP (S_IWUSR>>3)
16697 #   define S_IXGRP (S_IXUSR>>3)
16698 #   define S_IROTH (S_IRUSR>>6)
16699 #   define S_IWOTH (S_IWUSR>>6)
16700 #   define S_IXOTH (S_IXUSR>>6)
16701 #endif
16702 #ifndef S_IRWXU
16703 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16704 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16705 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16706 #endif
16707 END
16708     : see whether semctl IPC_STAT can use union semun
16709     case "$d_semctl_semun" in
16710     '')
16711       val="$undef"
16712       $cat > try.c <<END
16713 #include <sys/types.h>
16714 #include <sys/ipc.h>
16715 #include <sys/sem.h>
16716 #include <sys/stat.h>
16717 #include <stdio.h>
16718 #include <errno.h>
16719 #include "tryh.h"
16720 #ifndef errno
16721 extern int errno;
16722 #endif
16723 #$d_union_semun HAS_UNION_SEMUN
16724 int main() {
16725     union semun
16726 #ifndef HAS_UNION_SEMUN
16727     {
16728         int val;
16729         struct semid_ds *buf;
16730         unsigned short *array;
16731     }
16732 #endif
16733     arg;
16734     int sem, st;
16735
16736 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16737     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16738     if (sem > -1) {
16739         struct semid_ds argbuf;
16740         arg.buf = &argbuf;
16741 #       ifdef IPC_STAT
16742         st = semctl(sem, 0, IPC_STAT, arg);
16743         if (st == 0)
16744             printf("semun\n");
16745         else
16746 #       endif /* IPC_STAT */
16747             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16748 #       ifdef IPC_RMID
16749         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16750 #       endif /* IPC_RMID */
16751             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16752     } else
16753 #endif /* IPC_PRIVATE && ... */
16754         printf("semget failed: errno = %d\n", errno);
16755   return 0;
16756 }
16757 END
16758       set try
16759       if eval $compile; then
16760           xxx=`$run ./try`
16761           case "$xxx" in
16762           semun) val="$define" ;;
16763           esac
16764       fi
16765       $rm_try
16766       set d_semctl_semun
16767       eval $setvar
16768       ;;
16769     esac
16770     case "$d_semctl_semun" in
16771     $define)
16772         echo "You can use union semun for semctl IPC_STAT." >&4
16773         also='also'
16774         ;;
16775     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16776         also=''
16777         ;;
16778     esac
16779
16780     : see whether semctl IPC_STAT can use struct semid_ds pointer
16781     case "$d_semctl_semid_ds" in
16782     '')
16783       val="$undef"
16784       $cat > try.c <<'END'
16785 #include <sys/types.h>
16786 #include <sys/ipc.h>
16787 #include <sys/sem.h>
16788 #include <sys/stat.h>
16789 #include "tryh.h"
16790 #include <stdio.h>
16791 #include <errno.h>
16792 #ifndef errno
16793 extern int errno;
16794 #endif
16795 int main() {
16796     struct semid_ds arg;
16797     int sem, st;
16798
16799 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16800     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16801     if (sem > -1) {
16802 #       ifdef IPC_STAT
16803         st = semctl(sem, 0, IPC_STAT, &arg);
16804         if (st == 0)
16805             printf("semid_ds\n");
16806         else
16807 #       endif /* IPC_STAT */
16808             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16809 #       ifdef IPC_RMID
16810         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16811 #       endif /* IPC_RMID */
16812             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16813     } else
16814 #endif /* IPC_PRIVATE && ... */
16815         printf("semget failed: errno = %d\n", errno);
16816
16817     return 0;
16818 }
16819 END
16820       set try
16821       if eval $compile; then
16822           xxx=`$run ./try`
16823           case "$xxx" in
16824           semid_ds) val="$define" ;;
16825           esac
16826       fi
16827       $rm_try
16828       set d_semctl_semid_ds
16829       eval $setvar
16830       ;;
16831     esac
16832     case "$d_semctl_semid_ds" in
16833     $define)
16834         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16835         ;;
16836     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16837         ;;
16838     esac
16839     ;;
16840 *)  val="$undef"
16841
16842     # We do not have the full sem*(2) library, so assume we can not
16843     # use either.
16844
16845     set d_semctl_semun
16846     eval $setvar
16847
16848     set d_semctl_semid_ds
16849     eval $setvar
16850     ;;
16851 esac
16852 $rm_try tryh.h
16853
16854 : see if sendmsg exists
16855 set sendmsg d_sendmsg
16856 eval $inlibc
16857
16858 : see if setegid exists
16859 set setegid d_setegid
16860 eval $inlibc
16861
16862 : see if seteuid exists
16863 set seteuid d_seteuid
16864 eval $inlibc
16865
16866 : see if setgrent exists
16867 set setgrent d_setgrent
16868 eval $inlibc
16869
16870 : see if setgrent_r exists
16871 set setgrent_r d_setgrent_r
16872 eval $inlibc
16873 case "$d_setgrent_r" in
16874 "$define")
16875         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16876         case "$d_setgrent_r_proto:$usethreads" in
16877         ":define")      d_setgrent_r_proto=define
16878                 set d_setgrent_r_proto setgrent_r $hdrs
16879                 eval $hasproto ;;
16880         *)      ;;
16881         esac
16882         case "$d_setgrent_r_proto" in
16883         define)
16884         case "$setgrent_r_proto" in
16885         ''|0) try='int setgrent_r(FILE**);'
16886         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16887         esac
16888         case "$setgrent_r_proto" in
16889         ''|0) try='void setgrent_r(FILE**);'
16890         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16891         esac
16892         case "$setgrent_r_proto" in
16893         ''|0)   d_setgrent_r=undef
16894                 setgrent_r_proto=0
16895                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16896         * )     case "$setgrent_r_proto" in
16897                 REENTRANT_PROTO*) ;;
16898                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16899                 esac
16900                 echo "Prototype: $try" ;;
16901         esac
16902         ;;
16903         *)      case "$usethreads" in
16904                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16905                 esac
16906                 d_setgrent_r=undef
16907                 setgrent_r_proto=0
16908                 ;;
16909         esac
16910         ;;
16911 *)      setgrent_r_proto=0
16912         ;;
16913 esac
16914
16915 : see if sethostent exists
16916 set sethostent d_sethent
16917 eval $inlibc
16918
16919 : see if sethostent_r exists
16920 set sethostent_r d_sethostent_r
16921 eval $inlibc
16922 case "$d_sethostent_r" in
16923 "$define")
16924         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16925         case "$d_sethostent_r_proto:$usethreads" in
16926         ":define")      d_sethostent_r_proto=define
16927                 set d_sethostent_r_proto sethostent_r $hdrs
16928                 eval $hasproto ;;
16929         *)      ;;
16930         esac
16931         case "$d_sethostent_r_proto" in
16932         define)
16933         case "$sethostent_r_proto" in
16934         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16935         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16936         esac
16937         case "$sethostent_r_proto" in
16938         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16939         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16940         esac
16941         case "$sethostent_r_proto" in
16942         ''|0)   d_sethostent_r=undef
16943                 sethostent_r_proto=0
16944                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16945         * )     case "$sethostent_r_proto" in
16946                 REENTRANT_PROTO*) ;;
16947                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16948                 esac
16949                 echo "Prototype: $try" ;;
16950         esac
16951         ;;
16952         *)      case "$usethreads" in
16953                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16954                 esac
16955                 d_sethostent_r=undef
16956                 sethostent_r_proto=0
16957                 ;;
16958         esac
16959         ;;
16960 *)      sethostent_r_proto=0
16961         ;;
16962 esac
16963
16964 : see if setitimer exists
16965 set setitimer d_setitimer
16966 eval $inlibc
16967
16968 : see if setlinebuf exists
16969 set setlinebuf d_setlinebuf
16970 eval $inlibc
16971
16972 : see if setlocale exists
16973 set setlocale d_setlocale
16974 eval $inlibc
16975
16976 : see if locale.h is available
16977 set locale.h i_locale
16978 eval $inhdr
16979
16980 : see if setlocale_r exists
16981 set setlocale_r d_setlocale_r
16982 eval $inlibc
16983 case "$d_setlocale_r" in
16984 "$define")
16985         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16986         case "$d_setlocale_r_proto:$usethreads" in
16987         ":define")      d_setlocale_r_proto=define
16988                 set d_setlocale_r_proto setlocale_r $hdrs
16989                 eval $hasproto ;;
16990         *)      ;;
16991         esac
16992         case "$d_setlocale_r_proto" in
16993         define)
16994         case "$setlocale_r_proto" in
16995         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16996         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16997         esac
16998         case "$setlocale_r_proto" in
16999         ''|0)   d_setlocale_r=undef
17000                 setlocale_r_proto=0
17001                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17002         * )     case "$setlocale_r_proto" in
17003                 REENTRANT_PROTO*) ;;
17004                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17005                 esac
17006                 echo "Prototype: $try" ;;
17007         esac
17008         ;;
17009         *)      case "$usethreads" in
17010                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17011                 esac
17012                 d_setlocale_r=undef
17013                 setlocale_r_proto=0
17014                 ;;
17015         esac
17016         ;;
17017 *)      setlocale_r_proto=0
17018         ;;
17019 esac
17020
17021 : see if setnetent exists
17022 set setnetent d_setnent
17023 eval $inlibc
17024
17025 : see if setnetent_r exists
17026 set setnetent_r d_setnetent_r
17027 eval $inlibc
17028 case "$d_setnetent_r" in
17029 "$define")
17030         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17031         case "$d_setnetent_r_proto:$usethreads" in
17032         ":define")      d_setnetent_r_proto=define
17033                 set d_setnetent_r_proto setnetent_r $hdrs
17034                 eval $hasproto ;;
17035         *)      ;;
17036         esac
17037         case "$d_setnetent_r_proto" in
17038         define)
17039         case "$setnetent_r_proto" in
17040         ''|0) try='int setnetent_r(int, struct netent_data*);'
17041         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17042         esac
17043         case "$setnetent_r_proto" in
17044         ''|0) try='void setnetent_r(int, struct netent_data*);'
17045         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17046         esac
17047         case "$setnetent_r_proto" in
17048         ''|0)   d_setnetent_r=undef
17049                 setnetent_r_proto=0
17050                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17051         * )     case "$setnetent_r_proto" in
17052                 REENTRANT_PROTO*) ;;
17053                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17054                 esac
17055                 echo "Prototype: $try" ;;
17056         esac
17057         ;;
17058         *)      case "$usethreads" in
17059                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17060                 esac
17061                 d_setnetent_r=undef
17062                 setnetent_r_proto=0
17063                 ;;
17064         esac
17065         ;;
17066 *)      setnetent_r_proto=0
17067         ;;
17068 esac
17069
17070 : see if setprotoent exists
17071 set setprotoent d_setpent
17072 eval $inlibc
17073
17074 : see if setpgid exists
17075 set setpgid d_setpgid
17076 eval $inlibc
17077
17078 : see if setpgrp2 exists
17079 set setpgrp2 d_setpgrp2
17080 eval $inlibc
17081
17082 : see if setpriority exists
17083 set setpriority d_setprior
17084 eval $inlibc
17085
17086 : see if setproctitle exists
17087 set setproctitle d_setproctitle
17088 eval $inlibc
17089
17090 : see if setprotoent_r exists
17091 set setprotoent_r d_setprotoent_r
17092 eval $inlibc
17093 case "$d_setprotoent_r" in
17094 "$define")
17095         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17096         case "$d_setprotoent_r_proto:$usethreads" in
17097         ":define")      d_setprotoent_r_proto=define
17098                 set d_setprotoent_r_proto setprotoent_r $hdrs
17099                 eval $hasproto ;;
17100         *)      ;;
17101         esac
17102         case "$d_setprotoent_r_proto" in
17103         define)
17104         case "$setprotoent_r_proto" in
17105         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17106         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17107         esac
17108         case "$setprotoent_r_proto" in
17109         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17110         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17111         esac
17112         case "$setprotoent_r_proto" in
17113         ''|0)   d_setprotoent_r=undef
17114                 setprotoent_r_proto=0
17115                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17116         * )     case "$setprotoent_r_proto" in
17117                 REENTRANT_PROTO*) ;;
17118                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17119                 esac
17120                 echo "Prototype: $try" ;;
17121         esac
17122         ;;
17123         *)      case "$usethreads" in
17124                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17125                 esac
17126                 d_setprotoent_r=undef
17127                 setprotoent_r_proto=0
17128                 ;;
17129         esac
17130         ;;
17131 *)      setprotoent_r_proto=0
17132         ;;
17133 esac
17134
17135 : see if setpwent exists
17136 set setpwent d_setpwent
17137 eval $inlibc
17138
17139 : see if setpwent_r exists
17140 set setpwent_r d_setpwent_r
17141 eval $inlibc
17142 case "$d_setpwent_r" in
17143 "$define")
17144         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17145         case "$d_setpwent_r_proto:$usethreads" in
17146         ":define")      d_setpwent_r_proto=define
17147                 set d_setpwent_r_proto setpwent_r $hdrs
17148                 eval $hasproto ;;
17149         *)      ;;
17150         esac
17151         case "$d_setpwent_r_proto" in
17152         define)
17153         case "$setpwent_r_proto" in
17154         ''|0) try='int setpwent_r(FILE**);'
17155         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17156         esac
17157         case "$setpwent_r_proto" in
17158         ''|0) try='void setpwent_r(FILE**);'
17159         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17160         esac
17161         case "$setpwent_r_proto" in
17162         ''|0)   d_setpwent_r=undef
17163                 setpwent_r_proto=0
17164                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17165         * )     case "$setpwent_r_proto" in
17166                 REENTRANT_PROTO*) ;;
17167                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17168                 esac
17169                 echo "Prototype: $try" ;;
17170         esac
17171         ;;
17172         *)      case "$usethreads" in
17173                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17174                 esac
17175                 d_setpwent_r=undef
17176                 setpwent_r_proto=0
17177                 ;;
17178         esac
17179         ;;
17180 *)      setpwent_r_proto=0
17181         ;;
17182 esac
17183
17184 : see if setregid exists
17185 set setregid d_setregid
17186 eval $inlibc
17187 set setresgid d_setresgid
17188 eval $inlibc
17189
17190 : see if setreuid exists
17191 set setreuid d_setreuid
17192 eval $inlibc
17193 set setresuid d_setresuid
17194 eval $inlibc
17195
17196 : see if setrgid exists
17197 set setrgid d_setrgid
17198 eval $inlibc
17199
17200 : see if setruid exists
17201 set setruid d_setruid
17202 eval $inlibc
17203
17204 : see if setservent exists
17205 set setservent d_setsent
17206 eval $inlibc
17207
17208 : see if setservent_r exists
17209 set setservent_r d_setservent_r
17210 eval $inlibc
17211 case "$d_setservent_r" in
17212 "$define")
17213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17214         case "$d_setservent_r_proto:$usethreads" in
17215         ":define")      d_setservent_r_proto=define
17216                 set d_setservent_r_proto setservent_r $hdrs
17217                 eval $hasproto ;;
17218         *)      ;;
17219         esac
17220         case "$d_setservent_r_proto" in
17221         define)
17222         case "$setservent_r_proto" in
17223         ''|0) try='int setservent_r(int, struct servent_data*);'
17224         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17225         esac
17226         case "$setservent_r_proto" in
17227         ''|0) try='void setservent_r(int, struct servent_data*);'
17228         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17229         esac
17230         case "$setservent_r_proto" in
17231         ''|0)   d_setservent_r=undef
17232                 setservent_r_proto=0
17233                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17234         * )     case "$setservent_r_proto" in
17235                 REENTRANT_PROTO*) ;;
17236                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17237                 esac
17238                 echo "Prototype: $try" ;;
17239         esac
17240         ;;
17241         *)      case "$usethreads" in
17242                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17243                 esac
17244                 d_setservent_r=undef
17245                 setservent_r_proto=0
17246                 ;;
17247         esac
17248         ;;
17249 *)      setservent_r_proto=0
17250         ;;
17251 esac
17252
17253 : see if setsid exists
17254 set setsid d_setsid
17255 eval $inlibc
17256
17257 : see if setvbuf exists
17258 set setvbuf d_setvbuf
17259 eval $inlibc
17260
17261 : see if sfio.h is available
17262 set sfio.h i_sfio
17263 eval $inhdr
17264
17265 : see if sfio library is available
17266 case "$i_sfio" in
17267 $define)
17268         val=''
17269         set sfreserve val
17270         eval $inlibc
17271         ;;
17272 *)
17273         val="$undef"
17274         ;;
17275 esac
17276 : Ok, but do we want to use it.
17277 case "$val" in
17278 $define)
17279         case "$usesfio" in
17280         true|$define|[yY]*) dflt='y';;
17281         *) dflt='n';;
17282         esac
17283         echo "$package can use the sfio library, but it is experimental."
17284         case "$useperlio" in
17285         "$undef")
17286             echo "For sfio also the PerlIO abstraction layer is needed."
17287             echo "Earlier you said you wouldn't want that."
17288             ;;
17289         esac
17290         rp="You seem to have sfio available, do you want to try using it?"
17291         . ./myread
17292         case "$ans" in
17293         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17294                 useperlio="$define"
17295                 val="$define"
17296                 ;;
17297         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17298                 val="$undef"
17299                 ;;
17300         esac
17301         ;;
17302 *)      case "$usesfio" in
17303         true|$define|[yY]*)
17304                 echo "Sorry, cannot find sfio on this machine." >&4
17305                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17306                 val="$undef"
17307                 ;;
17308         esac
17309         ;;
17310 esac
17311 set d_sfio
17312 eval $setvar
17313 case "$d_sfio" in
17314 $define) usesfio='true';;
17315 *) usesfio='false';;
17316 esac
17317 case "$d_sfio" in
17318 $define) ;;
17319 *)      : Remove sfio from list of libraries to use
17320         case "$libs" in
17321         *-lsfio*)
17322                 echo "Removing unneeded -lsfio from library list" >&4
17323                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17324                 shift
17325                 libs="$*"
17326                 echo "libs = $libs" >&4
17327                 ;;
17328         esac
17329 ;;
17330 esac
17331
17332
17333 : see if shmctl exists
17334 set shmctl d_shmctl
17335 eval $inlibc
17336
17337 : see if shmget exists
17338 set shmget d_shmget
17339 eval $inlibc
17340
17341 : see if shmat exists
17342 set shmat d_shmat
17343 eval $inlibc
17344 : see what shmat returns
17345 case "$d_shmat" in
17346 "$define")
17347         $cat >shmat.c <<'END'
17348 #include <sys/shm.h>
17349 void *shmat();
17350 END
17351         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17352                 shmattype='void *'
17353         else
17354                 shmattype='char *'
17355         fi
17356         echo "and it returns ($shmattype)." >&4
17357         : see if a prototype for shmat is available
17358         xxx=`./findhdr sys/shm.h`
17359         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17360         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17361                 val="$define"
17362         else
17363                 val="$undef"
17364         fi
17365         $rm -f shmat.[co]
17366         ;;
17367 *)
17368         val="$undef"
17369         ;;
17370 esac
17371 set d_shmatprototype
17372 eval $setvar
17373
17374 : see if shmdt exists
17375 set shmdt d_shmdt
17376 eval $inlibc
17377
17378 : see how much of the 'shm*(2)' library is present.
17379 h_shm=true
17380 echo " "
17381 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17382 *"$undef"*) h_shm=false;;
17383 esac
17384 case "$osname" in
17385 freebsd)
17386     case "`ipcs 2>&1`" in
17387     "SVID shared memory"*"not configured"*)
17388         echo "Your $osname does not have the shm*(2) configured." >&4
17389         h_shm=false
17390         val="$undef"
17391         set shmctl d_shmctl
17392         evat $setvar
17393         set shmget d_shmget
17394         evat $setvar
17395         set shmat d_shmat
17396         evat $setvar
17397         set shmdt d_shmdt
17398         evat $setvar
17399         ;;
17400     esac
17401     ;;
17402 esac
17403 : we could also check for sys/ipc.h ...
17404 if $h_shm && $test `./findhdr sys/shm.h`; then
17405         echo "You have the full shm*(2) library." >&4
17406         val="$define"
17407 else
17408         echo "You don't have the full shm*(2) library." >&4
17409         val="$undef"
17410 fi
17411 set d_shm
17412 eval $setvar
17413
17414 : see if we have sigaction
17415 echo " "
17416 if set sigaction val -f d_sigaction; eval $csym; $val; then
17417         echo 'sigaction() found.' >&4
17418         $cat > try.c <<EOP
17419 #include <stdio.h>
17420 #include <sys/types.h>
17421 #include <signal.h>
17422 #$i_stdlib I_STDLIB
17423 #ifdef I_STDLIB
17424 #include <stdlib.h>
17425 #endif
17426 int main()
17427 {
17428     struct sigaction act, oact;
17429     act.sa_flags = 0;
17430     oact.sa_handler = 0;
17431     /* so that act and oact are used */
17432     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17433 }
17434 EOP
17435         set try
17436         if eval $compile_ok; then
17437                 val="$define"
17438         else
17439                 echo "But you don't seem to have a useable struct sigaction." >&4
17440                 val="$undef"
17441         fi
17442 else
17443         echo 'sigaction NOT found.' >&4
17444         val="$undef"
17445 fi
17446 set d_sigaction; eval $setvar
17447 $rm_try
17448
17449 : see if this is a sunmath.h system
17450 set sunmath.h i_sunmath
17451 eval $inhdr
17452
17453 : see if signbit exists
17454 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17455 $cat >try.c <<EOCP
17456 #$i_math I_MATH
17457 #$i_sunmath I_SUNMATH
17458 #ifdef I_MATH
17459 #  include <math.h>
17460 #endif
17461 #ifdef I_SUNMATH  /* Solaris special math library */
17462 #  include <sunmath.h>
17463 #endif
17464 #define NV $nvtype
17465 int main(int argc, char **argv)
17466 {
17467     NV x = 0.0;
17468     NV y = -0.0;
17469     if ((signbit(x) == 0) && (signbit(y) != 0))
17470         return 0;
17471     else
17472         return 1;
17473 }
17474 EOCP
17475 val="$undef"
17476 set try
17477 if eval $compile; then
17478     if $run ./try; then
17479         $echo "Yes." >&4
17480         val="$define"
17481     else
17482         $echo "Signbit seems to be available, but doesn't work as I expected."
17483         $echo "I won't use it." >&4
17484         val="$undef"
17485     fi
17486 else
17487     $echo "Nope." >&4
17488     dflt="$undef"
17489 fi
17490 set d_signbit
17491 eval $setvar
17492 $rm_try
17493
17494 : see if sigprocmask exists
17495 set sigprocmask d_sigprocmask
17496 eval $inlibc
17497
17498 : see if sigsetjmp exists
17499 echo " "
17500 case "$d_sigsetjmp" in
17501 '')
17502         $cat >try.c <<EOP
17503 #include <setjmp.h>
17504 #$i_stdlib I_STDLIB
17505 #ifdef I_STDLIB
17506 #include <stdlib.h>
17507 #endif
17508 sigjmp_buf env;
17509 int set = 1;
17510 int main()
17511 {
17512         if (sigsetjmp(env,1))
17513                 exit(set);
17514         set = 0;
17515         siglongjmp(env, 1);
17516         exit(1);
17517 }
17518 EOP
17519         set try
17520         if eval $compile; then
17521                 if $run ./try >/dev/null 2>&1; then
17522                         echo "POSIX sigsetjmp found." >&4
17523                         val="$define"
17524                 else
17525                         $cat >&4 <<EOM
17526 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17527 I'll ignore them.
17528 EOM
17529                         val="$undef"
17530                 fi
17531         else
17532                 echo "sigsetjmp not found." >&4
17533                 val="$undef"
17534         fi
17535         ;;
17536 *) val="$d_sigsetjmp"
17537         case "$d_sigsetjmp" in
17538         $define) echo "POSIX sigsetjmp found." >&4;;
17539         $undef) echo "sigsetjmp not found." >&4;;
17540         esac
17541         ;;
17542 esac
17543 set d_sigsetjmp
17544 eval $setvar
17545 $rm_try
17546
17547 : see if snprintf exists
17548 set snprintf d_snprintf
17549 eval $inlibc
17550
17551 : see if vsnprintf exists
17552 set vsnprintf d_vsnprintf
17553 eval $inlibc
17554
17555 case "$d_snprintf-$d_vsnprintf" in
17556 "$define-$define")
17557     $cat <<EOM
17558 Checking whether your snprintf() and vsnprintf() work okay...
17559 EOM
17560     $cat >try.c <<'EOCP'
17561 /* v?snprintf testing logic courtesy of Russ Allbery.
17562  * According to C99:
17563  * - if the buffer is too short it still must be \0-terminated
17564  * - if the buffer is too short the potentially required length
17565  *   must be returned and not -1
17566  * - if the buffer is NULL the potentially required length
17567  *   must be returned and not -1 or core dump
17568  */
17569 #include <stdio.h>
17570 #include <stdarg.h>
17571
17572 char buf[2];
17573
17574 int test (char *format, ...)
17575 {
17576     va_list args;
17577     int count;
17578
17579     va_start (args, format);
17580     count = vsnprintf (buf, sizeof buf, format, args);
17581     va_end (args);
17582     return count;
17583 }
17584
17585 int main ()
17586 {
17587     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17588              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17589 }
17590 EOCP
17591     set try
17592     if eval $compile; then
17593         `$run ./try`
17594         case "$?" in
17595         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17596         *) cat <<EOM >&4
17597 Your snprintf() and snprintf() don't seem to be working okay.
17598 EOM
17599            d_snprintf="$undef"
17600            d_vsnprintf="$undef"
17601            ;;
17602         esac
17603     else
17604         echo "(I can't seem to compile the test program--assuming they don't)"
17605         d_snprintf="$undef"
17606         d_vsnprintf="$undef"
17607     fi
17608     $rm_try
17609     ;;
17610 esac
17611
17612 : see if sockatmark exists
17613 set sockatmark d_sockatmark
17614 eval $inlibc
17615
17616 : see if prototype for sockatmark is available
17617 echo " "
17618 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17619 eval $hasproto
17620
17621 : see if socks5_init exists
17622 set socks5_init d_socks5_init
17623 eval $inlibc
17624
17625 : see if sprintf returns the length of the string in the buffer as per ANSI
17626 $echo "Checking whether sprintf returns the length of the string..." >&4
17627 $cat <<EOP >try.c
17628 #include <stdio.h>
17629 #$i_stdlib I_STDLIB
17630 #ifdef I_STDLIB
17631 #include <stdlib.h>
17632 #endif
17633 #$i_string I_STRING
17634 #ifdef I_STRING
17635 #  include <string.h>
17636 #else
17637 #  include <strings.h>
17638 #endif
17639 #$i_math I_MATH
17640 #ifdef I_MATH
17641 #include <math.h>
17642 #endif
17643
17644 char buffer[256];
17645
17646 int check (size_t expect, int test) {
17647   size_t got = strlen(buffer);
17648   if (expect == got)
17649     return 0;
17650
17651   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17652        test, buffer);
17653   exit (test);
17654 }
17655
17656 int main(int argc, char **argv) {
17657   int test = 0;
17658
17659   check(sprintf(buffer, ""), ++test);
17660   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17661   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17662
17663   return 0;
17664 }
17665 EOP
17666 set try
17667
17668 if eval $compile; then
17669     xxx="`$run ./try`"
17670     case "$?" in
17671         0) cat >&4 <<EOM
17672 sprintf returns the length of the string (as ANSI says it should)
17673 EOM
17674         d_sprintf_returns_strlen="$define"
17675         ;;
17676         *) cat >&4 <<EOM
17677 sprintf does not return the length of the string (how old is this system?)
17678 EOM
17679         d_sprintf_returns_strlen="$undef"
17680         ;;
17681     esac
17682 else
17683     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17684     d_sprintf_returns_strlen="$undef"
17685 fi
17686 $rm_try
17687
17688 : see if srand48_r exists
17689 set srand48_r d_srand48_r
17690 eval $inlibc
17691 case "$d_srand48_r" in
17692 "$define")
17693         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17694         case "$d_srand48_r_proto:$usethreads" in
17695         ":define")      d_srand48_r_proto=define
17696                 set d_srand48_r_proto srand48_r $hdrs
17697                 eval $hasproto ;;
17698         *)      ;;
17699         esac
17700         case "$d_srand48_r_proto" in
17701         define)
17702         case "$srand48_r_proto" in
17703         ''|0) try='int srand48_r(long, struct drand48_data*);'
17704         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17705         esac
17706         case "$srand48_r_proto" in
17707         ''|0)   d_srand48_r=undef
17708                 srand48_r_proto=0
17709                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17710         * )     case "$srand48_r_proto" in
17711                 REENTRANT_PROTO*) ;;
17712                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17713                 esac
17714                 echo "Prototype: $try" ;;
17715         esac
17716         ;;
17717         *)      case "$usethreads" in
17718                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17719                 esac
17720                 d_srand48_r=undef
17721                 srand48_r_proto=0
17722                 ;;
17723         esac
17724         ;;
17725 *)      srand48_r_proto=0
17726         ;;
17727 esac
17728
17729 : see if srandom_r exists
17730 set srandom_r d_srandom_r
17731 eval $inlibc
17732 case "$d_srandom_r" in
17733 "$define")
17734         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17735         case "$d_srandom_r_proto:$usethreads" in
17736         ":define")      d_srandom_r_proto=define
17737                 set d_srandom_r_proto srandom_r $hdrs
17738                 eval $hasproto ;;
17739         *)      ;;
17740         esac
17741         case "$d_srandom_r_proto" in
17742         define)
17743         case "$srandom_r_proto" in
17744         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17745         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17746         esac
17747         case "$srandom_r_proto" in
17748         ''|0)   d_srandom_r=undef
17749                 srandom_r_proto=0
17750                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17751         * )     case "$srandom_r_proto" in
17752                 REENTRANT_PROTO*) ;;
17753                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17754                 esac
17755                 echo "Prototype: $try" ;;
17756         esac
17757         ;;
17758         *)      case "$usethreads" in
17759                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17760                 esac
17761                 d_srandom_r=undef
17762                 srandom_r_proto=0
17763                 ;;
17764         esac
17765         ;;
17766 *)      srandom_r_proto=0
17767         ;;
17768 esac
17769
17770 : see if prototype for setresgid is available
17771 echo " "
17772 set d_sresgproto setresgid $i_unistd unistd.h
17773 eval $hasproto
17774
17775 : see if prototype for setresuid is available
17776 echo " "
17777 set d_sresuproto setresuid $i_unistd unistd.h
17778 eval $hasproto
17779
17780 : see if sys/stat.h is available
17781 set sys/stat.h i_sysstat
17782 eval $inhdr
17783
17784 : see if stat knows about block sizes
17785 echo " "
17786 echo "Checking to see if your struct stat has st_blocks field..." >&4
17787 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17788 eval $hasfield
17789
17790 : see if this is a sys/vfs.h system
17791 set sys/vfs.h i_sysvfs
17792 eval $inhdr
17793
17794 : see if this is a sys/statfs.h system
17795 set sys/statfs.h i_sysstatfs
17796 eval $inhdr
17797
17798 : Check for statfs_s
17799 echo " "
17800 echo "Checking to see if your system supports struct statfs..." >&4
17801 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
17802 eval $hasstruct
17803 case "$d_statfs_s" in
17804 "$define")      echo "Yes, it does."   ;;
17805 *)              echo "No, it doesn't." ;;
17806 esac
17807
17808
17809 : see if struct statfs knows about f_flags
17810 case "$d_statfs_s" in
17811 define)
17812         echo " "
17813         echo "Checking to see if your struct statfs has f_flags field..." >&4
17814         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
17815         eval $hasfield
17816         ;;
17817 *)      val="$undef"
17818         set d_statfs_f_flags
17819         eval $setvar
17820         ;;
17821 esac
17822 case "$d_statfs_f_flags" in
17823 "$define")      echo "Yes, it does."   ;;
17824 *)              echo "No, it doesn't." ;;
17825 esac
17826
17827 : Check stream access
17828 $cat >&4 <<EOM
17829 Checking how to access stdio streams by file descriptor number...
17830 EOM
17831 case "$stdio_stream_array" in
17832 '')     $cat >try.c <<EOCP
17833 #include <stdio.h>
17834 int main() {
17835   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17836     printf("yes\n");
17837 }
17838 EOCP
17839         for s in _iob __iob __sF
17840         do
17841                 set try -DSTDIO_STREAM_ARRAY=$s
17842                 if eval $compile; then
17843                         case "`$run ./try`" in
17844                         yes)    stdio_stream_array=$s; break ;;
17845                         esac
17846                 fi
17847         done
17848         $rm_try
17849 esac
17850 case "$stdio_stream_array" in
17851 '')     $cat >&4 <<EOM
17852 I can't figure out how to access stdio streams by file descriptor number.
17853 EOM
17854         d_stdio_stream_array="$undef"
17855         ;;
17856 *)      $cat >&4 <<EOM
17857 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17858 EOM
17859         d_stdio_stream_array="$define"
17860         ;;
17861 esac
17862
17863 : see if strcoll exists
17864 set strcoll d_strcoll
17865 eval $inlibc
17866
17867 : check for structure copying
17868 echo " "
17869 echo "Checking to see if your C compiler can copy structs..." >&4
17870 $cat >try.c <<'EOCP'
17871 int main()
17872 {
17873         struct blurfl {
17874                 int dyick;
17875         } foo, bar;
17876
17877         foo = bar;
17878 }
17879 EOCP
17880 if $cc -c try.c >/dev/null 2>&1 ; then
17881         val="$define"
17882         echo "Yup, it can."
17883 else
17884         val="$undef"
17885         echo "Nope, it can't."
17886 fi
17887 set d_strctcpy
17888 eval $setvar
17889 $rm_try
17890
17891 : see if strerror and/or sys_errlist[] exist
17892 echo " "
17893 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17894     if set strerror val -f d_strerror; eval $csym; $val; then
17895                 echo 'strerror() found.' >&4
17896                 d_strerror="$define"
17897                 d_strerrm='strerror(e)'
17898                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17899                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17900                         d_syserrlst="$define"
17901                 else
17902                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17903                         d_syserrlst="$undef"
17904                 fi
17905     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17906                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17907                 echo 'strerror() found in string header.' >&4
17908                 d_strerror="$define"
17909                 d_strerrm='strerror(e)'
17910                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17911                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17912                                 d_syserrlst="$define"
17913                 else
17914                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17915                         d_syserrlst="$undef"
17916                 fi
17917     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17918                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17919                 d_strerror="$undef"
17920                 d_syserrlst="$define"
17921                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17922     else
17923                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17924                 d_strerror="$undef"
17925                 d_syserrlst="$undef"
17926                 d_strerrm='"unknown"'
17927     fi
17928 fi
17929
17930 : see if strerror_r exists
17931 set strerror_r d_strerror_r
17932 eval $inlibc
17933 case "$d_strerror_r" in
17934 "$define")
17935         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17936         case "$d_strerror_r_proto:$usethreads" in
17937         ":define")      d_strerror_r_proto=define
17938                 set d_strerror_r_proto strerror_r $hdrs
17939                 eval $hasproto ;;
17940         *)      ;;
17941         esac
17942         case "$d_strerror_r_proto" in
17943         define)
17944         case "$strerror_r_proto" in
17945         ''|0) try='int strerror_r(int, char*, size_t);'
17946         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17947         esac
17948         case "$strerror_r_proto" in
17949         ''|0) try='int strerror_r(int, char*, int);'
17950         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17951         esac
17952         case "$strerror_r_proto" in
17953         ''|0) try='char* strerror_r(int, char*, size_t);'
17954         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17955         esac
17956         case "$strerror_r_proto" in
17957         ''|0)   d_strerror_r=undef
17958                 strerror_r_proto=0
17959                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17960         * )     case "$strerror_r_proto" in
17961                 REENTRANT_PROTO*) ;;
17962                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17963                 esac
17964                 echo "Prototype: $try" ;;
17965         esac
17966         ;;
17967         *)      case "$usethreads" in
17968                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17969                 esac
17970                 d_strerror_r=undef
17971                 strerror_r_proto=0
17972                 ;;
17973         esac
17974         ;;
17975 *)      strerror_r_proto=0
17976         ;;
17977 esac
17978
17979 : see if strftime exists
17980 set strftime d_strftime
17981 eval $inlibc
17982
17983 : see if strlcat exists
17984 set strlcat d_strlcat
17985 eval $inlibc
17986
17987 : see if strlcpy exists
17988 set strlcpy d_strlcpy
17989 eval $inlibc
17990
17991 : see if strtod exists
17992 set strtod d_strtod
17993 eval $inlibc
17994
17995 : see if strtol exists
17996 set strtol d_strtol
17997 eval $inlibc
17998
17999 : see if strtold exists
18000 set strtold d_strtold
18001 eval $inlibc
18002
18003 : see if strtoll exists
18004 set strtoll d_strtoll
18005 eval $inlibc
18006
18007 case "$d_longlong-$d_strtoll" in
18008 "$define-$define")
18009         $cat <<EOM
18010 Checking whether your strtoll() works okay...
18011 EOM
18012         $cat >try.c <<'EOCP'
18013 #include <errno.h>
18014 #ifdef __hpux
18015 #define strtoll __strtoll
18016 #endif
18017 #ifdef __EMX__
18018 #define strtoll _strtoll
18019 #endif
18020 #include <stdio.h>
18021 extern long long int strtoll(char *s, char **, int);
18022 static int bad = 0;
18023 int check(char *s, long long ell, int een) {
18024         long long gll;
18025         errno = 0;
18026         gll = strtoll(s, 0, 10);
18027         if (!((gll == ell) && (errno == een)))
18028                 bad++;
18029 }
18030 int main() {
18031         check(" 1",                                      1LL, 0);
18032         check(" 0",                                      0LL, 0);
18033         check("-1",                                     -1LL, 0);
18034         check("-9223372036854775808", -9223372036854775808LL, 0);
18035         check("-9223372036854775808", -9223372036854775808LL, 0);
18036         check(" 9223372036854775807",  9223372036854775807LL, 0);
18037         check("-9223372036854775808", -9223372036854775808LL, 0);
18038         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18039         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18040         if (!bad)
18041                 printf("ok\n");
18042 }
18043 EOCP
18044         set try
18045         if eval $compile; then
18046                 yyy=`$run ./try`
18047                 case "$yyy" in
18048                 ok) echo "Your strtoll() seems to be working okay." ;;
18049                 *) cat <<EOM >&4
18050 Your strtoll() doesn't seem to be working okay.
18051 EOM
18052                    d_strtoll="$undef"
18053                    ;;
18054                 esac
18055         else
18056                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18057                 d_strtoll="$undef"
18058         fi
18059         ;;
18060 esac
18061
18062 : see if strtoq exists
18063 set strtoq d_strtoq
18064 eval $inlibc
18065
18066 : see if strtoul exists
18067 set strtoul d_strtoul
18068 eval $inlibc
18069
18070 case "$d_strtoul" in
18071 "$define")
18072         $cat <<EOM
18073 Checking whether your strtoul() works okay...
18074 EOM
18075         $cat >try.c <<'EOCP'
18076 #include <errno.h>
18077 #include <stdio.h>
18078 extern unsigned long int strtoul(char *s, char **, int);
18079 static int bad = 0;
18080 void check(char *s, unsigned long eul, int een) {
18081         unsigned long gul;
18082         errno = 0;
18083         gul = strtoul(s, 0, 10);
18084         if (!((gul == eul) && (errno == een)))
18085                 bad++;
18086 }
18087 int main() {
18088         check(" 1", 1L, 0);
18089         check(" 0", 0L, 0);
18090 EOCP
18091         case "$longsize" in
18092         8)
18093             $cat >>try.c <<'EOCP'
18094         check("18446744073709551615", 18446744073709551615UL, 0);
18095         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18096 #if 0 /* strtoul() for /^-/ strings is undefined. */
18097         check("-1", 18446744073709551615UL, 0);
18098         check("-18446744073709551614", 2, 0);
18099         check("-18446744073709551615", 1, 0);
18100         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18101         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18102 #endif
18103 EOCP
18104                 ;;
18105         4)
18106                     $cat >>try.c <<'EOCP'
18107         check("4294967295", 4294967295UL, 0);
18108         check("4294967296", 4294967295UL, ERANGE);
18109 #if 0 /* strtoul() for /^-/ strings is undefined. */
18110         check("-1", 4294967295UL, 0);
18111         check("-4294967294", 2, 0);
18112         check("-4294967295", 1, 0);
18113         check("-4294967296", 4294967295UL, ERANGE);
18114         check("-4294967297", 4294967295UL, ERANGE);
18115 #endif
18116 EOCP
18117                 ;;
18118         *)
18119 : Should we write these tests to be more portable by sprintf-ing
18120 : ~0 and then manipulating that char string as input for strtol?
18121                 ;;
18122         esac
18123         $cat >>try.c <<'EOCP'
18124         if (!bad)
18125                 printf("ok\n");
18126         return 0;
18127 }
18128 EOCP
18129         set try
18130         if eval $compile; then
18131                 case "`$run ./try`" in
18132                 ok) echo "Your strtoul() seems to be working okay." ;;
18133                 *) cat <<EOM >&4
18134 Your strtoul() doesn't seem to be working okay.
18135 EOM
18136                    d_strtoul="$undef"
18137                    ;;
18138                 esac
18139         else
18140                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18141                 d_strtoul="$undef"
18142         fi
18143         ;;
18144 esac
18145
18146 : see if strtoull exists
18147 set strtoull d_strtoull
18148 eval $inlibc
18149
18150 case "$d_longlong-$d_strtoull" in
18151 "$define-$define")
18152         $cat <<EOM
18153 Checking whether your strtoull() works okay...
18154 EOM
18155         $cat >try.c <<'EOCP'
18156 #include <errno.h>
18157 #ifdef __hpux
18158 #define strtoull __strtoull
18159 #endif
18160 #include <stdio.h>
18161 extern unsigned long long int strtoull(char *s, char **, int);
18162 static int bad = 0;
18163 int check(char *s, long long eull, int een) {
18164         long long gull;
18165         errno = 0;
18166         gull = strtoull(s, 0, 10);
18167         if (!((gull == eull) && (errno == een)))
18168                 bad++;
18169 }
18170 int main() {
18171         check(" 1",                                        1LL, 0);
18172         check(" 0",                                        0LL, 0);
18173         check("18446744073709551615",  18446744073709551615ULL, 0);
18174         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18175 #if 0 /* strtoull() for /^-/ strings is undefined. */
18176         check("-1",                    18446744073709551615ULL, 0);
18177         check("-18446744073709551614",                     2LL, 0);
18178         check("-18446744073709551615",                     1LL, 0);
18179         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18180         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18181 #endif
18182         if (!bad)
18183                 printf("ok\n");
18184 }
18185 EOCP
18186         set try
18187         if eval $compile; then
18188                 case "`$run ./try`" in
18189                 ok) echo "Your strtoull() seems to be working okay." ;;
18190                 *) cat <<EOM >&4
18191 Your strtoull() doesn't seem to be working okay.
18192 EOM
18193                    d_strtoull="$undef"
18194                    ;;
18195                 esac
18196         else
18197                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18198                 d_strtoull="$undef"
18199         fi
18200         ;;
18201 esac
18202
18203 : see if strtouq exists
18204 set strtouq d_strtouq
18205 eval $inlibc
18206
18207 case "$d_strtouq" in
18208 "$define")
18209         $cat <<EOM
18210 Checking whether your strtouq() works okay...
18211 EOM
18212         $cat >try.c <<'EOCP'
18213 #include <errno.h>
18214 #include <stdio.h>
18215 extern unsigned long long int strtouq(char *s, char **, int);
18216 static int bad = 0;
18217 void check(char *s, unsigned long long eull, int een) {
18218         unsigned long long gull;
18219         errno = 0;
18220         gull = strtouq(s, 0, 10);
18221         if (!((gull == eull) && (errno == een)))
18222                 bad++;
18223 }
18224 int main() {
18225         check(" 1",                                        1LL, 0);
18226         check(" 0",                                        0LL, 0);
18227         check("18446744073709551615",  18446744073709551615ULL, 0);
18228         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18229 #if 0 /* strtouq() for /^-/ strings is undefined. */
18230         check("-1",                    18446744073709551615ULL, 0);
18231         check("-18446744073709551614",                     2LL, 0);
18232         check("-18446744073709551615",                     1LL, 0);
18233         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18234         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18235 #endif
18236         if (!bad)
18237                 printf("ok\n");
18238         return 0;
18239 }
18240 EOCP
18241         set try
18242         if eval $compile; then
18243                 case "`$run ./try`" in
18244                 ok) echo "Your strtouq() seems to be working okay." ;;
18245                 *) cat <<EOM >&4
18246 Your strtouq() doesn't seem to be working okay.
18247 EOM
18248                    d_strtouq="$undef"
18249                    ;;
18250                 esac
18251         else
18252                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18253                 d_strtouq="$undef"
18254         fi
18255         ;;
18256 esac
18257
18258 : see if strxfrm exists
18259 set strxfrm d_strxfrm
18260 eval $inlibc
18261
18262 : see if symlink exists
18263 set symlink d_symlink
18264 eval $inlibc
18265
18266 : see if syscall exists
18267 set syscall d_syscall
18268 eval $inlibc
18269
18270 : see if prototype for syscall is available
18271 echo " "
18272 set d_syscallproto syscall $i_unistd unistd.h
18273 eval $hasproto
18274
18275 : see if sysconf exists
18276 set sysconf d_sysconf
18277 eval $inlibc
18278
18279 : see if system exists
18280 set system d_system
18281 eval $inlibc
18282
18283 : see if tcgetpgrp exists
18284 set tcgetpgrp d_tcgetpgrp
18285 eval $inlibc
18286
18287 : see if tcsetpgrp exists
18288 set tcsetpgrp d_tcsetpgrp
18289 eval $inlibc
18290
18291 : see if prototype for telldir is available
18292 echo " "
18293 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18294 eval $hasproto
18295
18296 : see if time exists
18297 echo " "
18298 if test "X$d_time" = X -o X"$timetype" = X; then
18299     if set time val -f d_time; eval $csym; $val; then
18300                 echo 'time() found.' >&4
18301                 val="$define"
18302                 rp="What is the type returned by time() on this system?"
18303                 set time_t timetype long stdio.h sys/types.h
18304                 eval $typedef_ask
18305     else
18306                 echo 'time() not found, hope that will do.' >&4
18307                 val="$undef"
18308                 timetype='int';
18309     fi
18310     set d_time
18311     eval $setvar
18312 fi
18313
18314 : see if timegm exists
18315 set timegm d_timegm
18316 eval $inlibc
18317
18318 : see if this is a sys/times.h system
18319 set sys/times.h i_systimes
18320 eval $inhdr
18321
18322 : see if times exists
18323 echo " "
18324 if set times val -f d_times; eval $csym; $val; then
18325         echo 'times() found.' >&4
18326         d_times="$define"
18327         inc=''
18328         case "$i_systimes" in
18329         "$define") inc='sys/times.h';;
18330         esac
18331         rp="What is the type returned by times() on this system?"
18332         set clock_t clocktype long stdio.h sys/types.h $inc
18333         eval $typedef_ask
18334 else
18335         echo 'times() NOT found, hope that will do.' >&4
18336         d_times="$undef"
18337         clocktype='int'
18338 fi
18339
18340 : see if tmpnam_r exists
18341 set tmpnam_r d_tmpnam_r
18342 eval $inlibc
18343 case "$d_tmpnam_r" in
18344 "$define")
18345         hdrs="$i_systypes sys/types.h define stdio.h "
18346         case "$d_tmpnam_r_proto:$usethreads" in
18347         ":define")      d_tmpnam_r_proto=define
18348                 set d_tmpnam_r_proto tmpnam_r $hdrs
18349                 eval $hasproto ;;
18350         *)      ;;
18351         esac
18352         case "$d_tmpnam_r_proto" in
18353         define)
18354         case "$tmpnam_r_proto" in
18355         ''|0) try='char* tmpnam_r(char*);'
18356         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18357         esac
18358         case "$tmpnam_r_proto" in
18359         ''|0)   d_tmpnam_r=undef
18360                 tmpnam_r_proto=0
18361                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18362         * )     case "$tmpnam_r_proto" in
18363                 REENTRANT_PROTO*) ;;
18364                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18365                 esac
18366                 echo "Prototype: $try" ;;
18367         esac
18368         ;;
18369         *)      case "$usethreads" in
18370                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18371                 esac
18372                 d_tmpnam_r=undef
18373                 tmpnam_r_proto=0
18374                 ;;
18375         esac
18376         ;;
18377 *)      tmpnam_r_proto=0
18378         ;;
18379 esac
18380
18381 : see if truncate exists
18382 set truncate d_truncate
18383 eval $inlibc
18384
18385 : see if ttyname_r exists
18386 set ttyname_r d_ttyname_r
18387 eval $inlibc
18388 case "$d_ttyname_r" in
18389 "$define")
18390         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18391         case "$d_ttyname_r_proto:$usethreads" in
18392         ":define")      d_ttyname_r_proto=define
18393                 set d_ttyname_r_proto ttyname_r $hdrs
18394                 eval $hasproto ;;
18395         *)      ;;
18396         esac
18397         case "$d_ttyname_r_proto" in
18398         define)
18399         case "$ttyname_r_proto" in
18400         ''|0) try='int ttyname_r(int, char*, size_t);'
18401         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18402         esac
18403         case "$ttyname_r_proto" in
18404         ''|0) try='int ttyname_r(int, char*, int);'
18405         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18406         esac
18407         case "$ttyname_r_proto" in
18408         ''|0) try='char* ttyname_r(int, char*, int);'
18409         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18410         esac
18411         case "$ttyname_r_proto" in
18412         ''|0)   d_ttyname_r=undef
18413                 ttyname_r_proto=0
18414                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18415         * )     case "$ttyname_r_proto" in
18416                 REENTRANT_PROTO*) ;;
18417                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18418                 esac
18419                 echo "Prototype: $try" ;;
18420         esac
18421         ;;
18422         *)      case "$usethreads" in
18423                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18424                 esac
18425                 d_ttyname_r=undef
18426                 ttyname_r_proto=0
18427                 ;;
18428         esac
18429         ;;
18430 *)      ttyname_r_proto=0
18431         ;;
18432 esac
18433
18434 : see if tzname[] exists
18435 echo " "
18436 if set tzname val -a d_tzname; eval $csym; $val; then
18437         val="$define"
18438         echo 'tzname[] found.' >&4
18439 else
18440         val="$undef"
18441         echo 'tzname[] NOT found.' >&4
18442 fi
18443 set d_tzname
18444 eval $setvar
18445
18446 : Check if is a multiplatform env
18447 case "$osname" in
18448 next|rhapsody|darwin) multiarch="$define" ;;
18449 esac
18450 case "$multiarch" in
18451 ''|[nN]*) multiarch="$undef" ;;
18452 esac
18453
18454 : check for ordering of bytes in a UV
18455 echo " "
18456 case "$usecrosscompile$multiarch" in
18457 *$define*)
18458         $cat <<EOM
18459 You seem to be either cross-compiling or doing a multiarchitecture build,
18460 skipping the byteorder check.
18461
18462 EOM
18463         byteorder='ffff'
18464         ;;
18465 *)
18466         case "$byteorder" in
18467         '')
18468                 $cat <<'EOM'
18469 In the following, larger digits indicate more significance.  A big-endian
18470 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18471 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18472 machines may have weird orders like 3412.  A Cray will report 87654321,
18473 an Alpha will report 12345678. If the test program works the default is
18474 probably right.
18475 I'm now running the test program...
18476 EOM
18477                 $cat >try.c <<EOCP
18478 #include <stdio.h>
18479 #$i_stdlib I_STDLIB
18480 #ifdef I_STDLIB
18481 #include <stdlib.h>
18482 #endif
18483 #include <sys/types.h>
18484 typedef $uvtype UV;
18485 int main()
18486 {
18487         int i;
18488         union {
18489                 UV l;
18490                 char c[$uvsize];
18491         } u;
18492
18493         if ($uvsize > 4)
18494                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18495         else
18496                 u.l = (UV)0x04030201;
18497         for (i = 0; i < $uvsize; i++)
18498                 printf("%c", u.c[i]+'0');
18499         printf("\n");
18500         exit(0);
18501 }
18502 EOCP
18503                 xxx_prompt=y
18504                 set try
18505                 if eval $compile && $run ./try > /dev/null; then
18506                         dflt=`$run ./try`
18507                         case "$dflt" in
18508                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18509                                 echo "(The test program ran ok.)"
18510                                 echo "byteorder=$dflt"
18511                                 xxx_prompt=n
18512                         ;;
18513                         ????|????????) echo "(The test program ran ok.)" ;;
18514                         *) echo "(The test program didn't run right for some reason.)" ;;
18515                         esac
18516                 else
18517                         dflt='4321'
18518                         cat <<'EOM'
18519 (I can't seem to compile the test program.  Guessing big-endian...)
18520 EOM
18521                 fi
18522                 case "$xxx_prompt" in
18523                 y)
18524                         rp="What is the order of bytes in $uvtype?"
18525                         . ./myread
18526                         byteorder="$ans"
18527                         ;;
18528                 *)      byteorder=$dflt
18529                         ;;
18530                 esac
18531                 ;;
18532         esac
18533         $rm_try
18534         ;;
18535 esac
18536
18537 : Checking 32bit aligndness
18538 $cat <<EOM
18539
18540 Checking to see whether you can access character data unalignedly...
18541 EOM
18542 case "$d_u32align" in
18543 '')   $cat >try.c <<EOCP
18544 #include <stdio.h>
18545 #$i_stdlib I_STDLIB
18546 #ifdef I_STDLIB
18547 #include <stdlib.h>
18548 #endif
18549 #define U32 $u32type
18550 #define BYTEORDER 0x$byteorder
18551 #define U8 $u8type
18552 #include <signal.h>
18553 #ifdef SIGBUS
18554 $signal_t bletch(int s) { exit(4); }
18555 #endif
18556 int main() {
18557 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18558     U8 buf[8];
18559     U32 *up;
18560     int i;
18561
18562     if (sizeof(U32) != 4) {
18563         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18564         exit(1);
18565     }
18566
18567     fflush(stdout);
18568
18569 #ifdef SIGBUS
18570     signal(SIGBUS, bletch);
18571 #endif
18572
18573     buf[0] = 0;
18574     buf[1] = 0;
18575     buf[2] = 0;
18576     buf[3] = 1;
18577     buf[4] = 0;
18578     buf[5] = 0;
18579     buf[6] = 0;
18580     buf[7] = 1;
18581
18582     for (i = 0; i < 4; i++) {
18583         up = (U32*)(buf + i);
18584         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18585                (*up == 1 << (8*(3-i)))  /* little-endian */
18586               )
18587            )
18588         {
18589             printf("read failed (%x)\n", *up);
18590             exit(2);
18591         }
18592     }
18593
18594     /* write test */
18595     for (i = 0; i < 4; i++) {
18596         up = (U32*)(buf + i);
18597         *up = 0xBeef;
18598         if (*up != 0xBeef) {
18599             printf("write failed (%x)\n", *up);
18600             exit(3);
18601         }
18602     }
18603
18604     exit(0);
18605 #else
18606     printf("1\n");
18607     exit(1);
18608 #endif
18609     return 0;
18610 }
18611 EOCP
18612 set try
18613 if eval $compile_ok; then
18614         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18615         $run ./try 2>&1 >/dev/null
18616         case "$?" in
18617         0)      cat >&4 <<EOM
18618 You can access character data pretty unalignedly.
18619 EOM
18620                 d_u32align="$undef"
18621                 ;;
18622         *)      cat >&4 <<EOM
18623 It seems that you must access character data in an aligned manner.
18624 EOM
18625                 d_u32align="$define"
18626                 ;;
18627         esac
18628 else
18629         rp='Can you access character data at unaligned addresses?'
18630         dflt='n'
18631         . ./myread
18632         case "$ans" in
18633         [yY]*)  d_u32align="$undef"  ;;
18634         *)      d_u32align="$define" ;;
18635         esac
18636 fi
18637 $rm_try
18638 ;;
18639 esac
18640
18641 : see if ualarm exists
18642 set ualarm d_ualarm
18643 eval $inlibc
18644
18645 : see if umask exists
18646 set umask d_umask
18647 eval $inlibc
18648
18649 : see if unordered exists
18650 set unordered d_unordered
18651 eval $inlibc
18652
18653 : see if unsetenv exists
18654 set unsetenv d_unsetenv
18655 eval $inlibc
18656
18657 : see if usleep exists
18658 set usleep d_usleep
18659 eval $inlibc
18660
18661 : see if prototype for usleep is available
18662 echo " "
18663 set d_usleepproto usleep $i_unistd unistd.h
18664 eval $hasproto
18665
18666 : see if ustat exists
18667 set ustat d_ustat
18668 eval $inlibc
18669
18670 : see if closedir exists
18671 set closedir d_closedir
18672 eval $inlibc
18673
18674 case "$d_closedir" in
18675 "$define")
18676         echo " "
18677         echo "Checking whether closedir() returns a status..." >&4
18678         cat > try.c <<EOM
18679 #$i_dirent I_DIRENT             /**/
18680 #$i_sysdir I_SYS_DIR            /**/
18681 #$i_sysndir I_SYS_NDIR          /**/
18682 #$i_systypes I_SYS_TYPES        /**/
18683
18684 #if defined(I_SYS_TYPES)
18685 #include <sys/types.h>
18686 #endif
18687 #if defined(I_DIRENT)
18688 #include <dirent.h>
18689 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18690 #include <sys/dir.h>
18691 #endif
18692 #else
18693 #ifdef I_SYS_NDIR
18694 #include <sys/ndir.h>
18695 #else
18696 #ifdef I_SYS_DIR
18697 #ifdef hp9000s500
18698 #include <ndir.h>       /* may be wrong in the future */
18699 #else
18700 #include <sys/dir.h>
18701 #endif
18702 #endif
18703 #endif
18704 #endif
18705 int main() { return closedir(opendir(".")); }
18706 EOM
18707         set try
18708         if eval $compile_ok; then
18709                 if $run ./try > /dev/null 2>&1 ; then
18710                         echo "Yes, it does."
18711                         val="$undef"
18712                 else
18713                         echo "No, it doesn't."
18714                         val="$define"
18715                 fi
18716         else
18717                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18718                 val="$define"
18719         fi
18720         ;;
18721 *)
18722         val="$undef";
18723         ;;
18724 esac
18725 set d_void_closedir
18726 eval $setvar
18727 $rm_try
18728
18729 : see if there is a wait4
18730 set wait4 d_wait4
18731 eval $inlibc
18732
18733 : see if waitpid exists
18734 set waitpid d_waitpid
18735 eval $inlibc
18736
18737 : see if wcstombs exists
18738 set wcstombs d_wcstombs
18739 eval $inlibc
18740
18741 : see if wctomb exists
18742 set wctomb d_wctomb
18743 eval $inlibc
18744
18745 : see if writev exists
18746 set writev d_writev
18747 eval $inlibc
18748
18749 : preserve RCS keywords in files with variable substitution, grrr
18750 Date='$Date'
18751 Id='$Id'
18752 Log='$Log'
18753 RCSfile='$RCSfile'
18754 Revision='$Revision'
18755
18756 : check for alignment requirements
18757 echo " "
18758 case "$usecrosscompile$multiarch" in
18759 *$define*)
18760         $cat <<EOM
18761 You seem to be either cross-compiling or doing a multiarchitecture build,
18762 skipping the memory alignment check.
18763
18764 EOM
18765         case "$alignbytes" in
18766         '') alignbytes=8 ;;
18767         esac
18768         ;;
18769 *)
18770         case "$alignbytes" in
18771         '') echo "Checking alignment constraints..." >&4
18772                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18773                         $cat >try.c <<'EOCP'
18774 typedef long double NV;
18775 EOCP
18776                 else
18777                         $cat >try.c <<'EOCP'
18778 typedef double NV;
18779 EOCP
18780                 fi
18781                 $cat >>try.c <<'EOCP'
18782 #include <stdio.h>
18783 struct foobar {
18784         char foo;
18785         NV bar;
18786 } try_algn;
18787 int main()
18788 {
18789     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18790     return(0);
18791 }
18792 EOCP
18793                 set try
18794                 if eval $compile_ok; then
18795                         dflt=`$run ./try`
18796                 else
18797                         dflt='8'
18798                         echo "(I can't seem to compile the test program...)"
18799                 fi
18800                 ;;
18801         *) dflt="$alignbytes"
18802                 ;;
18803         esac
18804         rp="Doubles must be aligned on a how-many-byte boundary?"
18805         . ./myread
18806         alignbytes="$ans"
18807         $rm_try
18808         ;;
18809 esac
18810
18811
18812 : set the base revision
18813 baserev=5.0
18814
18815 : how do we concatenate cpp tokens here?
18816 echo " "
18817 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18818 $cat >cpp_stuff.c <<'EOCP'
18819 #define RCAT(a,b)a/**/b
18820 #define ACAT(a,b)a ## b
18821 RCAT(Rei,ser)
18822 ACAT(Cir,cus)
18823 EOCP
18824 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18825 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18826         echo "Oh!  Smells like ANSI's been here." >&4
18827         echo "We can catify or stringify, separately or together!"
18828         cpp_stuff=42
18829 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18830         echo "Ah, yes!  The good old days!" >&4
18831         echo "However, in the good old days we don't know how to stringify and"
18832         echo "catify at the same time."
18833         cpp_stuff=1
18834 else
18835         $cat >&4 <<EOM
18836 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18837 You're going to have to edit the values of CAT[2-5] in config.h...
18838 EOM
18839         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18840 fi
18841 $rm -f cpp_stuff.*
18842
18843 : see if this is a db.h system
18844 set db.h i_db
18845 eval $inhdr
18846
18847 case "$i_db" in
18848 $define)
18849         : Check db version.
18850         echo " "
18851         echo "Checking Berkeley DB version ..." >&4
18852         $cat >try.c <<EOCP
18853 #$d_const HASCONST
18854 #ifndef HASCONST
18855 #define const
18856 #endif
18857 #include <sys/types.h>
18858 #include <stdio.h>
18859 #$i_stdlib I_STDLIB
18860 #ifdef I_STDLIB
18861 #include <stdlib.h>
18862 #endif
18863 #include <db.h>
18864 int main(int argc, char *argv[])
18865 {
18866 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18867     int Major, Minor, Patch ;
18868     unsigned long Version ;
18869     (void)db_version(&Major, &Minor, &Patch) ;
18870     if (argc == 2) {
18871         printf("%d %d %d %d %d %d\n",
18872                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18873                Major, Minor, Patch);
18874         exit(0);
18875     }
18876     printf("You have Berkeley DB Version 2 or greater.\n");
18877
18878     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18879                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18880     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18881                 Major, Minor, Patch) ;
18882
18883     /* check that db.h & libdb are compatible */
18884     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18885         printf("db.h and libdb are incompatible.\n") ;
18886         exit(3);
18887     }
18888
18889     printf("db.h and libdb are compatible.\n") ;
18890
18891     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18892                 + DB_VERSION_PATCH ;
18893
18894     /* needs to be >= 2.3.4 */
18895     if (Version < 2003004) {
18896     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18897         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18898         exit(2);
18899     }
18900
18901     exit(0);
18902 #else
18903 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18904     if (argc == 2) {
18905         printf("1 0 0\n");
18906         exit(0);
18907     }
18908     printf("You have Berkeley DB Version 1.\n");
18909     exit(0);    /* DB version < 2: the coast is clear. */
18910 #else
18911     exit(1);    /* <db.h> not Berkeley DB? */
18912 #endif
18913 #endif
18914 }
18915 EOCP
18916         set try
18917         if eval $compile_ok && $run ./try; then
18918                 echo 'Looks OK.' >&4
18919                 set `$run ./try 1`
18920                 db_version_major=$1
18921                 db_version_minor=$2
18922                 db_version_patch=$3
18923         else
18924                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18925                 i_db=$undef
18926                 case " $libs " in
18927                 *"-ldb "*)
18928                         : Remove db from list of libraries to use
18929                         echo "Removing unusable -ldb from library list" >&4
18930                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18931                         shift
18932                         libs="$*"
18933                         echo "libs = $libs" >&4
18934                         ;;
18935                 esac
18936         fi
18937         $rm_try
18938         ;;
18939 esac
18940
18941 case "$i_db" in
18942 define)
18943         : Check the return type needed for hash
18944         echo " "
18945         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18946         $cat >try.c <<EOCP
18947 #$d_const HASCONST
18948 #ifndef HASCONST
18949 #define const
18950 #endif
18951 #include <sys/types.h>
18952 #include <db.h>
18953
18954 #ifndef DB_VERSION_MAJOR
18955 u_int32_t hash_cb (ptr, size)
18956 const void *ptr;
18957 size_t size;
18958 {
18959 }
18960 HASHINFO info;
18961 int main()
18962 {
18963         info.hash = hash_cb;
18964 }
18965 #endif
18966 EOCP
18967         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18968                 if $contains warning try.out >>/dev/null 2>&1 ; then
18969                         db_hashtype='int'
18970                 else
18971                         db_hashtype='u_int32_t'
18972                 fi
18973         else
18974                 : XXX Maybe we should just give up here.
18975                 db_hashtype=u_int32_t
18976                 $cat try.out >&4
18977                 echo "Help:  I can't seem to compile the db test program." >&4
18978                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18979         fi
18980         $rm_try
18981         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18982         ;;
18983 *)      db_hashtype=u_int32_t
18984         ;;
18985 esac
18986 case "$i_db" in
18987 define)
18988         : Check the return type needed for prefix
18989         echo " "
18990         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18991         cat >try.c <<EOCP
18992 #$d_const HASCONST
18993 #ifndef HASCONST
18994 #define const
18995 #endif
18996 #include <sys/types.h>
18997 #include <db.h>
18998
18999 #ifndef DB_VERSION_MAJOR
19000 size_t prefix_cb (key1, key2)
19001 const DBT *key1;
19002 const DBT *key2;
19003 {
19004 }
19005 BTREEINFO info;
19006 int main()
19007 {
19008         info.prefix = prefix_cb;
19009 }
19010 #endif
19011 EOCP
19012         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19013                 if $contains warning try.out >>/dev/null 2>&1 ; then
19014                         db_prefixtype='int'
19015                 else
19016                         db_prefixtype='size_t'
19017                 fi
19018         else
19019                 db_prefixtype='size_t'
19020                 : XXX Maybe we should just give up here.
19021                 $cat try.out >&4
19022                 echo "Help:  I can't seem to compile the db test program." >&4
19023                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19024         fi
19025         $rm_try
19026         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19027         ;;
19028 *)      db_prefixtype='size_t'
19029         ;;
19030 esac
19031
19032 : How can we generate normalized random numbers ?
19033 echo " "
19034 echo "Looking for a random number function..." >&4
19035 case "$randfunc" in
19036 '')
19037         if set drand48 val -f; eval $csym; $val; then
19038                 dflt="drand48"
19039                 echo "Good, found drand48()." >&4
19040         elif set random val -f; eval $csym; $val; then
19041                 dflt="random"
19042                 echo "OK, found random()." >&4
19043         else
19044                 dflt="rand"
19045                 echo "Yick, looks like I have to use rand()." >&4
19046         fi
19047         echo " "
19048         ;;
19049 *)
19050         dflt="$randfunc"
19051         ;;
19052 esac
19053 cont=true
19054
19055 case "$ccflags" in
19056 *-Dmy_rand=*|*-Dmy_srand=*)
19057         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19058         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19059         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19060         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19061         ;;
19062 esac
19063
19064 while $test "$cont"; do
19065         rp="Use which function to generate random numbers?"
19066         . ./myread
19067         if $test "$ans" = "$dflt"; then
19068                 : null
19069         else
19070                 randbits=''
19071         fi
19072         randfunc="$ans"
19073         if set $ans val -f; eval $csym; $val; then
19074                 cont=''
19075         else
19076                 dflt=y
19077                 rp="I cannot find function $ans. Use that name anyway?"
19078                 . ./myread
19079                 dflt=rand
19080                 case "$ans" in
19081                         [yY]*) cont='';;
19082                 esac
19083         fi
19084         case "$cont" in
19085         '')
19086                 case "$randfunc" in
19087                 drand48)
19088                         drand01="drand48()"
19089                         seedfunc="srand48"
19090                         randbits=48
19091                         randseedtype=long
19092                         ;;
19093                 rand|random)
19094                         case "$randbits" in
19095                         '')
19096 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19097                                 $cat >try.c <<EOCP
19098 #$i_unistd I_UNISTD
19099 #$i_stdlib I_STDLIB
19100 #include <stdio.h>
19101 #ifdef I_UNISTD
19102 #  include <unistd.h>
19103 #endif
19104 #ifdef I_STDLIB
19105 #  include <stdlib.h>
19106 #endif
19107 int main()
19108 {
19109         register int i;
19110         register unsigned long tmp;
19111         register unsigned long max = 0L;
19112
19113         for (i = 1000; i; i--) {
19114                 tmp = (unsigned long) $randfunc();
19115                 if (tmp > max) max = tmp;
19116         }
19117         for (i = 0; max; i++)
19118                 max /= 2;
19119         printf("%d\n",i);
19120 }
19121 EOCP
19122                                 set try
19123                                 if eval $compile_ok; then
19124                                         dflt=`try`
19125                                 else
19126                                         dflt='?'
19127                                         echo "(I can't seem to compile the test program...)"
19128                                 fi
19129                                 ;;
19130                         *)
19131                                 dflt="$randbits"
19132                                 ;;
19133                         esac
19134                         rp="How many bits does your $randfunc() function produce?"
19135                         . ./myread
19136                         randbits="$ans"
19137                         $rm_try
19138                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19139                         seedfunc="s$randfunc"
19140                         randseedtype=unsigned
19141                         ;;
19142                 *)
19143                         dflt="31"
19144                         rp="How many bits does your $randfunc() function produce?"
19145                         . ./myread
19146                         randbits="$ans"
19147                         seedfunc="s$randfunc"
19148                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19149                         if set $seedfunc val -f; eval $csym; $val; then
19150                                 echo "(Using $seedfunc() to seed random generator)"
19151                         else
19152                                 echo "(Warning: no $seedfunc() to seed random generator)"
19153                                 seedfunc=rand
19154                         fi
19155                         randseedtype=unsigned
19156                         ;;
19157                 esac
19158                 ;;
19159         esac
19160 done
19161
19162 : Determine if this is an EBCDIC system
19163 echo " "
19164 echo "Determining whether or not we are on an EBCDIC system..." >&4
19165 $cat >try.c <<'EOM'
19166 int main()
19167 {
19168   if ('M'==0xd4) return 0;
19169   return 1;
19170 }
19171 EOM
19172
19173 val=$undef
19174 set try
19175 if eval $compile_ok; then
19176         if $run ./try; then
19177                 echo "You seem to speak EBCDIC." >&4
19178                 val="$define"
19179         else
19180                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19181         fi
19182 else
19183         echo "I'm unable to compile the test program." >&4
19184         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19185 fi
19186 $rm_try
19187 set ebcdic
19188 eval $setvar
19189
19190 : Check how to flush
19191 echo " "
19192 $cat >&4 <<EOM
19193 Checking how to flush all pending stdio output...
19194 EOM
19195 # I only know how to find the first 32 possibly open files on SunOS.
19196 # See also hints/sunos_4_1.sh and util.c  --AD
19197 case "$osname" in
19198 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19199 esac
19200 $cat >>try.c <<EOCP
19201 #include <stdio.h>
19202 #$i_stdlib I_STDLIB
19203 #ifdef I_STDLIB
19204 #include <stdlib.h>
19205 #endif
19206 #$i_unistd I_UNISTD
19207 #ifdef I_UNISTD
19208 # include <unistd.h>
19209 #endif
19210 #$d_sysconf HAS_SYSCONF
19211 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19212 #ifdef HAS_STDIO_STREAM_ARRAY
19213 # define STDIO_STREAM_ARRAY $stdio_stream_array
19214 #endif
19215 int main() {
19216   FILE* p;
19217   unlink("try.out");
19218   p = fopen("try.out", "w");
19219 #ifdef TRY_FPUTC
19220   fputc('x', p);
19221 #else
19222 # ifdef TRY_FPRINTF
19223   fprintf(p, "x");
19224 # endif
19225 #endif
19226 #ifdef TRY_FFLUSH_NULL
19227   fflush(NULL);
19228 #endif
19229 #ifdef TRY_FFLUSH_ALL
19230   {
19231     long open_max = -1;
19232 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19233     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19234 # else
19235 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19236     open_max = sysconf(_SC_OPEN_MAX);
19237 #  else
19238 #   ifdef FOPEN_MAX
19239     open_max = FOPEN_MAX;
19240 #   else
19241 #    ifdef OPEN_MAX
19242     open_max = OPEN_MAX;
19243 #    else
19244 #     ifdef _NFILE
19245     open_max = _NFILE;
19246 #     endif
19247 #    endif
19248 #   endif
19249 #  endif
19250 # endif
19251 # ifdef HAS_STDIO_STREAM_ARRAY
19252     if (open_max > 0) {
19253       long i;
19254       for (i = 0; i < open_max; i++)
19255             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19256                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19257                 STDIO_STREAM_ARRAY[i]._flag)
19258                 fflush(&STDIO_STREAM_ARRAY[i]);
19259     }
19260   }
19261 # endif
19262 #endif
19263   _exit(42);
19264 }
19265 EOCP
19266 : first we have to find out how _not_ to flush
19267 $to try.c
19268 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19269     output=''
19270     set try -DTRY_FPUTC
19271     if eval $compile; then
19272             $run ./try 2>/dev/null
19273             code="$?"
19274             $from try.out
19275             if $test ! -s try.out -a "X$code" = X42; then
19276                 output=-DTRY_FPUTC
19277             fi
19278     fi
19279     case "$output" in
19280     '')
19281             set try -DTRY_FPRINTF
19282             if eval $compile; then
19283                     $run ./try 2>/dev/null
19284                     code="$?"
19285                     $from try.out
19286                     if $test ! -s try.out -a "X$code" = X42; then
19287                         output=-DTRY_FPRINTF
19288                     fi
19289             fi
19290         ;;
19291     esac
19292 fi
19293 : check for fflush NULL behaviour
19294 case "$fflushNULL" in
19295 '')     set try -DTRY_FFLUSH_NULL $output
19296         if eval $compile; then
19297                 $run ./try 2>/dev/null
19298                 code="$?"
19299                 $from try.out
19300                 if $test -s try.out -a "X$code" = X42; then
19301                         fflushNULL="`$cat try.out`"
19302                 else
19303                         if $test "X$code" != X42; then
19304                                 $cat >&4 <<EOM
19305 (If this test failed, don't worry, we'll try another method shortly.)
19306 EOM
19307                         fi
19308                 fi
19309         fi
19310         $rm -f core try.core core.try.*
19311         case "$fflushNULL" in
19312         x)      $cat >&4 <<EOM
19313 Your fflush(NULL) works okay for output streams.
19314 Let's see if it clobbers input pipes...
19315 EOM
19316 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19317 # bug that improperly flushes the input end of pipes.  So we avoid the
19318 # autoflush on fork/system/exec support for now. :-(
19319 $cat >tryp.c <<EOCP
19320 #include <stdio.h>
19321 int
19322 main(int argc, char **argv)
19323 {
19324     char buf[1024];
19325     int i;
19326     char *bp = buf;
19327     while (1) {
19328         while ((i = getc(stdin)) != -1
19329                && (*bp++ = i) != '\n'
19330                && bp < &buf[1024])
19331         /* DO NOTHING */ ;
19332         *bp = '\0';
19333         fprintf(stdout, "%s", buf);
19334         fflush(NULL);
19335         if (i == -1)
19336             return 0;
19337         bp = buf;
19338     }
19339 }
19340 EOCP
19341                 fflushNULL="$define"
19342                 set tryp
19343                 if eval $compile; then
19344                     $rm -f tryp.out
19345                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19346                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19347                        $cat >&4 <<EOM
19348 fflush(NULL) seems to behave okay with input streams.
19349 EOM
19350                         fflushNULL="$define"
19351                     else
19352                         $cat >&4 <<EOM
19353 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19354 EOM
19355                         fflushNULL="$undef"
19356                     fi
19357                 fi
19358                 $rm -f core tryp.c tryp.core core.tryp.*
19359                 ;;
19360         '')     $cat >&4 <<EOM
19361 Your fflush(NULL) isn't working (contrary to ANSI C).
19362 EOM
19363                 fflushNULL="$undef"
19364                 ;;
19365         *)      $cat >&4 <<EOM
19366 Cannot figure out whether your fflush(NULL) works or not.
19367 I'm assuming it doesn't (contrary to ANSI C).
19368 EOM
19369                 fflushNULL="$undef"
19370                 ;;
19371         esac
19372         ;;
19373 $define|true|[yY]*)
19374         fflushNULL="$define"
19375         ;;
19376 *)
19377         fflushNULL="$undef"
19378         ;;
19379 esac
19380 : check explicit looping only if NULL did not work, and if the pipe
19381 : bug does not show up on an explicit flush too
19382 case "$fflushNULL" in
19383 "$undef")
19384         $cat >tryp.c <<EOCP
19385 #include <stdio.h>
19386 int
19387 main(int argc, char **argv)
19388 {
19389     char buf[1024];
19390     int i;
19391     char *bp = buf;
19392     while (1) {
19393         while ((i = getc(stdin)) != -1
19394                && (*bp++ = i) != '\n'
19395                && bp < &buf[1024])
19396         /* DO NOTHING */ ;
19397         *bp = '\0';
19398         fprintf(stdout, "%s", buf);
19399         fflush(stdin);
19400         if (i == -1)
19401             return 0;
19402         bp = buf;
19403     }
19404 }
19405 EOCP
19406         set tryp
19407         if eval $compile; then
19408             $rm -f tryp.out
19409             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19410             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19411                $cat >&4 <<EOM
19412 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19413 EOM
19414                 : now check for fflushall behaviour
19415                 case "$fflushall" in
19416                 '')     set try -DTRY_FFLUSH_ALL $output
19417                         if eval $compile; then
19418                                 $cat >&4 <<EOM
19419 (Now testing the other method--but note that this also may fail.)
19420 EOM
19421                                 $run ./try 2>/dev/null
19422                                 code=$?
19423                                 $from try.out
19424                                 if $test -s try.out -a "X$code" = X42; then
19425                                         fflushall="`$cat try.out`"
19426                                 fi
19427                         fi
19428                         $rm_try
19429                         case "$fflushall" in
19430                         x)      $cat >&4 <<EOM
19431 Whew. Flushing explicitly all the stdio streams works.
19432 EOM
19433                                 fflushall="$define"
19434                                 ;;
19435                         '')     $cat >&4 <<EOM
19436 Sigh. Flushing explicitly all the stdio streams doesn't work.
19437 EOM
19438                                 fflushall="$undef"
19439                                 ;;
19440                         *)      $cat >&4 <<EOM
19441 Cannot figure out whether flushing stdio streams explicitly works or not.
19442 I'm assuming it doesn't.
19443 EOM
19444                                 fflushall="$undef"
19445                                 ;;
19446                         esac
19447                         ;;
19448                 "$define"|true|[yY]*)
19449                         fflushall="$define"
19450                         ;;
19451                 *)
19452                         fflushall="$undef"
19453                         ;;
19454                 esac
19455             else
19456                 $cat >&4 <<EOM
19457 All is futile.  Even fflush(stdin) clobbers input pipes!
19458 EOM
19459                 fflushall="$undef"
19460             fi
19461         else
19462             fflushall="$undef"
19463         fi
19464         $rm -f core tryp.c tryp.core core.tryp.*
19465         ;;
19466 *)      fflushall="$undef"
19467         ;;
19468 esac
19469
19470 case "$fflushNULL$fflushall" in
19471 undefundef)
19472         $cat <<EOM
19473 OK, I give up.  I cannot figure out how to flush pending stdio output.
19474 We won't be flushing handles at all before fork/exec/popen.
19475 EOM
19476         ;;
19477 esac
19478 $rm_try tryp
19479
19480 : Store the full pathname to the ar program for use in the C program
19481 : Respect a hint or command line value for full_ar.
19482 case "$full_ar" in
19483 '') full_ar=$ar ;;
19484 esac
19485
19486 : Store the full pathname to the sed program for use in the C program
19487 full_sed=$sed
19488
19489 : see what type gids are declared as in the kernel
19490 echo " "
19491 echo "Looking for the type for group ids returned by getgid()."
19492 set gid_t gidtype xxx stdio.h sys/types.h
19493 eval $typedef
19494 case "$gidtype" in
19495 xxx)
19496         xxx=`./findhdr sys/user.h`
19497         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19498         case $1 in
19499         unsigned) dflt="$1 $2" ;;
19500         *) dflt="$1" ;;
19501         esac
19502         ;;
19503 *) dflt="$gidtype";;
19504 esac
19505 case "$gidtype" in
19506 gid_t) echo "gid_t found." ;;
19507 *)      rp="What is the type for group ids returned by getgid()?"
19508         . ./myread
19509         gidtype="$ans"
19510         ;;
19511 esac
19512
19513 : Check the size of GID
19514 echo " "
19515 case "$gidtype" in
19516 *_t) zzz="$gidtype"     ;;
19517 *)   zzz="gid"          ;;
19518 esac
19519 echo "Checking the size of $zzz..." >&4
19520 cat > try.c <<EOCP
19521 #include <sys/types.h>
19522 #include <stdio.h>
19523 #$i_stdlib I_STDLIB
19524 #ifdef I_STDLIB
19525 #include <stdlib.h>
19526 #endif
19527 int main() {
19528     printf("%d\n", (int)sizeof($gidtype));
19529     exit(0);
19530 }
19531 EOCP
19532 set try
19533 if eval $compile_ok; then
19534         yyy=`$run ./try`
19535         case "$yyy" in
19536         '')     gidsize=4
19537                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19538                 ;;
19539         *)      gidsize=$yyy
19540                 echo "Your $zzz is $gidsize bytes long."
19541                 ;;
19542         esac
19543 else
19544         gidsize=4
19545         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19546 fi
19547
19548
19549 : Check if GID is signed
19550 echo " "
19551 case "$gidtype" in
19552 *_t) zzz="$gidtype"     ;;
19553 *)   zzz="gid"          ;;
19554 esac
19555 echo "Checking the sign of $zzz..." >&4
19556 cat > try.c <<EOCP
19557 #include <sys/types.h>
19558 #include <stdio.h>
19559 int main() {
19560         $gidtype foo = -1;
19561         if (foo < 0)
19562                 printf("-1\n");
19563         else
19564                 printf("1\n");
19565 }
19566 EOCP
19567 set try
19568 if eval $compile; then
19569         yyy=`$run ./try`
19570         case "$yyy" in
19571         '')     gidsign=1
19572                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19573                 ;;
19574         *)      gidsign=$yyy
19575                 case "$gidsign" in
19576                  1) echo "Your $zzz is unsigned." ;;
19577                 -1) echo "Your $zzz is signed."   ;;
19578                 esac
19579                 ;;
19580         esac
19581 else
19582         gidsign=1
19583         echo "(I can't compile the test program--guessing unsigned.)" >&4
19584 fi
19585
19586
19587 : Check 64bit sizes
19588 echo " "
19589
19590 if $test X"$quadtype" != X; then
19591
19592 echo "Checking how to print 64-bit integers..." >&4
19593
19594 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19595         $cat >try.c <<'EOCP'
19596 #include <sys/types.h>
19597 #include <stdio.h>
19598 int main() {
19599   int q = 12345678901;
19600   printf("%ld\n", q);
19601 }
19602 EOCP
19603         set try
19604         if eval $compile; then
19605                 yyy=`$run ./try`
19606                 case "$yyy" in
19607                 12345678901)
19608                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19609                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19610                         echo "We will use %d."
19611                         ;;
19612                 esac
19613         fi
19614 fi
19615
19616 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19617         $cat >try.c <<'EOCP'
19618 #include <sys/types.h>
19619 #include <stdio.h>
19620 int main() {
19621   long q = 12345678901;
19622   printf("%ld\n", q);
19623 }
19624 EOCP
19625         set try
19626         if eval $compile; then
19627                 yyy=`$run ./try`
19628                 case "$yyy" in
19629                 12345678901)
19630                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19631                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19632                         echo "We will use %ld."
19633                         ;;
19634                 esac
19635         fi
19636 fi
19637
19638 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19639         $cat >try.c <<'EOCP'
19640 #include <sys/types.h>
19641 #include <inttypes.h>
19642 #include <stdio.h>
19643 int main() {
19644   int64_t q = 12345678901;
19645   printf("%" PRId64 "\n", q);
19646 }
19647 EOCP
19648         set try
19649         if eval $compile; then
19650                 yyy=`$run ./try`
19651                 case "$yyy" in
19652                 12345678901)
19653                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19654                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19655                         echo "We will use the C9X style."
19656                         ;;
19657                 esac
19658         fi
19659 fi
19660
19661 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19662         $cat >try.c <<EOCP
19663 #include <sys/types.h>
19664 #include <stdio.h>
19665 int main() {
19666   $quadtype q = 12345678901;
19667   printf("%Ld\n", q);
19668 }
19669 EOCP
19670         set try
19671         if eval $compile; then
19672                 yyy=`$run ./try`
19673                 case "$yyy" in
19674                 12345678901)
19675                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19676                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19677                         echo "We will use %Ld."
19678                         ;;
19679                 esac
19680         fi
19681 fi
19682
19683 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19684         $cat >try.c <<'EOCP'
19685 #include <sys/types.h>
19686 #include <stdio.h>
19687 int main() {
19688   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19689   printf("%lld\n", q);
19690 }
19691 EOCP
19692         set try
19693         if eval $compile; then
19694                 yyy=`$run ./try`
19695                 case "$yyy" in
19696                 12345678901)
19697                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19698                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19699                         echo "We will use the %lld style."
19700                         ;;
19701                 esac
19702         fi
19703 fi
19704
19705 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19706         $cat >try.c <<EOCP
19707 #include <sys/types.h>
19708 #include <stdio.h>
19709 int main() {
19710   $quadtype q = 12345678901;
19711   printf("%qd\n", q);
19712 }
19713 EOCP
19714         set try
19715         if eval $compile; then
19716                 yyy=`$run ./try`
19717                 case "$yyy" in
19718                 12345678901)
19719                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19720                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19721                         echo "We will use %qd."
19722                         ;;
19723                 esac
19724         fi
19725 fi
19726
19727 if $test X"$sPRId64" = X; then
19728         echo "Cannot figure out how to print 64-bit integers." >&4
19729 fi
19730 $rm_try
19731
19732 fi
19733
19734 case "$sPRId64" in
19735 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19736         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19737         ;;
19738 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19739         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19740         ;;
19741 esac
19742
19743 : Check format strings for internal types
19744 echo " "
19745 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19746
19747 if $test X"$ivsize" = X8; then
19748         ivdformat="$sPRId64"
19749         uvuformat="$sPRIu64"
19750         uvoformat="$sPRIo64"
19751         uvxformat="$sPRIx64"
19752         uvXUformat="$sPRIXU64"
19753 else
19754         if $test X"$ivsize" = X"$longsize"; then
19755                 ivdformat='"ld"'
19756                 uvuformat='"lu"'
19757                 uvoformat='"lo"'
19758                 uvxformat='"lx"'
19759                 uvXUformat='"lX"'
19760         else
19761                 if $test X"$ivsize" = X"$intsize"; then
19762                         ivdformat='"d"'
19763                         uvuformat='"u"'
19764                         uvoformat='"o"'
19765                         uvxformat='"x"'
19766                         uvXUformat='"X"'
19767                 else
19768                         : far out
19769                         if $test X"$ivsize" = X"$shortsize"; then
19770                                 ivdformat='"hd"'
19771                                 uvuformat='"hu"'
19772                                 uvoformat='"ho"'
19773                                 uvxformat='"hx"'
19774                                 uvXUformat='"hX"'
19775                         fi
19776                 fi
19777         fi
19778 fi
19779
19780 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19781         nveformat="$sPRIeldbl"
19782         nvfformat="$sPRIfldbl"
19783         nvgformat="$sPRIgldbl"
19784         nvEUformat="$sPRIEUldbl"
19785         nvFUformat="$sPRIFUldbl"
19786         nvGUformat="$sPRIGUldbl"
19787 else
19788         nveformat='"e"'
19789         nvfformat='"f"'
19790         nvgformat='"g"'
19791         nvEUformat='"E"'
19792         nvFUformat='"F"'
19793         nvGUformat='"G"'
19794 fi
19795
19796 case "$ivdformat" in
19797 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19798     exit 1
19799     ;;
19800 esac
19801
19802 : Check format string for GID
19803
19804 echo " "
19805 $echo "Checking the format string to be used for gids..." >&4
19806
19807 case "$gidsign" in
19808 -1)     if $test X"$gidsize" = X"$ivsize"; then
19809                 gidformat="$ivdformat"
19810         else
19811                 if $test X"$gidsize" = X"$longsize"; then
19812                         gidformat='"ld"'
19813                 else
19814                         if $test X"$gidsize" = X"$intsize"; then
19815                                 gidformat='"d"'
19816                         else
19817                                 if $test X"$gidsize" = X"$shortsize"; then
19818                                         gidformat='"hd"'
19819                                 fi
19820                         fi
19821                 fi
19822         fi
19823         ;;
19824 *)      if $test X"$gidsize" = X"$uvsize"; then
19825                 gidformat="$uvuformat"
19826         else
19827                 if $test X"$gidsize" = X"$longsize"; then
19828                         gidformat='"lu"'
19829                 else
19830                         if $test X"$gidsize" = X"$intsize"; then
19831                                 gidformat='"u"'
19832                         else
19833                                 if $test X"$gidsize" = X"$shortsize"; then
19834                                         gidformat='"hu"'
19835                                 fi
19836                         fi
19837                 fi
19838         fi
19839         ;;
19840 esac
19841
19842 : see if getgroups exists
19843 set getgroups d_getgrps
19844 eval $inlibc
19845
19846 : see if setgroups exists
19847 set setgroups d_setgrps
19848 eval $inlibc
19849
19850 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19851 echo " "
19852 case "$d_getgrps$d_setgrps" in
19853 *define*)
19854         case "$groupstype" in
19855         '') dflt="$gidtype" ;;
19856         *)  dflt="$groupstype" ;;
19857         esac
19858         $cat <<EOM
19859 What type of pointer is the second argument to getgroups() and setgroups()?
19860 Usually this is the same as group ids, $gidtype, but not always.
19861
19862 EOM
19863         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19864         . ./myread
19865         groupstype="$ans"
19866         ;;
19867 *)  groupstype="$gidtype";;
19868 esac
19869
19870 : MAD = Misc Attribute Definition
19871
19872 if $test $patchlevel -lt 9; then
19873 : MAD is not available in 5.8.x or earlier.
19874     ans=n;
19875 else
19876     case "$mad" in
19877     $define|true|[yY]*) dflt='y' ;;
19878     *)                  dflt='n' ;;
19879     esac
19880     cat <<EOM
19881
19882 Would you like to build with Misc Attribute Decoration? This is development
19883 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19884 overhead on the interpreter.
19885
19886 If this doesn't make any sense to you, just accept the default '$dflt'.
19887 EOM
19888     rp='Build Perl with MAD?'
19889     . ./myread
19890 fi
19891 case "$ans" in
19892 y|Y)    val="$define"
19893         madlyh='madly.h madly.act madly.tab'
19894         madlysrc='madly.c'
19895         madlyobj="madly$_o" ;;
19896 *)      val="$undef"
19897         madlyh=''
19898         madlysrc=''
19899         madlyobj='' ;;
19900 esac
19901 set mad
19902 eval $setvar
19903
19904 : check whether make sets MAKE
19905 echo " "
19906 echo "Checking if your $make program sets \$(MAKE)..." >&4
19907 case "$make_set_make" in
19908 '')
19909         $sed 's/^X //' > testmake.mak << 'EOF'
19910 Xall:
19911 X       @echo 'maketemp="$(MAKE)"'
19912 EOF
19913         case "`$make -f testmake.mak 2>/dev/null`" in
19914         *maketemp=*) make_set_make='#' ;;
19915         *)      make_set_make="MAKE=$make" ;;
19916         esac
19917         $rm -f testmake.mak
19918         ;;
19919 esac
19920 case "$make_set_make" in
19921 '#') echo "Yup, it does.";;
19922 *) echo "Nope, it doesn't.";;
19923 esac
19924
19925 : see what type is used for mode_t
19926 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19927 set mode_t modetype int stdio.h sys/types.h
19928 eval $typedef_ask
19929
19930 : see if we need va_copy
19931 echo " "
19932 case "$i_stdarg" in
19933 "$define")
19934         $cat >try.c <<EOCP
19935 #include <stdarg.h>
19936 #include <stdio.h>
19937 #$i_stdlib I_STDLIB
19938 #ifdef I_STDLIB
19939 #include <stdlib.h>
19940 #endif
19941 #include <signal.h>
19942
19943 int
19944 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19945 {
19946   return vfprintf(f, fmt, *valp);
19947 }
19948
19949 int
19950 myvfprintf(FILE *f, const  char *fmt, va_list val)
19951 {
19952   return ivfprintf(f, fmt, &val);
19953 }
19954
19955 int
19956 myprintf(char *fmt, ...)
19957 {
19958   va_list val;
19959   va_start(val, fmt);
19960   return myvfprintf(stdout, fmt, val);
19961 }
19962
19963 int
19964 main(int ac, char **av)
19965 {
19966   signal(SIGSEGV, exit);
19967
19968   myprintf("%s%cs all right, then\n", "that", '\'');
19969   exit(0);
19970 }
19971 EOCP
19972         set try
19973         if eval $compile && $run ./try 2>&1 >/dev/null; then
19974                 case "`$run ./try`" in
19975                 "that's all right, then")
19976                         okay=yes
19977                         ;;
19978                 esac
19979         fi
19980         case "$okay" in
19981         yes)    echo "It seems that you don't need va_copy()." >&4
19982                 need_va_copy="$undef"
19983                 ;;
19984         *)      echo "It seems that va_copy() or similar will be needed." >&4
19985                 need_va_copy="$define"
19986                 ;;
19987         esac
19988         $rm_try
19989         ;;
19990 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19991         ;;
19992 esac
19993
19994 : see what type is used for size_t
19995 rp="What is the type used for the length parameter for string functions?"
19996 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19997 eval $typedef_ask
19998
19999 : check for type of arguments to gethostbyaddr. 
20000 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20001         case "$d_gethbyaddr" in
20002         $define)
20003                 $cat <<EOM
20004
20005 Checking to see what type of arguments are accepted by gethostbyaddr().
20006 EOM
20007                 hdrs="$define sys/types.h
20008                         $d_socket sys/socket.h 
20009                         $i_niin netinet/in.h 
20010                         $i_netdb netdb.h
20011                         $i_unistd unistd.h"
20012                 : The first arg can 'char *' or 'void *'
20013                 : The second arg is some of integral type
20014                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20015                         for yyy in size_t long int; do
20016                                 case "$netdb_host_type" in
20017                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20018                                         if ./protochk "$try" $hdrs; then
20019                                                 echo "Your system accepts $xxx for the first arg."
20020                                                 echo "...and $yyy for the second arg."
20021                                                 netdb_host_type="$xxx"
20022                                                 netdb_hlen_type="$yyy"
20023                                         fi
20024                                         ;;
20025                                 esac
20026                         done
20027                 done
20028                 : In case none of those worked, prompt the user.
20029                 case "$netdb_host_type" in
20030                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20031                         dflt='char *'
20032                         . ./myread
20033                         netdb_host_type=$ans
20034                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20035                         dflt="$sizetype"
20036                         . ./myread
20037                         netdb_hlen_type=$ans
20038                         ;;
20039                 esac
20040                 ;;
20041         *)      : no gethostbyaddr, so pick harmless defaults
20042                 netdb_host_type='char *'
20043                 netdb_hlen_type="$sizetype"
20044                 ;;
20045         esac
20046         # Remove the "const" if needed. -- but then we'll have a 
20047         # prototype clash!
20048         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20049 fi
20050
20051 : check for type of argument to gethostbyname. 
20052 if test "X$netdb_name_type" = X ; then
20053         case "$d_gethbyname" in
20054         $define)
20055                 $cat <<EOM
20056
20057 Checking to see what type of argument is accepted by gethostbyname().
20058 EOM
20059                 hdrs="$define sys/types.h
20060                         $d_socket sys/socket.h 
20061                         $i_niin netinet/in.h 
20062                         $i_netdb netdb.h
20063                         $i_unistd unistd.h"
20064                 for xxx in "const char *" "char *"; do
20065                         case "$netdb_name_type" in
20066                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20067                                 if ./protochk "$try" $hdrs; then
20068                                         echo "Your system accepts $xxx."
20069                                         netdb_name_type="$xxx"
20070                                 fi
20071                                 ;;
20072                         esac
20073                 done
20074                 : In case none of those worked, prompt the user.
20075                 case "$netdb_name_type" in
20076                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20077                         dflt='char *'
20078                         . ./myread
20079                         netdb_name_type=$ans
20080                         ;;
20081                 esac
20082                 ;;
20083         *)      : no gethostbyname, so pick harmless default
20084                 netdb_name_type='char *'
20085                 ;;
20086         esac
20087 fi
20088
20089 : check for type of 1st argument to getnetbyaddr. 
20090 if test "X$netdb_net_type" = X ; then
20091         case "$d_getnbyaddr" in
20092         $define)
20093                 $cat <<EOM
20094
20095 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20096 EOM
20097                 hdrs="$define sys/types.h
20098                         $d_socket sys/socket.h 
20099                         $i_niin netinet/in.h 
20100                         $i_netdb netdb.h
20101                         $i_unistd unistd.h"
20102                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20103                         case "$netdb_net_type" in
20104                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20105                                 if ./protochk "$try" $hdrs; then
20106                                         echo "Your system accepts $xxx."
20107                                         netdb_net_type="$xxx"
20108                                 fi
20109                                 ;;
20110                         esac
20111                 done
20112                 : In case none of those worked, prompt the user.
20113                 case "$netdb_net_type" in
20114                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20115                         dflt='long'
20116                         . ./myread
20117                         netdb_net_type=$ans
20118                         ;;
20119                 esac
20120                 ;;
20121         *)      : no getnetbyaddr, so pick harmless default
20122                 netdb_net_type='long'
20123                 ;;
20124         esac
20125 fi
20126 : locate the preferred pager for this system
20127 fn=f/
20128 case "$pager" in
20129 '')
20130         dflt=''
20131         case "$pg" in
20132         /*) dflt=$pg;;
20133         [a-zA-Z]:/*) dflt=$pg;;
20134         esac
20135         case "$more" in
20136         /*) dflt=$more;;
20137         [a-zA-Z]:/*) dflt=$more;;
20138         esac
20139         case "$less" in
20140         /*) dflt=$less;;
20141         [a-zA-Z]:/*) dflt=$less;;
20142         esac
20143         case "$dflt" in
20144         '') dflt=/usr/ucb/more;;
20145         esac
20146         ;;
20147 *)      dflt="$pager"
20148         fn="f/($pager)"
20149         ;;
20150 esac
20151 echo " "
20152 rp='What pager is used on your system?'
20153 . ./getfile
20154 pager="$ans"
20155
20156 : see what type pids are declared as in the kernel
20157 rp="What is the type of process ids on this system?"
20158 set pid_t pidtype int stdio.h sys/types.h
20159 eval $typedef_ask
20160
20161 : see if ar generates random libraries by itself
20162 echo " "
20163 echo "Checking how to generate random libraries on your machine..." >&4
20164 echo 'int bar1() { return bar2(); }' > bar1.c
20165 echo 'int bar2() { return 2; }' > bar2.c
20166 $cat > foo.c <<EOP
20167 #$i_stdlib I_STDLIB
20168 #ifdef I_STDLIB
20169 #include <stdlib.h>
20170 #endif
20171 int main() { printf("%d\n", bar1()); exit(0); }
20172 EOP
20173 $cc $ccflags -c bar1.c >/dev/null 2>&1
20174 $cc $ccflags -c bar2.c >/dev/null 2>&1
20175 $cc $ccflags -c foo.c >/dev/null 2>&1
20176 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20177 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20178         $run ./foobar >/dev/null 2>&1; then
20179         echo "$ar appears to generate random libraries itself."
20180         orderlib=false
20181         if [ "X$ranlib" = "X" ]; then
20182             ranlib=":"
20183         fi
20184 elif $ar s bar$_a >/dev/null 2>&1 &&
20185         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20186         $run ./foobar >/dev/null 2>&1; then
20187                 echo "a table of contents needs to be added with '$ar s'."
20188                 orderlib=false
20189                 ranlib="$ar s"
20190 elif $ar ts bar$_a >/dev/null 2>&1 &&
20191         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20192         $run ./foobar >/dev/null 2>&1; then
20193                 echo "a table of contents needs to be added with '$ar ts'."
20194                 orderlib=false
20195                 ranlib="$ar ts"
20196 else
20197         case "$ranlib" in
20198         :) ranlib='';;
20199         '')
20200                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20201                 $test -f $ranlib || ranlib=''
20202                 ;;
20203         esac
20204         if $test -n "$ranlib"; then
20205                 echo "your system has '$ranlib'; we'll use that."
20206                 orderlib=false
20207         else
20208                 echo "your system doesn't seem to support random libraries"
20209                 echo "so we'll use lorder and tsort to order the libraries."
20210                 orderlib=true
20211                 ranlib=":"
20212         fi
20213 fi
20214 $rm -f foo* bar*
20215
20216 : see if this is a values.h system
20217 set values.h i_values
20218 eval $inhdr
20219
20220 : Check the max offset that gmtime and localtime accept
20221 echo "Checking max offsets that gmtime () accepts"
20222
20223 case $i_values in
20224     define) yyy="#include <values.h>" ;;
20225     *)      yyy="" ;;
20226     esac
20227
20228 case "$sGMTIME_min/$sGMTIME_max" in
20229     0/0|/)
20230         $cat >try.c <<EOCP
20231 #include <sys/types.h>
20232 #include <stdio.h>
20233 #include <time.h>
20234 $yyy
20235
20236 int i;
20237 struct tm *tmp;
20238 time_t pt;
20239
20240 void gm_check (time_t t, int min_year, int max_year)
20241 {
20242     tmp = gmtime (&t);
20243     if ( tmp == NULL ||
20244         /* Check tm_year overflow */
20245          tmp->tm_year < min_year || tmp->tm_year > max_year)
20246         tmp = NULL;
20247     else
20248         pt = t;
20249     } /* gm_check */
20250
20251 int check_max ()
20252 {
20253     tmp = NULL;
20254     pt  = 0;
20255 #ifdef MAXLONG
20256     gm_check (MAXLONG, 69, 0x7fffffff);
20257 #endif
20258     if (tmp == NULL || tmp->tm_year < 0) {
20259         for (i = 63; i >= 0; i--) {
20260             time_t x = pt | ((time_t)1 << i);
20261             if (x < 0 || x < pt) continue;
20262             gm_check (x, 69, 0x7fffffff);
20263             }
20264         }
20265     printf ("sGMTIME_max=%ld\n", pt);
20266     return (0);
20267     } /* check_max */
20268
20269 int check_min ()
20270 {
20271     tmp = NULL;
20272     pt  = 0;
20273 #ifdef MINLONG
20274     gm_check (MINLONG, -1900, 70);
20275 #endif
20276     if (tmp == NULL) {
20277         for (i = 36; i >= 0; i--) {
20278             time_t x = pt - ((time_t)1 << i);
20279             if (x > 0) continue;
20280             gm_check (x, -1900, 70);
20281             }
20282         }
20283     printf ("sGMTIME_min=%ld\n", pt);
20284     return (0);
20285     } /* check_min */
20286
20287 int main (int argc, char *argv[])
20288 {
20289     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20290     check_max ();
20291     check_min ();
20292     return (0);
20293     } /* main */
20294 EOCP
20295         set try
20296         if eval $compile; then
20297             eval `$run ./try`
20298         else
20299             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20300             fi
20301         $rm_try
20302         ;;
20303     esac
20304
20305 echo "Checking max offsets that localtime () accepts"
20306
20307 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20308     0/0|/)
20309         $cat >try.c <<EOCP
20310 #include <sys/types.h>
20311 #include <stdio.h>
20312 #include <time.h>
20313 $yyy
20314
20315 int i;
20316 struct tm *tmp;
20317 time_t pt;
20318
20319 void local_check (time_t t, int min_year, int max_year)
20320 {
20321     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20322         tmp = NULL;
20323     else
20324         tmp = localtime (&t);
20325     if ( tmp == NULL ||
20326         /* Check tm_year overflow */
20327          tmp->tm_year < min_year || tmp->tm_year > max_year)
20328         tmp = NULL;
20329     else
20330         pt = t;
20331     } /* local_check */
20332
20333 int check_max ()
20334 {
20335     tmp = NULL;
20336     pt  = 0;
20337 #ifdef MAXLONG
20338     local_check (MAXLONG, 69, 0x7fffffff);
20339 #endif
20340     if (tmp == NULL || tmp->tm_year < 0) {
20341         for (i = 63; i >= 0; i--) {
20342             time_t x = pt | ((time_t)1 << i);
20343             if (x < 0 || x < pt) continue;
20344             local_check (x, 69, 0x7fffffff);
20345             }
20346         }
20347     printf ("sLOCALTIME_max=%ld\n", pt);
20348     return (0);
20349    } /* check_max */
20350
20351 int check_min ()
20352 {
20353     tmp = NULL;
20354     pt  = 0;
20355 #ifdef MINLONG
20356     local_check (MINLONG, -1900, 70);
20357 #endif
20358     if (tmp == NULL) {
20359         for (i = 36; i >= 0; i--) {
20360             time_t x = pt - ((time_t)1 << i);
20361             if (x > 0) continue;
20362             local_check (x, -1900, 70);
20363             }
20364         }
20365     printf ("sLOCALTIME_min=%ld\n", pt);
20366     return (0);
20367     } /* check_min */
20368
20369 int main (int argc, char *argv[])
20370 {
20371     check_max ();
20372     check_min ();
20373     return (0);
20374     } /* main */
20375 EOCP
20376         set try
20377         if eval $compile; then
20378             eval `$run ./try`
20379         else
20380             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20381             fi
20382         $rm_try
20383         ;;
20384     esac
20385
20386 : check for type of arguments to select.
20387 case "$selecttype" in
20388 '') case "$d_select" in
20389         $define)
20390                 echo " "
20391                 $cat <<EOM
20392 Checking to see what type of arguments are accepted by select().
20393 EOM
20394                 hdrs="$define sys/types.h
20395                         $i_systime sys/time.h
20396                         $i_sysselct sys/select.h
20397                         $d_socket sys/socket.h"
20398                 : The first arg can be int, unsigned, or size_t
20399                 : The last arg may or may not be 'const'
20400                 val=''
20401                 : void pointer has been seen but using that
20402                 : breaks the selectminbits test
20403                 for xxx in 'fd_set *' 'int *'; do
20404                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20405                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20406                                         case "$val" in
20407                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20408                                                 if ./protochk "$try" $hdrs; then
20409                                                         echo "Your system accepts $xxx."
20410                                                         val="$xxx"
20411                                                 fi
20412                                                 ;;
20413                                         esac
20414                                 done
20415                         done
20416                 done
20417                 case "$val" in
20418                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20419                         case "$d_fd_set" in
20420                                 $define) dflt="fd_set *" ;;
20421                                 *)              dflt="int *" ;;
20422                         esac
20423                         . ./myread
20424                         val=$ans
20425                         ;;
20426                 esac
20427                 selecttype="$val"
20428                 ;;
20429         *)      : no select, so pick a harmless default
20430                 selecttype='int *'
20431                 ;;
20432         esac
20433         ;;
20434 esac
20435
20436 : check for the select 'width'
20437 case "$selectminbits" in
20438 '') safebits=`expr $ptrsize \* 8`
20439     case "$d_select" in
20440         $define)
20441                 $cat <<EOM
20442
20443 Checking to see on how many bits at a time your select() operates...
20444 EOM
20445                 $cat >try.c <<EOCP
20446 #include <sys/types.h>
20447 #$i_time I_TIME
20448 #$i_systime I_SYS_TIME
20449 #$i_systimek I_SYS_TIME_KERNEL
20450 #ifdef I_TIME
20451 #   include <time.h>
20452 #endif
20453 #ifdef I_SYS_TIME
20454 #   ifdef I_SYS_TIME_KERNEL
20455 #       define KERNEL
20456 #   endif
20457 #   include <sys/time.h>
20458 #   ifdef I_SYS_TIME_KERNEL
20459 #       undef KERNEL
20460 #   endif
20461 #endif
20462 #$i_sysselct I_SYS_SELECT
20463 #ifdef I_SYS_SELECT
20464 #include <sys/select.h>
20465 #endif
20466 #$d_socket HAS_SOCKET
20467 #ifdef HAS_SOCKET
20468 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20469 #endif
20470 #include <stdio.h>
20471 #$i_stdlib I_STDLIB
20472 #ifdef I_STDLIB
20473 #include <stdlib.h>
20474 #endif
20475 $selecttype b;
20476 #define S sizeof(*(b))
20477 #define MINBITS 64
20478 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20479 #define NBITS  (NBYTES * 8)
20480 int main() {
20481     char *s = (char *)malloc(NBYTES);
20482     struct timeval t;
20483     int i;
20484     FILE* fp;
20485     int fd;
20486
20487     if (!s)
20488         exit(1);
20489     fclose(stdin);
20490     fp = fopen("try.c", "r");
20491     if (fp == 0)
20492       exit(2);
20493     fd = fileno(fp);
20494     if (fd < 0)
20495       exit(3);
20496     b = ($selecttype)s;
20497     for (i = 0; i < NBITS; i++)
20498         FD_SET(i, b);
20499     t.tv_sec  = 0;
20500     t.tv_usec = 0;
20501     select(fd + 1, b, 0, 0, &t);
20502     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20503     free(s);
20504     printf("%d\n", i + 1);
20505     return 0;
20506 }
20507 EOCP
20508                 set try
20509                 if eval $compile_ok; then
20510                         selectminbits=`$run ./try`
20511                         case "$selectminbits" in
20512                         '')     cat >&4 <<EOM
20513 Cannot figure out on how many bits at a time your select() operates.
20514 I'll play safe and guess it is $safebits bits.
20515 EOM
20516                                 selectminbits=$safebits
20517                                 bits="$safebits bits"
20518                                 ;;
20519                         1)      bits="1 bit" ;;
20520                         *)      bits="$selectminbits bits" ;;
20521                         esac
20522                         echo "Your select() operates on $bits at a time." >&4
20523                 else
20524                         rp='What is the minimum number of bits your select() operates on?'
20525                         case "$byteorder" in
20526                         12345678)       dflt=64 ;;
20527                         1234)           dflt=32 ;;
20528                         *)              dflt=1  ;;
20529                         esac
20530                         . ./myread
20531                         val=$ans
20532                         selectminbits="$val"
20533                 fi
20534                 $rm_try
20535                 ;;
20536         *)      : no select, so pick a harmless default
20537                 selectminbits=$safebits
20538                 ;;
20539         esac
20540         ;;
20541 esac
20542
20543 : Trace out the files included by signal.h, then look for SIGxxx names.
20544 if [ "X$fieldn" = X ]; then
20545         : Just make some guesses.  We check them later.
20546         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20547 else
20548         xxx=`echo '#include <signal.h>' |
20549         $cppstdin $cppminus $cppflags 2>/dev/null |
20550         $grep '^[       ]*#.*include' |
20551         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20552                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20553 fi
20554 xxxfiles=''
20555 for xx in $xxx /dev/null ; do
20556         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20557 done
20558 case "$xxxfiles" in
20559 '')     xxxfiles=`./findhdr signal.h` ;;
20560 esac
20561 xxx=`awk '
20562 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20563         print substr($2, 4, 20)
20564 }
20565 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20566         print substr($3, 4, 20)
20567 }' $xxxfiles`
20568 : Append some common names just in case the awk scan failed.
20569 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20570 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20571 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20572 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20573 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20574
20575 : generate a few handy files for later
20576 $cat > signal.c <<EOCP
20577 #include <sys/types.h>
20578 #include <signal.h>
20579 #$i_stdlib I_STDLIB
20580 #ifdef I_STDLIB
20581 #include <stdlib.h>
20582 #endif
20583 #include <stdio.h>
20584 int main() {
20585
20586 /* Strange style to avoid deeply-nested #if/#else/#endif */
20587 #ifndef NSIG
20588 #  ifdef _NSIG
20589 #    define NSIG (_NSIG)
20590 #  endif
20591 #endif
20592
20593 #ifndef NSIG
20594 #  ifdef SIGMAX
20595 #    define NSIG (SIGMAX+1)
20596 #  endif
20597 #endif
20598
20599 #ifndef NSIG
20600 #  ifdef SIG_MAX
20601 #    define NSIG (SIG_MAX+1)
20602 #  endif
20603 #endif
20604
20605 #ifndef NSIG
20606 #  ifdef _SIG_MAX
20607 #    define NSIG (_SIG_MAX+1)
20608 #  endif
20609 #endif
20610
20611 #ifndef NSIG
20612 #  ifdef MAXSIG
20613 #    define NSIG (MAXSIG+1)
20614 #  endif
20615 #endif
20616
20617 #ifndef NSIG
20618 #  ifdef MAX_SIG
20619 #    define NSIG (MAX_SIG+1)
20620 #  endif
20621 #endif
20622
20623 #ifndef NSIG
20624 #  ifdef SIGARRAYSIZE
20625 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20626 #  endif
20627 #endif
20628
20629 #ifndef NSIG
20630 #  ifdef _sys_nsig
20631 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20632 #  endif
20633 #endif
20634
20635 /* Default to some arbitrary number that's big enough to get most
20636    of the common signals.
20637 */
20638 #ifndef NSIG
20639 #    define NSIG 50
20640 #endif
20641
20642 printf("NSIG %d\n", NSIG);
20643
20644 #ifndef JUST_NSIG
20645
20646 EOCP
20647
20648 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20649 {
20650         printf "#ifdef SIG"; printf $1; printf "\n"
20651         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20652         printf $1; printf ");\n"
20653         printf "#endif\n"
20654 }
20655 END {
20656         printf "#endif /* JUST_NSIG */\n";
20657         printf "exit(0);\n}\n";
20658 }
20659 ' >>signal.c
20660 $cat >signal.awk <<'EOP'
20661 BEGIN { ndups = 0 }
20662 $1 ~ /^NSIG$/ { nsig = $2 }
20663 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20664     if ($2 > maxsig) { maxsig = $2 }
20665     if (sig_name[$2]) {
20666         dup_name[ndups] = $1
20667         dup_num[ndups] = $2
20668         ndups++
20669     }
20670     else {
20671         sig_name[$2] = $1
20672         sig_num[$2] = $2
20673     }
20674 }
20675 END {
20676     if (nsig == 0) {
20677         nsig = maxsig + 1
20678     }
20679     printf("NSIG %d\n", nsig);
20680     for (n = 1; n < nsig; n++) {
20681         if (sig_name[n]) {
20682             printf("%s %d\n", sig_name[n], sig_num[n])
20683         }
20684         else {
20685             printf("NUM%d %d\n", n, n)
20686         }
20687     }
20688     for (n = 0; n < ndups; n++) {
20689         printf("%s %d\n", dup_name[n], dup_num[n])
20690     }
20691 }
20692 EOP
20693 $cat >signal_cmd <<EOS
20694 $startsh
20695 if $test -s signal.lst; then
20696     echo "Using your existing signal.lst file"
20697         exit 0
20698 fi
20699 xxx="$xxx"
20700 EOS
20701 $cat >>signal_cmd <<'EOS'
20702
20703 set signal
20704 if eval $compile_ok; then
20705         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20706                 $uniq | $awk -f signal.awk >signal.lst
20707 else
20708         echo "(I can't seem be able to compile the whole test program)" >&4
20709         echo "(I'll try it in little pieces.)" >&4
20710         set signal -DJUST_NSIG
20711         if eval $compile_ok; then
20712                 $run ./signal$_exe > signal.nsg
20713                 $cat signal.nsg
20714         else
20715                 echo "I can't seem to figure out how many signals you have." >&4
20716                 echo "Guessing 50." >&4
20717                 echo 'NSIG 50' > signal.nsg
20718         fi
20719         : Now look at all the signal names, one at a time.
20720         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20721                 $cat > signal.c <<EOCP
20722 #include <sys/types.h>
20723 #include <signal.h>
20724 #include <stdio.h>
20725 int main() {
20726 printf("$xx %d\n", SIG${xx});
20727 return 0;
20728 }
20729 EOCP
20730                 set signal
20731                 if eval $compile; then
20732                         echo "SIG${xx} found."
20733                         $run ./signal$_exe  >> signal.ls1
20734                 else
20735                         echo "SIG${xx} NOT found."
20736                 fi
20737         done
20738         if $test -s signal.ls1; then
20739                 $cat signal.nsg signal.ls1 |
20740                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20741         fi
20742
20743 fi
20744 if $test -s signal.lst; then
20745         :
20746 else
20747         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20748         echo 'kill -l' >signal
20749         set X `csh -f <signal`
20750         $rm -f signal
20751         shift
20752         case $# in
20753         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20754         esac
20755         echo $@ | $tr ' ' $trnl | \
20756             $awk '{ printf "%s %d\n", $1, ++s; }
20757                   END { printf "NSIG %d\n", ++s }' >signal.lst
20758 fi
20759 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20760 EOS
20761 chmod a+x signal_cmd
20762 $eunicefix signal_cmd
20763
20764 : generate list of signal names
20765 echo " "
20766 case "$sig_name_init" in
20767 '') doinit=yes ;;
20768 *)  case "$sig_num_init" in
20769     ''|*,*) doinit=yes ;;
20770     esac ;;
20771 esac
20772 case "$doinit" in
20773 yes)
20774         echo "Generating a list of signal names and numbers..." >&4
20775         . ./signal_cmd
20776         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20777         sig_name=`$awk 'BEGIN { printf "ZERO " }
20778                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20779         sig_num=`$awk  'BEGIN { printf "0 " }
20780                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20781         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20782                              !/^NSIG/   { printf "\"%s\", ", $1 }
20783                              END        { printf "0\n" }' signal.lst`
20784         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20785                              !/^NSIG/   { printf "%d, ", $2}
20786                              END        { printf "0\n"}' signal.lst`
20787         ;;
20788 esac
20789 echo "The following $sig_count signals are available:"
20790 echo " "
20791 echo $sig_name | $awk \
20792 'BEGIN { linelen = 0 }
20793 {
20794         for (i = 1; i <= NF; i++) {
20795                 name = "SIG" $i " "
20796                 linelen = linelen + length(name)
20797                 if (linelen > 70) {
20798                         printf "\n"
20799                         linelen = length(name)
20800                 }
20801                 printf "%s", name
20802         }
20803         printf "\n"
20804 }'
20805 sig_size=`echo $sig_name | awk '{print NF}'`
20806 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20807
20808 : Check size of size
20809 echo " "
20810 case "$sizetype" in
20811 *_t) zzz="$sizetype"    ;;
20812 *)   zzz="filesize"     ;;
20813 esac
20814 echo "Checking the size of $zzz..." >&4
20815 cat > try.c <<EOCP
20816 #include <sys/types.h>
20817 #include <stdio.h>
20818 #$i_stdlib I_STDLIB
20819 #ifdef I_STDLIB
20820 #include <stdlib.h>
20821 #endif
20822 int main() {
20823     printf("%d\n", (int)sizeof($sizetype));
20824     exit(0);
20825 }
20826 EOCP
20827 set try
20828 if eval $compile_ok; then
20829         yyy=`$run ./try`
20830         case "$yyy" in
20831         '')     sizesize=4
20832                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20833                 ;;
20834         *)      sizesize=$yyy
20835                 echo "Your $zzz size is $sizesize bytes."
20836                 ;;
20837         esac
20838 else
20839         sizesize=4
20840         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20841 fi
20842
20843
20844 : check for socklen_t
20845 echo " "
20846 echo "Checking to see if you have socklen_t..." >&4
20847 $cat >try.c <<EOCP
20848 #include <sys/types.h>
20849 #$d_socket HAS_SOCKET
20850 #ifdef HAS_SOCKET
20851 #include <sys/socket.h>
20852 #endif
20853 int main() { socklen_t x = 16; }
20854 EOCP
20855 set try
20856 if eval $compile; then
20857         val="$define"
20858         echo "You have socklen_t."
20859 else
20860         val="$undef"
20861         echo "You do not have socklen_t."
20862         case "$sizetype" in
20863         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20864         esac
20865 fi
20866 $rm_try
20867 set d_socklen_t
20868 eval $setvar
20869
20870 : see if this is a socks.h system
20871 set socks.h i_socks
20872 eval $inhdr
20873
20874 : check for type of the size argument to socket calls
20875 case "$d_socket" in
20876 "$define")
20877         $cat <<EOM
20878
20879 Checking to see what type is the last argument of accept().
20880 EOM
20881         yyy=''
20882         case "$d_socklen_t" in
20883         "$define") yyy="$yyy socklen_t"
20884         esac
20885         yyy="$yyy $sizetype int long unsigned"
20886         for xxx in $yyy; do
20887                 case "$socksizetype" in
20888                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20889                         case "$usesocks" in
20890                         "$define")
20891                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20892                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20893                                         socksizetype="$xxx"
20894                                 fi
20895                                 ;;
20896                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20897                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20898                                         socksizetype="$xxx"
20899                                 fi
20900                                 ;;
20901                         esac
20902                         ;;
20903                 esac
20904         done
20905 : In case none of those worked, prompt the user.
20906         case "$socksizetype" in
20907         '')     rp='What is the type for socket address structure sizes?'
20908                 dflt='int'
20909                 . ./myread
20910                 socksizetype=$ans
20911                 ;;
20912         esac
20913         ;;
20914 *)      : no sockets, so pick relatively harmless default
20915         socksizetype='int'
20916         ;;
20917 esac
20918
20919 : see what type is used for signed size_t
20920 set ssize_t ssizetype int stdio.h sys/types.h
20921 eval $typedef
20922 dflt="$ssizetype"
20923 $cat > try.c <<EOM
20924 #include <stdio.h>
20925 #$i_stdlib I_STDLIB
20926 #ifdef I_STDLIB
20927 #include <stdlib.h>
20928 #endif
20929 #include <sys/types.h>
20930 #define Size_t $sizetype
20931 #define SSize_t $dflt
20932 int main()
20933 {
20934         if (sizeof(Size_t) == sizeof(SSize_t))
20935                 printf("$dflt\n");
20936         else if (sizeof(Size_t) == sizeof(int))
20937                 printf("int\n");
20938         else
20939                 printf("long\n");
20940         exit(0);
20941 }
20942 EOM
20943 echo " "
20944 set try
20945 if eval $compile_ok && $run ./try > /dev/null; then
20946         ssizetype=`$run ./try`
20947         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20948 else
20949         $cat >&4 <<EOM
20950 Help! I can't compile and run the ssize_t test program: please enlighten me!
20951 (This is probably a misconfiguration in your system or libraries, and
20952 you really ought to fix it.  Still, I'll try anyway.)
20953
20954 I need a type that is the same size as $sizetype, but is guaranteed to
20955 be signed.  Common values are ssize_t, int and long.
20956
20957 EOM
20958         rp="What signed type is the same size as $sizetype?"
20959         . ./myread
20960         ssizetype="$ans"
20961 fi
20962 $rm_try
20963
20964 : see what type of char stdio uses.
20965 echo " "
20966 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20967 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20968         echo "Your stdio uses unsigned chars." >&4
20969         stdchar="unsigned char"
20970 else
20971         echo "Your stdio uses signed chars." >&4
20972         stdchar="char"
20973 fi
20974 $rm -f stdioh
20975
20976 : see what type uids are declared as in the kernel
20977 echo " "
20978 echo "Looking for the type for user ids returned by getuid()."
20979 set uid_t uidtype xxx stdio.h sys/types.h
20980 eval $typedef
20981 case "$uidtype" in
20982 xxx)
20983         xxx=`./findhdr sys/user.h`
20984         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20985         case $1 in
20986         unsigned) dflt="$1 $2" ;;
20987         *) dflt="$1" ;;
20988         esac
20989         ;;
20990 *) dflt="$uidtype";;
20991 esac
20992 case "$uidtype" in
20993 uid_t)  echo "uid_t found." ;;
20994 *)      rp="What is the type for user ids returned by getuid()?"
20995         . ./myread
20996         uidtype="$ans"
20997         ;;
20998 esac
20999
21000 : Check size of UID
21001 echo " "
21002 case "$uidtype" in
21003 *_t) zzz="$uidtype"     ;;
21004 *)   zzz="uid"          ;;
21005 esac
21006 echo "Checking the size of $zzz..." >&4
21007 cat > try.c <<EOCP
21008 #include <sys/types.h>
21009 #include <stdio.h>
21010 #$i_stdlib I_STDLIB
21011 #ifdef I_STDLIB
21012 #include <stdlib.h>
21013 #endif
21014 int main() {
21015     printf("%d\n", (int)sizeof($uidtype));
21016     exit(0);
21017 }
21018 EOCP
21019 set try
21020 if eval $compile_ok; then
21021         yyy=`$run ./try`
21022         case "$yyy" in
21023         '')     uidsize=4
21024                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21025                 ;;
21026         *)      uidsize=$yyy
21027                 echo "Your $zzz is $uidsize bytes long."
21028                 ;;
21029         esac
21030 else
21031         uidsize=4
21032         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21033 fi
21034
21035 : Check if UID is signed
21036 echo " "
21037 case "$uidtype" in
21038 *_t) zzz="$uidtype"     ;;
21039 *)   zzz="uid"          ;;
21040 esac
21041 echo "Checking the sign of $zzz..." >&4
21042 cat > try.c <<EOCP
21043 #include <sys/types.h>
21044 #include <stdio.h>
21045 int main() {
21046         $uidtype foo = -1;
21047         if (foo < 0)
21048                 printf("-1\n");
21049         else
21050                 printf("1\n");
21051 }
21052 EOCP
21053 set try
21054 if eval $compile; then
21055         yyy=`$run ./try`
21056         case "$yyy" in
21057         '')     uidsign=1
21058                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21059                 ;;
21060         *)      uidsign=$yyy
21061                 case "$uidsign" in
21062                  1) echo "Your $zzz is unsigned." ;;
21063                 -1) echo "Your $zzz is signed."   ;;
21064                 esac
21065                 ;;
21066         esac
21067 else
21068         uidsign=1
21069         echo "(I can't compile the test program--guessing unsigned.)" >&4
21070 fi
21071
21072
21073 : Check format string for UID
21074 echo " "
21075 $echo "Checking the format string to be used for uids..." >&4
21076
21077 case "$uidsign" in
21078 -1)     if $test X"$uidsize" = X"$ivsize"; then
21079                 uidformat="$ivdformat"
21080         else
21081                 if $test X"$uidsize" = X"$longsize"; then
21082                         uidformat='"ld"'
21083                 else
21084                         if $test X"$uidsize" = X"$intsize"; then
21085                                 uidformat='"d"'
21086                         else
21087                                 if $test X"$uidsize" = X"$shortsize"; then
21088                                         uidformat='"hd"'
21089                                 fi
21090                         fi
21091                 fi
21092         fi
21093         ;;
21094 *)      if $test X"$uidsize" = X"$uvsize"; then
21095                 uidformat="$uvuformat"
21096         else
21097                 if $test X"$uidsize" = X"$longsize"; then
21098                         uidformat='"lu"'
21099                 else
21100                         if $test X"$uidsize" = X"$intsize"; then
21101                                 uidformat='"u"'
21102                         else
21103                                 if $test X"$uidsize" = X"$shortsize"; then
21104                                         uidformat='"hu"'
21105                                 fi
21106                         fi
21107                 fi
21108         fi
21109         ;;
21110 esac
21111
21112 : Check if site customization support was requested
21113 case "$usesitecustomize" in
21114     $define|true|[Yy]*)
21115         usesitecustomize="$define"
21116         ;;
21117     *)
21118         usesitecustomize="$undef"
21119         ;;
21120     esac
21121
21122 : determine compiler compiler
21123 case "$yacc" in
21124 '')
21125         dflt=yacc;;
21126 *)
21127         dflt="$yacc";;
21128 esac
21129 echo " "
21130 comp='yacc'
21131 if $test -f "$byacc$_exe"; then
21132         dflt="$byacc"
21133         comp="byacc or $comp"
21134 fi
21135 if $test -f "$bison$_exe"; then
21136         comp="$comp or bison -y"
21137 fi
21138 rp="Which compiler compiler ($comp) shall I use?"
21139 . ./myread
21140 yacc="$ans"
21141 case "$yacc" in
21142 *bis*)
21143         case "$yacc" in
21144         *-y*) ;;
21145         *)
21146                 yacc="$yacc -y"
21147                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21148                 ;;
21149         esac
21150         ;;
21151 esac
21152
21153 : see if this is a assert.h system
21154 set assert.h i_assert
21155 eval $inhdr
21156
21157 : see if this is a fp.h system
21158 set fp.h i_fp
21159 eval $inhdr
21160
21161 : see if this is a fp_class.h system
21162 set fp_class.h i_fp_class
21163 eval $inhdr
21164
21165 : see if gdbm.h is available
21166 set gdbm.h t_gdbm
21167 eval $inhdr
21168 case "$t_gdbm" in
21169 $define)
21170         : see if gdbm_open exists
21171         set gdbm_open d_gdbm_open
21172         eval $inlibc
21173         case "$d_gdbm_open" in
21174         $undef)
21175                 t_gdbm="$undef"
21176                 echo "We won't be including <gdbm.h>"
21177                 ;;
21178         esac
21179         ;;
21180 esac
21181 val="$t_gdbm"
21182 set i_gdbm
21183 eval $setvar
21184
21185 : see if this is a ieeefp.h system
21186 case "$i_ieeefp" in
21187 '' ) set ieeefp.h i_ieeefp
21188      eval $inhdr
21189      ;;
21190 esac
21191
21192 : see if this is a libutil.h system
21193 set libutil.h i_libutil
21194 eval $inhdr
21195
21196 : see if mach cthreads are available
21197 if test "X$usethreads" = "X$define"; then
21198         set mach/cthreads.h i_machcthr
21199         eval $inhdr
21200 else
21201         i_machcthr="$undef"
21202 fi
21203
21204 : see if this is a mntent.h system
21205 set mntent.h i_mntent
21206 eval $inhdr
21207
21208 : see if net/errno.h is available
21209 val=''
21210 set net/errno.h val
21211 eval $inhdr
21212
21213 : Unfortunately, it causes problems on some systems.  Arrgh.
21214 case "$val" in
21215 $define)
21216         cat > try.c <<'EOM'
21217 #include <stdio.h>
21218 #include <errno.h>
21219 #include <net/errno.h>
21220 int func()
21221 {
21222         return ENOTSOCK;
21223 }
21224 EOM
21225         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21226                 echo "We'll be including <net/errno.h>." >&4
21227         else
21228                 echo "We won't be including <net/errno.h>." >&4
21229                 val="$undef"
21230         fi
21231         $rm_try
21232         ;;
21233 esac
21234 set i_neterrno
21235 eval $setvar
21236
21237 : see if netinet/tcp.h is available
21238 set netinet/tcp.h i_netinettcp
21239 eval $inhdr
21240
21241 : see if this is a poll.h system
21242 set poll.h i_poll
21243 eval $inhdr
21244
21245 : see if this is a prot.h system
21246 set prot.h i_prot
21247 eval $inhdr
21248
21249 : Preprocessor symbols
21250 echo " "
21251 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21252 $cat <<'EOSH' > Cppsym.know
21253 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21254 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21255 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21256 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21257 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21258 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21259 bull c cadmus clipper CMU COFF COMPILER_VERSION
21260 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21261 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21262 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21263 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21264 GLIBC GLIBC_MINOR
21265 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21266 H3050R H3050RX hbullx20 hcx host_mips
21267 hp200 hp300 hp700 HP700 hp800 hp9000
21268 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21269 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21270 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21271 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21272 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21273 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21274 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21275 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21276 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21277 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21278 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21279 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21280 MATH_HAS_NO_SIDE_EFFECTS
21281 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21282 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21283 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21284 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21285 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21286 NetBSD news1500 news1700 news1800 news1900 news3700
21287 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21288 ns32016 ns32332 ns32k nsc32000
21289 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21290 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21291 pc532 pdp11 PGC PIC plexus PORTAR posix
21292 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21293 POSIX_C_SOURCE POSIX_SOURCE POWER
21294 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21295 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21296 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21297 sony sony_news sonyrisc sparc sparclite spectrum
21298 stardent stdc STDC_EXT stratos sun sun3 sun386
21299 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21300 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21301 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21302 sysV68 sysV88 Tek4132 Tek4300 titan
21303 TM3200 TM5400 TM5600
21304 tower tower32 tower32_200 tower32_600 tower32_700
21305 tower32_800 tower32_850 tss
21306 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21307 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21308 unix UNIX95 UNIX99 unixpc unos
21309 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21310 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21311 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21312 USGr4 USGr4_2
21313 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21314 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21315 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21316 z8000
21317 EOSH
21318 # Maybe put other stuff here too.
21319 cat <<EOSH >>Cppsym.know
21320 $osname
21321 EOSH
21322 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21323 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21324 $cat Cppsym.know > Cppsym.c
21325 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21326 $rm -f Cppsym.a Cppsym.b Cppsym.c
21327 cat <<EOSH > Cppsym
21328 $startsh
21329 if $test \$# -gt 0; then
21330     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21331     if $test -s Cppsym.got; then
21332         $rm -f Cppsym.got
21333         exit 0
21334     fi
21335     $rm -f Cppsym.got
21336     exit 1
21337 else
21338     $tr " " "$trnl" | ./Cppsym.try
21339     exit 0
21340 fi
21341 EOSH
21342 chmod +x Cppsym
21343 $eunicefix Cppsym
21344 cat <<EOSH > Cppsym.try
21345 $startsh
21346 cat <<'EOCP' > try.c
21347 #include <stdio.h>
21348 #if cpp_stuff == 1
21349 #define STRINGIFY(a)    "a"
21350 #endif
21351 #if cpp_stuff == 42
21352 #define StGiFy(a)  #a
21353 #define STRINGIFY(a)    StGiFy(a)
21354 #endif
21355 #if $cpp_stuff != 1 && $cpp_stuff != 42
21356 #   include "Bletch: How does this C preprocessor stringify macros?"
21357 #endif
21358 int main() {
21359 EOCP
21360 $awk \\
21361 EOSH
21362 cat <<'EOSH' >> Cppsym.try
21363 'length($1) > 0 {
21364     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21365     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21366     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21367     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21368 }'       >> try.c
21369 echo 'return 0;}' >> try.c
21370 EOSH
21371 cat <<EOSH >> Cppsym.try
21372 ccflags="$ccflags"
21373 case "$osname-$gccversion" in
21374 irix-) ccflags="\$ccflags -woff 1178" ;;
21375 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21376 esac
21377 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21378 EOSH
21379 chmod +x Cppsym.try
21380 $eunicefix Cppsym.try
21381 ./Cppsym < Cppsym.know > Cppsym.true
21382 : Add in any linux cpp "predefined macros":
21383 case "$osname::$gccversion" in
21384   *linux*::*.*)
21385     tHdrH=_tmpHdr
21386     rm -f $tHdrH'.h' $tHdrH
21387     touch $tHdrH'.h'
21388     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21389        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21390        if [ -s $tHdrH'_cppsym.real' ]; then
21391           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21392        fi
21393     fi
21394     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21395   ;;
21396 esac
21397 : now check the C compiler for additional symbols
21398 postprocess_cc_v=''
21399 case "$osname" in
21400 aix) postprocess_cc_v="|$tr , ' '" ;;
21401 esac
21402 $cat >ccsym <<EOS
21403 $startsh
21404 $cat >tmp.c <<EOF
21405 extern int foo;
21406 EOF
21407 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21408 do
21409         case "\$i" in
21410         -D*) echo "\$i" | $sed 's/^-D//';;
21411         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21412         esac
21413 done
21414 $rm_try
21415 EOS
21416 postprocess_cc_v=''
21417 chmod +x ccsym
21418 $eunicefix ccsym
21419 ./ccsym > ccsym1.raw
21420 if $test -s ccsym1.raw; then
21421        $sort ccsym1.raw | $uniq >ccsym.raw
21422 else
21423        mv ccsym1.raw ccsym.raw
21424 fi
21425
21426 $awk '/\=/ { print $0; next }
21427         { print $0"=1" }' ccsym.raw >ccsym.list
21428 $comm -13 Cppsym.true ccsym.list >ccsym.own
21429 $comm -12 Cppsym.true ccsym.list >ccsym.com
21430 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21431 also=''
21432 if $test -z ccsym.raw; then
21433         echo "Your C compiler doesn't seem to define any symbols!" >&4
21434         echo " "
21435         echo "However, your C preprocessor defines the following symbols:"
21436         $cat Cppsym.true
21437         ccsymbols=''
21438         cppsymbols=`$cat Cppsym.true`
21439         cppsymbols=`echo $cppsymbols`
21440         cppccsymbols="$cppsymbols"
21441 else
21442         if $test -s ccsym.com; then
21443                 echo "Your C compiler and pre-processor define these symbols:"
21444                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21445                 also='also '
21446                 symbols='ones'
21447                 cppccsymbols=`$cat ccsym.com`
21448                 cppccsymbols=`echo $cppccsymbols`
21449                 $test "$silent" || sleep 1
21450         fi
21451         if $test -s ccsym.cpp; then
21452                 $test "$also" && echo " "
21453                 echo "Your C pre-processor ${also}defines the following symbols:"
21454                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21455                 also='further '
21456                 cppsymbols=`$cat ccsym.cpp`
21457                 cppsymbols=`echo $cppsymbols`
21458                 $test "$silent" || sleep 1
21459         fi
21460         if $test -s ccsym.own; then
21461                 $test "$also" && echo " "
21462                 echo "Your C compiler ${also}defines the following cpp symbols:"
21463                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21464                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21465                 ccsymbols=`$cat ccsym.own`
21466                 ccsymbols=`echo $ccsymbols`
21467                 $test "$silent" || sleep 1
21468         fi
21469 fi
21470
21471 : see if this is a termio system
21472 val="$undef"
21473 val2="$undef"
21474 val3="$undef"
21475 if $test `./findhdr termios.h`; then
21476         set tcsetattr i_termios
21477         eval $inlibc
21478         val3="$i_termios"
21479 fi
21480 echo " "
21481 case "$val3" in
21482 "$define") echo "You have POSIX termios.h... good!" >&4;;
21483 *) if ./Cppsym pyr; then
21484                 case "`/bin/universe`" in
21485                 ucb) if $test `./findhdr sgtty.h`; then
21486                                 val2="$define"
21487                                 echo "<sgtty.h> found." >&4
21488                         else
21489                                 echo "System is pyramid with BSD universe."
21490                                 ./warn "<sgtty.h> not found--you could have problems."
21491                         fi;;
21492                 *) if $test `./findhdr termio.h`; then
21493                                 val="$define"
21494                                 echo "<termio.h> found." >&4
21495                         else
21496                                 echo "System is pyramid with USG universe."
21497                                 ./warn "<termio.h> not found--you could have problems."
21498                         fi;;
21499                 esac
21500         elif ./usg; then
21501                 if $test `./findhdr termio.h`; then
21502                         echo "<termio.h> found." >&4
21503                         val="$define"
21504                 elif $test `./findhdr sgtty.h`; then
21505                         echo "<sgtty.h> found." >&4
21506                         val2="$define"
21507                 else
21508                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21509                 fi
21510         else
21511                 if $test `./findhdr sgtty.h`; then
21512                         echo "<sgtty.h> found." >&4
21513                         val2="$define"
21514                 elif $test `./findhdr termio.h`; then
21515                         echo "<termio.h> found." >&4
21516                         val="$define"
21517                 else
21518                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21519                 fi
21520         fi;;
21521 esac
21522 set i_termio; eval $setvar
21523 val=$val2; set i_sgtty; eval $setvar
21524 val=$val3; set i_termios; eval $setvar
21525
21526 : see if stddef is available
21527 set stddef.h i_stddef
21528 eval $inhdr
21529
21530 : see if sys/access.h is available
21531 set sys/access.h i_sysaccess
21532 eval $inhdr
21533
21534 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21535 set sys/filio.h i_sysfilio
21536 eval $inhdr
21537 echo " "
21538 if $test `./findhdr sys/ioctl.h`; then
21539         val="$define"
21540         echo '<sys/ioctl.h> found.' >&4
21541 else
21542         val="$undef"
21543         if $test $i_sysfilio = "$define"; then
21544             echo '<sys/ioctl.h> NOT found.' >&4
21545         else
21546                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21547                 $test $i_termio = "$define" && xxx="termio.h"
21548                 $test $i_termios = "$define" && xxx="termios.h"
21549 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21550         fi
21551 fi
21552 set i_sysioctl
21553 eval $setvar
21554
21555 : see if socket ioctl defs are in sys/sockio.h
21556 echo " "
21557 xxx=`./findhdr sys/sockio.h`
21558 if $test "$xxx"; then
21559         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21560                 val="$define"
21561                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21562         else
21563                 val="$undef"
21564                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21565         fi
21566 else
21567         val="$undef"
21568         $cat <<EOM
21569 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21570 EOM
21571 fi
21572 set i_syssockio
21573 eval $setvar
21574
21575 : see if this is a syslog.h system
21576 set syslog.h i_syslog
21577 eval $inhdr
21578
21579 : see if this is a sys/mode.h system
21580 set sys/mode.h i_sysmode
21581 eval $inhdr
21582
21583 : see if there is a sys/poll.h file
21584 set sys/poll.h i_syspoll
21585 eval $inhdr
21586
21587 : see if sys/resource.h has to be included
21588 set sys/resource.h i_sysresrc
21589 eval $inhdr
21590
21591 : see if sys/security.h is available
21592 set sys/security.h i_syssecrt
21593 eval $inhdr
21594
21595 : see if this is a sys/statvfs.h system
21596 set sys/statvfs.h i_sysstatvfs
21597 eval $inhdr
21598
21599 : see if this is a sys/un.h system
21600 set sys/un.h i_sysun
21601 eval $inhdr
21602
21603 : see if this is a sys/utsname.h system
21604 set sys/utsname.h i_sysutsname
21605 eval $inhdr
21606
21607 : see if this is a syswait system
21608 set sys/wait.h i_syswait
21609 eval $inhdr
21610
21611 : see if this is a ustat.h system
21612 set ustat.h i_ustat
21613 eval $inhdr
21614
21615 : see if this is an utime system
21616 set utime.h i_utime
21617 eval $inhdr
21618
21619 : see if this is a vfork system
21620 case "$d_vfork" in
21621 "$define")
21622         set vfork.h i_vfork
21623         eval $inhdr
21624         ;;
21625 *)
21626         i_vfork="$undef"
21627         ;;
21628 esac
21629
21630 : Check extensions
21631 echo " "
21632 echo "Looking for extensions..." >&4
21633 : If we are using the old config.sh, known_extensions may contain
21634 : old or inaccurate or duplicate values.
21635 known_extensions=''
21636 nonxs_extensions=''
21637 : We do not use find because it might not be available.
21638 : We do not just use MANIFEST because the user may have dropped
21639 : some additional extensions into the source tree and expect them
21640 : to be built.
21641
21642 : Function to recursively find available extensions, ignoring DynaLoader
21643 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21644 find_extensions='
21645     for xxx in *; do
21646         case "$xxx" in
21647             DynaLoader|dynaload) ;;
21648             *)
21649             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21650             leaf=`echo $xxx | $sed -e s/.*-//`;
21651             if $test -d File-Glob; then
21652                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21653                     known_extensions="$known_extensions $this_ext";
21654                 elif $test -d $xxx; then
21655                     nonxs_extensions="$nonxs_extensions $this_ext";
21656                 fi
21657             else
21658                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21659                     known_extensions="$known_extensions $1$this_ext";
21660                 elif $test -f $xxx/Makefile.PL; then
21661                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21662                 else
21663                     if $test -d $xxx -a $# -lt 10; then
21664                         set $1$xxx/ $*;
21665                         cd "$xxx";
21666                         eval $find_extensions;
21667                         cd ..;
21668                         shift;
21669                     fi;
21670                 fi;
21671             fi
21672             ;;
21673         esac;
21674     done'
21675 tdir=`pwd`
21676 cd "$rsrc/ext"
21677 set X
21678 shift
21679 eval $find_extensions
21680 if $test -d File-Glob; then
21681     : All ext/ flattened
21682 else
21683     # Special case:  Add in modules that nest beyond the first level.
21684     # Currently threads/shared and Hash/Util/FieldHash, since they are
21685     # not picked up by the recursive find above (and adding in general
21686     # recursive finding breaks SDBM_File/sdbm).
21687     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21688     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21689 fi
21690 set X $known_extensions
21691 shift
21692 known_extensions="$*"
21693 set X $nonxs_extensions
21694 shift
21695 nonxs_extensions="$*"
21696 cd "$tdir"
21697
21698 : Now see which are supported on this system.
21699 avail_ext=''
21700 for xxx in $known_extensions ; do
21701         case "$xxx" in
21702         DB_File|db_file)
21703                 case "$i_db" in
21704                 $define) avail_ext="$avail_ext $xxx" ;;
21705                 esac
21706                 ;;
21707         GDBM_File|gdbm_fil)
21708                 case "$i_gdbm" in
21709                 $define) avail_ext="$avail_ext $xxx" ;;
21710                 esac
21711                 ;;
21712         I18N/Langinfo|i18n_lan)
21713                 case "$i_langinfo$d_nl_langinfo" in
21714                 $define$define) avail_ext="$avail_ext $xxx" ;;
21715                 esac
21716                 ;;
21717         IPC/SysV|ipc/sysv)
21718                 : XXX Do we need a useipcsysv variable here
21719                 case "${d_msg}${d_sem}${d_shm}" in
21720                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21721                 esac
21722                 ;;
21723         NDBM_File|ndbm_fil)
21724                 case "$i_ndbm" in
21725                 $define)
21726                     case "$osname-$use64bitint" in
21727                     hpux-define)
21728                         case "$libs" in
21729                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21730                         esac
21731                         ;;
21732                     *) avail_ext="$avail_ext $xxx" ;;
21733                     esac
21734                     ;;
21735                 esac
21736                 ;;
21737         ODBM_File|odbm_fil)
21738                 case "${i_dbm}${i_rpcsvcdbm}" in
21739                 *"${define}"*)
21740                     case "$d_cplusplus" in
21741                     define) ;; # delete as a function name will not work
21742                     *)  case "$osname-$use64bitint" in
21743                         hpux-define)
21744                             case "$libs" in
21745                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21746                             esac
21747                             ;;
21748                         *) avail_ext="$avail_ext $xxx" ;;
21749                         esac
21750                         ;;
21751                     esac
21752                     ;;
21753                 esac
21754                 ;;
21755         Opcode|opcode)
21756                 case "$useopcode" in
21757                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21758                 esac
21759                 ;;
21760         POSIX|posix)
21761                 case "$useposix" in
21762                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21763                 esac
21764                 ;;
21765         Socket|socket)
21766                 case "$d_socket" in
21767                 true|$define|y)
21768                     case "$osname" in
21769                     beos) ;; # not unless BONE
21770                     *) avail_ext="$avail_ext $xxx" ;;
21771                     esac
21772                     ;;
21773                 esac
21774                 ;;
21775         Sys/Syslog|sys/syslog)
21776                 : XXX syslog requires socket
21777                 case "$d_socket" in
21778                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21779                 esac
21780                 ;;
21781         Thread|thread)
21782                 case "$usethreads" in
21783                 true|$define|y)
21784                         case "$use5005threads" in
21785                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21786                         esac
21787                 esac
21788                 ;;
21789         threads|threads/shared)
21790                 # threads and threads::shared are special cases.
21791                 # To stop people from asking "Perl 5.8.0 was supposed
21792                 # to have this new fancy threads implementation but my
21793                 # perl doesn't have it" and from people trying to
21794                 # (re)install the threads module using CPAN.pm and
21795                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21796                 # the threads.pm and threads/shared.pm will always be
21797                 # there, croaking informatively ("you need to rebuild
21798                 # all of Perl with threads, sorry") when threads haven't
21799                 # been compiled in.
21800                 # --jhi
21801                 avail_ext="$avail_ext $xxx"
21802                 ;;
21803         VMS*)
21804                 ;;
21805         Win32*)
21806                 case "$osname" in
21807                 cygwin) avail_ext="$avail_ext $xxx" ;;
21808                 esac
21809                 ;;
21810         XS/APItest|xs/apitest)
21811                 # This is just for testing.  Skip it unless we have dynamic loading.
21812
21813                 case "$usedl" in
21814                 $define) avail_ext="$avail_ext $xxx" ;;
21815                 esac
21816                 ;;
21817         XS/Typemap|xs/typemap)
21818                 # This is just for testing.  Skip it unless we have dynamic loading.
21819                 case "$usedl" in
21820                 $define) avail_ext="$avail_ext $xxx" ;;
21821                 esac
21822                 ;;
21823         *)      avail_ext="$avail_ext $xxx"
21824                 ;;
21825         esac
21826 done
21827
21828 set X $avail_ext
21829 shift
21830 avail_ext="$*"
21831
21832 case "$onlyextensions" in
21833 '') ;;
21834 *)  keepextensions=''
21835     echo "You have requested that only certains extensions be included..." >&4
21836     for i in $onlyextensions; do
21837         case " $avail_ext " in
21838         *" $i "*)
21839             echo "Keeping extension $i."
21840             keepextensions="$keepextensions $i"
21841             ;;
21842         *) echo "Ignoring extension $i." ;;
21843         esac
21844     done
21845     avail_ext="$keepextensions"
21846     ;;
21847 esac
21848
21849 case "$noextensions" in
21850 '') ;;
21851 *)  keepextensions=''
21852     echo "You have requested that certain extensions be ignored..." >&4
21853     for i in $avail_ext; do
21854         case " $noextensions " in
21855         *" $i "*) echo "Ignoring extension $i." ;;
21856         *) echo "Keeping extension $i.";
21857            keepextensions="$keepextensions $i"
21858            ;;
21859         esac
21860     done
21861     avail_ext="$keepextensions"
21862     ;;
21863 esac
21864
21865 : Now see which nonxs extensions are supported on this system.
21866 : For now assume all are.
21867 nonxs_ext=''
21868 for xxx in $nonxs_extensions ; do
21869         case "$xxx" in
21870         *)      nonxs_ext="$nonxs_ext $xxx"
21871                 ;;
21872         esac
21873 done
21874
21875 set X $nonxs_ext
21876 shift
21877 nonxs_ext="$*"
21878
21879 case $usedl in
21880 $define)
21881         $cat <<EOM
21882 A number of extensions are supplied with $package.  You may choose to
21883 compile these extensions for dynamic loading (the default), compile
21884 them into the $package executable (static loading), or not include
21885 them at all.  Answer "none" to include no extensions.
21886 Note that DynaLoader is always built and need not be mentioned here.
21887
21888 EOM
21889         case "$dynamic_ext" in
21890         '')
21891                 : Exclude those listed in static_ext
21892                 dflt=''
21893                 for xxx in $avail_ext; do
21894                         case " $static_ext " in
21895                         *" $xxx "*) ;;
21896                         *) dflt="$dflt $xxx" ;;
21897                         esac
21898                 done
21899                 set X $dflt
21900                 shift
21901                 dflt="$*"
21902                 ;;
21903         *)      dflt="$dynamic_ext"
21904                 # Perhaps we are reusing an old out-of-date config.sh.
21905                 case "$hint" in
21906                 previous)
21907                         if test X"$dynamic_ext" != X"$avail_ext"; then
21908                                 $cat <<EOM
21909 NOTICE:  Your previous config.sh list may be incorrect.
21910 The extensions now available to you are
21911         ${avail_ext}
21912 but the default list from your previous config.sh is
21913         ${dynamic_ext}
21914
21915 EOM
21916                         fi
21917                         ;;
21918                 esac
21919                 ;;
21920         esac
21921         case "$dflt" in
21922         '')     dflt=none;;
21923         esac
21924         rp="What extensions do you wish to load dynamically?"
21925         . ./myread
21926         case "$ans" in
21927         none) dynamic_ext=' ' ;;
21928         *) dynamic_ext="$ans" ;;
21929         esac
21930
21931         case "$static_ext" in
21932         '')
21933                 : Exclude those already listed in dynamic linking
21934                 dflt=''
21935                 for xxx in $avail_ext; do
21936                         case " $dynamic_ext " in
21937                         *" $xxx "*) ;;
21938                         *) dflt="$dflt $xxx" ;;
21939                         esac
21940                 done
21941                 set X $dflt
21942                 shift
21943                 dflt="$*"
21944                 ;;
21945         *)  dflt="$static_ext"
21946                 ;;
21947         esac
21948
21949         case "$dflt" in
21950         '')     dflt=none;;
21951         esac
21952         rp="What extensions do you wish to load statically?"
21953         . ./myread
21954         case "$ans" in
21955         none) static_ext=' ' ;;
21956         *) static_ext="$ans" ;;
21957         esac
21958         ;;
21959 *)
21960         $cat <<EOM
21961 A number of extensions are supplied with $package.  Answer "none"
21962 to include no extensions.
21963 Note that DynaLoader is always built and need not be mentioned here.
21964
21965 EOM
21966         case "$static_ext" in
21967         '') dflt="$avail_ext" ;;
21968         *)      dflt="$static_ext"
21969                 # Perhaps we are reusing an old out-of-date config.sh.
21970                 case "$hint" in
21971                 previous)
21972                         if test X"$static_ext" != X"$avail_ext"; then
21973                                 $cat <<EOM
21974 NOTICE:  Your previous config.sh list may be incorrect.
21975 The extensions now available to you are
21976         ${avail_ext}
21977 but the default list from your previous config.sh is
21978         ${static_ext}
21979
21980 EOM
21981                         fi
21982                         ;;
21983                 esac
21984                 ;;
21985         esac
21986         : Exclude those that are not xs extensions
21987         case "$dflt" in
21988         '')     dflt=none;;
21989         esac
21990         rp="What extensions do you wish to include?"
21991         . ./myread
21992         case "$ans" in
21993         none) static_ext=' ' ;;
21994         *) static_ext="$ans" ;;
21995         esac
21996         ;;
21997 esac
21998 #
21999 # Encode is a special case.  If we are building Encode as a static
22000 # extension, we need to explicitly list its subextensions as well.
22001 # For other nested extensions, this is handled automatically by
22002 # the appropriate Makefile.PL.
22003 case " $static_ext " in
22004         *" Encode "*) # Add the subextensions of Encode
22005         cd "$rsrc/ext"
22006         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22007                 static_ext="$static_ext Encode/$xxx"
22008         done
22009         cd "$tdir"
22010         ;;
22011 esac
22012
22013 set X $dynamic_ext $static_ext $nonxs_ext
22014 shift
22015 extensions="$*"
22016
22017 # Sanity check:  We require an extension suitable for use with
22018 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22019 # should show up as failures in the test suite, but it's helpful to
22020 # catch them now.) The 'extensions' list is normally sorted
22021 # alphabetically, so we need to accept either
22022 #    DB_File ... Fcntl ... IO  ....
22023 # or something like
22024 #    Fcntl ... NDBM_File ... IO  ....
22025 case " $extensions"  in
22026 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22027 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22028 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22029 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22030    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22031    ;;
22032 esac
22033
22034 : Remove libraries needed only for extensions
22035 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22036 : The exception is SunOS 4.x, which needs them.
22037 case "${osname}X${osvers}" in
22038 sunos*X4*)
22039     perllibs="$libs"
22040     ;;
22041 *) case "$usedl" in
22042     $define|true|[yY]*)
22043             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22044             shift
22045             perllibs="$*"
22046             ;;
22047     *)  perllibs="$libs"
22048             ;;
22049     esac
22050     ;;
22051 esac
22052
22053 : Remove build directory name from cppstdin so it can be used from
22054 : either the present location or the final installed location.
22055 echo " "
22056 : Get out of the UU directory to get correct path name.
22057 cd ..
22058 case "$cppstdin" in
22059 `pwd`/cppstdin)
22060         echo "Stripping down cppstdin path name"
22061         cppstdin=cppstdin
22062         ;;
22063 esac
22064 cd UU
22065
22066 : end of configuration questions
22067 echo " "
22068 echo "End of configuration questions."
22069 echo " "
22070
22071 : back to where it started
22072 if test -d ../UU; then
22073         cd ..
22074 fi
22075
22076 : configuration may be unconditionally patched via a 'config.arch' file
22077 if $test -f config.arch; then
22078         echo "I see a config.arch file, loading it." >&4
22079         . ./config.arch
22080 fi
22081
22082 : configuration may be patched via a 'config.over' file
22083 if $test -f config.over; then
22084         echo " "
22085         dflt=y
22086         rp='I see a config.over file.  Do you wish to load it?'
22087         . UU/myread
22088         case "$ans" in
22089         n*) echo "OK, I'll ignore it.";;
22090         *)      . ./config.over
22091                 echo "Configuration override changes have been loaded."
22092                 ;;
22093         esac
22094 fi
22095
22096 : in case they want portability, strip down executable paths
22097 case "$d_portable" in
22098 "$define")
22099         echo " "
22100         echo "Stripping down executable paths..." >&4
22101         for file in $loclist $trylist; do
22102                 eval temp=\$$file
22103                 eval $file=`basename $temp`
22104         done
22105         ;;
22106 esac
22107
22108 : create config.sh file
22109 echo " "
22110 echo "Creating config.sh..." >&4
22111 $spitshell <<EOT >config.sh
22112 $startsh
22113 #
22114 # This file was produced by running the Configure script. It holds all the
22115 # definitions figured out by Configure. Should you modify one of these values,
22116 # do not forget to propagate your changes by running "Configure -der". You may
22117 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22118 #
22119
22120 # Package name      : $package
22121 # Source directory  : $src
22122 # Configuration time: $cf_time
22123 # Configured by     : $cf_by
22124 # Target system     : $myuname
22125
22126 EOT
22127 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22128 $spitshell <<EOT >>config.sh
22129
22130 Author='$Author'
22131 Date='$Date'
22132 Header='$Header'
22133 Id='$Id'
22134 Locker='$Locker'
22135 Log='$Log'
22136 RCSfile='$RCSfile'
22137 Revision='$Revision'
22138 Source='$Source'
22139 State='$State'
22140 _a='$_a'
22141 _exe='$_exe'
22142 _o='$_o'
22143 afs='$afs'
22144 afsroot='$afsroot'
22145 alignbytes='$alignbytes'
22146 ansi2knr='$ansi2knr'
22147 aphostname='$aphostname'
22148 api_revision='$api_revision'
22149 api_subversion='$api_subversion'
22150 api_version='$api_version'
22151 api_versionstring='$api_versionstring'
22152 ar='$ar'
22153 archlib='$archlib'
22154 archlibexp='$archlibexp'
22155 archname64='$archname64'
22156 archname='$archname'
22157 archobjs='$archobjs'
22158 asctime_r_proto='$asctime_r_proto'
22159 awk='$awk'
22160 baserev='$baserev'
22161 bash='$bash'
22162 bin='$bin'
22163 binexp='$binexp'
22164 bison='$bison'
22165 byacc='$byacc'
22166 byteorder='$byteorder'
22167 c='$c'
22168 castflags='$castflags'
22169 cat='$cat'
22170 cc='$cc'
22171 cccdlflags='$cccdlflags'
22172 ccdlflags='$ccdlflags'
22173 ccflags='$ccflags'
22174 ccflags_uselargefiles='$ccflags_uselargefiles'
22175 ccname='$ccname'
22176 ccsymbols='$ccsymbols'
22177 ccversion='$ccversion'
22178 cf_by='$cf_by'
22179 cf_email='$cf_email'
22180 cf_time='$cf_time'
22181 chgrp='$chgrp'
22182 chmod='$chmod'
22183 chown='$chown'
22184 clocktype='$clocktype'
22185 comm='$comm'
22186 compress='$compress'
22187 contains='$contains'
22188 cp='$cp'
22189 cpio='$cpio'
22190 cpp='$cpp'
22191 cpp_stuff='$cpp_stuff'
22192 cppccsymbols='$cppccsymbols'
22193 cppflags='$cppflags'
22194 cpplast='$cpplast'
22195 cppminus='$cppminus'
22196 cpprun='$cpprun'
22197 cppstdin='$cppstdin'
22198 cppsymbols='$cppsymbols'
22199 crypt_r_proto='$crypt_r_proto'
22200 cryptlib='$cryptlib'
22201 csh='$csh'
22202 ctermid_r_proto='$ctermid_r_proto'
22203 ctime_r_proto='$ctime_r_proto'
22204 d_Gconvert='$d_Gconvert'
22205 d_PRIEUldbl='$d_PRIEUldbl'
22206 d_PRIFUldbl='$d_PRIFUldbl'
22207 d_PRIGUldbl='$d_PRIGUldbl'
22208 d_PRIXU64='$d_PRIXU64'
22209 d_PRId64='$d_PRId64'
22210 d_PRIeldbl='$d_PRIeldbl'
22211 d_PRIfldbl='$d_PRIfldbl'
22212 d_PRIgldbl='$d_PRIgldbl'
22213 d_PRIi64='$d_PRIi64'
22214 d_PRIo64='$d_PRIo64'
22215 d_PRIu64='$d_PRIu64'
22216 d_PRIx64='$d_PRIx64'
22217 d_SCNfldbl='$d_SCNfldbl'
22218 d__fwalk='$d__fwalk'
22219 d_access='$d_access'
22220 d_accessx='$d_accessx'
22221 d_aintl='$d_aintl'
22222 d_alarm='$d_alarm'
22223 d_archlib='$d_archlib'
22224 d_asctime64='$d_asctime64'
22225 d_asctime_r='$d_asctime_r'
22226 d_atolf='$d_atolf'
22227 d_atoll='$d_atoll'
22228 d_attribute_deprecated='$d_attribute_deprecated'
22229 d_attribute_format='$d_attribute_format'
22230 d_attribute_malloc='$d_attribute_malloc'
22231 d_attribute_nonnull='$d_attribute_nonnull'
22232 d_attribute_noreturn='$d_attribute_noreturn'
22233 d_attribute_pure='$d_attribute_pure'
22234 d_attribute_unused='$d_attribute_unused'
22235 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22236 d_bcmp='$d_bcmp'
22237 d_bcopy='$d_bcopy'
22238 d_bsd='$d_bsd'
22239 d_bsdgetpgrp='$d_bsdgetpgrp'
22240 d_bsdsetpgrp='$d_bsdsetpgrp'
22241 d_builtin_choose_expr='$d_builtin_choose_expr'
22242 d_builtin_expect='$d_builtin_expect'
22243 d_bzero='$d_bzero'
22244 d_c99_variadic_macros='$d_c99_variadic_macros'
22245 d_casti32='$d_casti32'
22246 d_castneg='$d_castneg'
22247 d_charvspr='$d_charvspr'
22248 d_chown='$d_chown'
22249 d_chroot='$d_chroot'
22250 d_chsize='$d_chsize'
22251 d_class='$d_class'
22252 d_clearenv='$d_clearenv'
22253 d_closedir='$d_closedir'
22254 d_cmsghdr_s='$d_cmsghdr_s'
22255 d_const='$d_const'
22256 d_copysignl='$d_copysignl'
22257 d_cplusplus='$d_cplusplus'
22258 d_crypt='$d_crypt'
22259 d_crypt_r='$d_crypt_r'
22260 d_csh='$d_csh'
22261 d_ctermid='$d_ctermid'
22262 d_ctermid_r='$d_ctermid_r'
22263 d_ctime64='$d_ctime64'
22264 d_ctime_r='$d_ctime_r'
22265 d_cuserid='$d_cuserid'
22266 d_dbl_dig='$d_dbl_dig'
22267 d_dbminitproto='$d_dbminitproto'
22268 d_difftime64='$d_difftime64'
22269 d_difftime='$d_difftime'
22270 d_dir_dd_fd='$d_dir_dd_fd'
22271 d_dirfd='$d_dirfd'
22272 d_dirnamlen='$d_dirnamlen'
22273 d_dlerror='$d_dlerror'
22274 d_dlopen='$d_dlopen'
22275 d_dlsymun='$d_dlsymun'
22276 d_dosuid='$d_dosuid'
22277 d_drand48_r='$d_drand48_r'
22278 d_drand48proto='$d_drand48proto'
22279 d_dup2='$d_dup2'
22280 d_eaccess='$d_eaccess'
22281 d_endgrent='$d_endgrent'
22282 d_endgrent_r='$d_endgrent_r'
22283 d_endhent='$d_endhent'
22284 d_endhostent_r='$d_endhostent_r'
22285 d_endnent='$d_endnent'
22286 d_endnetent_r='$d_endnetent_r'
22287 d_endpent='$d_endpent'
22288 d_endprotoent_r='$d_endprotoent_r'
22289 d_endpwent='$d_endpwent'
22290 d_endpwent_r='$d_endpwent_r'
22291 d_endsent='$d_endsent'
22292 d_endservent_r='$d_endservent_r'
22293 d_eofnblk='$d_eofnblk'
22294 d_eunice='$d_eunice'
22295 d_faststdio='$d_faststdio'
22296 d_fchdir='$d_fchdir'
22297 d_fchmod='$d_fchmod'
22298 d_fchown='$d_fchown'
22299 d_fcntl='$d_fcntl'
22300 d_fcntl_can_lock='$d_fcntl_can_lock'
22301 d_fd_macros='$d_fd_macros'
22302 d_fd_set='$d_fd_set'
22303 d_fds_bits='$d_fds_bits'
22304 d_fgetpos='$d_fgetpos'
22305 d_finite='$d_finite'
22306 d_finitel='$d_finitel'
22307 d_flexfnam='$d_flexfnam'
22308 d_flock='$d_flock'
22309 d_flockproto='$d_flockproto'
22310 d_fork='$d_fork'
22311 d_fp_class='$d_fp_class'
22312 d_fpathconf='$d_fpathconf'
22313 d_fpclass='$d_fpclass'
22314 d_fpclassify='$d_fpclassify'
22315 d_fpclassl='$d_fpclassl'
22316 d_fpos64_t='$d_fpos64_t'
22317 d_frexpl='$d_frexpl'
22318 d_fs_data_s='$d_fs_data_s'
22319 d_fseeko='$d_fseeko'
22320 d_fsetpos='$d_fsetpos'
22321 d_fstatfs='$d_fstatfs'
22322 d_fstatvfs='$d_fstatvfs'
22323 d_fsync='$d_fsync'
22324 d_ftello='$d_ftello'
22325 d_ftime='$d_ftime'
22326 d_futimes='$d_futimes'
22327 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22328 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22329 d_getaddrinfo='$d_getaddrinfo'
22330 d_getcwd='$d_getcwd'
22331 d_getespwnam='$d_getespwnam'
22332 d_getfsstat='$d_getfsstat'
22333 d_getgrent='$d_getgrent'
22334 d_getgrent_r='$d_getgrent_r'
22335 d_getgrgid_r='$d_getgrgid_r'
22336 d_getgrnam_r='$d_getgrnam_r'
22337 d_getgrps='$d_getgrps'
22338 d_gethbyaddr='$d_gethbyaddr'
22339 d_gethbyname='$d_gethbyname'
22340 d_gethent='$d_gethent'
22341 d_gethname='$d_gethname'
22342 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22343 d_gethostbyname_r='$d_gethostbyname_r'
22344 d_gethostent_r='$d_gethostent_r'
22345 d_gethostprotos='$d_gethostprotos'
22346 d_getitimer='$d_getitimer'
22347 d_getlogin='$d_getlogin'
22348 d_getlogin_r='$d_getlogin_r'
22349 d_getmnt='$d_getmnt'
22350 d_getmntent='$d_getmntent'
22351 d_getnameinfo='$d_getnameinfo'
22352 d_getnbyaddr='$d_getnbyaddr'
22353 d_getnbyname='$d_getnbyname'
22354 d_getnent='$d_getnent'
22355 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22356 d_getnetbyname_r='$d_getnetbyname_r'
22357 d_getnetent_r='$d_getnetent_r'
22358 d_getnetprotos='$d_getnetprotos'
22359 d_getpagsz='$d_getpagsz'
22360 d_getpbyname='$d_getpbyname'
22361 d_getpbynumber='$d_getpbynumber'
22362 d_getpent='$d_getpent'
22363 d_getpgid='$d_getpgid'
22364 d_getpgrp2='$d_getpgrp2'
22365 d_getpgrp='$d_getpgrp'
22366 d_getppid='$d_getppid'
22367 d_getprior='$d_getprior'
22368 d_getprotobyname_r='$d_getprotobyname_r'
22369 d_getprotobynumber_r='$d_getprotobynumber_r'
22370 d_getprotoent_r='$d_getprotoent_r'
22371 d_getprotoprotos='$d_getprotoprotos'
22372 d_getprpwnam='$d_getprpwnam'
22373 d_getpwent='$d_getpwent'
22374 d_getpwent_r='$d_getpwent_r'
22375 d_getpwnam_r='$d_getpwnam_r'
22376 d_getpwuid_r='$d_getpwuid_r'
22377 d_getsbyname='$d_getsbyname'
22378 d_getsbyport='$d_getsbyport'
22379 d_getsent='$d_getsent'
22380 d_getservbyname_r='$d_getservbyname_r'
22381 d_getservbyport_r='$d_getservbyport_r'
22382 d_getservent_r='$d_getservent_r'
22383 d_getservprotos='$d_getservprotos'
22384 d_getspnam='$d_getspnam'
22385 d_getspnam_r='$d_getspnam_r'
22386 d_gettimeod='$d_gettimeod'
22387 d_gmtime64='$d_gmtime64'
22388 d_gmtime_r='$d_gmtime_r'
22389 d_gnulibc='$d_gnulibc'
22390 d_grpasswd='$d_grpasswd'
22391 d_hasmntopt='$d_hasmntopt'
22392 d_htonl='$d_htonl'
22393 d_ilogbl='$d_ilogbl'
22394 d_inc_version_list='$d_inc_version_list'
22395 d_index='$d_index'
22396 d_inetaton='$d_inetaton'
22397 d_inetntop='$d_inetntop'
22398 d_inetpton='$d_inetpton'
22399 d_int64_t='$d_int64_t'
22400 d_isascii='$d_isascii'
22401 d_isfinite='$d_isfinite'
22402 d_isinf='$d_isinf'
22403 d_isnan='$d_isnan'
22404 d_isnanl='$d_isnanl'
22405 d_killpg='$d_killpg'
22406 d_lchown='$d_lchown'
22407 d_ldbl_dig='$d_ldbl_dig'
22408 d_libm_lib_version='$d_libm_lib_version'
22409 d_link='$d_link'
22410 d_localtime64='$d_localtime64'
22411 d_localtime_r='$d_localtime_r'
22412 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22413 d_locconv='$d_locconv'
22414 d_lockf='$d_lockf'
22415 d_longdbl='$d_longdbl'
22416 d_longlong='$d_longlong'
22417 d_lseekproto='$d_lseekproto'
22418 d_lstat='$d_lstat'
22419 d_madvise='$d_madvise'
22420 d_malloc_good_size='$d_malloc_good_size'
22421 d_malloc_size='$d_malloc_size'
22422 d_mblen='$d_mblen'
22423 d_mbstowcs='$d_mbstowcs'
22424 d_mbtowc='$d_mbtowc'
22425 d_memchr='$d_memchr'
22426 d_memcmp='$d_memcmp'
22427 d_memcpy='$d_memcpy'
22428 d_memmove='$d_memmove'
22429 d_memset='$d_memset'
22430 d_mkdir='$d_mkdir'
22431 d_mkdtemp='$d_mkdtemp'
22432 d_mkfifo='$d_mkfifo'
22433 d_mkstemp='$d_mkstemp'
22434 d_mkstemps='$d_mkstemps'
22435 d_mktime64='$d_mktime64'
22436 d_mktime='$d_mktime'
22437 d_mmap='$d_mmap'
22438 d_modfl='$d_modfl'
22439 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22440 d_modflproto='$d_modflproto'
22441 d_mprotect='$d_mprotect'
22442 d_msg='$d_msg'
22443 d_msg_ctrunc='$d_msg_ctrunc'
22444 d_msg_dontroute='$d_msg_dontroute'
22445 d_msg_oob='$d_msg_oob'
22446 d_msg_peek='$d_msg_peek'
22447 d_msg_proxy='$d_msg_proxy'
22448 d_msgctl='$d_msgctl'
22449 d_msgget='$d_msgget'
22450 d_msghdr_s='$d_msghdr_s'
22451 d_msgrcv='$d_msgrcv'
22452 d_msgsnd='$d_msgsnd'
22453 d_msync='$d_msync'
22454 d_munmap='$d_munmap'
22455 d_mymalloc='$d_mymalloc'
22456 d_ndbm='$d_ndbm'
22457 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22458 d_nice='$d_nice'
22459 d_nl_langinfo='$d_nl_langinfo'
22460 d_nv_preserves_uv='$d_nv_preserves_uv'
22461 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22462 d_off64_t='$d_off64_t'
22463 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22464 d_oldpthreads='$d_oldpthreads'
22465 d_oldsock='$d_oldsock'
22466 d_open3='$d_open3'
22467 d_pathconf='$d_pathconf'
22468 d_pause='$d_pause'
22469 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22470 d_phostname='$d_phostname'
22471 d_pipe='$d_pipe'
22472 d_poll='$d_poll'
22473 d_portable='$d_portable'
22474 d_printf_format_null='$d_printf_format_null'
22475 d_procselfexe='$d_procselfexe'
22476 d_pseudofork='$d_pseudofork'
22477 d_pthread_atfork='$d_pthread_atfork'
22478 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22479 d_pthread_yield='$d_pthread_yield'
22480 d_pwage='$d_pwage'
22481 d_pwchange='$d_pwchange'
22482 d_pwclass='$d_pwclass'
22483 d_pwcomment='$d_pwcomment'
22484 d_pwexpire='$d_pwexpire'
22485 d_pwgecos='$d_pwgecos'
22486 d_pwpasswd='$d_pwpasswd'
22487 d_pwquota='$d_pwquota'
22488 d_qgcvt='$d_qgcvt'
22489 d_quad='$d_quad'
22490 d_random_r='$d_random_r'
22491 d_readdir64_r='$d_readdir64_r'
22492 d_readdir='$d_readdir'
22493 d_readdir_r='$d_readdir_r'
22494 d_readlink='$d_readlink'
22495 d_readv='$d_readv'
22496 d_recvmsg='$d_recvmsg'
22497 d_rename='$d_rename'
22498 d_rewinddir='$d_rewinddir'
22499 d_rmdir='$d_rmdir'
22500 d_safebcpy='$d_safebcpy'
22501 d_safemcpy='$d_safemcpy'
22502 d_sanemcmp='$d_sanemcmp'
22503 d_sbrkproto='$d_sbrkproto'
22504 d_scalbnl='$d_scalbnl'
22505 d_sched_yield='$d_sched_yield'
22506 d_scm_rights='$d_scm_rights'
22507 d_seekdir='$d_seekdir'
22508 d_select='$d_select'
22509 d_sem='$d_sem'
22510 d_semctl='$d_semctl'
22511 d_semctl_semid_ds='$d_semctl_semid_ds'
22512 d_semctl_semun='$d_semctl_semun'
22513 d_semget='$d_semget'
22514 d_semop='$d_semop'
22515 d_sendmsg='$d_sendmsg'
22516 d_setegid='$d_setegid'
22517 d_seteuid='$d_seteuid'
22518 d_setgrent='$d_setgrent'
22519 d_setgrent_r='$d_setgrent_r'
22520 d_setgrps='$d_setgrps'
22521 d_sethent='$d_sethent'
22522 d_sethostent_r='$d_sethostent_r'
22523 d_setitimer='$d_setitimer'
22524 d_setlinebuf='$d_setlinebuf'
22525 d_setlocale='$d_setlocale'
22526 d_setlocale_r='$d_setlocale_r'
22527 d_setnent='$d_setnent'
22528 d_setnetent_r='$d_setnetent_r'
22529 d_setpent='$d_setpent'
22530 d_setpgid='$d_setpgid'
22531 d_setpgrp2='$d_setpgrp2'
22532 d_setpgrp='$d_setpgrp'
22533 d_setprior='$d_setprior'
22534 d_setproctitle='$d_setproctitle'
22535 d_setprotoent_r='$d_setprotoent_r'
22536 d_setpwent='$d_setpwent'
22537 d_setpwent_r='$d_setpwent_r'
22538 d_setregid='$d_setregid'
22539 d_setresgid='$d_setresgid'
22540 d_setresuid='$d_setresuid'
22541 d_setreuid='$d_setreuid'
22542 d_setrgid='$d_setrgid'
22543 d_setruid='$d_setruid'
22544 d_setsent='$d_setsent'
22545 d_setservent_r='$d_setservent_r'
22546 d_setsid='$d_setsid'
22547 d_setvbuf='$d_setvbuf'
22548 d_sfio='$d_sfio'
22549 d_shm='$d_shm'
22550 d_shmat='$d_shmat'
22551 d_shmatprototype='$d_shmatprototype'
22552 d_shmctl='$d_shmctl'
22553 d_shmdt='$d_shmdt'
22554 d_shmget='$d_shmget'
22555 d_sigaction='$d_sigaction'
22556 d_signbit='$d_signbit'
22557 d_sigprocmask='$d_sigprocmask'
22558 d_sigsetjmp='$d_sigsetjmp'
22559 d_sitearch='$d_sitearch'
22560 d_snprintf='$d_snprintf'
22561 d_sockatmark='$d_sockatmark'
22562 d_sockatmarkproto='$d_sockatmarkproto'
22563 d_socket='$d_socket'
22564 d_socklen_t='$d_socklen_t'
22565 d_sockpair='$d_sockpair'
22566 d_socks5_init='$d_socks5_init'
22567 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22568 d_sqrtl='$d_sqrtl'
22569 d_srand48_r='$d_srand48_r'
22570 d_srandom_r='$d_srandom_r'
22571 d_sresgproto='$d_sresgproto'
22572 d_sresuproto='$d_sresuproto'
22573 d_statblks='$d_statblks'
22574 d_statfs_f_flags='$d_statfs_f_flags'
22575 d_statfs_s='$d_statfs_s'
22576 d_statvfs='$d_statvfs'
22577 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22578 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22579 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22580 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22581 d_stdio_stream_array='$d_stdio_stream_array'
22582 d_stdiobase='$d_stdiobase'
22583 d_stdstdio='$d_stdstdio'
22584 d_strchr='$d_strchr'
22585 d_strcoll='$d_strcoll'
22586 d_strctcpy='$d_strctcpy'
22587 d_strerrm='$d_strerrm'
22588 d_strerror='$d_strerror'
22589 d_strerror_r='$d_strerror_r'
22590 d_strftime='$d_strftime'
22591 d_strlcat='$d_strlcat'
22592 d_strlcpy='$d_strlcpy'
22593 d_strtod='$d_strtod'
22594 d_strtol='$d_strtol'
22595 d_strtold='$d_strtold'
22596 d_strtoll='$d_strtoll'
22597 d_strtoq='$d_strtoq'
22598 d_strtoul='$d_strtoul'
22599 d_strtoull='$d_strtoull'
22600 d_strtouq='$d_strtouq'
22601 d_strxfrm='$d_strxfrm'
22602 d_suidsafe='$d_suidsafe'
22603 d_symlink='$d_symlink'
22604 d_syscall='$d_syscall'
22605 d_syscallproto='$d_syscallproto'
22606 d_sysconf='$d_sysconf'
22607 d_sysernlst='$d_sysernlst'
22608 d_syserrlst='$d_syserrlst'
22609 d_system='$d_system'
22610 d_tcgetpgrp='$d_tcgetpgrp'
22611 d_tcsetpgrp='$d_tcsetpgrp'
22612 d_telldir='$d_telldir'
22613 d_telldirproto='$d_telldirproto'
22614 d_time='$d_time'
22615 d_timegm='$d_timegm'
22616 d_times='$d_times'
22617 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22618 d_tm_tm_zone='$d_tm_tm_zone'
22619 d_tmpnam_r='$d_tmpnam_r'
22620 d_truncate='$d_truncate'
22621 d_ttyname_r='$d_ttyname_r'
22622 d_tzname='$d_tzname'
22623 d_u32align='$d_u32align'
22624 d_ualarm='$d_ualarm'
22625 d_umask='$d_umask'
22626 d_uname='$d_uname'
22627 d_union_semun='$d_union_semun'
22628 d_unordered='$d_unordered'
22629 d_unsetenv='$d_unsetenv'
22630 d_usleep='$d_usleep'
22631 d_usleepproto='$d_usleepproto'
22632 d_ustat='$d_ustat'
22633 d_vendorarch='$d_vendorarch'
22634 d_vendorbin='$d_vendorbin'
22635 d_vendorlib='$d_vendorlib'
22636 d_vendorscript='$d_vendorscript'
22637 d_vfork='$d_vfork'
22638 d_void_closedir='$d_void_closedir'
22639 d_voidsig='$d_voidsig'
22640 d_voidtty='$d_voidtty'
22641 d_volatile='$d_volatile'
22642 d_vprintf='$d_vprintf'
22643 d_vsnprintf='$d_vsnprintf'
22644 d_wait4='$d_wait4'
22645 d_waitpid='$d_waitpid'
22646 d_wcstombs='$d_wcstombs'
22647 d_wctomb='$d_wctomb'
22648 d_writev='$d_writev'
22649 d_xenix='$d_xenix'
22650 date='$date'
22651 db_hashtype='$db_hashtype'
22652 db_prefixtype='$db_prefixtype'
22653 db_version_major='$db_version_major'
22654 db_version_minor='$db_version_minor'
22655 db_version_patch='$db_version_patch'
22656 defvoidused='$defvoidused'
22657 direntrytype='$direntrytype'
22658 dlext='$dlext'
22659 dlsrc='$dlsrc'
22660 doublesize='$doublesize'
22661 drand01='$drand01'
22662 drand48_r_proto='$drand48_r_proto'
22663 dtrace='$dtrace'
22664 dynamic_ext='$dynamic_ext'
22665 eagain='$eagain'
22666 ebcdic='$ebcdic'
22667 echo='$echo'
22668 egrep='$egrep'
22669 emacs='$emacs'
22670 endgrent_r_proto='$endgrent_r_proto'
22671 endhostent_r_proto='$endhostent_r_proto'
22672 endnetent_r_proto='$endnetent_r_proto'
22673 endprotoent_r_proto='$endprotoent_r_proto'
22674 endpwent_r_proto='$endpwent_r_proto'
22675 endservent_r_proto='$endservent_r_proto'
22676 eunicefix='$eunicefix'
22677 exe_ext='$exe_ext'
22678 expr='$expr'
22679 extensions='$extensions'
22680 extern_C='$extern_C'
22681 extras='$extras'
22682 fflushNULL='$fflushNULL'
22683 fflushall='$fflushall'
22684 find='$find'
22685 firstmakefile='$firstmakefile'
22686 flex='$flex'
22687 fpossize='$fpossize'
22688 fpostype='$fpostype'
22689 freetype='$freetype'
22690 from='$from'
22691 full_ar='$full_ar'
22692 full_csh='$full_csh'
22693 full_sed='$full_sed'
22694 gccansipedantic='$gccansipedantic'
22695 gccosandvers='$gccosandvers'
22696 gccversion='$gccversion'
22697 getgrent_r_proto='$getgrent_r_proto'
22698 getgrgid_r_proto='$getgrgid_r_proto'
22699 getgrnam_r_proto='$getgrnam_r_proto'
22700 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22701 gethostbyname_r_proto='$gethostbyname_r_proto'
22702 gethostent_r_proto='$gethostent_r_proto'
22703 getlogin_r_proto='$getlogin_r_proto'
22704 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22705 getnetbyname_r_proto='$getnetbyname_r_proto'
22706 getnetent_r_proto='$getnetent_r_proto'
22707 getprotobyname_r_proto='$getprotobyname_r_proto'
22708 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22709 getprotoent_r_proto='$getprotoent_r_proto'
22710 getpwent_r_proto='$getpwent_r_proto'
22711 getpwnam_r_proto='$getpwnam_r_proto'
22712 getpwuid_r_proto='$getpwuid_r_proto'
22713 getservbyname_r_proto='$getservbyname_r_proto'
22714 getservbyport_r_proto='$getservbyport_r_proto'
22715 getservent_r_proto='$getservent_r_proto'
22716 getspnam_r_proto='$getspnam_r_proto'
22717 gidformat='$gidformat'
22718 gidsign='$gidsign'
22719 gidsize='$gidsize'
22720 gidtype='$gidtype'
22721 glibpth='$glibpth'
22722 gmake='$gmake'
22723 gmtime_r_proto='$gmtime_r_proto'
22724 gnulibc_version='$gnulibc_version'
22725 grep='$grep'
22726 groupcat='$groupcat'
22727 groupstype='$groupstype'
22728 gzip='$gzip'
22729 h_fcntl='$h_fcntl'
22730 h_sysfile='$h_sysfile'
22731 hint='$hint'
22732 hostcat='$hostcat'
22733 html1dir='$html1dir'
22734 html1direxp='$html1direxp'
22735 html3dir='$html3dir'
22736 html3direxp='$html3direxp'
22737 i16size='$i16size'
22738 i16type='$i16type'
22739 i32size='$i32size'
22740 i32type='$i32type'
22741 i64size='$i64size'
22742 i64type='$i64type'
22743 i8size='$i8size'
22744 i8type='$i8type'
22745 i_arpainet='$i_arpainet'
22746 i_assert='$i_assert'
22747 i_bsdioctl='$i_bsdioctl'
22748 i_crypt='$i_crypt'
22749 i_db='$i_db'
22750 i_dbm='$i_dbm'
22751 i_dirent='$i_dirent'
22752 i_dld='$i_dld'
22753 i_dlfcn='$i_dlfcn'
22754 i_fcntl='$i_fcntl'
22755 i_float='$i_float'
22756 i_fp='$i_fp'
22757 i_fp_class='$i_fp_class'
22758 i_gdbm='$i_gdbm'
22759 i_gdbm_ndbm='$i_gdbm_ndbm'
22760 i_gdbmndbm='$i_gdbmndbm'
22761 i_grp='$i_grp'
22762 i_ieeefp='$i_ieeefp'
22763 i_inttypes='$i_inttypes'
22764 i_langinfo='$i_langinfo'
22765 i_libutil='$i_libutil'
22766 i_limits='$i_limits'
22767 i_locale='$i_locale'
22768 i_machcthr='$i_machcthr'
22769 i_malloc='$i_malloc'
22770 i_mallocmalloc='$i_mallocmalloc'
22771 i_math='$i_math'
22772 i_memory='$i_memory'
22773 i_mntent='$i_mntent'
22774 i_ndbm='$i_ndbm'
22775 i_netdb='$i_netdb'
22776 i_neterrno='$i_neterrno'
22777 i_netinettcp='$i_netinettcp'
22778 i_niin='$i_niin'
22779 i_poll='$i_poll'
22780 i_prot='$i_prot'
22781 i_pthread='$i_pthread'
22782 i_pwd='$i_pwd'
22783 i_rpcsvcdbm='$i_rpcsvcdbm'
22784 i_sfio='$i_sfio'
22785 i_sgtty='$i_sgtty'
22786 i_shadow='$i_shadow'
22787 i_socks='$i_socks'
22788 i_stdarg='$i_stdarg'
22789 i_stddef='$i_stddef'
22790 i_stdlib='$i_stdlib'
22791 i_string='$i_string'
22792 i_sunmath='$i_sunmath'
22793 i_sysaccess='$i_sysaccess'
22794 i_sysdir='$i_sysdir'
22795 i_sysfile='$i_sysfile'
22796 i_sysfilio='$i_sysfilio'
22797 i_sysin='$i_sysin'
22798 i_sysioctl='$i_sysioctl'
22799 i_syslog='$i_syslog'
22800 i_sysmman='$i_sysmman'
22801 i_sysmode='$i_sysmode'
22802 i_sysmount='$i_sysmount'
22803 i_sysndir='$i_sysndir'
22804 i_sysparam='$i_sysparam'
22805 i_syspoll='$i_syspoll'
22806 i_sysresrc='$i_sysresrc'
22807 i_syssecrt='$i_syssecrt'
22808 i_sysselct='$i_sysselct'
22809 i_syssockio='$i_syssockio'
22810 i_sysstat='$i_sysstat'
22811 i_sysstatfs='$i_sysstatfs'
22812 i_sysstatvfs='$i_sysstatvfs'
22813 i_systime='$i_systime'
22814 i_systimek='$i_systimek'
22815 i_systimes='$i_systimes'
22816 i_systypes='$i_systypes'
22817 i_sysuio='$i_sysuio'
22818 i_sysun='$i_sysun'
22819 i_sysutsname='$i_sysutsname'
22820 i_sysvfs='$i_sysvfs'
22821 i_syswait='$i_syswait'
22822 i_termio='$i_termio'
22823 i_termios='$i_termios'
22824 i_time='$i_time'
22825 i_unistd='$i_unistd'
22826 i_ustat='$i_ustat'
22827 i_utime='$i_utime'
22828 i_values='$i_values'
22829 i_varargs='$i_varargs'
22830 i_varhdr='$i_varhdr'
22831 i_vfork='$i_vfork'
22832 ignore_versioned_solibs='$ignore_versioned_solibs'
22833 inc_version_list='$inc_version_list'
22834 inc_version_list_init='$inc_version_list_init'
22835 incpath='$incpath'
22836 inews='$inews'
22837 initialinstalllocation='$initialinstalllocation'
22838 installarchlib='$installarchlib'
22839 installbin='$installbin'
22840 installhtml1dir='$installhtml1dir'
22841 installhtml3dir='$installhtml3dir'
22842 installman1dir='$installman1dir'
22843 installman3dir='$installman3dir'
22844 installprefix='$installprefix'
22845 installprefixexp='$installprefixexp'
22846 installprivlib='$installprivlib'
22847 installscript='$installscript'
22848 installsitearch='$installsitearch'
22849 installsitebin='$installsitebin'
22850 installsitehtml1dir='$installsitehtml1dir'
22851 installsitehtml3dir='$installsitehtml3dir'
22852 installsitelib='$installsitelib'
22853 installsiteman1dir='$installsiteman1dir'
22854 installsiteman3dir='$installsiteman3dir'
22855 installsitescript='$installsitescript'
22856 installstyle='$installstyle'
22857 installusrbinperl='$installusrbinperl'
22858 installvendorarch='$installvendorarch'
22859 installvendorbin='$installvendorbin'
22860 installvendorhtml1dir='$installvendorhtml1dir'
22861 installvendorhtml3dir='$installvendorhtml3dir'
22862 installvendorlib='$installvendorlib'
22863 installvendorman1dir='$installvendorman1dir'
22864 installvendorman3dir='$installvendorman3dir'
22865 installvendorscript='$installvendorscript'
22866 intsize='$intsize'
22867 issymlink='$issymlink'
22868 ivdformat='$ivdformat'
22869 ivsize='$ivsize'
22870 ivtype='$ivtype'
22871 known_extensions='$known_extensions'
22872 ksh='$ksh'
22873 ld='$ld'
22874 lddlflags='$lddlflags'
22875 ldflags='$ldflags'
22876 ldflags_uselargefiles='$ldflags_uselargefiles'
22877 ldlibpthname='$ldlibpthname'
22878 less='$less'
22879 lib_ext='$lib_ext'
22880 libc='$libc'
22881 libperl='$libperl'
22882 libpth='$libpth'
22883 libs='$libs'
22884 libsdirs='$libsdirs'
22885 libsfiles='$libsfiles'
22886 libsfound='$libsfound'
22887 libspath='$libspath'
22888 libswanted='$libswanted'
22889 libswanted_uselargefiles='$libswanted_uselargefiles'
22890 line='$line'
22891 lint='$lint'
22892 lkflags='$lkflags'
22893 ln='$ln'
22894 lns='$lns'
22895 localtime_r_proto='$localtime_r_proto'
22896 locincpth='$locincpth'
22897 loclibpth='$loclibpth'
22898 longdblsize='$longdblsize'
22899 longlongsize='$longlongsize'
22900 longsize='$longsize'
22901 lp='$lp'
22902 lpr='$lpr'
22903 ls='$ls'
22904 lseeksize='$lseeksize'
22905 lseektype='$lseektype'
22906 mad='$mad'
22907 madlyh='$madlyh'
22908 madlyobj='$madlyobj'
22909 madlysrc='$madlysrc'
22910 mail='$mail'
22911 mailx='$mailx'
22912 make='$make'
22913 make_set_make='$make_set_make'
22914 mallocobj='$mallocobj'
22915 mallocsrc='$mallocsrc'
22916 malloctype='$malloctype'
22917 man1dir='$man1dir'
22918 man1direxp='$man1direxp'
22919 man1ext='$man1ext'
22920 man3dir='$man3dir'
22921 man3direxp='$man3direxp'
22922 man3ext='$man3ext'
22923 mips_type='$mips_type'
22924 mistrustnm='$mistrustnm'
22925 mkdir='$mkdir'
22926 mmaptype='$mmaptype'
22927 modetype='$modetype'
22928 more='$more'
22929 multiarch='$multiarch'
22930 mv='$mv'
22931 myarchname='$myarchname'
22932 mydomain='$mydomain'
22933 myhostname='$myhostname'
22934 myuname='$myuname'
22935 n='$n'
22936 need_va_copy='$need_va_copy'
22937 netdb_hlen_type='$netdb_hlen_type'
22938 netdb_host_type='$netdb_host_type'
22939 netdb_name_type='$netdb_name_type'
22940 netdb_net_type='$netdb_net_type'
22941 nm='$nm'
22942 nm_opt='$nm_opt'
22943 nm_so_opt='$nm_so_opt'
22944 nonxs_ext='$nonxs_ext'
22945 nroff='$nroff'
22946 nvEUformat='$nvEUformat'
22947 nvFUformat='$nvFUformat'
22948 nvGUformat='$nvGUformat'
22949 nv_overflows_integers_at='$nv_overflows_integers_at'
22950 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22951 nveformat='$nveformat'
22952 nvfformat='$nvfformat'
22953 nvgformat='$nvgformat'
22954 nvsize='$nvsize'
22955 nvtype='$nvtype'
22956 o_nonblock='$o_nonblock'
22957 obj_ext='$obj_ext'
22958 old_pthread_create_joinable='$old_pthread_create_joinable'
22959 optimize='$optimize'
22960 orderlib='$orderlib'
22961 osname='$osname'
22962 osvers='$osvers'
22963 otherlibdirs='$otherlibdirs'
22964 package='$package'
22965 pager='$pager'
22966 passcat='$passcat'
22967 patchlevel='$patchlevel'
22968 path_sep='$path_sep'
22969 perl5='$perl5'
22970 perl='$perl'
22971 perl_patchlevel='$perl_patchlevel'
22972 perladmin='$perladmin'
22973 perllibs='$perllibs'
22974 perlpath='$perlpath'
22975 pg='$pg'
22976 phostname='$phostname'
22977 pidtype='$pidtype'
22978 plibpth='$plibpth'
22979 pmake='$pmake'
22980 pr='$pr'
22981 prefix='$prefix'
22982 prefixexp='$prefixexp'
22983 privlib='$privlib'
22984 privlibexp='$privlibexp'
22985 procselfexe='$procselfexe'
22986 prototype='$prototype'
22987 ptrsize='$ptrsize'
22988 quadkind='$quadkind'
22989 quadtype='$quadtype'
22990 randbits='$randbits'
22991 randfunc='$randfunc'
22992 random_r_proto='$random_r_proto'
22993 randseedtype='$randseedtype'
22994 ranlib='$ranlib'
22995 rd_nodata='$rd_nodata'
22996 readdir64_r_proto='$readdir64_r_proto'
22997 readdir_r_proto='$readdir_r_proto'
22998 revision='$revision'
22999 rm='$rm'
23000 rm_try='$rm_try'
23001 rmail='$rmail'
23002 run='$run'
23003 runnm='$runnm'
23004 sGMTIME_max='$sGMTIME_max'
23005 sGMTIME_min='$sGMTIME_min'
23006 sLOCALTIME_max='$sLOCALTIME_max'
23007 sLOCALTIME_min='$sLOCALTIME_min'
23008 sPRIEUldbl='$sPRIEUldbl'
23009 sPRIFUldbl='$sPRIFUldbl'
23010 sPRIGUldbl='$sPRIGUldbl'
23011 sPRIXU64='$sPRIXU64'
23012 sPRId64='$sPRId64'
23013 sPRIeldbl='$sPRIeldbl'
23014 sPRIfldbl='$sPRIfldbl'
23015 sPRIgldbl='$sPRIgldbl'
23016 sPRIi64='$sPRIi64'
23017 sPRIo64='$sPRIo64'
23018 sPRIu64='$sPRIu64'
23019 sPRIx64='$sPRIx64'
23020 sSCNfldbl='$sSCNfldbl'
23021 sched_yield='$sched_yield'
23022 scriptdir='$scriptdir'
23023 scriptdirexp='$scriptdirexp'
23024 sed='$sed'
23025 seedfunc='$seedfunc'
23026 selectminbits='$selectminbits'
23027 selecttype='$selecttype'
23028 sendmail='$sendmail'
23029 setgrent_r_proto='$setgrent_r_proto'
23030 sethostent_r_proto='$sethostent_r_proto'
23031 setlocale_r_proto='$setlocale_r_proto'
23032 setnetent_r_proto='$setnetent_r_proto'
23033 setprotoent_r_proto='$setprotoent_r_proto'
23034 setpwent_r_proto='$setpwent_r_proto'
23035 setservent_r_proto='$setservent_r_proto'
23036 sh='$sh'
23037 shar='$shar'
23038 sharpbang='$sharpbang'
23039 shmattype='$shmattype'
23040 shortsize='$shortsize'
23041 shrpenv='$shrpenv'
23042 shsharp='$shsharp'
23043 sig_count='$sig_count'
23044 sig_name='$sig_name'
23045 sig_name_init='$sig_name_init'
23046 sig_num='$sig_num'
23047 sig_num_init='$sig_num_init'
23048 sig_size='$sig_size'
23049 signal_t='$signal_t'
23050 sitearch='$sitearch'
23051 sitearchexp='$sitearchexp'
23052 sitebin='$sitebin'
23053 sitebinexp='$sitebinexp'
23054 sitehtml1dir='$sitehtml1dir'
23055 sitehtml1direxp='$sitehtml1direxp'
23056 sitehtml3dir='$sitehtml3dir'
23057 sitehtml3direxp='$sitehtml3direxp'
23058 sitelib='$sitelib'
23059 sitelib_stem='$sitelib_stem'
23060 sitelibexp='$sitelibexp'
23061 siteman1dir='$siteman1dir'
23062 siteman1direxp='$siteman1direxp'
23063 siteman3dir='$siteman3dir'
23064 siteman3direxp='$siteman3direxp'
23065 siteprefix='$siteprefix'
23066 siteprefixexp='$siteprefixexp'
23067 sitescript='$sitescript'
23068 sitescriptexp='$sitescriptexp'
23069 sizesize='$sizesize'
23070 sizetype='$sizetype'
23071 sleep='$sleep'
23072 smail='$smail'
23073 so='$so'
23074 sockethdr='$sockethdr'
23075 socketlib='$socketlib'
23076 socksizetype='$socksizetype'
23077 sort='$sort'
23078 spackage='$spackage'
23079 spitshell='$spitshell'
23080 srand48_r_proto='$srand48_r_proto'
23081 srandom_r_proto='$srandom_r_proto'
23082 src='$src'
23083 ssizetype='$ssizetype'
23084 startperl='$startperl'
23085 startsh='$startsh'
23086 static_ext='$static_ext'
23087 stdchar='$stdchar'
23088 stdio_base='$stdio_base'
23089 stdio_bufsiz='$stdio_bufsiz'
23090 stdio_cnt='$stdio_cnt'
23091 stdio_filbuf='$stdio_filbuf'
23092 stdio_ptr='$stdio_ptr'
23093 stdio_stream_array='$stdio_stream_array'
23094 strerror_r_proto='$strerror_r_proto'
23095 strings='$strings'
23096 submit='$submit'
23097 subversion='$subversion'
23098 sysman='$sysman'
23099 tail='$tail'
23100 tar='$tar'
23101 targetarch='$targetarch'
23102 tbl='$tbl'
23103 tee='$tee'
23104 test='$test'
23105 timeincl='$timeincl'
23106 timetype='$timetype'
23107 tmpnam_r_proto='$tmpnam_r_proto'
23108 to='$to'
23109 touch='$touch'
23110 tr='$tr'
23111 trnl='$trnl'
23112 troff='$troff'
23113 ttyname_r_proto='$ttyname_r_proto'
23114 u16size='$u16size'
23115 u16type='$u16type'
23116 u32size='$u32size'
23117 u32type='$u32type'
23118 u64size='$u64size'
23119 u64type='$u64type'
23120 u8size='$u8size'
23121 u8type='$u8type'
23122 uidformat='$uidformat'
23123 uidsign='$uidsign'
23124 uidsize='$uidsize'
23125 uidtype='$uidtype'
23126 uname='$uname'
23127 uniq='$uniq'
23128 uquadtype='$uquadtype'
23129 use5005threads='$use5005threads'
23130 use64bitall='$use64bitall'
23131 use64bitint='$use64bitint'
23132 usecrosscompile='$usecrosscompile'
23133 usedevel='$usedevel'
23134 usedl='$usedl'
23135 usedtrace='$usedtrace'
23136 usefaststdio='$usefaststdio'
23137 useithreads='$useithreads'
23138 uselargefiles='$uselargefiles'
23139 uselongdouble='$uselongdouble'
23140 usemallocwrap='$usemallocwrap'
23141 usemorebits='$usemorebits'
23142 usemultiplicity='$usemultiplicity'
23143 usemymalloc='$usemymalloc'
23144 usenm='$usenm'
23145 useopcode='$useopcode'
23146 useperlio='$useperlio'
23147 useposix='$useposix'
23148 usereentrant='$usereentrant'
23149 userelocatableinc='$userelocatableinc'
23150 usesfio='$usesfio'
23151 useshrplib='$useshrplib'
23152 usesitecustomize='$usesitecustomize'
23153 usesocks='$usesocks'
23154 usethreads='$usethreads'
23155 usevendorprefix='$usevendorprefix'
23156 usevfork='$usevfork'
23157 usrinc='$usrinc'
23158 uuname='$uuname'
23159 uvXUformat='$uvXUformat'
23160 uvoformat='$uvoformat'
23161 uvsize='$uvsize'
23162 uvtype='$uvtype'
23163 uvuformat='$uvuformat'
23164 uvxformat='$uvxformat'
23165 vendorarch='$vendorarch'
23166 vendorarchexp='$vendorarchexp'
23167 vendorbin='$vendorbin'
23168 vendorbinexp='$vendorbinexp'
23169 vendorhtml1dir='$vendorhtml1dir'
23170 vendorhtml1direxp='$vendorhtml1direxp'
23171 vendorhtml3dir='$vendorhtml3dir'
23172 vendorhtml3direxp='$vendorhtml3direxp'
23173 vendorlib='$vendorlib'
23174 vendorlib_stem='$vendorlib_stem'
23175 vendorlibexp='$vendorlibexp'
23176 vendorman1dir='$vendorman1dir'
23177 vendorman1direxp='$vendorman1direxp'
23178 vendorman3dir='$vendorman3dir'
23179 vendorman3direxp='$vendorman3direxp'
23180 vendorprefix='$vendorprefix'
23181 vendorprefixexp='$vendorprefixexp'
23182 vendorscript='$vendorscript'
23183 vendorscriptexp='$vendorscriptexp'
23184 version='$version'
23185 version_patchlevel_string='$version_patchlevel_string'
23186 versiononly='$versiononly'
23187 vi='$vi'
23188 voidflags='$voidflags'
23189 xlibpth='$xlibpth'
23190 yacc='$yacc'
23191 yaccflags='$yaccflags'
23192 zcat='$zcat'
23193 zip='$zip'
23194 EOT
23195
23196 : Add in command line options if available
23197 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23198
23199 : add special variables
23200 $test -f $src/patchlevel.h && \
23201 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23202 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23203 echo "PERL_CONFIG_SH=true" >>config.sh
23204
23205 : propagate old symbols
23206 if $test -f UU/config.sh; then
23207         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23208         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23209                 config.sh config.sh UU/oldconfig.sh |\
23210                 $sort | $uniq -u >UU/oldsyms
23211         set X `cat UU/oldsyms`
23212         shift
23213         case $# in
23214         0) ;;
23215         *)
23216                 cat <<EOM
23217 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23218 EOM
23219                 echo ": Variables propagated from previous config.sh file." >>config.sh
23220                 for sym in `cat UU/oldsyms`; do
23221                         echo "    Propagating $hint variable "'$'"$sym..."
23222                         eval 'tmp="$'"${sym}"'"'
23223                         echo "$tmp" | \
23224                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23225                 done
23226                 ;;
23227         esac
23228 fi
23229
23230 : Finish up by extracting the .SH files
23231 case "$alldone" in
23232 exit)
23233         $rm -rf UU
23234         echo "Extraction done."
23235         exit 0
23236         ;;
23237 cont)
23238         ;;
23239 '')
23240         dflt=''
23241         nostick=true
23242         $cat <<EOM
23243
23244 If you'd like to make any changes to the config.sh file before I begin
23245 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23246
23247 EOM
23248         rp="Press return or use a shell escape to edit config.sh:"
23249         . UU/myread
23250         nostick=''
23251         case "$ans" in
23252         '') ;;
23253         *) : in case they cannot read
23254                 sh 1>&4 -c "$ans";;
23255         esac
23256         ;;
23257 esac
23258
23259 : if this fails, just run all the .SH files by hand
23260 . ./config.sh
23261
23262 echo " "
23263 exec 1>&4
23264 pwd=`pwd`
23265 . ./UU/extract
23266 cd "$pwd"
23267
23268 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23269         dflt=y
23270         case "$silent" in
23271         true) ;;
23272         *)
23273                 $cat <<EOM
23274
23275 Now you need to generate make dependencies by running "$make depend".
23276 You might prefer to run it in background: "$make depend > makedepend.out &"
23277 It can take a while, so you might not want to run it right now.
23278
23279 EOM
23280                 ;;
23281         esac
23282         rp="Run $make depend now?"
23283         . UU/myread
23284         case "$ans" in
23285         y*)
23286                 $make depend && echo "Now you must run '$make'."
23287                 ;;
23288         *)
23289                 echo "You must run '$make depend' then '$make'."
23290                 ;;
23291         esac
23292 elif test -f [Mm]akefile; then
23293         echo " "
23294         echo "Now you must run a $make."
23295 else
23296         echo "Configure done."
23297 fi
23298
23299 if $test -f Policy.sh; then
23300     $cat <<EOM
23301
23302 If you compile $package on a different machine or from a different object
23303 directory, copy the Policy.sh file from this object directory to the
23304 new one before you run Configure -- this will help you with most of
23305 the policy defaults.
23306
23307 EOM
23308 fi
23309 if $test -f config.msg; then
23310     echo "Hmm.  I also noted the following information while running:"
23311     echo " "
23312     $cat config.msg >&4
23313     $rm -f config.msg
23314 fi
23315 $rm -f kit*isdone ark*isdone
23316 $rm -rf UU
23317
23318 : End of Configure
23319